edu.uci.isr.yancees.client
Class YanceesClient

java.lang.Object
  extended by edu.uci.isr.yancees.client.YanceesClient
All Implemented Interfaces:
YanceesInterface

public class YanceesClient
extends java.lang.Object
implements YanceesInterface

Author:
Roberto Silveira Silva Filho [rsilvafi@ics.uci.edu] This class works as a wrapper to YanceesRMI or other communication method between client and server. It also permits the insertion of filters, plug-ins and other interceptors between client and server.

Constructor Summary
YanceesClient(java.io.File configFile)
          Initializes the client YANCEES stub according to the provided configuration file.
YanceesClient(java.io.File configFile, java.lang.String instanceName)
          This constructor provides an instance name that uniquely identifies this YANCEES instance.
 
Method Summary
 ProtocolPluginInterface connectToNewProtocol(java.lang.String protocolId, SubscriberInterface si)
          Connects to a new instance of a protocol plug-in.
 ProtocolPluginInterface connectToSharedProtocol(java.lang.String protocolId, SubscriberInterface si)
          Connects to an existing protocol instance.
 void disconnectFromProtocol(java.lang.String protocolId, SubscriberInterface si)
          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)
           
 void resumeYancees()
           
 void shutdownYancees()
           
 void subscribe(SubscriptionInterface msg, SubscriberInterface rsi)
           
 void suspendYancees()
           
 void unsubscribe(SubscriberInterface rsi)
           
 void unsubscribe(SubscriberInterface rsi, MessageInterface sub)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

YanceesClient

public YanceesClient(java.io.File configFile)
Initializes the client YANCEES stub according to the provided configuration file.

Parameters:
configFile - is a XML document having the configuration

YanceesClient

public YanceesClient(java.io.File configFile,
                     java.lang.String instanceName)
This constructor provides an instance name that uniquely identifies this YANCEES instance. This is used by plug-ins such as JmDNSServrice to uniquely identify this instance.

Parameters:
configFile -
lookupName - a string that uniquely identify this instance
Method Detail

main

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

publish

public void publish(EventInterface evt)
             throws YanceesException
Specified by:
publish in interface YanceesInterface
Throws:
YanceesException

subscribe

public void subscribe(SubscriptionInterface msg,
                      SubscriberInterface rsi)
               throws YanceesException
Specified by:
subscribe in interface YanceesInterface
Throws:
YanceesException

unsubscribe

public void unsubscribe(SubscriberInterface rsi)
                 throws YanceesException
Specified by:
unsubscribe in interface YanceesInterface
Throws:
YanceesException

unsubscribe

public void unsubscribe(SubscriberInterface rsi,
                        MessageInterface sub)
                 throws YanceesException
Specified by:
unsubscribe in interface YanceesInterface
Throws:
YanceesException

shutdownYancees

public void shutdownYancees()
                     throws YanceesException
Specified by:
shutdownYancees in interface YanceesInterface
Throws:
YanceesException

suspendYancees

public void suspendYancees()
                    throws YanceesException
Specified by:
suspendYancees in interface YanceesInterface
Throws:
YanceesException

resumeYancees

public void resumeYancees()
                   throws YanceesException
Specified by:
resumeYancees in interface YanceesInterface
Throws:
YanceesException

connectToSharedProtocol

public ProtocolPluginInterface connectToSharedProtocol(java.lang.String protocolId,
                                                       SubscriberInterface si)
                                                throws YanceesException
Description copied from interface: YanceesInterface
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 YanceesInterface
Parameters:
protocolId - is the name of the protocol as registered in the configuration file and as available in the protocol factory
si - 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

connectToNewProtocol

public ProtocolPluginInterface connectToNewProtocol(java.lang.String protocolId,
                                                    SubscriberInterface si)
                                             throws YanceesException
Description copied from interface: YanceesInterface
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 YanceesInterface
Parameters:
protocolId - is the name of the protocol as registered in the configuration file and as available in the protocol factory
si - 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

disconnectFromProtocol

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

Specified by:
disconnectFromProtocol in interface YanceesInterface
Parameters:
protocolId - is the name of the protocol as registered in the configuration file and as available in the protocol factory
si - 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