From 6e7a584808039d13a79c957e968b580176357153 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Thu, 05 Jul 2007 16:07:24 +0000
Subject: [PATCH] Eliminate the ConfigurableComponent interface, as it is no longer needed and has been replaced by the ConfigurationChangeListener interface.

---
 opends/src/server/org/opends/server/core/DirectoryServer.java                 |  308 -------------------
 opends/src/server/org/opends/server/types/DirectoryConfig.java                |   29 -
 /dev/null                                                                     |  148 ---------
 opends/src/server/org/opends/server/replication/server/ReplicationServer.java |   41 --
 opends/src/server/org/opends/server/extensions/ConfigFileHandler.java         |   51 ---
 opends/src/server/org/opends/server/config/JMXMBean.java                      |  380 -----------------------
 6 files changed, 11 insertions(+), 946 deletions(-)

diff --git a/opends/src/server/org/opends/server/api/ConfigurableComponent.java b/opends/src/server/org/opends/server/api/ConfigurableComponent.java
deleted file mode 100644
index fd60535..0000000
--- a/opends/src/server/org/opends/server/api/ConfigurableComponent.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.api;
-
-
-
-import java.util.List;
-
-import org.opends.server.config.ConfigAttribute;
-import org.opends.server.config.ConfigEntry;
-import org.opends.server.types.ConfigChangeResult;
-import org.opends.server.types.DN;
-
-
-
-
-/**
- * This class defines an interface that may be implemented by
- * Directory Server components that may be reconfigured on-the-fly
- * either over a Directory Server protocol like LDAP or through JMX.
- */
-public interface ConfigurableComponent
-{
-  /**
-   * Retrieves the DN of the configuration entry with which this
-   * component is associated.
-   *
-   * @return  The DN of the configuration entry with which this
-   *          component is associated.
-   */
-  public DN getConfigurableComponentEntryDN();
-
-
-
-  /**
-   * Retrieves the set of configuration attributes that are associated
-   * with this configurable component.
-   *
-   * @return  The set of configuration attributes that are associated
-   *          with this configurable component.
-   */
-  public List<ConfigAttribute> getConfigurationAttributes();
-
-
-
-  /**
-   * Indicates whether the provided configuration entry has an
-   * acceptable configuration for this component.  If it does not,
-   * then detailed information about the problem(s) should be added to
-   * the provided list.
-   *
-   * @param  configEntry          The configuration entry for which to
-   *                              make the determination.
-   * @param  unacceptableReasons  A list that can be used to hold
-   *                              messages about why the provided
-   *                              entry does not have an acceptable
-   *                              configuration.
-   *
-   * @return  <CODE>true</CODE> if the provided entry has an
-   *          acceptable configuration for this component, or
-   *          <CODE>false</CODE> if not.
-   */
-  public boolean hasAcceptableConfiguration(ConfigEntry configEntry,
-                      List<String> unacceptableReasons);
-
-
-
-  /**
-   * Makes a best-effort attempt to apply the configuration contained
-   * in the provided entry.  Information about the result of this
-   * processing should be added to the provided message list.
-   * Information should always be added to this list if a
-   * configuration change could not be applied.  If detailed results
-   * are requested, then information about the changes applied
-   * successfully (and optionally about parameters that were not
-   * changed) should also be included.
-   *
-   * @param  configEntry      The entry containing the new
-   *                          configuration to apply for this
-   *                          component.
-   * @param  detailedResults  Indicates whether detailed information
-   *                          about the processing should be added to
-   *                          the list.
-   *
-   * @return  Information about the result of the configuration
-   *          update.
-   */
-  public ConfigChangeResult
-              applyNewConfiguration(ConfigEntry configEntry,
-                                    boolean detailedResults);
-}
-
diff --git a/opends/src/server/org/opends/server/config/JMXMBean.java b/opends/src/server/org/opends/server/config/JMXMBean.java
index 1754572..239dc9f 100644
--- a/opends/src/server/org/opends/server/config/JMXMBean.java
+++ b/opends/src/server/org/opends/server/config/JMXMBean.java
@@ -50,7 +50,6 @@
 
 import org.opends.server.admin.std.server.MonitorProviderCfg;
 import org.opends.server.api.AlertGenerator;
-import org.opends.server.api.ConfigurableComponent;
 import org.opends.server.api.DirectoryServerMBean;
 import org.opends.server.api.InvokableComponent;
 import org.opends.server.api.MonitorProvider;
@@ -64,7 +63,6 @@
 import org.opends.server.types.ErrorLogCategory;
 import org.opends.server.types.ErrorLogSeverity;
 import org.opends.server.types.InvokableMethod;
-import org.opends.server.types.RawModification;
 import org.opends.server.types.ResultCode;
 import org.opends.server.types.SearchScope;
 
@@ -75,16 +73,11 @@
 import static org.opends.server.messages.MessageHandler.*;
 import static org.opends.server.util.ServerConstants.*;
 import static org.opends.server.util.StaticUtils.*;
-import static org.opends.server.config.ConfigConstants.OPTION_PENDING_VALUES;
 import org.opends.server.protocols.jmx.JmxClientConnection;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.protocols.ldap.LDAPFilter;
-import org.opends.server.protocols.ldap.LDAPModification;
-import org.opends.server.protocols.ldap.LDAPAttribute ;
 import org.opends.server.protocols.internal.InternalSearchOperation ;
-import org.opends.server.core.ModifyOperationBasis ;
 import org.opends.server.types.LDAPException;
-import org.opends.server.types.ModificationType;
 
 
 
@@ -112,9 +105,6 @@
   // The set of alert generators for this MBean.
   private CopyOnWriteArrayList<AlertGenerator> alertGenerators;
 
-  // The set of configurable components for this MBean.
-  private CopyOnWriteArrayList<ConfigurableComponent> configurableComponents;
-
   // The set of invokable components for this MBean.
   private CopyOnWriteArrayList<InvokableComponent> invokableComponents;
 
@@ -205,8 +195,6 @@
         this.configEntryDN = configEntryDN;
 
         alertGenerators = new CopyOnWriteArrayList<AlertGenerator>();
-        configurableComponents =
-                           new CopyOnWriteArrayList<ConfigurableComponent>();
         invokableComponents = new CopyOnWriteArrayList<InvokableComponent>();
         monitorProviders =
              new CopyOnWriteArrayList<MonitorProvider<
@@ -319,59 +307,6 @@
 
 
   /**
-   * Retrieves the set of configurable components associated with this JMX
-   * MBean.
-   *
-   * @return  The set of configurable components associated with this JMX MBean.
-   */
-  public CopyOnWriteArrayList<ConfigurableComponent> getConfigurableComponents()
-  {
-    return configurableComponents;
-  }
-
-
-
-  /**
-   * Adds the provided configurable component to the set of components
-   * associated with this JMX MBean.
-   *
-   * @param  component  The component to add to the set of configurable
-   *                    components for this JMX MBean.
-   */
-  public void addConfigurableComponent(ConfigurableComponent component)
-  {
-    synchronized (configurableComponents)
-    {
-      if (! configurableComponents.contains(component))
-      {
-        configurableComponents.add(component);
-      }
-    }
-  }
-
-
-
-  /**
-   * Removes the provided configurable component from the set of components
-   * associated with this JMX MBean.
-   *
-   * @param  component  The component to remove from the set of configurable
-   *                    components for this JMX MBean.
-   *
-   * @return  <CODE>true</CODE> if the specified component was successfully
-   *          removed, or <CODE>false</CODE> if not.
-   */
-  public boolean removeConfigurableComponent(ConfigurableComponent component)
-  {
-    synchronized (configurableComponents)
-    {
-      return configurableComponents.remove(component);
-    }
-  }
-
-
-
-  /**
    * Retrieves the set of invokable components associated with this JMX MBean.
    *
    * @return  The set of invokable components associated with this JMX MBean.
@@ -485,69 +420,10 @@
    * @return  The specified configuration attribute, or <CODE>null</CODE> if
    *          there is no such attribute.
    */
-  private ConfigAttribute getConfigAttribute(String name)
-  {
-    for (ConfigurableComponent component : configurableComponents)
-    {
-      for (ConfigAttribute attr : component.getConfigurationAttributes())
-      {
-        if (attr.getName().equalsIgnoreCase(name))
-        {
-          return attr;
-        }
-      }
-    }
-
-    return null;
-  }
-
-
-
-  /**
-   * Retrieves the specified configuration attribute.
-   *
-   * @param  name  The name of the configuration attribute to retrieve.
-   *
-   * @return  The specified configuration attribute, or <CODE>null</CODE> if
-   *          there is no such attribute.
-   */
   private Attribute getJmxAttribute(String name)
   {
-    String attributeName ;
-    String pendingString = ";" + OPTION_PENDING_VALUES ;
-    boolean pending = false ;
-    if (name.endsWith(pendingString ))
-    {
-        int index = name.indexOf(pendingString) ;
-        attributeName = name.substring(0,index) ;
-        pending = true ;
-    }
-    else
-    {
-        attributeName = name ;
-    }
-
-    for (ConfigurableComponent component : configurableComponents)
-    {
-      for (ConfigAttribute attr : component.getConfigurationAttributes())
-      {
-        if (attr.getName().equalsIgnoreCase(attributeName))
-        {
-          if (pending)
-          {
-            return attr.toJMXAttributePending();
-          }
-          else
-          {
-            return attr.toJMXAttribute() ;
-          }
-        }
-      }
-    }
-
-    //
-    // It's possible that this is a monitor attribute rather than a
-    // configurable one. Check all of those.
+    // It's possible that this is a monitor attribute rather than a configurable
+    // one. Check all of those.
     AttributeType attrType =
       DirectoryServer.getAttributeType(name.toLowerCase());
     if (attrType == null)
@@ -683,89 +559,10 @@
     }
   }
 
-
   /**
-   * Convert an JMX attribute into an LDAP attribute.
-   *
-   * @param attribute
-   *        The JMX attribute which needs to be converted into an LDAP
-   *        attribute
-   * @param configEntry
-   *        The associated ConfigEntry
-   * @return The converted LDAP attribute
-   * @throws AttributeNotFoundException
-   * @throws InvalidAttributeValueException
-   */
-private LDAPAttribute getLdapAttributeFromJmx(
-      javax.management.Attribute attribute, ConfigEntry configEntry)
-      throws AttributeNotFoundException, InvalidAttributeValueException
-  {
-    String name = attribute.getName() ;
-    //
-    // Get a duplicated version of the config attribute
-    ConfigAttribute configAttribute;
-    try
-    {
-      configAttribute = getConfigAttribute(name).duplicate();
-    }
-    catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      int    msgID   = MSGID_CONFIG_JMX_ATTR_NO_ATTR;
-      String message = getMessage(msgID, String.valueOf(configEntryDN),
-                                  String.valueOf(name));
-
-      logError(
-          ErrorLogCategory.CONFIGURATION,
-          ErrorLogSeverity.MILD_ERROR, message, msgID);
-      throw new AttributeNotFoundException(message);
-    }
-
-    //
-    // Update the config Attribute value
-    try
-    {
-      configAttribute.setValue(attribute);
-    }
-    catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-      logError(
-          ErrorLogCategory.CONFIGURATION,
-          ErrorLogSeverity.MILD_ERROR,
-          MSGID_CONFIG_JMX_ATTR_INVALID_VALUE,
-          configEntryDN.toString(),
-          String.valueOf(e));
-      throw new InvalidAttributeValueException();
-    }
-
-    //
-    // Update the config entry (and the entry)
-    configEntry.putConfigAttribute(configAttribute);
-
-    //
-    // Get the Ldap attribute associated with this name
-    AttributeType attrType =
-         DirectoryServer.getAttributeType(name.toLowerCase());
-    if (attrType == null)
-    {
-      attrType = DirectoryServer.getDefaultAttributeType(name, configAttribute
-          .getSyntax());
-    }
-
-    return new LDAPAttribute(configEntry.getEntry().getAttribute(attrType).get(
-        0));
-  }
-
-  /**
-   * Set the value of a specific attribute of the Dynamic MBean.
+   * Set the value of a specific attribute of the Dynamic MBean.  In this case,
+   * it will always throw {@code InvalidAttributeValueException} because setting
+   * attribute values over JMX is currently not allowed.
    *
    * @param  attribute  The identification of the attribute to be set and the
    *                    value it is to be set to.
@@ -779,69 +576,7 @@
   public void setAttribute(javax.management.Attribute attribute)
          throws AttributeNotFoundException, InvalidAttributeValueException
   {
-    ConfigEntry configEntry;
-    ConfigEntry newConfigEntry ;
-
-    //
-    // Get the associated ConfigEntry, and duplicate it
-    try
-    {
-      configEntry = DirectoryServer.getConfigHandler().getConfigEntry(
-          configEntryDN);
-      newConfigEntry = configEntry.duplicate();
-    } catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      int    msgID   = MSGID_CONFIG_JMX_CANNOT_GET_CONFIG_ENTRY;
-      String message = getMessage(msgID, String.valueOf(configEntryDN),
-                                  String.valueOf(e));
-
-      logError(
-          ErrorLogCategory.CONFIGURATION,
-          ErrorLogSeverity.MILD_ERROR, message, msgID);
-      throw new AttributeNotFoundException(message);
-    }
-
-    //
-    // Get the jmx Client connection
-    JmxClientConnection jmxClientConnection = getClientConnection();
-    if (jmxClientConnection == null)
-    {
-      int    msgID   = MSGID_CONFIG_JMX_SET_ATTR_NO_CONNECTION;
-      String message = getMessage(msgID, attribute.getName(),
-                                  String.valueOf(configEntry.getDN()));
-      throw new AttributeNotFoundException(message);
-    }
-
-    //
-    // prepare the ldap modify
-    LDAPModification ldapModification = new LDAPModification(
-        ModificationType.REPLACE, getLdapAttributeFromJmx(
-            attribute,
-            newConfigEntry));
-    ArrayList<RawModification> ldapModList = new ArrayList<RawModification>();
-    ldapModList.add(ldapModification);
-
-    //
-    // Process the modify
-    ModifyOperationBasis op = jmxClientConnection.processModify(
-          new ASN1OctetString(configEntryDN.toString()),
-          ldapModList);
-
-    ResultCode rc = op.getResultCode();
-    if (rc != ResultCode.SUCCESS)
-    {
-      jmxClientConnection = null ;
-      throw new InvalidAttributeValueException();
-    }
-    //
-    // return part
-    jmxClientConnection = null ;
-    return ;
+    throw new InvalidAttributeValueException();
   }
 
   /**
@@ -973,100 +708,13 @@
    *                     attributes to be set and the values they are to be set
    *                     to.
    *
-   * @return  The list of attributes that were set with their new values.
+   * @return  The list of attributes that were set with their new values.  In
+   *          this case, the list will always be empty because we do not support
+   *          setting attribute values over JMX.
    */
   public AttributeList setAttributes(AttributeList attributes)
   {
-    AttributeList setAttrs = new AttributeList();
-
-    //
-    ConfigEntry configEntry;
-    ConfigEntry newConfigEntry ;
-
-    //
-    // Get the associated ConfigEntry, and duplicate it
-    try
-    {
-      configEntry = DirectoryServer.getConfigHandler().getConfigEntry(
-          configEntryDN);
-      newConfigEntry = configEntry.duplicate();
-    } catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      logError(
-          ErrorLogCategory.CONFIGURATION,
-          ErrorLogSeverity.MILD_ERROR,
-          MSGID_CONFIG_JMX_CANNOT_GET_CONFIG_ENTRY,
-          configEntryDN.toString(),
-          String.valueOf(e));
-      return setAttrs;
-    }
-
-    //
-    // Get the jmx Client connection
-    JmxClientConnection jmxClientConnection = getClientConnection();
-    if (jmxClientConnection == null)
-    {
-      return setAttrs;
-    }
-
-    //
-    // prepare the ldap modify
-    ArrayList<RawModification> ldapModList = new ArrayList<RawModification>();
-    for (Object o : attributes)
-    {
-      Attribute attribute = (Attribute) o;
-      try
-      {
-        LDAPModification ldapModification = new LDAPModification(
-            ModificationType.REPLACE, getLdapAttributeFromJmx(
-                attribute, newConfigEntry));
-                ldapModList.add(ldapModification);
-      }
-      catch (Exception e)
-      {
-        continue ;
-      }
-    }
-
-    //
-    // Process the modify
-    // TODO What about the return code?
-
-    jmxClientConnection.processModify(
-        new ASN1OctetString(configEntryDN.toString()),
-        ldapModList);
-
-    //
-    // return part
-    jmxClientConnection = null ;
-    for (Object o : attributes)
-    {
-      Attribute attribute = (Attribute) o;
-      ConfigAttribute configAttribute;
-      try
-      {
-        configAttribute = getConfigAttribute(attribute.getName());
-      }
-      catch (Exception e)
-      {
-        if (debugEnabled())
-        {
-          TRACER.debugCaught(DebugLogLevel.ERROR, e);
-        }
-
-        logError(ErrorLogCategory.CONFIGURATION, ErrorLogSeverity.MILD_ERROR,
-                 MSGID_CONFIG_JMX_ATTR_NO_ATTR, configEntryDN.toString(),
-                 attribute.getName());
-        continue;
-      }
-      configAttribute.toJMXAttribute(setAttrs);
-    }
-    return setAttrs;
+    return new AttributeList();
   }
 
 
@@ -1169,14 +817,6 @@
     }
 
     ArrayList<MBeanAttributeInfo> attrs = new ArrayList<MBeanAttributeInfo>();
-    for (ConfigurableComponent component : configurableComponents)
-    {
-      for (ConfigAttribute attr : component.getConfigurationAttributes())
-      {
-        attr.toJMXAttributeInfo(attrs);
-      }
-    }
-
     for (MonitorProvider<? extends MonitorProviderCfg> monitor :
          monitorProviders)
     {
diff --git a/opends/src/server/org/opends/server/core/DirectoryServer.java b/opends/src/server/org/opends/server/core/DirectoryServer.java
index 3b741dd..984c9ab 100644
--- a/opends/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -4277,314 +4277,6 @@
 
 
   /**
-   * Registers the provided configurable component with the Directory Server.
-   *
-   * @param  component  The configurable component to register.
-   */
-  public static void registerConfigurableComponent(ConfigurableComponent
-                                                        component)
-  {
-    DN componentDN = component.getConfigurableComponentEntryDN();
-    JMXMBean mBean = directoryServer.mBeans.get(componentDN);
-    if (mBean == null)
-    {
-      mBean = new JMXMBean(componentDN);
-      mBean.addConfigurableComponent(component);
-      directoryServer.mBeans.put(componentDN, mBean);
-    }
-    else
-    {
-      mBean.addConfigurableComponent(component);
-    }
-
-
-
-    // This is all code used to dynamically generate an admin definition from
-    // the configurable component.  We'll only generate it if the
-    // org.opends.server.dumpComponents property is set to "true".
-    String propValue = System.getProperty("org.opends.server.dumpComponents");
-    if ((propValue == null) || (! propValue.equals("true")))
-    {
-      return;
-    }
-
-    try
-    {
-      DN entryDN = component.getConfigurableComponentEntryDN();
-      ConfigEntry configEntry =
-           directoryServer.configHandler.getConfigEntry(entryDN);
-      ObjectClass structuralClass =
-           configEntry.getEntry().getStructuralObjectClass();
-      ObjectClass superiorClass = structuralClass.getSuperiorClass();
-
-      String baseName;
-      String primaryName = structuralClass.getPrimaryName();
-      if (primaryName.startsWith("ds-cfg-"))
-      {
-        baseName = primaryName.substring(7);
-      }
-      else
-      {
-        baseName = "___NAME___";
-      }
-
-
-      LinkedList<String> lines = new LinkedList<String>();
-      lines.add("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
-      lines.add("<adm:managed-object name=\"" + baseName + "\" plural-name=\"" +
-                baseName + "s\"");
-      lines.add("  package=\"org.opends.server.admin.std\"");
-      lines.add("  xmlns:adm=\"http://www.opends.org/admin\"");
-      lines.add("  xmlns:ldap=\"http://www.opends.org/admin-ldap\">");
-      lines.add("  <adm:synopsis>");
-      lines.add("    ___SYNOPSIS___");
-      lines.add("  </adm:synopsis>");
-
-
-      // Write information about the object class.
-      lines.add("  <adm:profile name=\"ldap\">");
-      lines.add("    <ldap:object-class>");
-      lines.add("      <ldap:oid>" + structuralClass.getOID() + "</ldap:oid>");
-      lines.add("      <ldap:name>" + primaryName + "</ldap:name>");
-
-      if (superiorClass != null)
-      {
-        lines.add("      <ldap:superior>" + superiorClass.getNameOrOID() +
-                  "</ldap:superior>");
-      }
-
-      lines.add("    </ldap:object-class>");
-      lines.add("  </adm:profile>");
-
-
-      // Write information about all of the configuration attributes.
-      for (org.opends.server.config.ConfigAttribute attr :
-           component.getConfigurationAttributes())
-      {
-        if (attr instanceof org.opends.server.config.ReadOnlyConfigAttribute)
-        {
-          continue;
-        }
-
-        primaryName = attr.getName();
-        AttributeType type = getAttributeType(toLowerCase(primaryName), true);
-        if (primaryName.startsWith("ds-cfg-"))
-        {
-          baseName = primaryName.substring(7);
-        }
-        else
-        {
-          baseName = "___NAME___";
-        }
-
-        lines.add("  <adm:property name=\"" + baseName + "\"");
-        lines.add("    mandatory=\""
-             + String.valueOf(attr.isRequired()) + "\"");
-        lines.add("    multi-valued=\""
-             + String.valueOf(attr.isMultiValued()) + "\">");
-        lines.add("    <adm:synopsis>");
-        lines.add("      ___SYNOPSIS___");
-        lines.add("    </adm:synopsis>");
-        lines.add("    <adm:description>");
-
-        String description = attr.getDescription();
-        int startPos = 0;
-        while (startPos < description.length())
-        {
-          StringBuilder buffer = new StringBuilder();
-          buffer.append("      ");
-          int remaining = description.length() - startPos;
-          if (remaining <= 73)
-          {
-            buffer.append(description.substring(startPos));
-            startPos += remaining;
-          }
-          else
-          {
-            int endPos = startPos + 72;
-            while ((endPos > startPos) && (description.charAt(endPos) != ' '))
-            {
-              endPos--;
-            }
-            if (description.charAt(endPos) == ' ')
-            {
-              buffer.append(description.substring(startPos, endPos));
-              startPos = endPos + 1;
-            }
-            else
-            {
-              buffer.append(description.substring(startPos));
-              startPos += remaining;
-            }
-          }
-
-          lines.add(buffer.toString());
-        }
-
-        lines.add("    </adm:description>");
-        if (attr.requiresAdminAction())
-        {
-          lines.add("    <adm:requires-admin-action>");
-          lines.add("      <adm:server-restart/>");
-          lines.add("    </adm:requires-admin-action>");
-        }
-        if (!attr.isRequired())
-        {
-          lines.add("    <adm:default-behavior>");
-          lines.add("      <adm:undefined/>");
-          lines.add("    </adm:default-behavior>");
-        }
-        lines.add("    <adm:syntax>");
-
-        if (attr instanceof org.opends.server.config.BooleanConfigAttribute)
-        {
-          lines.add("      <adm:boolean />");
-        }
-        else if (attr instanceof org.opends.server.config.DNConfigAttribute)
-        {
-          lines.add("      <adm:dn />");
-        }
-        else if (attr instanceof
-                 org.opends.server.config.IntegerConfigAttribute)
-        {
-          org.opends.server.config.IntegerConfigAttribute intAttr =
-               (org.opends.server.config.IntegerConfigAttribute) attr;
-          String lineStr = "      <adm:integer ";
-          if (intAttr.hasLowerBound())
-          {
-            lineStr += " lower-limit=\"" + intAttr.getLowerBound() + "\" ";
-          }
-
-          if (intAttr.hasUpperBound())
-          {
-            lineStr += " upper-limit=\"" + intAttr.getUpperBound() + "\" ";
-          }
-
-          lineStr += "/>";
-          lines.add(lineStr);
-        }
-        else if (attr instanceof
-                 org.opends.server.config.IntegerWithUnitConfigAttribute)
-        {
-          lines.add("     <!-- ___INTEGER_WITH_UNIT_TYPE___ -->");
-          lines.add("      <adm:string />");
-        }
-        else if (attr instanceof
-                 org.opends.server.config.MultiChoiceConfigAttribute)
-        {
-          lines.add("      <adm:enumeration>");
-
-          org.opends.server.config.MultiChoiceConfigAttribute mcAttr =
-               (org.opends.server.config.MultiChoiceConfigAttribute) attr;
-          for (String allowedValue : mcAttr.allowedValues())
-          {
-            lines.add("        <adm:value name=\"" + allowedValue + "\">");
-            lines.add("          <adm:synopsis>");
-            lines.add("            ___SYNOPSIS___");
-            lines.add("          </adm:synopsis>");
-            lines.add("        </adm:value>");
-          }
-
-          lines.add("      </adm:enumeration>");
-        }
-        else if (attr instanceof
-                 org.opends.server.config.StringConfigAttribute)
-        {
-          lines.add("      <adm:string />");
-        }
-        else
-        {
-          lines.add("     <!-- ___UNKNOWN_CONFIG_ATTR_TYPE___ -->");
-          lines.add("      <adm:string />");
-        }
-
-        lines.add("    </adm:syntax>");
-        lines.add("    <adm:profile name=\"ldap\">");
-        lines.add("      <ldap:attribute>");
-        lines.add("        <ldap:oid>" + type.getOID() + "</ldap:oid>");
-        lines.add("        <ldap:name>" + primaryName + "</ldap:name>");
-        lines.add("      </ldap:attribute>");
-        lines.add("    </adm:profile>");
-        lines.add("  </adm:property>");
-      }
-
-      lines.add("</adm:managed-object>");
-
-
-      File parentDir = new File("/tmp/admin-framework");
-      if (! parentDir.exists())
-      {
-        parentDir.mkdirs();
-      }
-
-      String dnString = entryDN.toNormalizedString();
-      StringBuilder filename = new StringBuilder();
-      filename.append(parentDir.getAbsolutePath());
-      filename.append("/");
-      for (int i=0; i < dnString.length(); i++)
-      {
-        char c = dnString.charAt(i);
-        if (Character.isLetter(c) || Character.isDigit(c))
-        {
-          filename.append(c);
-        }
-        else
-        {
-          filename.append('_');
-        }
-      }
-      filename.append(".xml");
-
-      java.io.BufferedWriter bw =
-           new java.io.BufferedWriter(new java.io.FileWriter(
-                                               filename.toString()));
-      for (String line : lines)
-      {
-        bw.write(line);
-        bw.newLine();
-      }
-      bw.flush();
-      bw.close();
-
-      System.err.println();
-      System.err.println();
-      System.err.println("---------- Registered Configurable Component " +
-                         "----------");
-      for (String line : lines)
-      {
-        System.err.println(line);
-      }
-
-      System.err.println();
-      System.err.println();
-    }
-    catch (Exception e)
-    {
-      e.printStackTrace();
-    }
-  }
-
-
-
-  /**
-   * Deregisters the provided configurable component with the Directory Server.
-   *
-   * @param  component  The configurable component to deregister.
-   */
-  public static void deregisterConfigurableComponent(ConfigurableComponent
-                                                          component)
-  {
-    DN componentDN = component.getConfigurableComponentEntryDN();
-    JMXMBean mBean = directoryServer.mBeans.get(componentDN);
-    if (mBean != null)
-    {
-      mBean.removeConfigurableComponent(component);
-    }
-  }
-
-
-
-  /**
    * Registers the provided invokable component with the Directory Server.
    *
    * @param  component  The invokable component to register.
diff --git a/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java b/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
index e23adc2..2afa71a 100644
--- a/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
+++ b/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
@@ -39,7 +39,6 @@
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.LinkedList;
 import java.util.List;
@@ -64,10 +63,8 @@
 import org.opends.server.api.ConfigChangeListener;
 import org.opends.server.api.ConfigDeleteListener;
 import org.opends.server.api.ConfigHandler;
-import org.opends.server.api.ConfigurableComponent;
 import org.opends.server.config.ConfigEntry;
 import org.opends.server.config.ConfigException;
-import org.opends.server.config.JMXMBean;
 import org.opends.server.core.AddOperation;
 import org.opends.server.core.DeleteOperation;
 import org.opends.server.core.DirectoryServer;
@@ -1651,41 +1648,6 @@
       }
 
 
-      // See if there are any configurable components associated with this
-      // entry.  If there are, then make sure they are all OK with the change.
-      JMXMBean mBean = DirectoryServer.getJMXMBean(entryDN);
-      CopyOnWriteArrayList<ConfigurableComponent> configurableComponents = null;
-      if (mBean != null)
-      {
-        configurableComponents = mBean.getConfigurableComponents();
-        LinkedList<String> unacceptableReasons = new LinkedList<String>();
-
-        for (ConfigurableComponent c : configurableComponents)
-        {
-          if (! c.hasAcceptableConfiguration(newEntry, unacceptableReasons))
-          {
-            if (! unacceptableReasons.isEmpty())
-            {
-              Iterator<String> iterator = unacceptableReasons.iterator();
-              unacceptableReason.append(iterator.next());
-
-              while (iterator.hasNext())
-              {
-                unacceptableReason.append("  ");
-                unacceptableReason.append(iterator.next());
-              }
-            }
-
-            int msgID = MSGID_CONFIG_FILE_MODIFY_REJECTED_BY_COMPONENT;
-            String message = getMessage(msgID, String.valueOf(entryDN),
-                                        String.valueOf(unacceptableReason));
-            throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM,
-                                         message, msgID);
-          }
-        }
-      }
-
-
       // At this point, it looks like the change is acceptable, so apply it.
       // We'll just overwrite the core entry in the current config entry so that
       // we keep all the registered listeners, references to the parent and
@@ -1701,19 +1663,6 @@
                                  currentEntry.getDN(), l.getClass().getName(),
                                  "applyConfigurationChange");
       }
-
-
-      // Notify all the configurable components of the update.
-      if (configurableComponents != null)
-      {
-        for (ConfigurableComponent c : configurableComponents)
-        {
-          handleConfigChangeResult(c.applyNewConfiguration(currentEntry,
-                                          DynamicConstants.DEBUG_BUILD),
-                                   currentEntry.getDN(), c.getClass().getName(),
-                                   "applyNewConfiguration");
-        }
-      }
     }
     finally
     {
diff --git a/opends/src/server/org/opends/server/replication/server/ReplicationServer.java b/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
index b4bf0cf..e8cc35f 100644
--- a/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
+++ b/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
@@ -48,10 +48,8 @@
 import org.opends.server.admin.server.ConfigurationChangeListener;
 import org.opends.server.admin.std.server.MonitorProviderCfg;
 import org.opends.server.admin.std.server.ReplicationServerCfg;
-import org.opends.server.api.ConfigurableComponent;
 import org.opends.server.api.MonitorProvider;
 import org.opends.server.config.ConfigAttribute;
-import org.opends.server.config.ConfigEntry;
 import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.replication.protocol.SocketSession;
@@ -77,8 +75,7 @@
  * It is responsible for creating the replication server cache and managing it
  */
 public class ReplicationServer extends MonitorProvider<MonitorProviderCfg>
-  implements Runnable, ConfigurableComponent,
-             ConfigurationChangeListener<ReplicationServerCfg>
+  implements Runnable, ConfigurationChangeListener<ReplicationServerCfg>
 {
   private short serverId;
   private String serverURL;
@@ -156,42 +153,6 @@
     DirectoryServer.registerMonitorProvider(this);
   }
 
-  /**
-   * {@inheritDoc}
-   */
-  public DN getConfigurableComponentEntryDN()
-  {
-    return configDn;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public List<ConfigAttribute> getConfigurationAttributes()
-  {
-    return configAttributes ;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasAcceptableConfiguration(ConfigEntry configEntry,
-      List<String> unacceptableReasons)
-  {
-    // TODO NYI
-    return true;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public ConfigChangeResult applyNewConfiguration(ConfigEntry configEntry,
-      boolean detailedResults)
-  {
-    // TODO NYI
-    return null;
-  }
-
 
   /**
    * The run method for the Listen thread.
diff --git a/opends/src/server/org/opends/server/types/DirectoryConfig.java b/opends/src/server/org/opends/server/types/DirectoryConfig.java
index da055d5..e2c6c96 100644
--- a/opends/src/server/org/opends/server/types/DirectoryConfig.java
+++ b/opends/src/server/org/opends/server/types/DirectoryConfig.java
@@ -36,7 +36,6 @@
 import org.opends.server.api.AttributeSyntax;
 import org.opends.server.api.ChangeNotificationListener;
 import org.opends.server.api.ConfigHandler;
-import org.opends.server.api.ConfigurableComponent;
 import org.opends.server.api.EqualityMatchingRule;
 import org.opends.server.api.ExtendedOperationHandler;
 import org.opends.server.api.InvokableComponent;
@@ -705,34 +704,6 @@
 
 
   /**
-   * Registers the provided configurable component with the Directory
-   * Server.
-   *
-   * @param  component  The configurable component to register.
-   */
-  public static final void registerConfigurableComponent(
-                                ConfigurableComponent component)
-  {
-    DirectoryServer.registerConfigurableComponent(component);
-  }
-
-
-
-  /**
-   * Deregisters the provided configurable component with the
-   * Directory Server.
-   *
-   * @param  component  The configurable component to deregister.
-   */
-  public static final void deregisterConfigurableComponent(
-                                ConfigurableComponent component)
-  {
-    DirectoryServer.deregisterConfigurableComponent(component);
-  }
-
-
-
-  /**
    * Registers the provided invokable component with the Directory
    * Server.
    *
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/api/ConfigurableComponentTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/api/ConfigurableComponentTestCase.java
deleted file mode 100644
index 0773417..0000000
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/api/ConfigurableComponentTestCase.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * 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 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.api;
-
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-import org.opends.server.TestCaseUtils;
-import org.opends.server.config.ConfigAttribute;
-import org.opends.server.config.ConfigEntry;
-import org.opends.server.config.JMXMBean;
-import org.opends.server.core.DirectoryServer;
-import org.opends.server.types.DN;
-
-import static org.testng.Assert.*;
-
-
-
-/**
- * A set of generic test cases for configurable components.
- */
-public class ConfigurableComponentTestCase
-       extends APITestCase
-{
-  /**
-   * Ensures that the Directory Server is running.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @BeforeClass()
-  public void startServer()
-         throws Exception
-  {
-    TestCaseUtils.startServer();
-  }
-
-
-
-  /**
-   * Retrieves the set of configurable components registered with the server.
-   *
-   * @return  The set of configurable components registered with the server.
-   */
-  @DataProvider(name = "configurableComponents")
-  public Object[][] getConfigurableComponents()
-  {
-    ArrayList<ConfigurableComponent> components =
-         new ArrayList<ConfigurableComponent>();
-    for (JMXMBean b : DirectoryServer.getJMXMBeans().values())
-    {
-      for (ConfigurableComponent c : b.getConfigurableComponents())
-      {
-        components.add(c);
-      }
-    }
-
-    Object[][] componentArray = new Object[components.size()][1];
-    for (int i=0; i < componentArray.length; i++)
-    {
-      componentArray[i] = new Object[] { components.get(i) };
-    }
-
-    return componentArray;
-  }
-
-
-
-  /**
-   * Tests the <CODE>getConfigurableComponentEntryDN</CODE> method.
-   *
-   * @param  c  The configurable component to use in the test.
-   */
-  @Test(dataProvider = "configurableComponents")
-  public void testGetConfigurableComponentEntryDN(ConfigurableComponent c)
-  {
-    assertNotNull(c.getConfigurableComponentEntryDN());
-  }
-
-
-
-  /**
-   * Tests the <CODE>getConfigurationAttributes</CODE> method.
-   *
-   * @param  c  The configurable component to use in the test.
-   */
-  @Test(dataProvider = "configurableComponents")
-  public void testGetConfigurationAttributes(ConfigurableComponent c)
-  {
-    List<ConfigAttribute> attrs = c.getConfigurationAttributes();
-    assertNotNull(attrs);
-  }
-
-
-
-  /**
-   * Tests the <CODE>hasAcceptableConfiguration</CODE> method with the
-   * associated configuration entry.
-   *
-   * @param  c  The configurable component to use in the test.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test(dataProvider = "configurableComponents")
-  public void testHasAcceptableConfiguration(ConfigurableComponent c)
-         throws Exception
-  {
-    DN          configEntryDN = c.getConfigurableComponentEntryDN();
-    ConfigEntry configEntry   = DirectoryServer.getConfigEntry(configEntryDN);
-
-    if (configEntry != null)
-    {
-      ArrayList<String> unacceptableReasons = new ArrayList<String>();
-      assertTrue(c.hasAcceptableConfiguration(configEntry,
-                                              unacceptableReasons));
-    }
-  }
-}
-

--
Gitblit v1.10.0