) throws DirectoryException
{
String backendID = backend.getBackendID();
// Create a root workflow element to encapsulate the backend
LocalBackendWorkflowElement rootWE =
LocalBackendWorkflowElement.createAndRegister(backendID, backend);
// 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 = backend.getBackendID() + "#" + baseDN.toString();
// Create the workflow for the base DN and register the workflow with
// the server.
WorkflowImpl workflowImpl = new WorkflowImpl(
workflowID,
baseDN,
rootWE.getWorkflowElementID(),
rootWE);
workflowImpl.register();
return workflowImpl;
}