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

jcambon
22.12.2007 c950fe2ad987d5669df1927ba79d4c4080fc55e9
opends/src/server/org/opends/server/admin/client/ManagementContext.java
@@ -422,4 +422,15 @@
   *         context.
   */
  protected abstract Driver getDriver();
 /**
   * Close the associated management context.
   *
   */
  public void close() {
    this.getDriver().close();
  }
}
opends/src/server/org/opends/server/admin/client/ldap/JNDIDirContextAdaptor.java
@@ -240,4 +240,16 @@
    return dirContext.getAttributes(dn, attrIdList);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public void unbind() {
    try {
      dirContext.close();
    } catch (NamingException e) {
      // nothing to do
    }
  }
}
opends/src/server/org/opends/server/admin/client/ldap/LDAPConnection.java
@@ -139,4 +139,11 @@
   */
  public abstract Attributes readEntry(LdapName dn, Collection<String> attrIds)
      throws NamingException;
  /**
   * Close the associated management context.
   *
   */
  public abstract void unbind();
}
opends/src/server/org/opends/server/admin/client/ldap/LDAPDriver.java
@@ -408,6 +408,15 @@
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public void close() {
    connection.unbind();
  }
  /**
   * {@inheritDoc}
opends/src/server/org/opends/server/admin/client/spi/Driver.java
@@ -656,6 +656,13 @@
      CommunicationException;
  /**
   * Close the associated management context.
   *
   */
  public void close() {
    // do nothing by default
  }
  /**
   * Deletes the named managed object.
opends/src/server/org/opends/server/tools/dsconfig/DSConfig.java
@@ -719,26 +719,36 @@
      return 1;
    }
    int retCode = 0;
    if (parser.getSubCommand() == null) {
      hasSubCommand = false;
      if (isInteractive()) {
        // Top-level interactive mode.
        return runInteractiveMode();
          // Top-level interactive mode.
          retCode = runInteractiveMode();
        } else {
          Message message = ERR_ERROR_PARSING_ARGS
              .get(ERR_DSCFG_ERROR_MISSING_SUBCOMMAND.get());
          displayMessageAndUsageReference(message);
          retCode = 1;
        }
      } else {
        Message message = ERR_ERROR_PARSING_ARGS
            .get(ERR_DSCFG_ERROR_MISSING_SUBCOMMAND.get());
        displayMessageAndUsageReference(message);
        return 1;
      }
    } else {
      hasSubCommand = true;
        hasSubCommand = true;
      // Retrieve the sub-command implementation and run it.
      SubCommandHandler handler = handlers.get(parser.getSubCommand());
      return runSubCommand(handler);
        // Retrieve the sub-command implementation and run it.
        SubCommandHandler handler = handlers.get(parser.getSubCommand());
        retCode = runSubCommand(handler);
      }
      try {
        // Close the Management context ==> an LDAP UNBIND is sent
        factory.getManagementContext(this).close();
      } catch (Exception e) {
      // Nothing to report in this case
      }
      return retCode;
    }
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/client/ldap/MockLDAPConnection.java
@@ -355,4 +355,9 @@
    return entries.get(name);
  }
  @Override
  public void unbind() {
    // nothing to do
  }
}