dermi.session.pastry
Class NotificationParser

java.lang.Object
  extended by dermi.core.pastry.ScribeClient
      extended by dermi.session.pastry.NotificationParser
All Implemented Interfaces:
Client, DermiApplicationListener, rice.p2p.scribe.ScribeClient

public class NotificationParser
extends ScribeClient
implements DermiApplicationListener

This class encapsulates a notification parser which is notified about events, and dispatches them to the different clients subscribed

Version:
1.2
Author:
Carles Pairot , Ruben Mondejar

Constructor Summary
NotificationParser(ConnectionListener connsubs)
          Constructor
NotificationParser(RemoteEventListener subs)
          Constructor
NotificationParser(RemoteInterceptorListener filtsubs)
          Constructor
 
Method Summary
 boolean anycast(rice.p2p.scribe.Topic topic, rice.p2p.scribe.ScribeContent cnt)
          Invoked when an anycast event is received
 void childAdded(rice.p2p.scribe.Topic topic, rice.p2p.commonapi.NodeHandle nodeHandle)
          Activated when a child is added to this node in the multicast group
 void childRemoved(rice.p2p.scribe.Topic topic, rice.p2p.commonapi.NodeHandle nodeHandle)
          Activated when a child is removed from this node in the multicast group
 void close()
          Closes bus connection
 void deliver(rice.p2p.scribe.Topic topic, rice.p2p.scribe.ScribeContent scribeContent)
          Invoked when an event is received
 boolean equals(java.lang.Object o)
           
 int getId()
           
 DermiContent interceptAnycast(Topic topic, DermiContent cnt)
          Invoked when an anycast event is received
 void receiveInterceptorMessage(java.util.Hashtable msg, java.util.ArrayList interceptors)
          Invoked when an interception message is received
 void setConnection(DermiConnection conn)
          Sets this parser's connection
 void subscribeFailed(rice.p2p.scribe.Topic topic)
          Activated when a subscription failure is detected
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NotificationParser

public NotificationParser(RemoteEventListener subs)
Constructor

Parameters:
subs - RemoteEventListener Application to be notified

NotificationParser

public NotificationParser(RemoteInterceptorListener filtsubs)
Constructor

Parameters:
filtsubs - RemoteInterceptorListener Interceptor application to be notified

NotificationParser

public NotificationParser(ConnectionListener connsubs)
Constructor

Parameters:
connsubs - ConnectionListener Connection listener to be notified
Method Detail

setConnection

public void setConnection(DermiConnection conn)
Sets this parser's connection

Specified by:
setConnection in interface DermiApplicationListener
Parameters:
conn - DermiConnection

anycast

public boolean anycast(rice.p2p.scribe.Topic topic,
                       rice.p2p.scribe.ScribeContent cnt)
Invoked when an anycast event is received

Specified by:
anycast in interface rice.p2p.scribe.ScribeClient
Parameters:
topic - Topic Group's identifier
cnt - ScribeContent Anycast's content
Returns:
boolean false if message must not be routed further

interceptAnycast

public DermiContent interceptAnycast(Topic topic,
                                     DermiContent cnt)
Invoked when an anycast event is received

Specified by:
interceptAnycast in interface DermiApplicationListener
Parameters:
topic - Topic Group's identifier
cnt - ScribeContent Original anycast message
Returns:
ScribeContent Modified anycast message

close

public void close()
Closes bus connection


receiveInterceptorMessage

public void receiveInterceptorMessage(java.util.Hashtable msg,
                                      java.util.ArrayList interceptors)
Invoked when an interception message is received

Specified by:
receiveInterceptorMessage in interface DermiApplicationListener
Parameters:
msg - Hashtable The message data
interceptors - ArrayList Remaining interceptors list

deliver

public void deliver(rice.p2p.scribe.Topic topic,
                    rice.p2p.scribe.ScribeContent scribeContent)
Invoked when an event is received

Specified by:
deliver in interface rice.p2p.scribe.ScribeClient
Parameters:
topic - Topic Group's identifier
scribeContent - ScribeContent Message content

childAdded

public void childAdded(rice.p2p.scribe.Topic topic,
                       rice.p2p.commonapi.NodeHandle nodeHandle)
Activated when a child is added to this node in the multicast group

Specified by:
childAdded in interface rice.p2p.scribe.ScribeClient
Parameters:
topic - Topic Group's identifier
nodeHandle - NodeHandle Child's node handle

childRemoved

public void childRemoved(rice.p2p.scribe.Topic topic,
                         rice.p2p.commonapi.NodeHandle nodeHandle)
Activated when a child is removed from this node in the multicast group

Specified by:
childRemoved in interface rice.p2p.scribe.ScribeClient
Parameters:
topic - Topic Group's identifier
nodeHandle - NodeHandle Child's node handle

subscribeFailed

public void subscribeFailed(rice.p2p.scribe.Topic topic)
Activated when a subscription failure is detected

Specified by:
subscribeFailed in interface rice.p2p.scribe.ScribeClient
Parameters:
topic - Topic Group's identifier

getId

public int getId()

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object