edu.uci.isr.yancees.server.rmi
Class RemoteYanceesImplementation

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by edu.uci.isr.yancees.server.rmi.RemoteYanceesImplementation
All Implemented Interfaces:
RemoteYanceesInterface, java.io.Serializable, java.rmi.Remote

public class RemoteYanceesImplementation
extends java.rmi.server.UnicastRemoteObject
implements RemoteYanceesInterface

This class implements the RemoteYanceesInterface, which is a façade, a remote interface to all Yancees APIs: Publisher, Subscriber and Protocol. It collects the calls and route them to the appropriate API. It glues everything together. This is a remote class since it is registered in the server side to handle yancess calls.

See Also:
Serialized Form

Field Summary
static boolean MULTI_THREADED_PUBLISH
           
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface edu.uci.isr.yancees.server.rmi.RemoteYanceesInterface
RMI_LOOKUP_NAME
 
Constructor Summary
RemoteYanceesImplementation(java.io.File configFile)
          Constructor that accepts an architecture configuration file, with which plug-ins, filters and services are installed in the basic infrastructure
RemoteYanceesImplementation(java.io.File configFile, java.lang.String lookupName)
          Alternative constructor with optional lookup name
 
Method Summary
 RemoteProtocolPluginInterface connectToNewProtocol(java.lang.String protocolId, RemoteSubscriberInterface rsi)
          Connects to a new instance of a protocol plug-in.
 RemoteProtocolPluginInterface connectToSharedProtocol(java.lang.String protocolId, RemoteSubscriberInterface rsi)
          Connects to an existing protocol instance.
 void disconnectFromProtocol(java.lang.String protocolId, RemoteSubscriberInterface rsi)
          Terminates unshared protocol instances, or shared protocol instances if no more clients are connected to them.
static void main(java.lang.String[] args)
           
 void publish(EventInterface evt)
          Multithreaded implementation of the Publish command Note that the YanceesException will not be thrown here
 void publishBuffer(EventInterface[] evtList)
          This method is used by the publication buffer to speed up the transmission of events through the network.
 void resumeYancees()
           
 void shutdownYancees()
           
 void subscribe(SubscriptionInterface sub, RemoteSubscriberInterface rsi)
          Multithreaded implementation fo the subscribe command.
 void suspendYancees()
           
 void threadGuard()
           
 void unsubscribe(RemoteSubscriberInterface rsi)
          Multithreaded implementaiton of ubsubscribe method
 void unsubscribe(RemoteSubscriberInterface rsi, MessageInterface msg)
          Multithreaded implementaiton of ubsubscribe method
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, 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
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MULTI_THREADED_PUBLISH

public static boolean MULTI_THREADED_PUBLISH
Constructor Detail

RemoteYanceesImplementation

public RemoteYanceesImplementation(java.io.File configFile,
                                   java.lang.String lookupName)
                            throws java.rmi.RemoteException
Alternative constructor with optional lookup name

Throws:
java.rmi.RemoteException

RemoteYanceesImplementation

public RemoteYanceesImplementation(java.io.File configFile)
                            throws java.rmi.RemoteException
Constructor that accepts an architecture configuration file, with which plug-ins, filters and services are installed in the basic infrastructure

Throws:
java.rmi.RemoteException
Method Detail

main

public static void main(java.lang.String[] args)

connectToSharedProtocol

public RemoteProtocolPluginInterface connectToSharedProtocol(java.lang.String protocolId,
                                                             RemoteSubscriberInterface rsi)
                                                      throws YanceesException,
                                                             java.rmi.RemoteException
Description copied from interface: RemoteYanceesInterface
Connects to an existing protocol instance. If there is no instance available, YANCEES instantiates a new protocol plug-in. Subsequent calls to this method, for that specific protocol, will return the shared plug-in instance.

Specified by:
connectToSharedProtocol in interface RemoteYanceesInterface
Parameters:
protocolId - is the name of the protocol as registered in the configuration file and as available in the protocol factory
rsi - is the subscriber interface that can be used to receive events from the plug-in
Returns:
a reference to the plug-in
Throws:
YanceesException - is thrown in case of errors in the creation of the protocol plug-in
java.rmi.RemoteException - is thrown in case of RMI related issues

connectToNewProtocol

public RemoteProtocolPluginInterface connectToNewProtocol(java.lang.String protocolId,
                                                          RemoteSubscriberInterface rsi)
                                                   throws YanceesException,
                                                          java.rmi.RemoteException
Description copied from interface: RemoteYanceesInterface
Connects to a new instance of a protocol plug-in. Each time this method is invoked, a new instance is created.

Specified by:
connectToNewProtocol in interface RemoteYanceesInterface
Parameters:
protocolId - is the name of the protocol as registered in the configuration file and as available in the protocol factory
rsi - is the subscriber interface that can be used to receive events from the plug-in
Returns:
a reference to the plug-in
Throws:
YanceesException - is thrown in case of errors in the creation of the protocol plug-in
java.rmi.RemoteException - is thrown in case of RMI related issues

disconnectFromProtocol

public void disconnectFromProtocol(java.lang.String protocolId,
                                   RemoteSubscriberInterface rsi)
                            throws YanceesException,
                                   java.rmi.RemoteException
Description copied from interface: RemoteYanceesInterface
Terminates unshared protocol instances, or shared protocol instances if no more clients are connected to them.

Specified by:
disconnectFromProtocol in interface RemoteYanceesInterface
Parameters:
protocolId - is the name of the protocol as registered in the configuration file and as available in the protocol factory
rsi - is the subscriber interface that can be used to receive events from the plug-in
Throws:
YanceesException - is thrown in case of errors in the creation of the protocol plug-in
java.rmi.RemoteException - is thrown in case of RMI related issues

publish

public void publish(EventInterface evt)
             throws YanceesException,
                    java.rmi.RemoteException
Multithreaded implementation of the Publish command Note that the YanceesException will not be thrown here

Specified by:
publish in interface RemoteYanceesInterface
Parameters:
evt - is the event to be published.
Throws:
YanceesException
java.rmi.RemoteException

publishBuffer

public void publishBuffer(EventInterface[] evtList)
                   throws YanceesException,
                          java.rmi.RemoteException
This method is used by the publication buffer to speed up the transmission of events through the network. It receives a list of events from a publisher (YanceesRMIClient).

Specified by:
publishBuffer in interface RemoteYanceesInterface
Parameters:
evtList - is a list of events to be published.
Throws:
YanceesException
java.rmi.RemoteException

subscribe

public void subscribe(SubscriptionInterface sub,
                      RemoteSubscriberInterface rsi)
               throws YanceesException,
                      java.rmi.RemoteException
Multithreaded implementation fo the subscribe command. Sends a subscription. When the subscriptio is matched, events are routed back to the remote subscriber.

Specified by:
subscribe in interface RemoteYanceesInterface
Parameters:
sub - is the message having the subscription/notification
-
Throws:
YanceesException
java.rmi.RemoteException

unsubscribe

public void unsubscribe(RemoteSubscriberInterface rsi)
                 throws YanceesException,
                        java.rmi.RemoteException
Multithreaded implementaiton of ubsubscribe method

Specified by:
unsubscribe in interface RemoteYanceesInterface
Parameters:
rsi - is the remote subscriber engaging in the operation.
Throws:
YanceesException
java.rmi.RemoteException

unsubscribe

public void unsubscribe(RemoteSubscriberInterface rsi,
                        MessageInterface msg)
                 throws YanceesException,
                        java.rmi.RemoteException
Multithreaded implementaiton of ubsubscribe method

Specified by:
unsubscribe in interface RemoteYanceesInterface
Parameters:
rsi - is the remote subscriber engaging in the operation.
msg - is the Subscriptoin being discontinued
Throws:
YanceesException
java.rmi.RemoteException

shutdownYancees

public void shutdownYancees()
                     throws YanceesException,
                            java.rmi.RemoteException
Specified by:
shutdownYancees in interface RemoteYanceesInterface
Throws:
YanceesException
java.rmi.RemoteException

suspendYancees

public void suspendYancees()
                    throws YanceesException,
                           java.rmi.RemoteException
Specified by:
suspendYancees in interface RemoteYanceesInterface
Throws:
YanceesException
java.rmi.RemoteException

resumeYancees

public void resumeYancees()
                   throws YanceesException,
                          java.rmi.RemoteException
Specified by:
resumeYancees in interface RemoteYanceesInterface
Throws:
YanceesException
java.rmi.RemoteException

threadGuard

public void threadGuard()