net.groboclown.eventbus.v2.rmi
Class RemoteEventBus

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--net.groboclown.eventbus.v2.rmi.RemoteEventBus
All Implemented Interfaces:
IRemoteEventBus, Remote, Serializable

public class RemoteEventBus
extends UnicastRemoteObject
implements IRemoteEventBus

Master control unit which is in charge of registering event listeners, deregistering event listeners, and distributing events. There are no default distributors, so those must be manually added, or specified as external distributors through the command-line.

This has been redesigned to allow for multiple busses to co-exist within the same VM.

Version:
Alpha 0.9.0
Author:
Matt Albrecht
See Also:
Serialized Form

Field Summary
private static boolean DEBUG
           
private  EventBus localBus
           
(package private) static long serialVersionUID
           
 
Fields inherited from class java.rmi.server.UnicastRemoteObject
csf, port, portFactoryParamTypes, portParamTypes, ssf
 
Fields inherited from class java.rmi.server.RemoteServer
log, logname
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
private RemoteEventBus()
           
  RemoteEventBus(EventBus busToRegister)
           
 
Method Summary
 void addRemoteListener(IRemoteListener listener)
          Add the given listener to the list, and generates a filter agent.
 String getBusId()
           
static IRemoteEventBus getRegisteredEventBus(String bindName)
          Loads a remote registered event bus into this VM.
 void redirectEvent(RemoteEventBusEvent rebe)
           
static void registerEventBus(EventBus busToBeRemoted, String bindName)
          Register a local bus as accessible from an outside VM.
 boolean removeRemoteListener(IRemoteListener listener)
          Deregister the given listener and its filter.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
, clone, exportObject, exportObject, exportObject, exportObject, readObject, reexport, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub, writeObject
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID

localBus

private EventBus localBus

DEBUG

private static final boolean DEBUG
Constructor Detail

RemoteEventBus

private RemoteEventBus()
                throws RemoteException

RemoteEventBus

public RemoteEventBus(EventBus busToRegister)
               throws RemoteException
Method Detail

registerEventBus

public static void registerEventBus(EventBus busToBeRemoted,
                                    String bindName)
                             throws RemoteException,
                                    MalformedURLException
Register a local bus as accessible from an outside VM.
Parameters:
bindName - the RMI lookup name to bind the event bus to. Must be of the form "//hostname/rmi name".

getRegisteredEventBus

public static IRemoteEventBus getRegisteredEventBus(String bindName)
                                             throws RemoteException,
                                                    MalformedURLException,
                                                    NotBoundException
Loads a remote registered event bus into this VM.
Parameters:
bindName - the RMI lookup name to find the bounded event bus. Must be of the form "//hostname/rmi name".

addRemoteListener

public void addRemoteListener(IRemoteListener listener)
                       throws RemoteException
Add the given listener to the list, and generates a filter agent.
Specified by:
addRemoteListener in interface IRemoteEventBus

removeRemoteListener

public boolean removeRemoteListener(IRemoteListener listener)
                             throws RemoteException
Deregister the given listener and its filter.
Specified by:
removeRemoteListener in interface IRemoteEventBus
Returns:
true if the listener was found and removed, or false if it could not be found.

redirectEvent

public void redirectEvent(RemoteEventBusEvent rebe)
                   throws RemoteException
Specified by:
redirectEvent in interface IRemoteEventBus

getBusId

public String getBusId()
                throws RemoteException
Specified by:
getBusId in interface IRemoteEventBus


Written under the LGPL