edu.uci.isr.yancees.server
Class ServerProtocolSession

java.lang.Object
  extended byedu.uci.isr.yancees.server.ServerProtocolSession
All Implemented Interfaces:
PluginListenerInterface

public class ServerProtocolSession
extends java.lang.Object
implements PluginListenerInterface

It represents a session, a context, that deals with the exchange of messages between the clients and the corresponding plug-in instance that handles this protocol. It implements the same idea as a File a TCP connection object. In a protocol session there are two moments, an initial parsing and determinatoin of what plug-in to instantiate, followed by a sequence of messages, which replies are sent as events to the ProtocolListenerInterface, and then a termination of the session.


Constructor Summary
protected ServerProtocolSession(SubscriberInterface si, ProtocolManager pm)
          The protected here allows only the ProtocolAPI to initialize this object.
 
Method Summary
protected  void finalize()
          This class is invoked by the Garbage Collector...
protected  void initialize(MessageInterface msg)
          Issues an initialization message to initiate this session.
 void receivePluginNotification(EventInterface[] evtList, PluginInterface source)
          Receives a list of DATA events as notifications from another plug-in
 void receivePluginNotification(EventInterface evt, PluginInterface source)
          Receives a DATA notification from another plug-in
 void sendMessage(MessageInterface message)
          Send a message to the protocol plug-in that is responsible for this context
 void terminate()
          Terminates the session without sending a termination message This message finalizes the plug-in and terminates its instance.
 void terminate(MessageInterface msg)
          Issues a termination message to finalze this session.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerProtocolSession

protected ServerProtocolSession(SubscriberInterface si,
                                ProtocolManager pm)
The protected here allows only the ProtocolAPI to initialize this object.

Parameters:
si - is the subscriptin listener interface, which will receive all the events (data) generated as a result of the protocol.
pm - is the protocol manager, with plug-in factories, to be used.
Method Detail

initialize

protected void initialize(MessageInterface msg)
                   throws YanceesException
Issues an initialization message to initiate this session. This message will result in the creation of the protocol plug-in instance that will handle all the communication from now on.

Parameters:
msg - is the initial message of this session.
Throws:
YanceesException

terminate

public void terminate(MessageInterface msg)
               throws YanceesException
Issues a termination message to finalze this session. This message finalizes the plug-in and terminates its instance.

Parameters:
msg - is the finalization messsage
Throws:
YanceesException

terminate

public void terminate()
               throws YanceesException
Terminates the session without sending a termination message This message finalizes the plug-in and terminates its instance.

Throws:
YanceesException

finalize

protected void finalize()
                 throws java.lang.Throwable
This class is invoked by the Garbage Collector... May be used to release any resource allocated by this object and perform finalizations.

Throws:
java.lang.Throwable

sendMessage

public void sendMessage(MessageInterface message)
                 throws YanceesException
Send a message to the protocol plug-in that is responsible for this context

Parameters:
message - is an XML document wrapped in the message.
Throws:
YanceesException

receivePluginNotification

public void receivePluginNotification(EventInterface evt,
                                      PluginInterface source)
Receives a DATA notification from another plug-in

Specified by:
receivePluginNotification in interface PluginListenerInterface
Parameters:
evt - is the event received
source - is the plug-in sending the notification.

receivePluginNotification

public void receivePluginNotification(EventInterface[] evtList,
                                      PluginInterface source)
Receives a list of DATA events as notifications from another plug-in

Specified by:
receivePluginNotification in interface PluginListenerInterface
Parameters:
evtList - is the list of events received
source - is the plug-in sending the notification.