mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

abobrov
10.05.2009 5454afb4c6dd326cc3a448b095c16ee6460c5c49
- register with internal and admin network groups as well.
1 files modified
103 ■■■■■ changed files
opends/src/server/org/opends/server/backends/ndb/BackendImpl.java 103 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/ndb/BackendImpl.java
@@ -846,6 +846,8 @@
      {
        DirectoryServer.registerBaseDN(dn, this, false);
        WorkflowImpl workflowImpl = createWorkflow(dn);
        registerWorkflowWithInternalNetworkGroup(workflowImpl);
        registerWorkflowWithAdminNetworkGroup(workflowImpl);
        registerWorkflowWithDefaultNetworkGroup(workflowImpl);
      }
      catch (Exception e)
@@ -891,7 +893,9 @@
      try
      {
        DirectoryServer.deregisterBaseDN(dn);
        deregisterWorkflowWithAdminNetworkGroup(dn);
        deregisterWorkflowWithDefaultNetworkGroup(dn);
        deregisterWorkflowWithInternalNetworkGroup(dn);
      }
      catch (Exception e)
      {
@@ -2107,10 +2111,41 @@
  }
  /**
   * Deregisters a workflow with the default network group and
   * deregisters the workflow with the server. This method is
   * intended to be called when workflow configuration mode is
   * auto.
   * Registers a workflow with the admin network group.
   *
   * @param workflowImpl  The workflow to register with the
   *                      admin network group
   *
   * @throws  DirectoryException  If the workflow is already registered with
   *                              the admin network group
   */
  private void registerWorkflowWithAdminNetworkGroup(
      WorkflowImpl workflowImpl
      ) throws DirectoryException
  {
    NetworkGroup adminNetworkGroup = NetworkGroup.getAdminNetworkGroup();
    adminNetworkGroup.registerWorkflow(workflowImpl);
  }
  /**
   * Registers a workflow with the internal network group.
   *
   * @param workflowImpl  The workflow to register with the
   *                      internal network group
   *
   * @throws  DirectoryException  If the workflow is already registered with
   *                              the internal network group
   */
  private void registerWorkflowWithInternalNetworkGroup(
      WorkflowImpl workflowImpl
      ) throws DirectoryException
  {
    NetworkGroup internalNetworkGroup = NetworkGroup.getInternalNetworkGroup();
    internalNetworkGroup.registerWorkflow(workflowImpl);
  }
  /**
   * Deregisters a workflow with the default network group.
   *
   * @param baseDN  the DN of the workflow to deregister
   */
@@ -2138,4 +2173,64 @@
    NDBWorkflowElement.remove(backendID);
    workflowImpl.deregister(workflowID);
  }
  /**
   * Deregisters a workflow with the admin network group.
   *
   * @param baseDN  the DN of the workflow to deregister
   */
  private void deregisterWorkflowWithAdminNetworkGroup(
      DN baseDN
      )
  {
    String backendID = this.getBackendID();
    // Get the admin network group and deregister all the workflows
    // being configured for the backend (there is one worklfow per
    // backend base DN).
    NetworkGroup adminNetworkGroup = NetworkGroup.getAdminNetworkGroup();
    Workflow workflow = adminNetworkGroup.deregisterWorkflow(baseDN);
    WorkflowImpl workflowImpl = (WorkflowImpl) workflow;
    // 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();
    NDBWorkflowElement.remove(backendID);
    workflowImpl.deregister(workflowID);
  }
  /**
   * Deregisters a workflow with the internal network group.
   *
   * @param baseDN  the DN of the workflow to deregister
   */
  private void deregisterWorkflowWithInternalNetworkGroup(
      DN baseDN
      )
  {
    String backendID = this.getBackendID();
    // Get the internal network group and deregister all the workflows
    // being configured for the backend (there is one workflow per
    // backend base DN).
    NetworkGroup internalNetworkGroup = NetworkGroup.getInternalNetworkGroup();
    Workflow workflow = internalNetworkGroup.deregisterWorkflow(baseDN);
    WorkflowImpl workflowImpl = (WorkflowImpl) workflow;
    // 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();
    NDBWorkflowElement.remove(backendID);
    workflowImpl.deregister(workflowID);
  }
}