| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.config; |
| | | |
| | |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeValue; |
| | | |
| | | import static org.opends.server.loggers.Debug.*; |
| | | import static org.opends.server.messages.ConfigMessages.*; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | | |
| | |
| | | */ |
| | | public abstract class ConfigAttribute |
| | | { |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.config.ConfigAttribute"; |
| | | |
| | | |
| | | |
| | |
| | | protected ConfigAttribute(String name, String description, boolean isRequired, |
| | | boolean isMultiValued, boolean requiresAdminAction) |
| | | { |
| | | assert debugConstructor(CLASS_NAME, String.valueOf(name), |
| | | String.valueOf(description), |
| | | String.valueOf(isRequired), |
| | | String.valueOf(isMultiValued), |
| | | String.valueOf(requiresAdminAction)); |
| | | |
| | | |
| | | this.name = name; |
| | |
| | | boolean isMultiValued, boolean requiresAdminAction, |
| | | LinkedHashSet<AttributeValue> activeValues) |
| | | { |
| | | assert debugConstructor(CLASS_NAME, |
| | | new String[] |
| | | { |
| | | String.valueOf(name), |
| | | String.valueOf(description), |
| | | String.valueOf(isRequired), |
| | | String.valueOf(isMultiValued), |
| | | String.valueOf(requiresAdminAction), |
| | | String.valueOf(activeValues) |
| | | }); |
| | | |
| | | |
| | | this.name = name; |
| | |
| | | boolean hasPendingValues, |
| | | LinkedHashSet<AttributeValue> pendingValues) |
| | | { |
| | | assert debugConstructor(CLASS_NAME, |
| | | new String[] |
| | | { |
| | | String.valueOf(name), |
| | | String.valueOf(description), |
| | | String.valueOf(isRequired), |
| | | String.valueOf(isMultiValued), |
| | | String.valueOf(requiresAdminAction), |
| | | String.valueOf(activeValues), |
| | | String.valueOf(hasPendingValues), |
| | | String.valueOf(pendingValues) |
| | | }); |
| | | |
| | | |
| | | this.name = name; |
| | |
| | | */ |
| | | public String getName() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getName"); |
| | | |
| | | return name; |
| | | } |
| | |
| | | */ |
| | | public String getDescription() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getDescription"); |
| | | |
| | | return description; |
| | | } |
| | |
| | | */ |
| | | public boolean isRequired() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "isRequired"); |
| | | |
| | | return isRequired; |
| | | } |
| | |
| | | */ |
| | | public boolean isMultiValued() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "isMultiValued"); |
| | | |
| | | return isMultiValued; |
| | | } |
| | |
| | | */ |
| | | public boolean requiresAdminAction() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "requiresAdminAction"); |
| | | |
| | | return requiresAdminAction; |
| | | } |
| | |
| | | */ |
| | | public LinkedHashSet<AttributeValue> getActiveValues() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getActiveValues"); |
| | | |
| | | return activeValues; |
| | | } |
| | |
| | | */ |
| | | public boolean hasPendingValues() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "hasPendingValues"); |
| | | |
| | | return hasPendingValues; |
| | | } |
| | |
| | | */ |
| | | public LinkedHashSet<AttributeValue> getPendingValues() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getPendingValues"); |
| | | |
| | | if (requiresAdminAction) |
| | | { |
| | |
| | | protected void setValues(LinkedHashSet<AttributeValue> values) |
| | | throws ConfigException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "setValues", String.valueOf(values)); |
| | | |
| | | |
| | | // If no values are provided, then check to see if this is a required |
| | |
| | | */ |
| | | protected void setActiveValues(LinkedHashSet<AttributeValue> values) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "setActiveValues", |
| | | String.valueOf(values)); |
| | | |
| | | activeValues = values; |
| | | } |
| | |
| | | */ |
| | | protected void setPendingValues(LinkedHashSet<AttributeValue> values) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "setPendingValues", |
| | | String.valueOf(values)); |
| | | |
| | | pendingValues = values; |
| | | hasPendingValues = true; |
| | |
| | | protected void addValues(List<AttributeValue> values) |
| | | throws ConfigException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "addValues", String.valueOf(values)); |
| | | |
| | | |
| | | // If there are no values provided, then do nothing. |
| | |
| | | protected void removeValues(List<AttributeValue> values) |
| | | throws ConfigException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "removeValues", String.valueOf(values)); |
| | | |
| | | |
| | | // Create a temporary set of values that we will use for this change. It |
| | |
| | | protected void removeAllValues() |
| | | throws ConfigException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "removeAllValues"); |
| | | |
| | | if (isRequired) |
| | | { |
| | |
| | | */ |
| | | public void setInitialValues(LinkedHashSet<AttributeValue> values) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "setInitialValues"); |
| | | |
| | | if (values == null) |
| | | { |
| | |
| | | */ |
| | | public void applyPendingValues() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "applyPendingValues"); |
| | | |
| | | if (hasPendingValues) |
| | | { |