org.opends.server.core
Class WorkflowImpl

java.lang.Object
  extended by org.opends.server.core.WorkflowImpl
All Implemented Interfaces:
Workflow

public class WorkflowImpl
extends java.lang.Object
implements Workflow

This class implements the workflow interface. Each task in the workflow is implemented by a WorkflowElement. All the tasks in the workflow are structured in a tree of tasks and the root node of the task tree is stored in the Workflow class itself. To execute a workflow, one just need to call the execute method on the root node of the task tree. Then each task in turn will execute its subordinate nodes and synchronizes them as needed.


Constructor Summary
WorkflowImpl(java.lang.String workflowId, DN baseDN, WorkflowElement rootWorkflowElement)
          Creates a new instance of a workflow implementation.
 
Method Summary
 void deregister()
          Deregisters the current worklow (this) with the server.
 WorkflowImpl deregister(java.lang.String workflowID)
          Deregisters a worklow with the server.
static void deregisterAllOnShutdown()
          Deregisters all Workflows that have been registered.
 void execute(Operation operation)
          Executes all the tasks defined by the workflow task tree for a given operation.
 void finalizeWorkflow()
          Performs any finalization that might be required when this workflow is unloaded.
 DN getBaseDN()
          Gets the base DN of the data set being handled by the workflow.
static Workflow getWorkflow(java.lang.String workflowID)
          Gets a workflow that was registered with the server.
 java.lang.String getWorkflowId()
          Gets the workflow internal identifier.
static java.util.Collection<Workflow> getWorkflows()
          Gets all the workflows that were registered with the server.
 boolean isPrivate()
          Indicates whether the root node of the workflow task tree is handling a private local backend.
 void register()
          Registers the current worklow (this) with the server.
static void resetConfig()
          Resets all the registered workflows.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkflowImpl

public WorkflowImpl(java.lang.String workflowId,
                    DN baseDN,
                    WorkflowElement rootWorkflowElement)
Creates a new instance of a workflow implementation. To define a worfklow one needs to provide a task tree root node (the rootWorkflowElement) and a base DN to identify the data set upon which the tasks can be applied. The rootWorkflowElement must not be null.

Parameters:
workflowId - workflow internal identifier
baseDN - identifies the data handled by the workflow
rootWorkflowElement - the root node of the workflow task tree
Method Detail

finalizeWorkflow

public void finalizeWorkflow()
Performs any finalization that might be required when this workflow is unloaded. No action is taken in the default implementation.


getBaseDN

public DN getBaseDN()
Gets the base DN of the data set being handled by the workflow.

Specified by:
getBaseDN in interface Workflow
Returns:
the workflow base DN

getWorkflowId

public java.lang.String getWorkflowId()
Gets the workflow internal identifier.

Returns:
the workflow internal indentifier

isPrivate

public boolean isPrivate()
Indicates whether the root node of the workflow task tree is handling a private local backend.

Returns:
true if the workflow encapsulates a private local backend

execute

public void execute(Operation operation)
             throws CanceledOperationException
Executes all the tasks defined by the workflow task tree for a given operation.

Specified by:
execute in interface Workflow
Parameters:
operation - the operation to execute
Throws:
CanceledOperationException - if this operation should be cancelled.

register

public void register()
              throws DirectoryException
Registers the current worklow (this) with the server.

Throws:
DirectoryException - If the workflow ID for the provided workflow conflicts with the workflow ID of an existing workflow.

deregister

public void deregister()
Deregisters the current worklow (this) with the server.


deregister

public WorkflowImpl deregister(java.lang.String workflowID)
Deregisters a worklow with the server. The workflow to deregister is identified with its identifier.

Parameters:
workflowID - the identifier of the workflow to deregister
Returns:
the workflow that has been deregistered, null if no workflow has been found.

deregisterAllOnShutdown

public static void deregisterAllOnShutdown()
Deregisters all Workflows that have been registered. This should be called when the server is shutting down.


getWorkflow

public static Workflow getWorkflow(java.lang.String workflowID)
Gets a workflow that was registered with the server.

Parameters:
workflowID - the ID of the workflow to get
Returns:
the requested workflow

getWorkflows

public static java.util.Collection<Workflow> getWorkflows()
Gets all the workflows that were registered with the server.

Returns:
the list of registered workflows

resetConfig

public static void resetConfig()
Resets all the registered workflows.