dermi.core.pastry
Class DermiKernel

java.lang.Object
  extended by rice.p2p.scribe.ScribeImpl
      extended by dermi.core.pastry.DermiKernel
All Implemented Interfaces:
rice.p2p.commonapi.Application, rice.p2p.scribe.Scribe

public class DermiKernel
extends rice.p2p.scribe.ScribeImpl

This class implements the kernel of Dermi based on Scribe. It extends the Scribe event service to provide all the features and services

Version:
1.2
Author:
Carles Pairot , Ruben Mondejar

Nested Class Summary
 
Nested classes/interfaces inherited from class rice.p2p.scribe.ScribeImpl
rice.p2p.scribe.ScribeImpl.TopicManager
 
Field Summary
 
Fields inherited from class rice.p2p.scribe.ScribeImpl
endpoint, handle, MAINTENANCE_INTERVAL, MESSAGE_TIMEOUT, policy, topics
 
Constructor Summary
DermiKernel(java.lang.String instance, DermiConnection conn)
          The kernel constructor
 
Method Summary
 void addInterceptor(DermiApplicationListener client, Topic topic, java.lang.String intId)
          Method for adding an interceptor object to an object group
 void anycast(Topic topic, DermiContent cnt)
           
 void continueInterception(java.util.Hashtable evt, java.util.ArrayList interceptors)
          Method invoked by interceptor skeletons to resume the interception process
 void deliver(rice.p2p.commonapi.Id id, rice.p2p.commonapi.Message message)
          This method is called on the application at the destination node for the given id.
 boolean forward(rice.p2p.commonapi.RouteMessage message)
          The Common API forward method has been changed to first pass the RouteMessage to Dermi's notification parser, so as to be able to route new messages with content changes (useful in manycalls)
 PriorityList getComponentHops(java.lang.String componentId)
           
 rice.p2p.commonapi.NodeHandle getLocalNodeHandle()
          Returns the local node handle
 java.util.Collection getReplicaSet(Id id, int maxRank)
          Returns a set of suitable replica nodes for such Id
 void publish(Topic topic, DermiContent cnt)
           
 void publishDirect(Topic topic, DermiContent content)
          Publishes a direct message to the topic.
 void removeInterceptor(rice.p2p.scribe.Topic topic, java.lang.String intId)
          Method for removing an interceptor from an object group
 void subscribe(Topic topic, Client client)
           
 void unsubscribe(Topic topic, Client client)
          Unsubscribes the given client from the provided topic.
 void update(NodeHandle handle, boolean joined)
          This method is invoked to inform the application that the given node has either joined or left the neighbor set of the local node, as the set would be returned by the neighborSet call.
 
Methods inherited from class rice.p2p.scribe.ScribeImpl
addChild, addChild, anycast, getChildren, getClients, getEnvironment, getId, getParent, getPolicy, getTopics, isRoot, publish, removeChild, removeChild, setPolicy, subscribe, subscribe, unsubscribe, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DermiKernel

public DermiKernel(java.lang.String instance,
                   DermiConnection conn)
The kernel constructor

Parameters:
instance - String Instance name
conn - DermiConnection The connection node
Method Detail

addInterceptor

public void addInterceptor(DermiApplicationListener client,
                           Topic topic,
                           java.lang.String intId)
Method for adding an interceptor object to an object group

Parameters:
client - ScribeClient Interceptor application
topic - Topic Group's identifier
intId - String Interceptor id

removeInterceptor

public void removeInterceptor(rice.p2p.scribe.Topic topic,
                              java.lang.String intId)
Method for removing an interceptor from an object group

Parameters:
topic - Topic Group's identifier
intId - String Interceptor id

getLocalNodeHandle

public rice.p2p.commonapi.NodeHandle getLocalNodeHandle()
Returns the local node handle

Returns:
NodeHandle Returned node handle

publish

public void publish(Topic topic,
                    DermiContent cnt)

anycast

public void anycast(Topic topic,
                    DermiContent cnt)

getReplicaSet

public java.util.Collection getReplicaSet(Id id,
                                          int maxRank)
Returns a set of suitable replica nodes for such Id

Parameters:
id - Id Which id to replicate
maxRank - int Maximum number of replicas
Returns:
Collection Set of replicas

publishDirect

public void publishDirect(Topic topic,
                          DermiContent content)
Publishes a direct message to the topic. (This means sending it not via the rendezvous point, but directly to the destination peer)

Parameters:
topic - The topic to publish to
content - The content to publish

update

public void update(NodeHandle handle,
                   boolean joined)
This method is invoked to inform the application that the given node has either joined or left the neighbor set of the local node, as the set would be returned by the neighborSet call.

Parameters:
handle - The handle that has joined/left
joined - Whether the node has joined or left

getComponentHops

public PriorityList getComponentHops(java.lang.String componentId)

forward

public boolean forward(rice.p2p.commonapi.RouteMessage message)
The Common API forward method has been changed to first pass the RouteMessage to Dermi's notification parser, so as to be able to route new messages with content changes (useful in manycalls)

Specified by:
forward in interface rice.p2p.commonapi.Application
Overrides:
forward in class rice.p2p.scribe.ScribeImpl
Parameters:
message - RouteMessage Received message
Returns:
boolean true if message has to be routed further

deliver

public void deliver(rice.p2p.commonapi.Id id,
                    rice.p2p.commonapi.Message message)
This method is called on the application at the destination node for the given id.

Specified by:
deliver in interface rice.p2p.commonapi.Application
Overrides:
deliver in class rice.p2p.scribe.ScribeImpl
Parameters:
id - The destination id of the message
message - The message being sent

continueInterception

public void continueInterception(java.util.Hashtable evt,
                                 java.util.ArrayList interceptors)
Method invoked by interceptor skeletons to resume the interception process

Parameters:
evt - Hashtable Event data
interceptors - ArrayList Remaining interceptors to be traversed

unsubscribe

public void unsubscribe(Topic topic,
                        Client client)
Unsubscribes the given client from the provided topic.

Parameters:
topic - The topic to unsubscribe from
client - The client to unsubscribe

subscribe

public void subscribe(Topic topic,
                      Client client)