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

jdemendi
05.08.2008 4a41c53f70eaf12d28215a8aee4fef4d02bc5a57
opends/src/server/org/opends/server/core/networkgroups/NetworkGroup.java
@@ -94,6 +94,7 @@
  private static NetworkGroup adminNetworkGroup =
      new NetworkGroup (ADMIN_NETWORK_GROUP_NAME);
  // The internal network group (singleton).
  // The internal network group has no criterion, no policy, and gives
  // access to all the workflows. The purpose of the internal network
@@ -214,6 +215,8 @@
  /**
   * Deregisters the current network group (this) with the server.
   * The method also decrements the reference counter of the workflows
   * so that workflows can be disabled or deleted if needed.
   */
  public void deregister()
  {
@@ -224,6 +227,27 @@
      networkGroups.remove(networkGroupID);
      registeredNetworkGroups = networkGroups;
      orderedNetworkGroups.remove(this);
      // decrement the reference counter of the workflows registered with
      // this network group
      updateWorkflowReferenceCounters();
    }
  }
  /**
   * Decrements the workflow reference counters of all the workflows
   * registered with this network group.
   */
  private void updateWorkflowReferenceCounters()
  {
    synchronized (registeredWorkflowNodesLock)
    {
      for (WorkflowTopologyNode workflowNode: registeredWorkflowNodes.values())
      {
        WorkflowImpl workflowImpl = workflowNode.getWorkflowImpl();
        workflowImpl.decrementReferenceCounter();
      }
    }
  }
opends/src/server/org/opends/server/core/networkgroups/NetworkGroupConfigManager.java
@@ -150,9 +150,9 @@
  public ConfigChangeResult applyConfigurationAdd(
      NetworkGroupCfg configuration)
  {
    ResultCode         resultCode          = ResultCode.SUCCESS;
    boolean            adminActionRequired = false;
    ArrayList<Message> messages            = new ArrayList<Message>();
    ResultCode    resultCode          = ResultCode.SUCCESS;
    boolean       adminActionRequired = false;
    List<Message> messages            = new ArrayList<Message>();
    configuration.addChangeListener(this);
@@ -198,9 +198,9 @@
  public ConfigChangeResult applyConfigurationDelete(
      NetworkGroupCfg configuration)
  {
    ResultCode         resultCode          = ResultCode.SUCCESS;
    boolean            adminActionRequired = false;
    ArrayList<Message> messages            = new ArrayList<Message>();
    ResultCode    resultCode          = ResultCode.SUCCESS;
    boolean       adminActionRequired = false;
    List<Message> messages            = new ArrayList<Message>();
    NetworkGroup networkGroup = networkGroups.remove(configuration.dn());
@@ -234,9 +234,9 @@
  public ConfigChangeResult applyConfigurationChange(
      NetworkGroupCfg configuration)
  {
    ResultCode         resultCode          = ResultCode.SUCCESS;
    boolean            adminActionRequired = false;
    ArrayList<Message> messages            = new ArrayList<Message>();
    ResultCode    resultCode          = ResultCode.SUCCESS;
    boolean       adminActionRequired = false;
    List<Message> messages            = new ArrayList<Message>();
    ConfigChangeResult configChangeResult =
      new ConfigChangeResult(resultCode, adminActionRequired, messages);
opends/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/NetworkGroupTest.java
@@ -147,7 +147,7 @@
   * - a boolean telling whether we expect to find a workflow for the baseDN
   *   in the default network group
   * - a boolean telling whether we expect to find a workflow for the baseDN
   *   in the admin network group
   *   in the administration network group
   * - a boolean telling whether we expect to find a workflow for the baseDN
   *   in the internal network group
   *
@@ -484,7 +484,7 @@
    // Create a workflow -- the workflow ID is the string representation
    // of the workflow base DN.
    WorkflowElement nullWE = null;
    WorkflowElement<?> nullWE = null;
    WorkflowImpl workflow = new WorkflowImpl(
        workflowBaseDN.toString(), workflowBaseDN, null, nullWE);
@@ -543,7 +543,6 @@
    dump(defaultNG, "defaultNetworkGroup> ");
    // let's get the admin network group -- it should always exist
    NetworkGroup adminNG = NetworkGroup.getAdminNetworkGroup();
    assertNotNull(adminNG);
@@ -610,7 +609,7 @@
    createAndRegisterWorkflow(networkGroup, dn2);
    createAndRegisterWorkflow(networkGroup, dn3);
    // Check the route thorugh the network group
    // Check the route through the network group
    doCheckNetworkGroup(networkGroup, dn1, subordinate1, unrelatedDN, true);
    doCheckNetworkGroup(networkGroup, dn2, subordinate2, unrelatedDN, true);
    doCheckNetworkGroup(networkGroup, dn3, subordinate3, unrelatedDN, true);
@@ -678,8 +677,8 @@
   * backend base DNs are added or removed. When a new backend base DN is
   * added, the new suffix should be accessible for the route process - ie.
   * a workflow should be created and be a potential candidate for the route
   * process. Simillarly, when a backend base DN is removed its associated
   * workflow should be removed; subsequently, any request targetting the
   * process. Similarly, when a backend base DN is removed its associated
   * workflow should be removed; subsequently, any request targeting the
   * removed suffix should be rejected and a no such entry status code be
   * returned.
   */
@@ -777,7 +776,7 @@
    // Create a workflow -- the workflow ID is the string representation
    // of the workflow base DN.
    WorkflowElement nullWE = null;
    WorkflowElement<?> nullWE = null;
    WorkflowImpl workflow = new WorkflowImpl(
        workflowBaseDN.toString(), workflowBaseDN, null, nullWE);
@@ -833,7 +832,7 @@
    // Create a workflow -- the workflow ID is the string representation
    // of the workflow base DN.
    WorkflowElement nullWE = null;
    WorkflowElement<?> nullWE = null;
    WorkflowImpl workflow1 = new WorkflowImpl(
        dn1.toString(), dn1, null, nullWE);
    WorkflowImpl workflow2 = new WorkflowImpl(
@@ -848,7 +847,7 @@
    // Find a networkGroup for this connection
    // As the network groups define no criteria, the highest priority
    // must be choosen
    // must be chosen
    NetworkGroup ng = NetworkGroup.findMatchingNetworkGroup(connection);
    if (prio1 < prio2) {
      assertEquals(ng, networkGroup1);
@@ -996,7 +995,7 @@
  /**
   * Tests the mechnism to attribute a network group to a client connection,
   * Tests the mechanism to attribute a network group to a client connection,
   * based on the bind dn filter.
   */
  @Test (groups = "virtual")
@@ -1207,7 +1206,7 @@
    // Create a workflow with no task inside. The workflow identifier
    // is the a string representation of the workflow base DN.
    WorkflowElement rootWE = null;
    WorkflowElement<?> rootWE = null;
    String workflowId = workflowBaseDN.toString();
    WorkflowImpl workflow = new WorkflowImpl(
        workflowId, workflowBaseDN, null, rootWE);