123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- package com.rdlze.radializebase.mocks;
- import java.rmi.RemoteException;
- import java.rmi.registry.LocateRegistry;
- import java.rmi.registry.Registry;
- import java.rmi.server.UnicastRemoteObject;
- import java.util.List;
- import com.rdlze.radializebase.interfaces.InterfaceNotifiable;
- import com.rdlze.radializeutils.notification.Notification;
- public class MockNotifiable implements InterfaceNotifiable {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- String name = "";
- MockNotifiable mn = null;
- public MockNotifiable(String name){
- this.name=name;
-
- try {
- LocateRegistry.createRegistry(1099);
- } catch (Exception e) {
- System.out.println("createRegistryException....");
- }
- try {
- InterfaceNotifiable stub = (InterfaceNotifiable) UnicastRemoteObject.exportObject(
- this, 0);
- Registry registry = LocateRegistry.getRegistry(1099);
- registry.rebind(name, stub);
- System.out.println("MockNotifiable - OnLine");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- @Override
- public void notify(Notification notification) throws RemoteException {
- System.out.println(this.getName()+" received notification "+notification.getRadioId());
- }
- @Override
- public void notify(List list) throws RemoteException {
- System.out.println("received list");
- }
- @Override
- public void registerNotifiable(String IP, String serviceName, int port)
- throws RemoteException {
- }
- @Override
- public String getName() throws RemoteException {
- return this.name;
- }
- public static void main(String[] args){
- new MockNotifiable("teste");
- }
- }
|