dermi.core.pastry
Class DermiConnection

java.lang.Object
  extended by dermi.core.DermiConnection
      extended by dermi.core.pastry.DermiConnection

public class DermiConnection
extends DermiConnection

This class wraps a connection to Pastry and is used by Dermi as its main routing substrate.

Version:
1.2
Author:
Carles Pairot

Field Summary
static java.lang.String BOOTSTRAP_HOST
           
static int BOOTSTRAP_PORT
           
static rice.environment.Environment env
           
static java.lang.String INSTANCE_NAME
           
static int PORT
           
 
Fields inherited from class dermi.core.DermiConnection
activatorClient, activatorImpl, configurationFile, logger
 
Constructor Summary
DermiConnection(java.lang.Object... args)
          This method creates a new node which will serve as the underlying p2p layer for Dermi
 
Method Summary
 void addInterceptor(DermiApplicationListener npar, Id subsKey, java.lang.String interceptorId)
          Method for adding an interceptor to an object group
 void anycall(Topic topic, java.io.Serializable data)
          Method for anycalling to a group of objects
 void close()
          Method for closing a connection, thus killing the node
 void continueInterception(java.util.Hashtable evt, java.util.ArrayList interceptors)
          Method for resume the interception process.
 PriorityList getComponentHops(java.lang.String componentId)
           
 Node getLocalNode()
          Utility method for obtaining the local node
 NodeHandle getLocalNodeHandle()
          Utility method for obtaining the local node handle
 Id getLocalNodeId()
          Utility method for obtaining the local node id
 java.util.Collection getReplicaSet(Id id, int maxRank)
          Returns a set of suitable replica nodes for such Id
 void publish(Topic topic, java.io.Serializable data)
          Method for publishing data
 void publishDirect(Topic topic, java.io.Serializable data)
          Method for publishing data directly to a node
 void removeInterceptor(Id subsKey, java.lang.String interceptorId)
          Method for removing an interceptor from an object group
 void subscribe(Topic topic, Client subscriber)
          Method for subscribing an application to a multicast group
 void unsubscribe(Topic topic, Client subscriber)
          Method for unsubscribing an application from a multicast group
 
Methods inherited from class dermi.core.DermiConnection
addActiveObject, containsActiveObject, getActivator, listActiveObjects, loadActivator, removeActiveObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

env

public static rice.environment.Environment env

PORT

public static int PORT

BOOTSTRAP_PORT

public static int BOOTSTRAP_PORT

BOOTSTRAP_HOST

public static java.lang.String BOOTSTRAP_HOST

INSTANCE_NAME

public static java.lang.String INSTANCE_NAME
Constructor Detail

DermiConnection

public DermiConnection(java.lang.Object... args)
                throws ConnectionException
This method creates a new node which will serve as the underlying p2p layer for Dermi

Parameters:
args - Constructor arguments: 0 - String bootstrap host; 1 - int bootstrap port; 2 - PastryNodeFactory factory; 3 - int protocol
Throws:
ConnectionException - If connection cannot be established against the bootstrap
Method Detail

subscribe

public void subscribe(Topic topic,
                      Client subscriber)
Method for subscribing an application to a multicast group

Specified by:
subscribe in class DermiConnection
Parameters:
topic - Topic The group's identifier
subscriber - ScribeClient The application to subscribe

unsubscribe

public void unsubscribe(Topic topic,
                        Client subscriber)
Method for unsubscribing an application from a multicast group

Specified by:
unsubscribe in class DermiConnection
Parameters:
topic - Topic The group's identifier
subscriber - ScribeClient The application to unsubscribe

publish

public void publish(Topic topic,
                    java.io.Serializable data)
Method for publishing data

Specified by:
publish in class DermiConnection
Parameters:
topic - Topic The group's identifier
data - Serializable Data to publish

publishDirect

public void publishDirect(Topic topic,
                          java.io.Serializable data)
Method for publishing data directly to a node

Specified by:
publishDirect in class DermiConnection
Parameters:
topic - Topic The group's identifier
data - Serializable Data to publish

anycall

public void anycall(Topic topic,
                    java.io.Serializable data)
Method for anycalling to a group of objects

Specified by:
anycall in class DermiConnection
Parameters:
topic - Topic The group's identifier
data - Serializable Data to publish

getLocalNodeHandle

public NodeHandle getLocalNodeHandle()
Utility method for obtaining the local node handle

Specified by:
getLocalNodeHandle in class DermiConnection
Returns:
NodeHandle Local node handle

getLocalNode

public Node getLocalNode()
Utility method for obtaining the local node

Specified by:
getLocalNode in class DermiConnection
Returns:
Node Local node

getLocalNodeId

public Id getLocalNodeId()
Utility method for obtaining the local node id

Specified by:
getLocalNodeId in class DermiConnection
Returns:
Id Local node id

getReplicaSet

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

Specified by:
getReplicaSet in class DermiConnection
Parameters:
id - Id Which id to replicate
maxRank - int Maximum number of replicas
Returns:
Collection Set of replicas

addInterceptor

public void addInterceptor(DermiApplicationListener npar,
                           Id subsKey,
                           java.lang.String interceptorId)
Method for adding an interceptor to an object group

Specified by:
addInterceptor in class DermiConnection
Parameters:
npar - NotificationParser Interceptor application
subsKey - Id Subscription key
interceptorId - String Interceptor id

removeInterceptor

public void removeInterceptor(Id subsKey,
                              java.lang.String interceptorId)
Method for removing an interceptor from an object group

Specified by:
removeInterceptor in class DermiConnection
Parameters:
subsKey - Id Subscription key
interceptorId - String Interceptor id

continueInterception

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

Specified by:
continueInterception in class DermiConnection
Parameters:
evt - Hashtable
interceptors - ArrayList

close

public void close()
Method for closing a connection, thus killing the node

Specified by:
close in class DermiConnection

getComponentHops

public PriorityList getComponentHops(java.lang.String componentId)
Specified by:
getComponentHops in class DermiConnection