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

boli
01.27.2007 455897cc245b67d929f409a93cfa7106e835cc1f
opends/src/server/org/opends/server/config/DNConfigAttribute.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 */
package org.opends.server.config;
@@ -44,10 +44,12 @@
import org.opends.server.types.DN;
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
import org.opends.server.types.DebugLogLevel;
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.loggers.Debug.*;
import static org.opends.server.loggers.Error.*;
import static org.opends.server.loggers.debug.DebugLogger.debugCought;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.ServerConstants.*;
@@ -61,11 +63,6 @@
public class DNConfigAttribute
       extends ConfigAttribute
{
  /**
   * The fully-qualified name of this class for debugging purposes.
   */
  private static final String CLASS_NAME =
       "org.opends.server.config.DNConfigAttribute";
@@ -98,11 +95,6 @@
  {
    super(name, description, isRequired, isMultiValued, requiresAdminAction);
    assert debugConstructor(CLASS_NAME, String.valueOf(name),
                            String.valueOf(isRequired),
                            String.valueOf(isMultiValued),
                            String.valueOf(description),
                            String.valueOf(requiresAdminAction));
    activeValues  = new ArrayList<DN>();
    pendingValues = activeValues;
@@ -133,16 +125,6 @@
    super(name, description, isRequired, isMultiValued, requiresAdminAction,
          getValueSet(value));
    assert debugConstructor(CLASS_NAME,
                            new String[]
                            {
                              String.valueOf(name),
                              String.valueOf(isRequired),
                              String.valueOf(isMultiValued),
                              String.valueOf(description),
                              String.valueOf(requiresAdminAction),
                              String.valueOf(value)
                            });
    if (value == null)
    {
@@ -183,16 +165,6 @@
    super(name, description, isRequired, isMultiValued, requiresAdminAction,
          getValueSet(values));
    assert debugConstructor(CLASS_NAME,
                            new String[]
                            {
                              String.valueOf(name),
                              String.valueOf(isRequired),
                              String.valueOf(isMultiValued),
                              String.valueOf(description),
                              String.valueOf(requiresAdminAction),
                              String.valueOf(values)
                            });
    if (values == null)
    {
@@ -235,17 +207,6 @@
          getValueSet(activeValues), (pendingValues != null),
          getValueSet(pendingValues));
    assert debugConstructor(CLASS_NAME,
                            new String[]
                            {
                              String.valueOf(name),
                              String.valueOf(isRequired),
                              String.valueOf(isMultiValued),
                              String.valueOf(description),
                              String.valueOf(requiresAdminAction),
                              String.valueOf(activeValues),
                              String.valueOf(pendingValues)
                            });
    if (activeValues == null)
    {
@@ -278,7 +239,6 @@
   */
  public String getDataType()
  {
    assert debugEnter(CLASS_NAME, "getDataType");
    return "DN";
  }
@@ -292,7 +252,6 @@
   */
  public AttributeSyntax getSyntax()
  {
    assert debugEnter(CLASS_NAME,"getSyntax");
    return DirectoryServer.getDefaultStringSyntax();
  }
@@ -311,7 +270,6 @@
  public DN activeValue()
         throws ConfigException
  {
    assert debugEnter(CLASS_NAME, "activeValue");
    if ((activeValues == null) || activeValues.isEmpty())
    {
@@ -339,7 +297,6 @@
   */
  public List<DN> activeValues()
  {
    assert debugEnter(CLASS_NAME, "activeValues");
    return activeValues;
  }
@@ -360,7 +317,6 @@
  public DN pendingValue()
         throws ConfigException
  {
    assert debugEnter(CLASS_NAME, "pendingValue");
    if (! hasPendingValues())
    {
@@ -395,7 +351,6 @@
   */
  public List<DN> pendingValues()
  {
    assert debugEnter(CLASS_NAME, "pendingValues");
    if (! hasPendingValues())
    {
@@ -417,7 +372,6 @@
  public void setValue(DN value)
         throws ConfigException
  {
    assert debugEnter(CLASS_NAME, "setValue", String.valueOf(value));
    if (value == null)
    {
@@ -454,7 +408,6 @@
  public void setValues(List<DN> values)
         throws ConfigException
  {
    assert debugEnter(CLASS_NAME, "setValues", String.valueOf(values));
    // First check if the set is empty and if that is allowed.
@@ -545,7 +498,6 @@
   */
  private static LinkedHashSet<AttributeValue> getValueSet(DN value)
  {
    assert debugEnter(CLASS_NAME, "getValueSet", String.valueOf(value));
    LinkedHashSet<AttributeValue> valueSet;
    if (value == null)
@@ -573,7 +525,6 @@
   */
  private static LinkedHashSet<AttributeValue> getValueSet(List<DN> values)
  {
    assert debugEnter(CLASS_NAME, "getValueSet", String.valueOf(values));
    if (values == null)
    {
@@ -601,7 +552,6 @@
   */
  public void applyPendingValues()
  {
    assert debugEnter(CLASS_NAME, "applyPendingValues");
    if (! hasPendingValues())
    {
@@ -629,8 +579,6 @@
  public boolean valueIsAcceptable(AttributeValue value,
                                   StringBuilder rejectReason)
  {
    assert debugEnter(CLASS_NAME, "valueIsAcceptable", String.valueOf(value),
                      "java.lang.StringBuilder");
    // Make sure that the value is not null.
@@ -648,7 +596,10 @@
    }
    catch (Exception e)
    {
      assert debugException(CLASS_NAME, "valueIsAcceptable", e);
      if (debugEnabled())
      {
        debugCought(DebugLogLevel.ERROR, e);
      }
      rejectReason.append(getMessage(MSGID_CONFIG_ATTR_DN_CANNOT_PARSE,
                                     value.getStringValue(), getName(),
@@ -686,9 +637,6 @@
                              boolean allowFailures)
         throws ConfigException
  {
    assert debugEnter(CLASS_NAME, "stringsToValues",
                      String.valueOf(valueStrings),
                      String.valueOf(allowFailures));
    if ((valueStrings == null) || valueStrings.isEmpty())
    {
@@ -743,7 +691,10 @@
      }
      catch (Exception e)
      {
        assert debugException(CLASS_NAME, "stringsToValues", e);
        if (debugEnabled())
        {
          debugCought(DebugLogLevel.ERROR, e);
        }
        int    msgID   = MSGID_CONFIG_ATTR_DN_CANNOT_PARSE;
        String message = getMessage(msgID, valueString, getName(),
@@ -795,7 +746,6 @@
   */
  public List<String> activeValuesToStrings()
  {
    assert debugEnter(CLASS_NAME, "activeValuesToStrings");
    ArrayList<String> valueStrings = new ArrayList<String>(activeValues.size());
    for (DN dn : activeValues)
@@ -821,7 +771,6 @@
   */
  public List<String> pendingValuesToStrings()
  {
    assert debugEnter(CLASS_NAME, "pendingValuesToStrings");
    if (hasPendingValues())
    {
@@ -866,8 +815,6 @@
  public ConfigAttribute getConfigAttribute(List<Attribute> attributeList)
         throws ConfigException
  {
    assert debugEnter(CLASS_NAME, "getConfigAttribute",
                      String.valueOf(attributeList));
    ArrayList<DN> activeValues  = null;
@@ -926,7 +873,10 @@
              }
              catch (Exception e)
              {
                assert debugException(CLASS_NAME, "getConfigAttribute", e);
                if (debugEnabled())
                {
                  debugCought(DebugLogLevel.ERROR, e);
                }
                int msgID = MSGID_CONFIG_ATTR_DN_CANNOT_PARSE;
                String message = getMessage(msgID, v.getStringValue(),
@@ -996,7 +946,10 @@
            }
            catch (Exception e)
            {
              assert debugException(CLASS_NAME, "getConfigAttribute", e);
              if (debugEnabled())
              {
                debugCought(DebugLogLevel.ERROR, e);
              }
              int msgID = MSGID_CONFIG_ATTR_DN_CANNOT_PARSE;
              String message = getMessage(msgID, v.getStringValue(), getName(),
@@ -1043,7 +996,6 @@
   */
  private javax.management.Attribute _toJMXAttribute(boolean pending)
  {
    assert debugEnter(CLASS_NAME, "_toJMXAttribute");
    List<DN> requestedValues ;
    String name ;
@@ -1120,8 +1072,6 @@
   */
  public void toJMXAttribute(AttributeList attributeList)
  {
    assert debugEnter(CLASS_NAME, "toJMXAttribute",
                      String.valueOf(attributeList));
    if (activeValues.size() > 0)
    {
@@ -1194,8 +1144,6 @@
   */
  public void toJMXAttributeInfo(List<MBeanAttributeInfo> attributeInfoList)
  {
    assert debugEnter(CLASS_NAME, "toJMXAttributeInfo",
                      String.valueOf(attributeInfoList));
    if (isMultiValued())
@@ -1246,7 +1194,6 @@
   */
  public MBeanParameterInfo toJMXParameterInfo()
  {
    assert debugEnter(CLASS_NAME, "toJMXParameterInfo");
    if (isMultiValued())
    {
@@ -1276,7 +1223,6 @@
  public void setValue(javax.management.Attribute jmxAttribute)
         throws ConfigException
  {
    assert debugEnter(CLASS_NAME, "setValue", String.valueOf(jmxAttribute));
    Object value = jmxAttribute.getValue();
    if (value == null)
@@ -1298,7 +1244,10 @@
      }
      catch (Exception e)
      {
        assert debugException(CLASS_NAME, "setValue", e);
        if (debugEnabled())
        {
          debugCought(DebugLogLevel.ERROR, e);
        }
        int    msgID   = MSGID_CONFIG_ATTR_DN_CANNOT_PARSE;
        String message = getMessage(msgID, (String) value, getName(),
@@ -1340,7 +1289,10 @@
            }
            catch (Exception e)
            {
              assert debugException(CLASS_NAME, "setValue", e);
              if (debugEnabled())
              {
                debugCought(DebugLogLevel.ERROR, e);
              }
              int    msgID   = MSGID_CONFIG_ATTR_DN_CANNOT_PARSE;
              String message = getMessage(msgID, valueStr, getName(),
@@ -1355,13 +1307,19 @@
        }
        catch (ConfigException ce)
        {
          assert debugException(CLASS_NAME, "setValue", ce);
          if (debugEnabled())
          {
            debugCought(DebugLogLevel.ERROR, ce);
          }
          throw ce;
        }
        catch (Exception e)
        {
          assert debugException(CLASS_NAME, "setValue", e);
          if (debugEnabled())
          {
            debugCought(DebugLogLevel.ERROR, e);
          }
          int msgID = MSGID_CONFIG_ATTR_INVALID_DN_VALUE;
          String message = getMessage(msgID, getName(), String.valueOf(value),
@@ -1394,7 +1352,6 @@
   */
  public ConfigAttribute duplicate()
  {
    assert debugEnter(CLASS_NAME, "duplicate");
    return new DNConfigAttribute(getName(), getDescription(), isRequired(),
                                 isMultiValued(), requiresAdminAction(),