From 58a50508676500a29b29075f66e454b113a08791 Mon Sep 17 00:00:00 2001
From: jdemendi <jdemendi@localhost>
Date: Wed, 08 Aug 2007 09:57:42 +0000
Subject: [PATCH] This set of changes add ID to identify network groups, workflows and workflow elements. These identifiers pave the way for the network group and workflow configuration.

---
 opends/src/server/org/opends/server/core/DirectoryServer.java |   39 ++++++++++++++++++++++++++++++---------
 1 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/DirectoryServer.java b/opends/src/server/org/opends/server/core/DirectoryServer.java
index f315d7d..be769b3 100644
--- a/opends/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -2427,21 +2427,26 @@
    * TODO implement the registration with the appropriate network group.
    *
    * @param backend  the backend handled by the workflow
+   *
+   * @throws  DirectoryException  If the workflow ID for the provided
+   *                              workflow conflicts with the workflow
+   *                              ID of an existing workflow.
    */
   private static void createAndRegisterWorkflows(
       Backend backend
-      )
+      ) throws DirectoryException
   {
     // Create a root workflow element to encapsulate the backend
     LocalBackendWorkflowElement rootWE =
-        new LocalBackendWorkflowElement(backend);
+        new LocalBackendWorkflowElement(backend.getBackendID(), backend);
 
     // Create a worklfow for each baseDN being configured
-    // in the backend and register the workflow with the network groups
+    // in the backend and register the workflow with the network groups.
+    // The workflow identifier is the same as the backend ID.
     for (DN curBaseDN: backend.getBaseDNs())
     {
       WorkflowImpl workflowImpl = new WorkflowImpl(
-          curBaseDN, (WorkflowElement) rootWE);
+          curBaseDN.toString(), curBaseDN, (WorkflowElement) rootWE);
       registerWorkflowInNetworkGroups(workflowImpl);
     }
   }
@@ -2456,10 +2461,15 @@
    * TODO implement the registration with the appropriate network group.
    *
    * @param workflowImpl  the workflow to register
+   *
+   * @throws  DirectoryException  If the workflow ID for the provided
+   *                              workflow conflicts with the workflow
+   *                              ID of an existing workflow in a
+   *                              network group.
    */
   private static void registerWorkflowInNetworkGroups(
       WorkflowImpl workflowImpl
-      )
+      ) throws DirectoryException
   {
     // Register first the workflow with the default network group
     NetworkGroup defaultNetworkGroup = NetworkGroup.getDefaultNetworkGroup();
@@ -2482,14 +2492,25 @@
    * For the prototype: there is no configuration for the workflows.
    * So we create one workflow per local backend, and we register it
    * to the pool.
+   *
+   * @throws  ConfigException  If there is a configuration problem with any of
+   *                           the workflows.
    */
   private void createAndRegisterRemainingWorkflows()
+      throws ConfigException
   {
-    // Create a workflow for the cn=config backend
-    createAndRegisterWorkflows (configHandler);
+    try
+    {
+      // Create a workflow for the cn=config backend
+      createAndRegisterWorkflows (configHandler);
 
-    // Create a workflows for the rootDSE backend
-    createAndRegisterWorkflows (rootDSEBackend);
+      // Create a workflows for the rootDSE backend
+      createAndRegisterWorkflows (rootDSEBackend);
+    }
+    catch (DirectoryException de)
+    {
+      throw new ConfigException(de.getMessageID(), de.getErrorMessage());
+    }
   }
 
 

--
Gitblit v1.10.0