private WorkflowImpl createWorkflow(DN baseDN) throws DirectoryException
{
String backendID = this.getBackendID();
// Create a root workflow element to encapsulate the backend
NDBWorkflowElement rootWE =
NDBWorkflowElement.createAndRegister(backendID, this);
// The workflow ID is "backendID + baseDN".
// We cannot use backendID as workflow identifier because a backend
// may handle several base DNs. We cannot use baseDN either because
// we might want to configure several workflows handling the same
// baseDN through different network groups. So a mix of both
// backendID and baseDN should be ok.
String workflowID = backendID + "#" + baseDN.toString();
// Create the worklfow for the base DN and register the workflow with
// the server.
WorkflowImpl workflowImpl = new WorkflowImpl(workflowID, baseDN,
rootWE.getWorkflowElementID(), (WorkflowElement) rootWE);
workflowImpl.register();
return workflowImpl;
}