From 75a473ce00aa65afac08aeef2b76163ab7fa1d20 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 02 Oct 2013 08:44:53 +0000
Subject: [PATCH] ConfigEntry.java: Added toString(), that displays the entry field. Comments => Javadoc.

---
 opendj-sdk/opends/src/server/org/opends/server/config/ConfigEntry.java |   56 ++++++++++++++++++++++++++------------------------------
 1 files changed, 26 insertions(+), 30 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/config/ConfigEntry.java b/opendj-sdk/opends/src/server/org/opends/server/config/ConfigEntry.java
index 2b38b0e..ac6f691 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/config/ConfigEntry.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/config/ConfigEntry.java
@@ -26,11 +26,10 @@
  */
 package org.opends.server.config;
 
-
-
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.CopyOnWriteArrayList;
 
 import org.opends.messages.Message;
@@ -39,21 +38,13 @@
 import org.opends.server.api.ConfigDeleteListener;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.loggers.debug.DebugTracer;
-import org.opends.server.types.Attribute;
-import org.opends.server.types.AttributeBuilder;
-import org.opends.server.types.AttributeType;
-import org.opends.server.types.DN;
-import org.opends.server.types.Entry;
-import org.opends.server.types.ObjectClass;
-import org.opends.server.types.DebugLogLevel;
+import org.opends.server.types.*;
 
 import static org.opends.messages.ConfigMessages.*;
 import static org.opends.server.config.ConfigConstants.*;
 import static org.opends.server.loggers.debug.DebugLogger.*;
 import static org.opends.server.util.StaticUtils.*;
 
-
-
 /**
  * This class defines a configuration entry, which can hold zero or more
  * attributes that may control the configuration of various components of the
@@ -74,25 +65,25 @@
 
 
 
-  // The set of immediate children for this configuration entry.
-  private ConcurrentHashMap<DN,ConfigEntry> children;
+  /** The set of immediate children for this configuration entry. */
+  private final ConcurrentMap<DN,ConfigEntry> children;
 
-  // The immediate parent for this configuration entry.
+  /** The immediate parent for this configuration entry. */
   private ConfigEntry parent;
 
-  // The set of add listeners that have been registered with this entry.
-  private CopyOnWriteArrayList<ConfigAddListener> addListeners;
+  /** The set of add listeners that have been registered with this entry. */
+  private final CopyOnWriteArrayList<ConfigAddListener> addListeners;
 
-  // The set of change listeners that have been registered with this entry.
-  private CopyOnWriteArrayList<ConfigChangeListener> changeListeners;
+  /** The set of change listeners that have been registered with this entry. */
+  private final CopyOnWriteArrayList<ConfigChangeListener> changeListeners;
 
-  // The set of delete listeners that have been registered with this entry.
-  private CopyOnWriteArrayList<ConfigDeleteListener> deleteListeners;
+  /** The set of delete listeners that have been registered with this entry. */
+  private final CopyOnWriteArrayList<ConfigDeleteListener> deleteListeners;
 
-  // The actual entry wrapped by this configuration entry.
+  /** The actual entry wrapped by this configuration entry. */
   private Entry entry;
 
-  // The lock used to provide threadsafe access to this configuration entry.
+  /** The lock used to provide threadsafe access to this configuration entry. */
   private Object entryLock;
 
 
@@ -213,12 +204,11 @@
     }
 
     List<Attribute> attrList = entry.getAttribute(attrType);
-    if ((attrList == null) || (attrList.isEmpty()))
+    if (attrList != null && !attrList.isEmpty())
     {
-      return null;
+      return stub.getConfigAttribute(attrList);
     }
-
-    return stub.getConfigAttribute(attrList);
+    return null;
   }
 
 
@@ -242,7 +232,7 @@
            DirectoryServer.getDefaultAttributeType(name, attribute.getSyntax());
     }
 
-    ArrayList<Attribute> attrs = new ArrayList<Attribute>(2);
+    List<Attribute> attrs = new ArrayList<Attribute>(2);
     AttributeBuilder builder = new AttributeBuilder(attrType, name);
     builder.addAll(attribute.getActiveValues());
     attrs.add(builder.toAttribute());
@@ -315,7 +305,7 @@
    *
    * @return  The set of children associated with this configuration entry.
    */
-  public ConcurrentHashMap<DN,ConfigEntry> getChildren()
+  public ConcurrentMap<DN, ConfigEntry> getChildren()
   {
     return children;
   }
@@ -330,7 +320,7 @@
    */
   public boolean hasChildren()
   {
-    return (! children.isEmpty());
+    return !children.isEmpty();
   }
 
 
@@ -568,5 +558,11 @@
   {
     deleteListeners.remove(listener);
   }
-}
 
+  /** {@inheritDoc} */
+  @Override
+  public String toString()
+  {
+    return entry.toString();
+  }
+}

--
Gitblit v1.10.0