dermi
Interface Session

All Known Implementing Classes:
Session

public interface Session

The Session class establishes a simple contract to access publish/subscribe middleware. It mimics the delegation event model to smooth the transition from local to remote events for Java programmers

Author:
Carles Pairot , Pedro Garcia

Method Summary
 void addInterceptor(RemoteInterceptorListener listener, java.util.Hashtable evt)
          Adds an interceptor to the specified multicast group
 void addRemoteAnycallEventListener(RemoteAnycallEventListener sel, java.util.Hashtable subscription)
          Adds an anycall listener
 void anycall(java.util.Hashtable evt)
          Makes an anycall
 void close()
          The close method safely frees resources and closes the connection.
 void continueInterception(java.util.Hashtable evt, java.util.ArrayList interceptors)
          Continues distributed interception process
 rice.p2p.commonapi.Node getLocalNode()
          Method used to obtain the local node instance
 rice.p2p.commonapi.NodeHandle getLocalNodeHandle()
          Method used to obtain the local node handle for this node
 void open(java.util.Hashtable evt)
          The open method is mainly used by the facility class SessionFactory, so normally should not be used by programmers.
 void publish(java.util.Hashtable event)
          The publish method produces notifications in a simple and straightforward style.
 void publish(java.util.Hashtable event, java.io.Serializable obj)
          Publisher method that accepts a Serializable object as a parameter.
 void publishDirect(java.util.Hashtable event)
          Publishes an event directly to a peer (without routing it through the rendezvous point)
 void publishDirect(java.util.Hashtable event, java.io.Serializable obj)
          Publishes an event directly to a peer (without routing it through the rendezvous point)
 void removeInterceptor(java.util.Hashtable evt)
          Removes an interceptor from the specified multicast group
 void removeRemoteAnycallEventListener(RemoteAnycallEventListener sel, java.util.Hashtable subscription)
          Removes an anycall listener
 void subscribe(RemoteEventListener listener, java.util.Hashtable subs)
          This method creates a listener of remote events that matches the subscription specified in the subscription parameter.
 void subscribe(RemoteEventListener listener, java.lang.String subs)
          This method creates a listener of remote events that matches the subscription specified in the subscription parameter.
 void unsubscribe(RemoteEventListener listener, java.util.Hashtable subs)
          This method removes the subscription specified in subscription parameters.
 void unsubscribe(RemoteEventListener listener, java.lang.String subs)
          This method removes the subscription specified in subscription parameters.
 

Method Detail

open

void open(java.util.Hashtable evt)
          throws SessionException
The open method is mainly used by the facility class SessionFactory, so normally should not be used by programmers.

Parameters:
evt - Hashtable key/value pairs representing connection parameters
Throws:
SessionException - It throws the wrapper SessionException encapsulating all possible problems in the connection phase.

close

void close()
           throws SessionException
The close method safely frees resources and closes the connection.

Throws:
SessionException - It throws the wrapper SessionException encapsulating all possible problems in the connection phase.

subscribe

void subscribe(RemoteEventListener listener,
               java.lang.String subs)
               throws SessionException
This method creates a listener of remote events that matches the subscription specified in the subscription parameter.

Parameters:
listener - RemoteEventListener The listener of remote events. It will handle incoming events matching the subscription.
subs - String The subscription is represented using a String in the specified constraint filter language of the used notification service.
Throws:
SessionException - It throws the wrapper SessionException encapsulating all possible problems in the connection phase.
See Also:
RemoteEventListener

subscribe

void subscribe(RemoteEventListener listener,
               java.util.Hashtable subs)
               throws SessionException
This method creates a listener of remote events that matches the subscription specified in the subscription parameter.

Parameters:
listener - RemoteEventListener The listener of remote events. It will handle incoming events matching the subscription.
subs - Hashtable The subscription is represented using a Hashtable.
Throws:
SessionException - It throws the wrapper SessionException encapsulating all possible problems in the connection phase.
See Also:
RemoteEventListener

unsubscribe

void unsubscribe(RemoteEventListener listener,
                 java.lang.String subs)
                 throws SessionException
This method removes the subscription specified in subscription parameters.

Parameters:
listener - RemoteEventListener The listener of remote events
subs - String The subscription to be removed (using specific constraint filter language)
Throws:
SessionException - It throws the wrapper SessionException encapsulating all possible problems in the connection phase.

unsubscribe

void unsubscribe(RemoteEventListener listener,
                 java.util.Hashtable subs)
                 throws SessionException
This method removes the subscription specified in subscription parameters.

Parameters:
listener - RemoteEventListener The listener of remote events
subs - Hashtable The subscription to be removed
Throws:
SessionException - It throws the wrapper SessionException encapsulating all possible problems in the connection phase.

publish

void publish(java.util.Hashtable event)
             throws SessionException
The publish method produces notifications in a simple and straightforward style.

Parameters:
event - Hashtable The well-known java.util.Hashtable class is used for creating key/value pair notifications
Throws:
SessionException - It throws the wrapper SessionException encapsulating all possible problems in the connection phase.

publish

void publish(java.util.Hashtable event,
             java.io.Serializable obj)
             throws SessionException
Publisher method that accepts a Serializable object as a parameter. It will be received by the client with the key "object" in the hashtable event parameter.

Parameters:
event - Hashtable The well-known java.util.Hashtable class is used for creating key/value pair notifications
obj - Serializable Java serializable object
Throws:
SessionException - It throws the wrapper SessionException encapsulating all possible problems in the connection phase.

publishDirect

void publishDirect(java.util.Hashtable event)
                   throws SessionException
Publishes an event directly to a peer (without routing it through the rendezvous point)

Parameters:
event - Hashtable Event data
Throws:
SessionException - If something goes wrong ;-)

publishDirect

void publishDirect(java.util.Hashtable event,
                   java.io.Serializable obj)
                   throws SessionException
Publishes an event directly to a peer (without routing it through the rendezvous point)

Parameters:
event - Hashtable Event data
obj - Serializable Object to publish
Throws:
SessionException - If something goes wrong ;-)

addInterceptor

void addInterceptor(RemoteInterceptorListener listener,
                    java.util.Hashtable evt)
                    throws SessionException
Adds an interceptor to the specified multicast group

Parameters:
listener - RemoteInterceptorListener The interceptor to add
evt - Hashtable Subscription data
Throws:
SessionException - If something goes wrong ;-)

removeInterceptor

void removeInterceptor(java.util.Hashtable evt)
                       throws SessionException
Removes an interceptor from the specified multicast group

Parameters:
evt - Hashtable Subscription data
Throws:
SessionException - If something goes wrong ;-)

continueInterception

void continueInterception(java.util.Hashtable evt,
                          java.util.ArrayList interceptors)
Continues distributed interception process

Parameters:
evt - Hashtable Event data
interceptors - ArrayList List of remaining interceptors

addRemoteAnycallEventListener

void addRemoteAnycallEventListener(RemoteAnycallEventListener sel,
                                   java.util.Hashtable subscription)
                                   throws SessionException
Adds an anycall listener

Parameters:
sel - RemoteAnycallEventListener The listener
subscription - Hashtable Subscription data
Throws:
SessionException - If something goes wrong ;-)

removeRemoteAnycallEventListener

void removeRemoteAnycallEventListener(RemoteAnycallEventListener sel,
                                      java.util.Hashtable subscription)
                                      throws SessionException
Removes an anycall listener

Parameters:
sel - RemoteAnycallEventListener The listener
subscription - Hashtable Subscription data
Throws:
SessionException - If something goes wrong ;-)

anycall

void anycall(java.util.Hashtable evt)
             throws SessionException
Makes an anycall

Parameters:
evt - Hashtable Subscription data
Throws:
SessionException - If something goes wrong ;-)

getLocalNodeHandle

rice.p2p.commonapi.NodeHandle getLocalNodeHandle()
Method used to obtain the local node handle for this node

Returns:
NodeHandle Local node handle

getLocalNode

rice.p2p.commonapi.Node getLocalNode()
Method used to obtain the local node instance

Returns:
Node Local node instance