From 9b88d8643e4f7a311d2b228d2bce5c043bba82b5 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Fri, 31 Aug 2007 22:49:33 +0000
Subject: [PATCH] Create configuration definitions for "generic" objects in the server configuration.  This also includes allocating object classes for each of these types.  This will help make it easier for users to create new instances of these kinds of configuration objects because they will not need to know the fully-qualified name of the Java class that implements the associated logic.

---
 opends/src/server/org/opends/server/plugins/LDAPADListPlugin.java |   45 +++++++++++++++++++++++++++++++++++----------
 1 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/opends/src/server/org/opends/server/plugins/LDAPADListPlugin.java b/opends/src/server/org/opends/server/plugins/LDAPADListPlugin.java
index 9664fdf..40821ed 100644
--- a/opends/src/server/org/opends/server/plugins/LDAPADListPlugin.java
+++ b/opends/src/server/org/opends/server/plugins/LDAPADListPlugin.java
@@ -25,15 +25,16 @@
  *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
  */
 package org.opends.server.plugins;
-import org.opends.messages.Message;
 
 
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
 
+import org.opends.messages.Message;
 import org.opends.server.admin.server.ConfigurationChangeListener;
 import org.opends.server.admin.std.meta.PluginCfgDefn;
+import org.opends.server.admin.std.server.LDAPAttributeDescriptionListPluginCfg;
 import org.opends.server.admin.std.server.PluginCfg;
 import org.opends.server.api.plugin.DirectoryServerPlugin;
 import org.opends.server.api.plugin.PluginType;
@@ -62,14 +63,22 @@
  * object class identifier from an attribute descriptions.
  */
 public final class LDAPADListPlugin
-       extends DirectoryServerPlugin<PluginCfg>
-       implements ConfigurationChangeListener<PluginCfg>
+       extends DirectoryServerPlugin<LDAPAttributeDescriptionListPluginCfg>
+       implements ConfigurationChangeListener<
+                       LDAPAttributeDescriptionListPluginCfg>
 {
   /**
    * The tracer object for the debug logger.
    */
   private static final DebugTracer TRACER = getTracer();
 
+
+
+  // The current configuration for this plugin.
+  private LDAPAttributeDescriptionListPluginCfg currentConfig;
+
+
+
   /**
    * Creates a new instance of this Directory Server plugin.  Every plugin must
    * implement a default constructor (it is the only one that will be used to
@@ -79,7 +88,6 @@
   public LDAPADListPlugin()
   {
     super();
-
   }
 
 
@@ -89,10 +97,11 @@
    */
   @Override()
   public final void initializePlugin(Set<PluginType> pluginTypes,
-                                     PluginCfg configuration)
+                         LDAPAttributeDescriptionListPluginCfg configuration)
          throws ConfigException
   {
-    configuration.addChangeListener(this);
+    currentConfig = configuration;
+    configuration.addLDAPAttributeDescriptionListChangeListener(this);
 
     // The set of plugin types must contain only the pre-parse search element.
     if (pluginTypes.isEmpty())
@@ -125,6 +134,17 @@
    * {@inheritDoc}
    */
   @Override()
+  public final void finalizePlugin()
+  {
+    currentConfig.removeLDAPAttributeDescriptionListChangeListener(this);
+  }
+
+
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override()
   public final PreParsePluginResult
        doPreParse(PreParseSearchOperation searchOperation)
   {
@@ -199,7 +219,9 @@
   public boolean isConfigurationAcceptable(PluginCfg configuration,
                                            List<Message> unacceptableReasons)
   {
-    return isConfigurationChangeAcceptable(configuration, unacceptableReasons);
+    LDAPAttributeDescriptionListPluginCfg cfg =
+         (LDAPAttributeDescriptionListPluginCfg) configuration;
+    return isConfigurationChangeAcceptable(cfg, unacceptableReasons);
   }
 
 
@@ -207,7 +229,8 @@
   /**
    * {@inheritDoc}
    */
-  public boolean isConfigurationChangeAcceptable(PluginCfg configuration,
+  public boolean isConfigurationChangeAcceptable(
+                      LDAPAttributeDescriptionListPluginCfg configuration,
                       List<Message> unacceptableReasons)
   {
     boolean configAcceptable = true;
@@ -239,9 +262,11 @@
   /**
    * {@inheritDoc}
    */
-  public ConfigChangeResult applyConfigurationChange(PluginCfg configuration)
+  public ConfigChangeResult applyConfigurationChange(
+                                 LDAPAttributeDescriptionListPluginCfg
+                                      configuration)
   {
-    // No implementation is required.
+    currentConfig = configuration;
     return new ConfigChangeResult(ResultCode.SUCCESS, false);
   }
 }

--
Gitblit v1.10.0