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

java.lang.Object
  extended by edu.uci.isr.yancees.server.rmi.SubscriberMediator
All Implemented Interfaces:
SubscriberInterface

public class SubscriberMediator
extends java.lang.Object
implements SubscriberInterface

Performs the mapping between the remote interface and the local subscriber interface, working also as a record of the active subscriptions. We have remote and local subscriberInterfaces to allow the implementation of different protocols, for example HTTP or SOAP, that may heve different ways of representing a remote SubscriberInterface, so we need someone to be a mediator here for the sake of future extensions Behind this façade, yancees interacts only with SubscriberInterfaces whereas, to the outside world, RemoteSubscriberInterfaces are used. Hence, a translation between both is necessary here.


Constructor Summary
SubscriberMediator(RemoteSubscriberInterface rsi, RemoteYanceesImplementation ryi)
          constructor
 
Method Summary
 int decReferenceCounter()
           
 RemoteSubscriberInterface getRemoteSubscriberReference()
          Some applications need the actual remote interface used in the client side.
 RemoteYanceesImplementation getRemoteYanceesReference()
          Used by the NotificationBuffer to obtain a reference to Yancees remote API.
 int incReferenceCounter()
           
 void notify(EventInterface evt)
          Receives notifications from the local components of Yancees and forwards them to the remote subscribers
 void notify(EventInterface[] evtList)
          Receives notifications from the local components of Yancees and forwards them to the remote subscribers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubscriberMediator

public SubscriberMediator(RemoteSubscriberInterface rsi,
                          RemoteYanceesImplementation ryi)
constructor

Parameters:
rsi - is the remote interface, that came from the publish or subscribe commands, protocols as well.
callback - is
Method Detail

getRemoteYanceesReference

public RemoteYanceesImplementation getRemoteYanceesReference()
Used by the NotificationBuffer to obtain a reference to Yancees remote API.

Returns:
the server implementation that created this mediator.

getRemoteSubscriberReference

public RemoteSubscriberInterface getRemoteSubscriberReference()
Some applications need the actual remote interface used in the client side. For example, this may be important to uniquely identify the clients when using protocol plug-ins.

Returns:
the actual remote interface that this local SubscriberInterface represents

notify

public void notify(EventInterface evt)
Receives notifications from the local components of Yancees and forwards them to the remote subscribers

Specified by:
notify in interface SubscriberInterface

notify

public void notify(EventInterface[] evtList)
Receives notifications from the local components of Yancees and forwards them to the remote subscribers

Specified by:
notify in interface SubscriberInterface

incReferenceCounter

public int incReferenceCounter()

decReferenceCounter

public int decReferenceCounter()