org.hypergraphdb.peer.workflow
Class ActivityManager

java.lang.Object
  extended by org.hypergraphdb.peer.workflow.ActivityManager
All Implemented Interfaces:
MessageHandler

public class ActivityManager
extends java.lang.Object
implements MessageHandler

The ActivityManager manages all activities currently in effect within a given peer.

Author:
Borislav Iordanov

Constructor Summary
ActivityManager(HyperGraphPeer thisPeer)
           
 
Method Summary
 Activity getParent(Activity a)
           
 void handleMessage(Message msg)
           
 java.util.concurrent.Future<ActivityResult> initiateActivity(Activity activity)
           
 java.util.concurrent.Future<ActivityResult> initiateActivity(Activity activity, Activity parentActivity, ActivityListener listener)
           Initiate a new activity.
 java.util.concurrent.Future<ActivityResult> initiateActivity(Activity activity, ActivityListener listener)
           
 void registerActivityType(java.lang.Class<? extends Activity> activityClass)
           A simplified version of registerActivityType in which the type name is taken to be the fully qualified classname of the activityClass parameter and a DefaultActivityFactory instance is going to be used to create new activities of that type.
 void registerActivityType(java.lang.Class<? extends Activity> activityClass, ActivityFactory factory)
           Register an activity type with an associated factory.
 void registerActivityType(java.lang.String type, java.lang.Class<? extends Activity> activityClass)
           Register an activity type with the specified non-default type name.
 void registerActivityType(java.lang.String type, java.lang.Class<? extends Activity> activityClass, ActivityFactory factory)
           Register an activity type with the specified non-default type name and factory.
 void start()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActivityManager

public ActivityManager(HyperGraphPeer thisPeer)
Method Detail

start

public void start()

registerActivityType

public void registerActivityType(java.lang.Class<? extends Activity> activityClass)

A simplified version of registerActivityType in which the type name is taken to be the fully qualified classname of the activityClass parameter and a DefaultActivityFactory instance is going to be used to create new activities of that type.

Parameters:
activityClass - The class implementing the activity.

registerActivityType

public void registerActivityType(java.lang.Class<? extends Activity> activityClass,
                                 ActivityFactory factory)

Register an activity type with an associated factory. The factory will be used to construct new activity instances based on incoming message.

Parameters:
activityClass - The class implementing the activity.
factory - The activity factory associated with this type.

registerActivityType

public void registerActivityType(java.lang.String type,
                                 java.lang.Class<? extends Activity> activityClass)

Register an activity type with the specified non-default type name.

Parameters:
type - The type name.
activityClass - The class that implements the activity.

registerActivityType

public void registerActivityType(java.lang.String type,
                                 java.lang.Class<? extends Activity> activityClass,
                                 ActivityFactory factory)

Register an activity type with the specified non-default type name and factory.

Parameters:
type - The type name.
activityClass - The class that implements the activity.
factory - The activity factory associated with this type.

initiateActivity

public java.util.concurrent.Future<ActivityResult> initiateActivity(Activity activity)

initiateActivity

public java.util.concurrent.Future<ActivityResult> initiateActivity(Activity activity,
                                                                    ActivityListener listener)

initiateActivity

public java.util.concurrent.Future<ActivityResult> initiateActivity(Activity activity,
                                                                    Activity parentActivity,
                                                                    ActivityListener listener)

Initiate a new activity.

Parameters:
activity -
parentActivity -
listener -
Returns:

handleMessage

public void handleMessage(Message msg)
Specified by:
handleMessage in interface MessageHandler

getParent

public Activity getParent(Activity a)