edu.uci.isr.yancees.server.dispatcher.siena
Class AbstractSienaAdapter

java.lang.Object
  extended byedu.uci.isr.yancees.server.dispatcher.siena.AbstractSienaAdapter
All Implemented Interfaces:
EventDispatcherAdapterInterface
Direct Known Subclasses:
SienaLocalAdapter, SienaRemoteAdapter

public abstract class AbstractSienaAdapter
extends java.lang.Object
implements EventDispatcherAdapterInterface


Nested Class Summary
 class AbstractSienaAdapter.DispatcherListenerMediator
          This class represents a dispatcher listener, receiving all the events from Siena that are destinated to this particular EventDispatcherListenerInterface This class here operates as a brides between YANCEES and SIENA.
 
Field Summary
protected  java.lang.String DEFAULT_SIENA_ADDRESS
           
protected  boolean print
           
protected  HierarchicalDispatcher siena
           
protected  java.lang.String sienaAddress
           
protected  java.util.HashMap subscribersMap
           
 
Constructor Summary
AbstractSienaAdapter()
           
AbstractSienaAdapter(java.lang.String address)
          Constructor
 
Method Summary
abstract  void connect()
          The connection to siena changes whether it is local or remote.
abstract  void connect(java.lang.String address)
          Connects to siena bafore any method can be used.
protected  void finalize()
           
 void publish(EventInterface e)
          Publishes a Yancees event in the format of Siena event.
 void resumeDispatcher(EventDispatcherListenerInterface li)
          resumes the delivery of notifications to the given subscriber n.
 void shutdownDispatcher()
          closes this Dispatcher service access point.
 void subscribe(SubscriptionInterface sub, EventDispatcherListenerInterface li)
          subscribes for sequences of events matching subscription p.
 void suspendDispatcher(EventDispatcherListenerInterface li)
          suspends the delivery of notifications to the given subscriber li.
 void unsubscribe(EventDispatcherListenerInterface li)
          cancels all the subscriptions posted by li.
 void unsubscribe(SubscriptionInterface sub, EventDispatcherListenerInterface li)
          cancels the subscriptions, posted by li, whose subscripton sub' is covered by subscripiton p.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.uci.isr.yancees.dispatcher.EventDispatcherAdapterInterface
getAdapterName
 

Field Detail

DEFAULT_SIENA_ADDRESS

protected final java.lang.String DEFAULT_SIENA_ADDRESS
See Also:
Constant Field Values

siena

protected HierarchicalDispatcher siena

sienaAddress

protected java.lang.String sienaAddress

subscribersMap

protected java.util.HashMap subscribersMap

print

protected boolean print
Constructor Detail

AbstractSienaAdapter

public AbstractSienaAdapter(java.lang.String address)
                     throws DispatcherException
Constructor


AbstractSienaAdapter

public AbstractSienaAdapter()
Method Detail

connect

public abstract void connect()
                      throws DispatcherException
The connection to siena changes whether it is local or remote.

Throws:
DispatcherException

connect

public abstract void connect(java.lang.String address)
                      throws DispatcherException
Connects to siena bafore any method can be used. this method is used by the architecture manager to initialize the dispatcher and is not part of the EventDispatcherInterface

Specified by:
connect in interface EventDispatcherAdapterInterface
Parameters:
address - is the address of the server.
Throws:
DispatcherException

finalize

protected void finalize()
                 throws java.lang.Throwable
Throws:
java.lang.Throwable

publish

public void publish(EventInterface e)
             throws DispatcherException
Publishes a Yancees event in the format of Siena event. It also makes the namespace transformation to differentiate body and header events. Special attributes are added to identify yancees events from regular ones that may be used in siena

Specified by:
publish in interface EventDispatcherAdapterInterface
Throws:
DispatcherException
See Also:
Event

subscribe

public void subscribe(SubscriptionInterface sub,
                      EventDispatcherListenerInterface li)
               throws DispatcherException
subscribes for sequences of events matching subscription p.

Notice that given the distributed nature of some implementations of Dispatcher interface, there exist race conditions that might affect the semantics of subscriptions. A subscriber might miss some notifications published before or while the subscription is processed by Dispatcher.

Also, keep in mind that the current implementation of Dispatcher does not enforce any temporal order for the delivery of notifications. This limitation might affect the recognition of patterns. For example, two notifications x and y, generated at time tx and ty respectively, with tx < ty, in that order matching a pattern P=(fx fy), might in fact reach the subscriber at times Tx and Ty, with Tx > Ty, in which case pattern P would not be matched.

Specified by:
subscribe in interface EventDispatcherAdapterInterface
Parameters:
li - is the subscriber
sub - is a generic subscription containing a DOM tree. It is expected here that this subscription is in the format readable by the SienaAdapter.
Throws:
DispatcherException
See Also:
unsubscribe(edu.uci.isr.yancees.SubscriptionInterface, edu.uci.isr.yancees.dispatcher.EventDispatcherListenerInterface)

unsubscribe

public void unsubscribe(SubscriptionInterface sub,
                        EventDispatcherListenerInterface li)
                 throws DispatcherException
cancels the subscriptions, posted by li, whose subscripton sub' is covered by subscripiton p.

Unsubscriptions might incurr in the same kind of race conditions as subscriptions. Dispatcher will stop sending notifications to the subscriber only after it has completed the processing of the unsubscription. Due to the distributed nature of some implementations of Dispatcher, this might result in some additional ``unsolicited'' notifications.

Specified by:
unsubscribe in interface EventDispatcherAdapterInterface
Parameters:
li - is the subscriber interface
Throws:
DispatcherException
See Also:
subscribe(edu.uci.isr.yancees.SubscriptionInterface, edu.uci.isr.yancees.dispatcher.EventDispatcherListenerInterface)

unsubscribe

public void unsubscribe(EventDispatcherListenerInterface li)
                 throws DispatcherException
cancels all the subscriptions posted by li.

Specified by:
unsubscribe in interface EventDispatcherAdapterInterface
Parameters:
li - is event dispatcher listener interface
Throws:
DispatcherException
See Also:
subscribe(edu.uci.isr.yancees.SubscriptionInterface, edu.uci.isr.yancees.dispatcher.EventDispatcherListenerInterface)

suspendDispatcher

public void suspendDispatcher(EventDispatcherListenerInterface li)
                       throws DispatcherException
suspends the delivery of notifications to the given subscriber li.

Specified by:
suspendDispatcher in interface EventDispatcherAdapterInterface
Parameters:
li - subscriber to be suspended
Throws:
DispatcherException

resumeDispatcher

public void resumeDispatcher(EventDispatcherListenerInterface li)
                      throws DispatcherException
resumes the delivery of notifications to the given subscriber n.

Specified by:
resumeDispatcher in interface EventDispatcherAdapterInterface
Parameters:
li - is the subscriber callback reference
Throws:
DispatcherException

shutdownDispatcher

public void shutdownDispatcher()
                        throws DispatcherException
closes this Dispatcher service access point. This method releases any system resources associated with the access point. In case this access point is connected to other Dispatcher servers, this method will properly disconnect it.

Specified by:
shutdownDispatcher in interface EventDispatcherAdapterInterface
Throws:
DispatcherException