| | |
| | | |
| | | |
| | | // A lock to protect concurrent access to the registered Workflow nodes. |
| | | private static Object registeredWorkflowNodesLock = new Object(); |
| | | private Object registeredWorkflowNodesLock = new Object(); |
| | | |
| | | |
| | | // The workflow node for the rootDSE entry. The RootDSE workflow node |
| | |
| | | |
| | | |
| | | /** |
| | | * Performs any finalization that might be required when this |
| | | * network group is unloaded. No action is taken in the |
| | | * default implementation. |
| | | */ |
| | | public void finalizeNetworkGroup() |
| | | { |
| | | // No action is required by default. |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Registers the current network group (this) with the server. |
| | | * |
| | | * @throws DirectoryException If the network group ID for the provided |
| | |
| | | WorkflowElement[] postWorkflowElements |
| | | ) throws DirectoryException |
| | | { |
| | | // true as soon as the workflow has been registered |
| | | boolean registered = false; |
| | | |
| | | // Is it the rootDSE workflow? |
| | | DN baseDN = workflow.getBaseDN(); |
| | | if (baseDN.isNullDN()) |
| | |
| | | // NOTE - The rootDSE workflow is stored with the registeredWorkflows. |
| | | rootDSEWorkflowNode = |
| | | new RootDseWorkflowTopology(workflow, namingContexts); |
| | | registered = true; |
| | | } |
| | | else |
| | | { |
| | |
| | | // Register the workflow node with the network group. If the workflow |
| | | // ID is already existing then an exception is raised. |
| | | registerWorkflowNode(workflowNode); |
| | | registered = true; |
| | | |
| | | // Now add the workflow in the workflow topology... |
| | | for (WorkflowTopologyNode curNode: registeredWorkflowNodes.values()) |
| | |
| | | // Rebuild the list of naming context handled by the network group |
| | | rebuildNamingContextList(); |
| | | } |
| | | |
| | | // If the workflow has been registered successfully then register it |
| | | // with the default network group |
| | | if (registered) |
| | | { |
| | | if (this != defaultNetworkGroup) |
| | | { |
| | | defaultNetworkGroup.registerWorkflow( |
| | | workflow, preWorkflowElements, postWorkflowElements); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | * deregister is identified by its baseDN. |
| | | * |
| | | * @param baseDN the baseDN of the workflow to deregister, may be null |
| | | * |
| | | * @return the deregistered workflow |
| | | */ |
| | | public void deregisterWorkflow( |
| | | public Workflow deregisterWorkflow( |
| | | DN baseDN |
| | | ) |
| | | { |
| | | Workflow workflow = null; |
| | | |
| | | if (baseDN == null) |
| | | { |
| | | return; |
| | | return workflow; |
| | | } |
| | | |
| | | if (baseDN.isNullDN()) |
| | | { |
| | | // deregister the rootDSE |
| | | deregisterWorkflow(rootDSEWorkflowNode); |
| | | workflow = rootDSEWorkflowNode.getWorkflowImpl(); |
| | | } |
| | | else |
| | | { |
| | |
| | | // Call deregisterWorkflow() instead of deregisterWorkflowNode() |
| | | // because we want the naming context list to be updated as well. |
| | | deregisterWorkflow(node); |
| | | workflow = node.getWorkflowImpl(); |
| | | |
| | | // Only one workflow can match the baseDN, so we can break |
| | | // the loop here. |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | return workflow; |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * Checks whether a base DN has been already registered with |
| | | * the network group. |
| | | * |
| | | * @param baseDN the base DN to check |
| | | * @return <code>false</code> if the base DN is registered with the |
| | | * network group, <code>false</code> otherwise |
| | | */ |
| | | private boolean baseDNAlreadyRegistered( |
| | | DN baseDN |
| | | ) |
| | | { |
| | | // returned result |
| | | boolean alreadyRegistered = false; |
| | | |
| | | // go through the list of registered workflow and check whether a base DN |
| | | // has already been used in a registered workflow |
| | | for (WorkflowTopologyNode workflowNode: registeredWorkflowNodes.values()) |
| | | { |
| | | DN curDN = workflowNode.getBaseDN(); |
| | | if (baseDN.equals (curDN)) |
| | | { |
| | | alreadyRegistered = true; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | // check done |
| | | return alreadyRegistered; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the list of naming contexts handled by the network group. |
| | | * |
| | | * @return the list of naming contexts |
| | |
| | | namingContexts = null; |
| | | networkGroupID = null; |
| | | rootDSEWorkflowNode = null; |
| | | registeredWorkflowNodes = null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Provides the list of network group registered with the server. |
| | | * |
| | | * @return the list of registered network groups |
| | | */ |
| | | public static Collection<NetworkGroup> getRegisteredNetworkGroups() |
| | | { |
| | | return registeredNetworkGroups.values(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Resets the configuration of all the registered network groups. |
| | | */ |
| | | public static void resetConfig() |
| | | { |
| | | // Reset the default network group |
| | | defaultNetworkGroup.reset(); |
| | | |
| | | // Reset all the registered network group |
| | | synchronized (registeredNetworkGroupsLock) |
| | | { |
| | | registeredNetworkGroups = new TreeMap<String, NetworkGroup>(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Resets the configuration of the current network group. |
| | | */ |
| | | public void reset() |
| | | { |
| | | synchronized (registeredWorkflowNodesLock) |
| | | { |
| | | registeredWorkflowNodes = new TreeMap<String, WorkflowTopologyNode>(); |
| | | rootDSEWorkflowNode = null; |
| | | namingContexts = new NetworkGroupNamingContexts(); |
| | | } |
| | | } |
| | | } |