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

matthew_swift
14.43.2008 4d488857c1e78805224dcb1eab91e47586ceba5b
Partial fix for issue 2661 - public APIs must not reference private classes.

In org.opends.server.admin.Configuration replace

ManagedObjectDefinition<...,...> definition()

With:

Class<? extends Configuration> configurationClass()

And remove method:

ServerManagedObject<...> managedObject()

This decouples generated server-side management APIs from the rest of the framework with the exception of configuration listeners.
6 files added
45 files modified
1317 ■■■■ changed files
opendj-sdk/opends/resource/admin/metaMO.xsl 21 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/resource/admin/serverMO.xsl 15 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/admin/AggregationPropertyDefinition.java 18 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/admin/Configuration.java 22 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/admin/server/ConfigAddListenerAdaptor.java 30 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/admin/server/ConfigChangeListenerAdaptor.java 22 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/admin/server/ConfigDeleteListenerAdaptor.java 31 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/admin/server/ConfigurationAddListener.java 5 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/admin/server/ConfigurationChangeListener.java 5 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/admin/server/ConfigurationDeleteListener.java 5 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/admin/server/ServerManagedObject.java 323 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/admin/server/ServerManagedObjectAddListener.java 78 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/admin/server/ServerManagedObjectAddListenerAdaptor.java 100 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/admin/server/ServerManagedObjectChangeListener.java 80 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/admin/server/ServerManagedObjectChangeListenerAdaptor.java 102 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/admin/server/ServerManagedObjectDeleteListener.java 80 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/admin/server/ServerManagedObjectDeleteListenerAdaptor.java 101 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/AccessControlConfigManager.java 8 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/AccountStatusNotificationHandlerConfigManager.java 5 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/AlertHandlerConfigManager.java 7 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/AttributeSyntaxConfigManager.java 7 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/CertificateMapperConfigManager.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/ConnectionHandlerConfigManager.java 7 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/EntryCacheConfigManager.java 6 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/ExtendedOperationConfigManager.java 7 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/GroupManager.java 8 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/IdentityMapperConfigManager.java 7 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/KeyManagerProviderConfigManager.java 7 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/LogRetentionPolicyConfigManager.java 10 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/LogRotationPolicyConfigManager.java 10 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/MatchingRuleConfigManager.java 7 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/MonitorConfigManager.java 7 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/PasswordGeneratorConfigManager.java 7 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/PasswordStorageSchemeConfigManager.java 5 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/PasswordValidatorConfigManager.java 7 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/PluginConfigManager.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/SASLConfigManager.java 8 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/TrustManagerProviderConfigManager.java 8 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/VirtualAttributeConfigManager.java 8 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/WorkQueueConfigManager.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/loggers/AccessLogger.java 6 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/loggers/ErrorLogger.java 6 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugLogger.java 6 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/workflowelement/WorkflowElementConfigManager.java 6 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/TestChildCfg.java 10 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/TestChildCfgDefn.java 6 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/TestParentCfg.java 9 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/TestParentCfgDefn.java 6 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/server/ListenerTest.java 52 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/DomainFakeCfg.java 7 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ReplServerFakeConfiguration.java 7 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/resource/admin/metaMO.xsl
@@ -22,7 +22,7 @@
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  !      Portions Copyright 2007-2008 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
  xmlns:admpp="http://www.opends.org/admin-preprocessor"
@@ -606,7 +606,7 @@
      <xsl:call-template name="generate-server-relation-methods" />
    </xsl:for-each>
    <!--
      Configuration definition getter.
      Configuration class getter.
    -->
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
@@ -615,21 +615,8 @@
      select="concat('    /**&#xa;',
                     '     * {@inheritDoc}&#xa;',
                     '     */&#xa;',
                     '    public ManagedObjectDefinition&lt;? extends ', $this-java-class,'CfgClient, ? extends ', $this-java-class,'Cfg&gt; definition() {&#xa;',
                     '      return INSTANCE;&#xa;',
                     '    }&#xa;')" />
    <!--
      Server managed object getter.
    -->
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:value-of
      select="concat('    /**&#xa;',
                     '     * {@inheritDoc}&#xa;',
                     '     */&#xa;',
                     '    public ServerManagedObject&lt;? extends ', $this-java-class,'Cfg&gt; managedObject() {&#xa;',
                     '      return impl;&#xa;',
                     '    public Class&lt;? extends ', $this-java-class,'Cfg&gt; configurationClass() {&#xa;',
                     '      return ', $this-java-class, 'Cfg.class;&#xa;',
                     '    }&#xa;')" />
    <!--
      Configuration entry DN getter.
opendj-sdk/opends/resource/admin/serverMO.xsl
@@ -22,7 +22,7 @@
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  !      Portions Copyright 2007-2008 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
  xmlns:admpp="http://www.opends.org/admin-preprocessor"
@@ -63,17 +63,17 @@
    <xsl:text>{&#xa;</xsl:text>
  </xsl:template>
  <!-- 
    Template for generating the configuration definition getter.
    Template for generating the configuration class getter.
  -->
  <xsl:template name="generate-configuration-definition-getter">
    <xsl:value-of
      select="concat('  /**&#xa;',
                       '   * Get the configuration definition associated with this ', $this-ufn, '.&#xa;',
                       '   * Gets the configuration class associated with this ', $this-ufn, '.&#xa;',
                       '   *&#xa;',
                       '   * @return Returns the configuration definition associated with this ', $this-ufn, '.&#xa;',
                       '   * @return Returns the configuration class associated with this ', $this-ufn, '.&#xa;',
                       '   */&#xa;')" />
    <xsl:value-of
      select="concat('  ManagedObjectDefinition&lt;? extends ', $this-java-class,'CfgClient, ? extends ', $this-java-class,'Cfg&gt; definition();&#xa;')" />
      select="concat('  Class&lt;? extends ', $this-java-class,'Cfg&gt; configurationClass();&#xa;')" />
  </xsl:template>
  <!--
    Template for generating the change listener declaration.
@@ -346,10 +346,6 @@
    <xsl:text>&#xa;</xsl:text>
    <xsl:call-template name="generate-import-statements">
      <xsl:with-param name="imports">
        <xsl:element name="import">
          <xsl:value-of
            select="concat($this-package, '.client.', $this-java-class, 'CfgClient')" />
        </xsl:element>
        <xsl:for-each select="$this-local-properties">
          <xsl:call-template name="get-property-java-imports" >
            <xsl:with-param name="interface" select="'server'" />
@@ -388,7 +384,6 @@
            org.opends.server.admin.server.ConfigurationDeleteListener
          </import>
        </xsl:if>
        <import>org.opends.server.admin.ManagedObjectDefinition</import>
      </xsl:with-param>
    </xsl:call-template>
    <xsl:text>&#xa;</xsl:text>
opendj-sdk/opends/src/server/org/opends/server/admin/AggregationPropertyDefinition.java
@@ -51,10 +51,10 @@
import org.opends.server.admin.client.ManagementContext;
import org.opends.server.admin.condition.Condition;
import org.opends.server.admin.condition.Conditions;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.admin.server.ConfigurationDeleteListener;
import org.opends.server.admin.server.ServerConstraintHandler;
import org.opends.server.admin.server.ServerManagedObject;
import org.opends.server.admin.server.ServerManagedObjectChangeListener;
import org.opends.server.admin.server.ServerManagementContext;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.opends.server.config.ConfigException;
@@ -250,7 +250,7 @@
   * disabled.
   */
  private class ReferentialIntegrityChangeListener implements
      ConfigurationChangeListener<S> {
      ServerManagedObjectChangeListener<S> {
    // The error message which should be returned if an attempt is
    // made to disable the referenced component.
@@ -273,8 +273,8 @@
    /**
     * {@inheritDoc}
     */
    public ConfigChangeResult applyConfigurationChange(S configuration) {
      ServerManagedObject<?> mo = configuration.managedObject();
    public ConfigChangeResult applyConfigurationChange(
        ServerManagedObject<? extends S> mo) {
      try {
        if (targetIsEnabledCondition.evaluate(mo)) {
          return new ConfigChangeResult(ResultCode.SUCCESS, false);
@@ -287,7 +287,7 @@
      // This should not happen - the previous call-back should have
      // trapped this.
      throw new IllegalStateException("Attempting to disable a referenced "
          + configuration.definition().getUserFriendlyName());
          + relationDefinition.getChildDefinition().getUserFriendlyName());
    }
@@ -295,11 +295,11 @@
    /**
     * {@inheritDoc}
     */
    public boolean isConfigurationChangeAcceptable(S configuration,
    public boolean isConfigurationChangeAcceptable(
        ServerManagedObject<? extends S> mo,
        List<Message> unacceptableReasons) {
      // Always prevent the referenced component from being
      // disabled.
      ServerManagedObject<?> mo = configuration.managedObject();
      try {
        if (!targetIsEnabledCondition.evaluate(mo)) {
          unacceptableReasons.add(message);
@@ -315,7 +315,7 @@
        Message message = ERR_REFINT_UNABLE_TO_EVALUATE_TARGET_CONDITION.get(mo
            .getManagedObjectDefinition().getUserFriendlyName(), String
            .valueOf(configuration.dn()), StaticUtils.getExceptionMessage(e));
            .valueOf(mo.getDN()), StaticUtils.getExceptionMessage(e));
        ErrorLogger.logError(message);
        unacceptableReasons.add(message);
        return false;
@@ -369,7 +369,7 @@
        // isConfigurationDeleteAcceptable() call-back should have
        // trapped this.
        throw new IllegalStateException("Attempting to delete a referenced "
            + configuration.definition().getUserFriendlyName());
            + relationDefinition.getChildDefinition().getUserFriendlyName());
      } else {
        return new ConfigChangeResult(ResultCode.SUCCESS, false);
      }
opendj-sdk/opends/src/server/org/opends/server/admin/Configuration.java
@@ -22,14 +22,13 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 *      Portions Copyright 2007-2008 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import org.opends.server.admin.server.ServerManagedObject;
import org.opends.server.types.DN;
@@ -51,23 +50,10 @@
  /**
   * Gets the configuration definition associated with this
   * configuration.
   * Gets the configuration class associated with this configuration.
   *
   * @return Returns the configuration definition associated with this
   * @return Returns the configuration class associated with this
   *         configuration.
   */
  ManagedObjectDefinition<? extends ConfigurationClient,
      ? extends Configuration> definition();
  /**
   * Gets the underlying server-side managed object associated with
   * this configuration.
   *
   * @return Returns the underlying server-side managed object
   *         associated with this configuration.
   */
  ServerManagedObject<? extends Configuration> managedObject();
  Class<? extends Configuration> configurationClass();
}
opendj-sdk/opends/src/server/org/opends/server/admin/server/ConfigAddListenerAdaptor.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 *      Portions Copyright 2007-2008 Sun Microsystems, Inc.
 */
package org.opends.server.admin.server;
@@ -56,7 +56,7 @@
/**
 * An adaptor class which converts {@link ConfigAddListener} callbacks
 * to strongly typed {@link ConfigurationAddListener} callbacks.
 * to {@link ServerManagedObjectAddListener} callbacks.
 *
 * @param <S>
 *          The type of server configuration handled by the add
@@ -70,9 +70,6 @@
   */
  private static final DebugTracer TRACER = getTracer();
  // Cached configuration object between accept/apply callbacks.
  private S cachedConfiguration;
  // Cached managed object between accept/apply callbacks.
  private ServerManagedObject<? extends S> cachedManagedObject;
@@ -80,7 +77,7 @@
  private final InstantiableRelationDefinition<?, S> instantiableRelation;
  // The underlying add listener.
  private final ConfigurationAddListener<S> listener;
  private final ServerManagedObjectAddListener<S> listener;
  // The optional relation.
  private final OptionalRelationDefinition<?, S> optionalRelation;
@@ -103,12 +100,11 @@
   */
  public ConfigAddListenerAdaptor(ManagedObjectPath<?, ?> path,
      InstantiableRelationDefinition<?, S> relation,
      ConfigurationAddListener<S> listener) {
      ServerManagedObjectAddListener<S> listener) {
    this.path = path;
    this.instantiableRelation = relation;
    this.optionalRelation = null;
    this.listener = listener;
    this.cachedConfiguration = null;
    this.cachedManagedObject = null;
  }
@@ -127,12 +123,11 @@
   */
  public ConfigAddListenerAdaptor(ManagedObjectPath<?, ?> path,
      OptionalRelationDefinition<?, S> relation,
      ConfigurationAddListener<S> listener) {
      ServerManagedObjectAddListener<S> listener) {
    this.path = path;
    this.optionalRelation = relation;
    this.instantiableRelation = null;
    this.listener = listener;
    this.cachedConfiguration = null;
    this.cachedManagedObject = null;
  }
@@ -157,7 +152,7 @@
    // Cached objects are guaranteed to be from previous acceptable
    // callback.
    ConfigChangeResult result = listener
        .applyConfigurationAdd(cachedConfiguration);
        .applyConfigurationAdd(cachedManagedObject);
    // Now apply post constraint call-backs.
    if (result.getResultCode() == ResultCode.SUCCESS) {
@@ -214,8 +209,6 @@
      return false;
    }
    cachedConfiguration = cachedManagedObject.getConfiguration();
    // Give up immediately if a constraint violation occurs.
    try {
      cachedManagedObject.ensureIsUsable();
@@ -226,7 +219,7 @@
    // Let the add listener decide.
    List<Message> reasons = new LinkedList<Message>();
    if (listener.isConfigurationAddAcceptable(cachedConfiguration, reasons)) {
    if (listener.isConfigurationAddAcceptable(cachedManagedObject, reasons)) {
      return true;
    } else {
      generateUnacceptableReason(reasons, unacceptableReason);
@@ -237,12 +230,13 @@
  /**
   * Get the configuration add listener associated with this adaptor.
   * Get the server managed object add listener associated with this
   * adaptor.
   *
   * @return Returns the configuration add listener associated with
   *         this adaptor.
   * @return Returns the server managed object add listener associated
   *         with this adaptor.
   */
  ConfigurationAddListener<S> getConfigurationAddListener() {
  ServerManagedObjectAddListener<S> getServerManagedObjectAddListener() {
    return listener;
  }
}
opendj-sdk/opends/src/server/org/opends/server/admin/server/ConfigChangeListenerAdaptor.java
@@ -70,7 +70,7 @@
/**
 * An adaptor class which converts {@link ConfigChangeListener}
 * call-backs to strongly typed {@link ConfigurationChangeListener}
 * call-backs to {@link ServerManagedObjectChangeListener}
 * call-backs.
 *
 * @param <S>
@@ -218,7 +218,7 @@
  private final DN dn;
  // The underlying change listener.
  private final ConfigurationChangeListener<? super S> listener;
  private final ServerManagedObjectChangeListener<? super S> listener;
  // The managed object path.
  private final ManagedObjectPath<?, S> path;
@@ -234,7 +234,7 @@
   *          The underlying change listener.
   */
  public ConfigChangeListenerAdaptor(ManagedObjectPath<?, S> path,
      ConfigurationChangeListener<? super S> listener) {
      ServerManagedObjectChangeListener<? super S> listener) {
    this.path = path;
    this.dn = DNBuilder.create(path);
    this.listener = listener;
@@ -340,7 +340,7 @@
    cachedManagedObject.setConfigEntry(configEntry);
    ConfigChangeResult result = listener
        .applyConfigurationChange(cachedManagedObject.getConfiguration());
        .applyConfigurationChange(cachedManagedObject);
    // Now apply post constraint call-backs.
    if (result.getResultCode() == ResultCode.SUCCESS) {
@@ -415,8 +415,7 @@
    // Let the change listener decide.
    List<Message> reasons = new LinkedList<Message>();
    if (listener.isConfigurationChangeAcceptable(cachedManagedObject
        .getConfiguration(), reasons)) {
    if (listener.isConfigurationChangeAcceptable(cachedManagedObject,reasons)) {
      return true;
    } else {
      generateUnacceptableReason(reasons, unacceptableReason);
@@ -451,13 +450,14 @@
  /**
   * Get the configuration change listener associated with this
   * adaptor.
   * Get the server managed object change listener associated with
   * this adaptor.
   *
   * @return Returns the configuration change listener associated with
   *         this adaptor.
   * @return Returns the server managed object change listener
   *         associated with this adaptor.
   */
  ConfigurationChangeListener<? super S> getConfigurationChangeListener() {
  ServerManagedObjectChangeListener<? super S>
  getServerManagedObjectChangeListener() {
    return listener;
  }
opendj-sdk/opends/src/server/org/opends/server/admin/server/ConfigDeleteListenerAdaptor.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 *      Portions Copyright 2007-2008 Sun Microsystems, Inc.
 */
package org.opends.server.admin.server;
@@ -57,8 +57,7 @@
/**
 * An adaptor class which converts {@link ConfigDeleteListener}
 * callbacks to strongly typed {@link ConfigurationDeleteListener}
 * callbacks.
 * callbacks to {@link ServerManagedObjectDeleteListener} callbacks.
 *
 * @param <S>
 *          The type of server configuration handled by the delete
@@ -72,9 +71,6 @@
   */
  private static final DebugTracer TRACER = getTracer();
  // Cached configuration object between accept/apply callbacks.
  private S cachedConfiguration;
  // Cached managed object between accept/apply callbacks.
  private ServerManagedObject<? extends S> cachedManagedObject;
@@ -82,7 +78,7 @@
  private final InstantiableRelationDefinition<?, S> instantiableRelation;
  // The underlying delete listener.
  private final ConfigurationDeleteListener<S> listener;
  private final ServerManagedObjectDeleteListener<S> listener;
  // The optional relation.
  private final OptionalRelationDefinition<?, S> optionalRelation;
@@ -105,12 +101,11 @@
   */
  public ConfigDeleteListenerAdaptor(ManagedObjectPath<?, ?> path,
      InstantiableRelationDefinition<?, S> relation,
      ConfigurationDeleteListener<S> listener) {
      ServerManagedObjectDeleteListener<S> listener) {
    this.path = path;
    this.optionalRelation = null;
    this.instantiableRelation = relation;
    this.listener = listener;
    this.cachedConfiguration = null;
    this.cachedManagedObject = null;
  }
@@ -129,12 +124,11 @@
   */
  public ConfigDeleteListenerAdaptor(ManagedObjectPath<?, ?> path,
      OptionalRelationDefinition<?, S> relation,
      ConfigurationDeleteListener<S> listener) {
      ServerManagedObjectDeleteListener<S> listener) {
    this.path = path;
    this.optionalRelation = relation;
    this.instantiableRelation = null;
    this.listener = listener;
    this.cachedConfiguration = null;
    this.cachedManagedObject = null;
  }
@@ -159,7 +153,7 @@
    // Cached objects are guaranteed to be from previous acceptable
    // callback.
    ConfigChangeResult result = listener
        .applyConfigurationDelete(cachedConfiguration);
        .applyConfigurationDelete(cachedManagedObject);
    // Now apply post constraint call-backs.
    if (result.getResultCode() == ResultCode.SUCCESS) {
@@ -216,7 +210,6 @@
      return false;
    }
    cachedConfiguration = cachedManagedObject.getConfiguration();
    List<Message> reasons = new LinkedList<Message>();
    // Enforce any constraints.
@@ -246,7 +239,7 @@
    }
    // Let the delete listener decide.
    if (listener.isConfigurationDeleteAcceptable(cachedConfiguration,
    if (listener.isConfigurationDeleteAcceptable(cachedManagedObject,
        reasons)) {
      return true;
    } else {
@@ -258,13 +251,13 @@
  /**
   * Get the configuration delete listener associated with this
   * adaptor.
   * Get the server managed object delete listener associated with
   * this adaptor.
   *
   * @return Returns the configuration delete listener associated with
   *         this adaptor.
   * @return Returns the server managed object delete listener
   *         associated with this adaptor.
   */
  ConfigurationDeleteListener<S> getConfigurationDeleteListener() {
  ServerManagedObjectDeleteListener<S> getServerManagedObjectDeleteListener() {
    return listener;
  }
}
opendj-sdk/opends/src/server/org/opends/server/admin/server/ConfigurationAddListener.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 *      Portions Copyright 2007-2008 Sun Microsystems, Inc.
 */
package org.opends.server.admin.server;
import org.opends.messages.Message;
@@ -31,6 +31,7 @@
import java.util.List;
import org.opends.server.admin.Configuration;
import org.opends.server.types.ConfigChangeResult;
@@ -44,7 +45,7 @@
 *          The type of configuration that this listener should be
 *          notified about.
 */
public interface ConfigurationAddListener<T> {
public interface ConfigurationAddListener<T extends Configuration> {
  /**
   * Indicates whether the proposed addition of a new configuration is
opendj-sdk/opends/src/server/org/opends/server/admin/server/ConfigurationChangeListener.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 *      Portions Copyright 2007-2008 Sun Microsystems, Inc.
 */
package org.opends.server.admin.server;
import org.opends.messages.Message;
@@ -31,6 +31,7 @@
import java.util.List;
import org.opends.server.admin.Configuration;
import org.opends.server.types.ConfigChangeResult;
@@ -45,7 +46,7 @@
 *          The type of configuration that this listener should be
 *          notified about.
 */
public interface ConfigurationChangeListener<T> {
public interface ConfigurationChangeListener<T extends Configuration> {
  /**
   * Indicates whether the proposed change to the configuration is
opendj-sdk/opends/src/server/org/opends/server/admin/server/ConfigurationDeleteListener.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 *      Portions Copyright 2007-2008 Sun Microsystems, Inc.
 */
package org.opends.server.admin.server;
import org.opends.messages.Message;
@@ -31,6 +31,7 @@
import java.util.List;
import org.opends.server.admin.Configuration;
import org.opends.server.types.ConfigChangeResult;
@@ -44,7 +45,7 @@
 *          The type of configuration that this listener should be
 *          notified about.
 */
public interface ConfigurationDeleteListener<T> {
public interface ConfigurationDeleteListener<T extends Configuration> {
  /**
   * Indicates whether the proposed deletion of an existing
opendj-sdk/opends/src/server/org/opends/server/admin/server/ServerManagedObject.java
@@ -149,6 +149,31 @@
  /**
   * Deregisters an existing server managed object add listener.
   *
   * @param <M>
   *          The type of the child server configuration object.
   * @param d
   *          The instantiable relation definition.
   * @param listener
   *          The server managed object add listener.
   * @throws IllegalArgumentException
   *           If the instantiable relation definition is not
   *           associated with this managed object's definition.
   */
  public <M extends Configuration> void deregisterAddListener(
      InstantiableRelationDefinition<?, M> d,
      ServerManagedObjectAddListener<M> listener)
      throws IllegalArgumentException {
    validateRelationDefinition(d);
    DN baseDN = DNBuilder.create(path, d);
    deregisterAddListener(baseDN, listener);
  }
  /**
   * Deregisters an existing configuration add listener.
   *
   * @param <M>
@@ -173,6 +198,31 @@
  /**
   * Deregisters an existing server managed object add listener.
   *
   * @param <M>
   *          The type of the child server configuration object.
   * @param d
   *          The optional relation definition.
   * @param listener
   *          The server managed object add listener.
   * @throws IllegalArgumentException
   *           If the optional relation definition is not associated
   *           with this managed object's definition.
   */
  public <M extends Configuration> void deregisterAddListener(
      OptionalRelationDefinition<?, M> d,
      ServerManagedObjectAddListener<M> listener)
      throws IllegalArgumentException {
    validateRelationDefinition(d);
    DN baseDN = DNBuilder.create(path, d).getParent();
    deregisterAddListener(baseDN, listener);
  }
  /**
   * Deregisters an existing configuration change listener.
   *
   * @param listener
@@ -184,7 +234,35 @@
      if (l instanceof ConfigChangeListenerAdaptor) {
        ConfigChangeListenerAdaptor<?> adaptor =
          (ConfigChangeListenerAdaptor<?>) l;
        if (adaptor.getConfigurationChangeListener() == listener) {
        ServerManagedObjectChangeListener<?> l2 = adaptor
            .getServerManagedObjectChangeListener();
        if (l2 instanceof ServerManagedObjectChangeListenerAdaptor<?>) {
          ServerManagedObjectChangeListenerAdaptor<?> adaptor2 =
            (ServerManagedObjectChangeListenerAdaptor<?>) l2;
          if (adaptor2.getConfigurationChangeListener() == listener) {
            adaptor.finalizeChangeListener();
            configEntry.deregisterChangeListener(adaptor);
          }
        }
      }
    }
  }
  /**
   * Deregisters an existing server managed object change listener.
   *
   * @param listener
   *          The server managed object change listener.
   */
  public void deregisterChangeListener(
      ServerManagedObjectChangeListener<? super S> listener) {
    for (ConfigChangeListener l : configEntry.getChangeListeners()) {
      if (l instanceof ConfigChangeListenerAdaptor) {
        ConfigChangeListenerAdaptor<?> adaptor =
          (ConfigChangeListenerAdaptor<?>) l;
        if (adaptor.getServerManagedObjectChangeListener() == listener) {
          adaptor.finalizeChangeListener();
          configEntry.deregisterChangeListener(adaptor);
        }
@@ -219,6 +297,31 @@
  /**
   * Deregisters an existing server managed object delete listener.
   *
   * @param <M>
   *          The type of the child server configuration object.
   * @param d
   *          The instantiable relation definition.
   * @param listener
   *          The server managed object delete listener.
   * @throws IllegalArgumentException
   *           If the instantiable relation definition is not
   *           associated with this managed object's definition.
   */
  public <M extends Configuration> void deregisterDeleteListener(
      InstantiableRelationDefinition<?, M> d,
      ServerManagedObjectDeleteListener<M> listener)
      throws IllegalArgumentException {
    validateRelationDefinition(d);
    DN baseDN = DNBuilder.create(path, d);
    deregisterDeleteListener(baseDN, listener);
  }
  /**
   * Deregisters an existing configuration delete listener.
   *
   * @param <M>
@@ -243,6 +346,31 @@
  /**
   * Deregisters an existing server managed object delete listener.
   *
   * @param <M>
   *          The type of the child server configuration object.
   * @param d
   *          The optional relation definition.
   * @param listener
   *          The server managed object delete listener.
   * @throws IllegalArgumentException
   *           If the optional relation definition is not associated
   *           with this managed object's definition.
   */
  public <M extends Configuration> void deregisterDeleteListener(
      OptionalRelationDefinition<?, M> d,
      ServerManagedObjectDeleteListener<M> listener)
      throws IllegalArgumentException {
    validateRelationDefinition(d);
    DN baseDN = DNBuilder.create(path, d).getParent();
    deregisterDeleteListener(baseDN, listener);
  }
  /**
   * Retrieve an instantiable child managed object.
   *
   * @param <M>
@@ -491,6 +619,33 @@
      InstantiableRelationDefinition<?, M> d,
      ConfigurationAddListener<M> listener) throws IllegalArgumentException,
      ConfigException {
    registerAddListener(d, new ServerManagedObjectAddListenerAdaptor<M>(
        listener));
  }
  /**
   * Register to be notified when new child server managed object are
   * added beneath an instantiable relation.
   *
   * @param <M>
   *          The type of the child server configuration object.
   * @param d
   *          The instantiable relation definition.
   * @param listener
   *          The server managed object add listener.
   * @throws IllegalArgumentException
   *           If the instantiable relation definition is not
   *           associated with this managed object's definition.
   * @throws ConfigException
   *           If the configuration entry associated with the
   *           instantiable relation could not be retrieved.
   */
  public <M extends Configuration> void registerAddListener(
      InstantiableRelationDefinition<?, M> d,
      ServerManagedObjectAddListener<M> listener)
      throws IllegalArgumentException, ConfigException {
    validateRelationDefinition(d);
    DN baseDN = DNBuilder.create(path, d);
    ConfigAddListener adaptor = new ConfigAddListenerAdaptor<M>(path, d,
@@ -520,6 +675,33 @@
  public <M extends Configuration> void registerAddListener(
      OptionalRelationDefinition<?, M> d, ConfigurationAddListener<M> listener)
      throws IllegalArgumentException, ConfigException {
    registerAddListener(d, new ServerManagedObjectAddListenerAdaptor<M>(
        listener));
  }
  /**
   * Register to be notified when a new child server managed object is
   * added beneath an optional relation.
   *
   * @param <M>
   *          The type of the child server configuration object.
   * @param d
   *          The optional relation definition.
   * @param listener
   *          The server managed object add listener.
   * @throws IllegalArgumentException
   *           If the optional relation definition is not associated
   *           with this managed object's definition.
   * @throws ConfigException
   *           If the configuration entry associated with the optional
   *           relation could not be retrieved.
   */
  public <M extends Configuration> void registerAddListener(
      OptionalRelationDefinition<?, M> d,
      ServerManagedObjectAddListener<M> listener)
      throws IllegalArgumentException, ConfigException {
    validateRelationDefinition(d);
    DN baseDN = DNBuilder.create(path, d).getParent();
    ConfigAddListener adaptor = new ConfigAddListenerAdaptor<M>(path, d,
@@ -538,6 +720,21 @@
   */
  public void registerChangeListener(
      ConfigurationChangeListener<? super S> listener) {
    registerChangeListener(new ServerManagedObjectChangeListenerAdaptor<S>(
        listener));
  }
  /**
   * Register to be notified when this server managed object is
   * changed.
   *
   * @param listener
   *          The server managed object change listener.
   */
  public void registerChangeListener(
      ServerManagedObjectChangeListener<? super S> listener) {
    ConfigChangeListener adaptor = new ConfigChangeListenerAdaptor<S>(path,
        listener);
    configEntry.registerChangeListener(adaptor);
@@ -585,6 +782,33 @@
      InstantiableRelationDefinition<?, M> d,
      ConfigurationDeleteListener<M> listener) throws IllegalArgumentException,
      ConfigException {
    registerDeleteListener(d, new ServerManagedObjectDeleteListenerAdaptor<M>(
        listener));
  }
  /**
   * Register to be notified when existing child server managed
   * objects are deleted beneath an instantiable relation.
   *
   * @param <M>
   *          The type of the child server configuration object.
   * @param d
   *          The instantiable relation definition.
   * @param listener
   *          The server managed objects delete listener.
   * @throws IllegalArgumentException
   *           If the instantiable relation definition is not
   *           associated with this managed object's definition.
   * @throws ConfigException
   *           If the configuration entry associated with the
   *           instantiable relation could not be retrieved.
   */
  public <M extends Configuration> void registerDeleteListener(
      InstantiableRelationDefinition<?, M> d,
      ServerManagedObjectDeleteListener<M> listener)
      throws IllegalArgumentException, ConfigException {
    validateRelationDefinition(d);
    DN baseDN = DNBuilder.create(path, d);
    ConfigDeleteListener adaptor = new ConfigDeleteListenerAdaptor<M>(path, d,
@@ -615,6 +839,33 @@
      OptionalRelationDefinition<?, M> d,
      ConfigurationDeleteListener<M> listener) throws IllegalArgumentException,
      ConfigException {
    registerDeleteListener(d, new ServerManagedObjectDeleteListenerAdaptor<M>(
        listener));
  }
  /**
   * Register to be notified when an existing child server managed
   * object is deleted beneath an optional relation.
   *
   * @param <M>
   *          The type of the child server configuration object.
   * @param d
   *          The optional relation definition.
   * @param listener
   *          The server managed object delete listener.
   * @throws IllegalArgumentException
   *           If the optional relation definition is not associated
   *           with this managed object's definition.
   * @throws ConfigException
   *           If the configuration entry associated with the optional
   *           relation could not be retrieved.
   */
  public <M extends Configuration> void registerDeleteListener(
      OptionalRelationDefinition<?, M> d,
      ServerManagedObjectDeleteListener<M> listener)
      throws IllegalArgumentException, ConfigException {
    validateRelationDefinition(d);
    DN baseDN = DNBuilder.create(path, d).getParent();
    ConfigDeleteListener adaptor = new ConfigDeleteListenerAdaptor<M>(path, d,
@@ -710,7 +961,39 @@
          if (l instanceof ConfigAddListenerAdaptor) {
            ConfigAddListenerAdaptor<?> adaptor =
              (ConfigAddListenerAdaptor<?>) l;
            if (adaptor.getConfigurationAddListener() == listener) {
            ServerManagedObjectAddListener<?> l2 = adaptor
                .getServerManagedObjectAddListener();
            if (l2 instanceof ServerManagedObjectAddListenerAdaptor<?>) {
              ServerManagedObjectAddListenerAdaptor<?> adaptor2 =
                (ServerManagedObjectAddListenerAdaptor<?>) l2;
              if (adaptor2.getConfigurationAddListener() == listener) {
                configEntry.deregisterAddListener(adaptor);
              }
            }
          }
        }
      }
    } catch (ConfigException e) {
      // Ignore the exception since this implies deregistration.
      if (debugEnabled()) {
        TRACER.debugCaught(DebugLogLevel.ERROR, e);
      }
    }
  }
  // Deregister an add listener.
  private <M extends Configuration> void deregisterAddListener(DN baseDN,
      ServerManagedObjectAddListener<M> listener) {
    try {
      ConfigEntry configEntry = getListenerConfigEntry(baseDN);
      if (configEntry != null) {
        for (ConfigAddListener l : configEntry.getAddListeners()) {
          if (l instanceof ConfigAddListenerAdaptor) {
            ConfigAddListenerAdaptor<?> adaptor =
              (ConfigAddListenerAdaptor<?>) l;
            if (adaptor.getServerManagedObjectAddListener() == listener) {
              configEntry.deregisterAddListener(adaptor);
            }
          }
@@ -727,7 +1010,7 @@
  // Deregister a delete listener.
  private <M> void deregisterDeleteListener(DN baseDN,
  private <M extends Configuration> void deregisterDeleteListener(DN baseDN,
      ConfigurationDeleteListener<M> listener) {
    try {
      ConfigEntry configEntry = getListenerConfigEntry(baseDN);
@@ -736,7 +1019,39 @@
          if (l instanceof ConfigDeleteListenerAdaptor) {
            ConfigDeleteListenerAdaptor<?> adaptor =
              (ConfigDeleteListenerAdaptor<?>) l;
            if (adaptor.getConfigurationDeleteListener() == listener) {
            ServerManagedObjectDeleteListener<?> l2 = adaptor
                .getServerManagedObjectDeleteListener();
            if (l2 instanceof ServerManagedObjectDeleteListenerAdaptor<?>) {
              ServerManagedObjectDeleteListenerAdaptor<?> adaptor2 =
                (ServerManagedObjectDeleteListenerAdaptor<?>) l2;
              if (adaptor2.getConfigurationDeleteListener() == listener) {
                configEntry.deregisterDeleteListener(adaptor);
              }
            }
          }
        }
      }
    } catch (ConfigException e) {
      // Ignore the exception since this implies deregistration.
      if (debugEnabled()) {
        TRACER.debugCaught(DebugLogLevel.ERROR, e);
      }
    }
  }
  // Deregister a delete listener.
  private <M extends Configuration> void deregisterDeleteListener(DN baseDN,
      ServerManagedObjectDeleteListener<M> listener) {
    try {
      ConfigEntry configEntry = getListenerConfigEntry(baseDN);
      if (configEntry != null) {
        for (ConfigDeleteListener l : configEntry.getDeleteListeners()) {
          if (l instanceof ConfigDeleteListenerAdaptor) {
            ConfigDeleteListenerAdaptor<?> adaptor =
              (ConfigDeleteListenerAdaptor<?>) l;
            if (adaptor.getServerManagedObjectDeleteListener() == listener) {
              configEntry.deregisterDeleteListener(adaptor);
            }
          }
opendj-sdk/opends/src/server/org/opends/server/admin/server/ServerManagedObjectAddListener.java
New file
@@ -0,0 +1,78 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2008 Sun Microsystems, Inc.
 */
package org.opends.server.admin.server;
import org.opends.messages.Message;
import java.util.List;
import org.opends.server.admin.Configuration;
import org.opends.server.types.ConfigChangeResult;
/**
 * This interface defines the methods that a Directory Server
 * configurable component should implement if it wishes to be able to
 * receive notifications when a new server managed object is added.
 *
 * @param <T>
 *          The type of server managed object that this listener
 *          should be notified about.
 */
public interface ServerManagedObjectAddListener<T extends Configuration> {
  /**
   * Indicates whether the proposed addition of a new server managed
   * object is acceptable to this add listener.
   *
   * @param mo
   *          The server managed object that will be added.
   * @param unacceptableReasons
   *          A list that can be used to hold messages about why the
   *          provided server managed object is not acceptable.
   * @return Returns <code>true</code> if the proposed addition is
   *         acceptable, or <code>false</code> if it is not.
   */
  public boolean isConfigurationAddAcceptable(
      ServerManagedObject<? extends T> mo, List<Message> unacceptableReasons);
  /**
   * Adds a new server managed object to this add listener.
   *
   * @param mo
   *          The server managed object that will be added.
   * @return Returns information about the result of adding the server
   *         managed object.
   */
  public ConfigChangeResult applyConfigurationAdd(
      ServerManagedObject<? extends T> mo);
}
opendj-sdk/opends/src/server/org/opends/server/admin/server/ServerManagedObjectAddListenerAdaptor.java
New file
@@ -0,0 +1,100 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2008 Sun Microsystems, Inc.
 */
package org.opends.server.admin.server;
import java.util.List;
import org.opends.messages.Message;
import org.opends.server.admin.Configuration;
import org.opends.server.types.ConfigChangeResult;
/**
 * An adaptor class which converts
 * {@link ServerManagedObjectAddListener} callbacks to
 * {@link ConfigurationAddListener} callbacks.
 *
 * @param <T>
 *          The type of server managed object that this listener
 *          should be notified about.
 */
final class ServerManagedObjectAddListenerAdaptor<T extends Configuration>
    implements ServerManagedObjectAddListener<T> {
  // The underlying add listener.
  private final ConfigurationAddListener<T> listener;
  /**
   * Creates a new server managed object add listener adaptor.
   *
   * @param listener
   *          The underlying add listener.
   */
  public ServerManagedObjectAddListenerAdaptor(
      ConfigurationAddListener<T> listener) {
    this.listener = listener;
  }
  /**
   * {@inheritDoc}
   */
  public ConfigChangeResult applyConfigurationAdd(
      ServerManagedObject<? extends T> mo) {
    return listener.applyConfigurationAdd(mo.getConfiguration());
  }
  /**
   * Gets the configuration add listener associated with this adaptor.
   *
   * @return Returns the configuration add listener associated with
   *         this adaptor.
   */
  public ConfigurationAddListener<T> getConfigurationAddListener() {
    return listener;
  }
  /**
   * {@inheritDoc}
   */
  public boolean isConfigurationAddAcceptable(
      ServerManagedObject<? extends T> mo, List<Message> unacceptableReasons) {
    return listener.isConfigurationAddAcceptable(mo.getConfiguration(),
        unacceptableReasons);
  }
}
opendj-sdk/opends/src/server/org/opends/server/admin/server/ServerManagedObjectChangeListener.java
New file
@@ -0,0 +1,80 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2008 Sun Microsystems, Inc.
 */
package org.opends.server.admin.server;
import org.opends.messages.Message;
import java.util.List;
import org.opends.server.admin.Configuration;
import org.opends.server.types.ConfigChangeResult;
/**
 * This interface defines the methods that a Directory Server
 * configurable component should implement if it wishes to be able to
 * receive notifications when a its associated server managed object
 * is changed.
 *
 * @param <T>
 *          The type of server managed object that this listener
 *          should be notified about.
 */
public interface ServerManagedObjectChangeListener<T extends Configuration> {
  /**
   * Indicates whether the proposed change to the server managed
   * object is acceptable to this change listener.
   *
   * @param mo
   *          The new server managed object containing the changes.
   * @param unacceptableReasons
   *          A list that can be used to hold messages about why the
   *          provided server managed object is not acceptable.
   * @return Returns <code>true</code> if the proposed change is
   *         acceptable, or <code>false</code> if it is not.
   */
  public boolean isConfigurationChangeAcceptable(
      ServerManagedObject<? extends T> mo, List<Message> unacceptableReasons);
  /**
   * Applies the server managed object changes to this change
   * listener.
   *
   * @param mo
   *          The new server managed object containing the changes.
   * @return Returns information about the result of changing the
   *         server managed object.
   */
  public ConfigChangeResult applyConfigurationChange(
      ServerManagedObject<? extends T> mo);
}
opendj-sdk/opends/src/server/org/opends/server/admin/server/ServerManagedObjectChangeListenerAdaptor.java
New file
@@ -0,0 +1,102 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2008 Sun Microsystems, Inc.
 */
package org.opends.server.admin.server;
import java.util.List;
import org.opends.messages.Message;
import org.opends.server.admin.Configuration;
import org.opends.server.types.ConfigChangeResult;
/**
 * An adaptor class which converts
 * {@link ServerManagedObjectChangeListener} callbacks to
 * {@link ConfigurationChangeListener} callbacks.
 *
 * @param <T>
 *          The type of server managed object that this listener
 *          should be notified about.
 */
final class ServerManagedObjectChangeListenerAdaptor<T extends Configuration>
    implements ServerManagedObjectChangeListener<T> {
  // The underlying change listener.
  private final ConfigurationChangeListener<? super T> listener;
  /**
   * Creates a new server managed object change listener adaptor.
   *
   * @param listener
   *          The underlying change listener.
   */
  public ServerManagedObjectChangeListenerAdaptor(
      ConfigurationChangeListener<? super T> listener) {
    this.listener = listener;
  }
  /**
   * {@inheritDoc}
   */
  public ConfigChangeResult applyConfigurationChange(
      ServerManagedObject<? extends T> mo) {
    return listener.applyConfigurationChange(mo.getConfiguration());
  }
  /**
   * Gets the configuration change listener associated with this
   * adaptor.
   *
   * @return Returns the configuration change listener associated with
   *         this adaptor.
   */
  public ConfigurationChangeListener<? super T>
  getConfigurationChangeListener() {
    return listener;
  }
  /**
   * {@inheritDoc}
   */
  public boolean isConfigurationChangeAcceptable(
      ServerManagedObject<? extends T> mo, List<Message> unacceptableReasons) {
    return listener.isConfigurationChangeAcceptable(mo.getConfiguration(),
        unacceptableReasons);
  }
}
opendj-sdk/opends/src/server/org/opends/server/admin/server/ServerManagedObjectDeleteListener.java
New file
@@ -0,0 +1,80 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2008 Sun Microsystems, Inc.
 */
package org.opends.server.admin.server;
import org.opends.messages.Message;
import java.util.List;
import org.opends.server.admin.Configuration;
import org.opends.server.types.ConfigChangeResult;
/**
 * This interface defines the methods that a Directory Server
 * configurable component should implement if it wishes to be able to
 * receive notifications when an existing server managed object is
 * deleted.
 *
 * @param <T>
 *          The type of server managed object that this listener
 *          should be notified about.
 */
public interface ServerManagedObjectDeleteListener<T extends Configuration> {
  /**
   * Indicates whether the proposed deletion of an existing server
   * managed object is acceptable to this delete listener.
   *
   * @param mo
   *          The server managed object that will be deleted.
   * @param unacceptableReasons
   *          A list that can be used to hold messages about why the
   *          provided server managed object is not acceptable.
   * @return Returns <code>true</code> if the proposed deletion is
   *         acceptable, or <code>false</code> if it is not.
   */
  public boolean isConfigurationDeleteAcceptable(
      ServerManagedObject<? extends T> mo, List<Message> unacceptableReasons);
  /**
   * Deletes an existing server managed object from this delete
   * listener.
   *
   * @param mo
   *          The existing server managed object that will be deleted.
   * @return Returns information about the result of deleting the
   *         server managed object.
   */
  public ConfigChangeResult applyConfigurationDelete(
      ServerManagedObject<? extends T> mo);
}
opendj-sdk/opends/src/server/org/opends/server/admin/server/ServerManagedObjectDeleteListenerAdaptor.java
New file
@@ -0,0 +1,101 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2008 Sun Microsystems, Inc.
 */
package org.opends.server.admin.server;
import java.util.List;
import org.opends.messages.Message;
import org.opends.server.admin.Configuration;
import org.opends.server.types.ConfigChangeResult;
/**
 * An adaptor class which converts
 * {@link ServerManagedObjectDeleteListener} callbacks to
 * {@link ConfigurationDeleteListener} callbacks.
 *
 * @param <T>
 *          The type of server managed object that this listener
 *          should be notified about.
 */
final class ServerManagedObjectDeleteListenerAdaptor<T extends Configuration>
    implements ServerManagedObjectDeleteListener<T> {
  // The underlying delete listener.
  private final ConfigurationDeleteListener<T> listener;
  /**
   * Creates a new server managed object delete listener adaptor.
   *
   * @param listener
   *          The underlying delete listener.
   */
  public ServerManagedObjectDeleteListenerAdaptor(
      ConfigurationDeleteListener<T> listener) {
    this.listener = listener;
  }
  /**
   * {@inheritDoc}
   */
  public ConfigChangeResult applyConfigurationDelete(
      ServerManagedObject<? extends T> mo) {
    return listener.applyConfigurationDelete(mo.getConfiguration());
  }
  /**
   * Gets the configuration delete listener associated with this
   * adaptor.
   *
   * @return Returns the configuration delete listener associated with
   *         this adaptor.
   */
  public ConfigurationDeleteListener<T> getConfigurationDeleteListener() {
    return listener;
  }
  /**
   * {@inheritDoc}
   */
  public boolean isConfigurationDeleteAcceptable(
      ServerManagedObject<? extends T> mo, List<Message> unacceptableReasons) {
    return listener.isConfigurationDeleteAcceptable(mo.getConfiguration(),
        unacceptableReasons);
  }
}
opendj-sdk/opends/src/server/org/opends/server/core/AccessControlConfigManager.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
 */
package org.opends.server.core;
import org.opends.messages.Message;
@@ -454,9 +454,9 @@
      if (configuration != null)
      {
        Method method =
          provider.getClass().getMethod("initializeAccessControlHandler",
                  configuration.definition().getServerConfigurationClass());
        Method method = provider.getClass().getMethod(
            "initializeAccessControlHandler",
            configuration.configurationClass());
        if(initialize) {
          method.invoke(provider, configuration);
        }
opendj-sdk/opends/src/server/org/opends/server/core/AccountStatusNotificationHandlerConfigManager.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
 */
package org.opends.server.core;
import org.opends.messages.Message;
@@ -435,8 +435,7 @@
      {
        Method method = notificationHandler.getClass().getMethod(
            "initializeStatusNotificationHandler",
            configuration.definition().getServerConfigurationClass()
            );
            configuration.configurationClass());
        method.invoke(notificationHandler, configuration);
      }
      else
opendj-sdk/opends/src/server/org/opends/server/core/AlertHandlerConfigManager.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
 */
package org.opends.server.core;
import org.opends.messages.Message;
@@ -384,9 +384,8 @@
      if (initialize)
      {
        Method method =
             handler.getClass().getMethod("initializeAlertHandler",
                  configuration.definition().getServerConfigurationClass());
        Method method = handler.getClass().getMethod("initializeAlertHandler",
            configuration.configurationClass());
        method.invoke(handler, configuration);
      }
      else
opendj-sdk/opends/src/server/org/opends/server/core/AttributeSyntaxConfigManager.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
 */
package org.opends.server.core;
@@ -469,9 +469,8 @@
      if (initialize)
      {
        Method method =
             syntax.getClass().getMethod("initializeSyntax",
                  configuration.definition().getServerConfigurationClass());
        Method method = syntax.getClass().getMethod("initializeSyntax",
            configuration.configurationClass());
        method.invoke(syntax, configuration);
      }
      else
opendj-sdk/opends/src/server/org/opends/server/core/CertificateMapperConfigManager.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
 */
package org.opends.server.core;
import org.opends.messages.Message;
@@ -401,7 +401,7 @@
      {
        Method method =
             mapper.getClass().getMethod("initializeCertificateMapper",
                  configuration.definition().getServerConfigurationClass());
                  configuration.configurationClass());
        method.invoke(mapper, configuration);
      }
      else
opendj-sdk/opends/src/server/org/opends/server/core/ConnectionHandlerConfigManager.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
 */
package org.opends.server.core;
import org.opends.messages.Message;
@@ -405,9 +405,8 @@
      // Determine the initialization method to use: it must take a
      // single parameter which is the exact type of the configuration
      // object.
      Method method = theClass.getMethod(
          "initializeConnectionHandler", config.definition()
              .getServerConfigurationClass());
      Method method = theClass.getMethod("initializeConnectionHandler", config
          .configurationClass());
      method.invoke(connectionHandler, config);
    } catch (Exception e) {
opendj-sdk/opends/src/server/org/opends/server/core/EntryCacheConfigManager.java
@@ -620,10 +620,8 @@
      if (initialize)
      {
        Method method = cache.getClass().getMethod(
            "initializeEntryCache",
            configuration.definition().getServerConfigurationClass()
            );
        Method method = cache.getClass().getMethod("initializeEntryCache",
            configuration.configurationClass());
        method.invoke(cache, configuration);
      }
      // This will check if configuration is acceptable on disabled
opendj-sdk/opends/src/server/org/opends/server/core/ExtendedOperationConfigManager.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
 */
package org.opends.server.core;
import org.opends.messages.Message;
@@ -355,9 +355,8 @@
      // Determine the initialization method to use: it must take a
      // single parameter which is the exact type of the configuration
      // object.
      Method method = theClass.getMethod(
           "initializeExtendedOperationHandler",
           config.definition().getServerConfigurationClass());
      Method method = theClass.getMethod("initializeExtendedOperationHandler",
          config.configurationClass());
      method.invoke(extendedOperationHandler, config);
    }
opendj-sdk/opends/src/server/org/opends/server/core/GroupManager.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 *      Portions Copyright 2007-2008 Sun Microsystems, Inc.
 */
package org.opends.server.core;
@@ -454,9 +454,9 @@
      if (initialize)
      {
        Method method =
             group.getClass().getMethod("initializeGroupImplementation",
                  configuration.definition().getServerConfigurationClass());
        Method method = group.getClass()
            .getMethod("initializeGroupImplementation",
                configuration.configurationClass());
        method.invoke(group, configuration);
      }
      else
opendj-sdk/opends/src/server/org/opends/server/core/IdentityMapperConfigManager.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
 */
package org.opends.server.core;
import org.opends.messages.Message;
@@ -412,9 +412,8 @@
      if (initialize)
      {
        Method method =
             mapper.getClass().getMethod("initializeIdentityMapper",
                  configuration.definition().getServerConfigurationClass());
        Method method = mapper.getClass().getMethod("initializeIdentityMapper",
            configuration.configurationClass());
        method.invoke(mapper, configuration);
      }
      else
opendj-sdk/opends/src/server/org/opends/server/core/KeyManagerProviderConfigManager.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
 */
package org.opends.server.core;
import org.opends.messages.Message;
@@ -398,9 +398,8 @@
      if (initialize)
      {
        Method method =
             provider.getClass().getMethod("initializeKeyManagerProvider",
                  configuration.definition().getServerConfigurationClass());
        Method method = provider.getClass().getMethod(
            "initializeKeyManagerProvider", configuration.configurationClass());
        method.invoke(provider, configuration);
      }
      else
opendj-sdk/opends/src/server/org/opends/server/core/LogRetentionPolicyConfigManager.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
 */
package org.opends.server.core;
import org.opends.messages.Message;
@@ -240,8 +240,8 @@
      // Determine the initialization method to use: it must take a
      // single parameter which is the exact type of the configuration
      // object.
      theClass.getMethod("initializeLogRetentionPolicy", config.definition()
          .getServerConfigurationClass());
      theClass.getMethod("initializeLogRetentionPolicy", config
          .configurationClass());
    } catch (Exception e) {
      Message message = ERR_CONFIG_RETENTION_POLICY_INVALID_CLASS.get(className,
                                  config.dn().toString(),
@@ -269,8 +269,8 @@
      // Determine the initialization method to use: it must take a
      // single parameter which is the exact type of the configuration
      // object.
      Method method = theClass.getMethod("initializeLogRetentionPolicy",
                             config.definition().getServerConfigurationClass());
      Method method = theClass.getMethod("initializeLogRetentionPolicy", config
          .configurationClass());
      method.invoke(RetentionPolicy, config);
    }
    catch (InvocationTargetException ite)
opendj-sdk/opends/src/server/org/opends/server/core/LogRotationPolicyConfigManager.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
 */
package org.opends.server.core;
import org.opends.messages.Message;
@@ -240,8 +240,8 @@
      // Determine the initialization method to use: it must take a
      // single parameter which is the exact type of the configuration
      // object.
      theClass.getMethod("initializeLogRotationPolicy", config.definition()
          .getServerConfigurationClass());
      theClass.getMethod("initializeLogRotationPolicy", config
          .configurationClass());
    } catch (Exception e) {
      Message message = ERR_CONFIG_ROTATION_POLICY_INVALID_CLASS.get(className,
                                  config.dn().toString(),
@@ -269,8 +269,8 @@
      // Determine the initialization method to use: it must take a
      // single parameter which is the exact type of the configuration
      // object.
      Method method = theClass.getMethod("initializeLogRotationPolicy",
                             config.definition().getServerConfigurationClass());
      Method method = theClass.getMethod("initializeLogRotationPolicy", config
          .configurationClass());
      method.invoke(rotationPolicy, config);
    }
    catch (InvocationTargetException ite)
opendj-sdk/opends/src/server/org/opends/server/core/MatchingRuleConfigManager.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
 */
package org.opends.server.core;
import org.opends.messages.Message;
@@ -632,9 +632,8 @@
      if (initialize)
      {
        Method method =
             matchingRule.getClass().getMethod("initializeMatchingRule",
                  configuration.definition().getServerConfigurationClass());
        Method method = matchingRule.getClass().getMethod(
            "initializeMatchingRule", configuration.configurationClass());
        method.invoke(matchingRule, configuration);
      }
      else
opendj-sdk/opends/src/server/org/opends/server/core/MonitorConfigManager.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
 */
package org.opends.server.core;
import org.opends.messages.Message;
@@ -401,9 +401,8 @@
      if (configuration != null)
      {
        Method method =
             monitor.getClass().getMethod("initializeMonitorProvider",
                  configuration.definition().getServerConfigurationClass());
        Method method = monitor.getClass().getMethod(
            "initializeMonitorProvider", configuration.configurationClass());
        method.invoke(monitor, configuration);
      }
opendj-sdk/opends/src/server/org/opends/server/core/PasswordGeneratorConfigManager.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
 */
package org.opends.server.core;
import org.opends.messages.Message;
@@ -392,9 +392,8 @@
      if (initialize)
      {
        Method method =
          generator.getClass().getMethod("initializePasswordGenerator",
                  configuration.definition().getServerConfigurationClass());
        Method method = generator.getClass().getMethod(
            "initializePasswordGenerator", configuration.configurationClass());
        method.invoke(generator, configuration);
      }
      else
opendj-sdk/opends/src/server/org/opends/server/core/PasswordStorageSchemeConfigManager.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
 */
package org.opends.server.core;
import org.opends.messages.Message;
@@ -423,8 +423,7 @@
      {
        Method method = passwordStorageScheme.getClass().getMethod(
            "initializePasswordStorageScheme",
            configuration.definition().getServerConfigurationClass()
            );
            configuration.configurationClass());
        method.invoke(passwordStorageScheme, configuration);
      }
      else
opendj-sdk/opends/src/server/org/opends/server/core/PasswordValidatorConfigManager.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
 */
package org.opends.server.core;
import org.opends.messages.Message;
@@ -405,9 +405,8 @@
      if (initialize)
      {
        Method method =
             validator.getClass().getMethod("initializePasswordValidator",
                  configuration.definition().getServerConfigurationClass());
        Method method = validator.getClass().getMethod(
            "initializePasswordValidator", configuration.configurationClass());
        method.invoke(validator, configuration);
      }
      else
opendj-sdk/opends/src/server/org/opends/server/core/PluginConfigManager.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
 */
package org.opends.server.core;
@@ -416,7 +416,7 @@
        method.invoke(plugin, configuration, pluginTypes);
        method = plugin.getClass().getMethod("initializePlugin", Set.class,
                      configuration.definition().getServerConfigurationClass());
            configuration.configurationClass());
        method.invoke(plugin, pluginTypes, configuration);
      }
      else
opendj-sdk/opends/src/server/org/opends/server/core/SASLConfigManager.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
 */
package org.opends.server.core;
import org.opends.messages.Message;
@@ -391,9 +391,9 @@
      if (initialize)
      {
        Method method =
             handler.getClass().getMethod("initializeSASLMechanismHandler",
                  configuration.definition().getServerConfigurationClass());
        Method method = handler.getClass().getMethod(
            "initializeSASLMechanismHandler",
            configuration.configurationClass());
        method.invoke(handler, configuration);
      }
      else
opendj-sdk/opends/src/server/org/opends/server/core/TrustManagerProviderConfigManager.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
 */
package org.opends.server.core;
import org.opends.messages.Message;
@@ -399,9 +399,9 @@
      if (initialize)
      {
        Method method =
             provider.getClass().getMethod("initializeTrustManagerProvider",
                  configuration.definition().getServerConfigurationClass());
        Method method = provider.getClass().getMethod(
            "initializeTrustManagerProvider",
            configuration.configurationClass());
        method.invoke(provider, configuration);
      }
      else
opendj-sdk/opends/src/server/org/opends/server/core/VirtualAttributeConfigManager.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 *      Portions Copyright 2007-2008 Sun Microsystems, Inc.
 */
package org.opends.server.core;
import org.opends.messages.Message;
@@ -564,9 +564,9 @@
      if (initialize)
      {
        Method method =
             provider.getClass().getMethod("initializeVirtualAttributeProvider",
                  configuration.definition().getServerConfigurationClass());
        Method method = provider.getClass().getMethod(
            "initializeVirtualAttributeProvider",
            configuration.configurationClass());
        method.invoke(provider, configuration);
      }
      else
opendj-sdk/opends/src/server/org/opends/server/core/WorkQueueConfigManager.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
 */
package org.opends.server.core;
import org.opends.messages.Message;
@@ -112,7 +112,7 @@
      WorkQueue workQueue = workQueueClass.newInstance();
      Method method = workQueue.getClass().getMethod("initializeWorkQueue",
           workQueueConfig.definition().getServerConfigurationClass());
          workQueueConfig.configurationClass());
      method.invoke(workQueue, workQueueConfig);
      return workQueue;
opendj-sdk/opends/src/server/org/opends/server/loggers/AccessLogger.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
 */
package org.opends.server.loggers;
import org.opends.messages.Message;
@@ -402,8 +402,8 @@
       // Determine the initialization method to use: it must take a
       // single parameter which is the exact type of the configuration
       // object.
       Method method = theClass.getMethod("initializeAccessLogPublisher",
                             config.definition().getServerConfigurationClass());
       Method method = theClass.getMethod("initializeAccessLogPublisher", config
          .configurationClass());
       method.invoke(AccessLogPublisher, config);
     }
     catch (InvocationTargetException ite)
opendj-sdk/opends/src/server/org/opends/server/loggers/ErrorLogger.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
 */
package org.opends.server.loggers;
import org.opends.messages.Message;
@@ -396,8 +396,8 @@
      // Determine the initialization method to use: it must take a
      // single parameter which is the exact type of the configuration
      // object.
      Method method = theClass.getMethod("initializeErrorLogPublisher",
                             config.definition().getServerConfigurationClass());
      Method method = theClass.getMethod("initializeErrorLogPublisher", config
          .configurationClass());
      method.invoke(errorLogPublisher, config);
    }
    catch (InvocationTargetException ite)
opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugLogger.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 *      Portions Copyright 2007-2008 Sun Microsystems, Inc.
 */
package org.opends.server.loggers.debug;
@@ -408,8 +408,8 @@
      // Determine the initialization method to use: it must take a
      // single parameter which is the exact type of the configuration
      // object.
      Method method = theClass.getMethod("initializeDebugLogPublisher",
                             config.definition().getServerConfigurationClass());
      Method method = theClass.getMethod("initializeDebugLogPublisher", config
          .configurationClass());
      method.invoke(debugLogPublisher, config);
    }
    catch (InvocationTargetException ite)
opendj-sdk/opends/src/server/org/opends/server/workflowelement/WorkflowElementConfigManager.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 *      Portions Copyright 2007-2008 Sun Microsystems, Inc.
 */
package org.opends.server.workflowelement;
@@ -395,9 +395,7 @@
      if (initialize)
      {
        Method method = workflowElement.getClass().getMethod(
            "initializeWorkflowElement",
            configuration.definition().getServerConfigurationClass()
            );
            "initializeWorkflowElement", configuration.configurationClass());
        method.invoke(workflowElement, configuration);
      }
      else
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/TestChildCfg.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 *      Portions Copyright 2007-2008 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
@@ -30,9 +30,7 @@
import java.util.SortedSet;
import org.opends.server.admin.Configuration;
import org.opends.server.admin.ManagedObjectDefinition;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.admin.TestChildCfgClient;
import org.opends.server.types.AttributeType;
import org.opends.server.types.DN;
@@ -48,11 +46,11 @@
public interface TestChildCfg extends Configuration {
  /**
   * Get the configuration definition associated with this Test Child.
   * Get the configuration class associated with this Test Child.
   *
   * @return Returns the configuration definition associated with this Test Child.
   * @return Returns the configuration class associated with this Test Child.
   */
  ManagedObjectDefinition<? extends TestChildCfgClient, ? extends TestChildCfg> definition();
  Class<? extends TestChildCfg> configurationClass();
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/TestChildCfgDefn.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 *      Portions Copyright 2007-2008 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
@@ -570,8 +570,8 @@
    /**
     * {@inheritDoc}
     */
    public ManagedObjectDefinition<? extends TestChildCfgClient, ? extends TestChildCfg> definition() {
      return INSTANCE;
    public Class<? extends TestChildCfg> configurationClass() {
      return TestChildCfg.class;
    }
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/TestParentCfg.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 *      Portions Copyright 2007-2008 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
@@ -30,7 +30,6 @@
import java.util.SortedSet;
import org.opends.server.admin.Configuration;
import org.opends.server.admin.ManagedObjectDefinition;
import org.opends.server.admin.server.ConfigurationAddListener;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.admin.server.ConfigurationDeleteListener;
@@ -49,11 +48,11 @@
public interface TestParentCfg extends Configuration {
  /**
   * Get the configuration definition associated with this Test Parent.
   * Get the configuration class associated with this Test Parent.
   *
   * @return Returns the configuration definition associated with this Test Parent.
   * @return Returns the configuration class associated with this Test Parent.
   */
  ManagedObjectDefinition<? extends TestParentCfgClient, ? extends TestParentCfg> definition();
  Class<? extends TestParentCfg> configurationClass();
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/TestParentCfgDefn.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 *      Portions Copyright 2007-2008 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
@@ -712,8 +712,8 @@
    /**
     * {@inheritDoc}
     */
    public ManagedObjectDefinition<? extends TestParentCfgClient, ? extends TestParentCfg> definition() {
      return INSTANCE;
    public Class<? extends TestParentCfg> configurationClass() {
      return TestParentCfg.class;
    }
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/server/ListenerTest.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 *      Portions Copyright 2007-2008 Sun Microsystems, Inc.
 */
package org.opends.server.admin.server;
@@ -172,7 +172,7 @@
        ConfigAddListener tmp = dl.getDelayedAddListener();
        if (tmp instanceof ConfigAddListenerAdaptor) {
          ConfigAddListenerAdaptor<?> al = (ConfigAddListenerAdaptor<?>) tmp;
          if (al.getConfigurationAddListener() == listener) {
          if (extractListener(al) == listener) {
            isFound = true;
          }
        }
@@ -201,7 +201,7 @@
        ConfigAddListener tmp = dl.getDelayedAddListener();
        if (tmp instanceof ConfigAddListenerAdaptor) {
          ConfigAddListenerAdaptor<?> al = (ConfigAddListenerAdaptor<?>) tmp;
          if (al.getConfigurationAddListener() == listener) {
          if (extractListener(al) == listener) {
            fail("Delayed listener still exists in entry " + parentDN
                + " when it should have been removed");
@@ -221,7 +221,7 @@
    for (ConfigAddListener l : configEntry.getAddListeners()) {
      if (l instanceof ConfigAddListenerAdaptor) {
        ConfigAddListenerAdaptor<?> al = (ConfigAddListenerAdaptor<?>) l;
        if (al.getConfigurationAddListener() == listener) {
        if (extractListener(al) == listener) {
          isFound = true;
          // Clean up.
@@ -278,7 +278,7 @@
    for (ConfigAddListener l : configEntry.getAddListeners()) {
      if (l instanceof ConfigAddListenerAdaptor) {
        ConfigAddListenerAdaptor<?> al = (ConfigAddListenerAdaptor<?>) l;
        if (al.getConfigurationAddListener() == listener) {
        if (extractListener(al) == listener) {
          isFound = true;
          // Clean up.
@@ -326,7 +326,7 @@
    for (ConfigAddListener l : configEntry.getAddListeners()) {
      if (l instanceof ConfigAddListenerAdaptor) {
        ConfigAddListenerAdaptor<?> al = (ConfigAddListenerAdaptor<?>) l;
        if (al.getConfigurationAddListener() == listener) {
        if (extractListener(al) == listener) {
          isFound = true;
          // Clean up.
@@ -376,7 +376,7 @@
        ConfigDeleteListener tmp = dl.getDelayedDeleteListener();
        if (tmp instanceof ConfigDeleteListenerAdaptor) {
          ConfigDeleteListenerAdaptor<?> al = (ConfigDeleteListenerAdaptor<?>) tmp;
          if (al.getConfigurationDeleteListener() == listener) {
          if (extractListener(al) == listener) {
            isFound = true;
          }
        }
@@ -405,7 +405,7 @@
        ConfigDeleteListener tmp = dl.getDelayedDeleteListener();
        if (tmp instanceof ConfigDeleteListenerAdaptor) {
          ConfigDeleteListenerAdaptor<?> al = (ConfigDeleteListenerAdaptor<?>) tmp;
          if (al.getConfigurationDeleteListener() == listener) {
          if (extractListener(al) == listener) {
            fail("Delayed listener still exists in entry " + parentDN
                + " when it should have been removed");
@@ -425,7 +425,7 @@
    for (ConfigDeleteListener l : configEntry.getDeleteListeners()) {
      if (l instanceof ConfigDeleteListenerAdaptor) {
        ConfigDeleteListenerAdaptor<?> al = (ConfigDeleteListenerAdaptor<?>) l;
        if (al.getConfigurationDeleteListener() == listener) {
        if (extractListener(al) == listener) {
          isFound = true;
          // Clean up.
@@ -482,7 +482,7 @@
    for (ConfigDeleteListener l : configEntry.getDeleteListeners()) {
      if (l instanceof ConfigDeleteListenerAdaptor) {
        ConfigDeleteListenerAdaptor<?> al = (ConfigDeleteListenerAdaptor<?>) l;
        if (al.getConfigurationDeleteListener() == listener) {
        if (extractListener(al) == listener) {
          isFound = true;
          // Clean up.
@@ -530,7 +530,7 @@
    for (ConfigDeleteListener l : configEntry.getDeleteListeners()) {
      if (l instanceof ConfigDeleteListenerAdaptor) {
        ConfigDeleteListenerAdaptor<?> al = (ConfigDeleteListenerAdaptor<?>) l;
        if (al.getConfigurationDeleteListener() == listener) {
        if (extractListener(al) == listener) {
          isFound = true;
          // Clean up.
@@ -543,4 +543,34 @@
      fail("Unable to locate listener adaptor in entry " + relationDN);
    }
  }
  // Attempt to extract an add listener from the provided adaptor.
  private ConfigurationAddListener<?> extractListener(
      ConfigAddListenerAdaptor<?> al) {
    ServerManagedObjectAddListener<?> al2 = al
        .getServerManagedObjectAddListener();
    if (al2 instanceof ServerManagedObjectAddListenerAdaptor) {
      ServerManagedObjectAddListenerAdaptor<?> al3 =
        (ServerManagedObjectAddListenerAdaptor<?>) al2;
      return al3.getConfigurationAddListener();
    }
    return null;
  }
  // Attempt to extract a delete listener from the provided adaptor.
  private ConfigurationDeleteListener<?> extractListener(
      ConfigDeleteListenerAdaptor<?> al) {
    ServerManagedObjectDeleteListener<?> al2 = al
        .getServerManagedObjectDeleteListener();
    if (al2 instanceof ServerManagedObjectDeleteListenerAdaptor) {
      ServerManagedObjectDeleteListenerAdaptor<?> al3 =
        (ServerManagedObjectDeleteListenerAdaptor<?>) al2;
      return al3.getConfigurationDeleteListener();
    }
    return null;
  }
}
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/DomainFakeCfg.java
@@ -22,17 +22,15 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 *      Portions Copyright 2007-2008 Sun Microsystems, Inc.
 */
package org.opends.server.replication.plugin;
import java.util.SortedSet;
import org.opends.server.admin.Configuration;
import org.opends.server.admin.ManagedObjectDefinition;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.admin.server.ServerManagedObject;
import org.opends.server.admin.std.client.ReplicationDomainCfgClient;
import org.opends.server.admin.std.meta.ReplicationDomainCfgDefn.IsolationPolicy;
import org.opends.server.admin.std.server.ReplicationDomainCfg;
import org.opends.server.types.DN;
@@ -72,8 +70,7 @@
  /**
   * {@inheritDoc}
   */
  public ManagedObjectDefinition<? extends ReplicationDomainCfgClient,
      ? extends ReplicationDomainCfg> definition()
  public Class<? extends ReplicationDomainCfg> configurationClass()
  {
    return null;
  }
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ReplServerFakeConfiguration.java
@@ -22,17 +22,15 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 *      Portions Copyright 2007-2008 Sun Microsystems, Inc.
 */
package org.opends.server.replication.server;
import java.util.SortedSet;
import org.opends.server.admin.Configuration;
import org.opends.server.admin.ManagedObjectDefinition;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.admin.server.ServerManagedObject;
import org.opends.server.admin.std.client.ReplicationServerCfgClient;
import org.opends.server.admin.std.server.ReplicationServerCfg;
import org.opends.server.types.DN;
@@ -101,8 +99,7 @@
  /**
   * {@inheritDoc}
   */
  public ManagedObjectDefinition<? extends ReplicationServerCfgClient,
                                 ? extends ReplicationServerCfg> definition()
  public Class<? extends ReplicationServerCfg> configurationClass()
  {
    return null;
  }