org.opends.server.config
Class IntegerConfigAttribute

java.lang.Object
  extended by org.opends.server.config.ConfigAttribute
      extended by org.opends.server.config.IntegerConfigAttribute

@PublicAPI(stability=VOLATILE,
           mayInstantiate=true,
           mayExtend=false,
           mayInvoke=true)
public final class IntegerConfigAttribute
extends ConfigAttribute

This class defines an integer configuration attribute, which can hold zero or more integer values. For scalability, the actual values will be stored as long elements, although it will be possible to interact with them as integers in cases where that scalability is not required.


Constructor Summary
IntegerConfigAttribute(java.lang.String name, Message description, boolean isRequired, boolean isMultiValued, boolean requiresAdminAction, boolean hasLowerBound, long lowerBound, boolean hasUpperBound, long upperBound)
          Creates a new integer configuration attribute stub with the provided information but no values.
IntegerConfigAttribute(java.lang.String name, Message description, boolean isRequired, boolean isMultiValued, boolean requiresAdminAction, boolean hasLowerBound, long lowerBound, boolean hasUpperBound, long upperBound, java.util.List<java.lang.Long> values)
          Creates a new integer configuration attribute with the provided information.
IntegerConfigAttribute(java.lang.String name, Message description, boolean isRequired, boolean isMultiValued, boolean requiresAdminAction, boolean hasLowerBound, long lowerBound, boolean hasUpperBound, long upperBound, java.util.List<java.lang.Long> activeValues, java.util.List<java.lang.Long> pendingValues)
          Creates a new integer configuration attribute with the provided information.
IntegerConfigAttribute(java.lang.String name, Message description, boolean isRequired, boolean isMultiValued, boolean requiresAdminAction, boolean hasLowerBound, long lowerBound, boolean hasUpperBound, long upperBound, long value)
          Creates a new integer configuration attribute with the provided information.
 
Method Summary
 int activeIntValue()
          Retrieves the active value for this configuration attribute as an integer.
 long activeValue()
          Retrieves the active value for this configuration attribute as a long.
 java.util.List<java.lang.Long> activeValues()
          Retrieves the set of active values for this configuration attribute.
 java.util.List<java.lang.String> activeValuesToStrings()
          Converts the set of active values for this configuration attribute into a set of strings that may be stored in the configuration or represented over protocol.
 void applyPendingValues()
          Applies the set of pending values, making them the active values for this configuration attribute.
 ConfigAttribute duplicate()
          Creates a duplicate of this configuration attribute.
 ConfigAttribute getConfigAttribute(java.util.List<Attribute> attributeList)
          Retrieves a new configuration attribute of this type that will contain the values from the provided attribute.
 java.lang.String getDataType()
          Retrieves the name of the data type for this configuration attribute.
 long getLowerBound()
          Retrieves the lower bound for the value of this configuration attribute.
 AttributeSyntax getSyntax()
          Retrieves the attribute syntax for this configuration attribute.
 long getUpperBound()
          Retrieves the upper bound for the calculated value of this configuration attribute.
 boolean hasLowerBound()
          Indicates whether a lower bound will be enforced for the value of this configuration attribute.
 boolean hasUpperBound()
          Indicates whether an upper bound will be enforced for the calculated value of this configuration attribute.
 int pendingIntValue()
          Retrieves the pending value for this configuration attribute as an integer.
 long pendingValue()
          Retrieves the pending value for this configuration attribute as a long.
 java.util.List<java.lang.Long> pendingValues()
          Retrieves the set of pending values for this configuration attribute.
 java.util.List<java.lang.String> pendingValuesToStrings()
          Converts the set of pending values for this configuration attribute into a set of strings that may be stored in the configuration or represented over protocol.
 void setValue(javax.management.Attribute jmxAttribute)
          Attempts to set the value of this configuration attribute based on the information in the provided JMX attribute.
 void setValue(long value)
          Sets the value for this integer configuration attribute.
 void setValues(java.util.List<java.lang.Long> values)
          Sets the values for this integer configuration attribute.
 java.util.LinkedHashSet<AttributeValue> stringsToValues(java.util.List<java.lang.String> valueStrings, boolean allowFailures)
          Converts the provided set of strings to a corresponding set of attribute values.
 javax.management.Attribute toJMXAttribute()
          Retrieves a JMX attribute containing the active value set for this configuration attribute.
 void toJMXAttribute(javax.management.AttributeList attributeList)
          Adds information about this configuration attribute to the provided JMX attribute list.
 void toJMXAttributeInfo(java.util.List<javax.management.MBeanAttributeInfo> attributeInfoList)
          Adds information about this configuration attribute to the provided list in the form of a JMX MBeanAttributeInfo object.
 javax.management.Attribute toJMXAttributePending()
          Retrieves a JMX attribute containing the pending value set for this configuration attribute.
 javax.management.MBeanParameterInfo toJMXParameterInfo()
          Retrieves a JMX MBeanParameterInfo object that describes this configuration attribute.
 boolean valueIsAcceptable(AttributeValue value, java.lang.StringBuilder rejectReason)
          Indicates whether the provided value is acceptable for use in this attribute.
 
Methods inherited from class org.opends.server.config.ConfigAttribute
addValues, getActiveValues, getDescription, getName, getPendingValues, hasPendingValues, isMultiValued, isRequired, removeAllValues, removeValues, requiresAdminAction, setActiveValues, setInitialValues, setPendingValues, setValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntegerConfigAttribute

public IntegerConfigAttribute(java.lang.String name,
                              Message description,
                              boolean isRequired,
                              boolean isMultiValued,
                              boolean requiresAdminAction,
                              boolean hasLowerBound,
                              long lowerBound,
                              boolean hasUpperBound,
                              long upperBound)
Creates a new integer configuration attribute stub with the provided information but no values. The values will be set using the setInitialValue method.

Parameters:
name - The name for this configuration attribute.
description - The description for this configuration attribute.
isRequired - Indicates whether this configuration attribute is required to have at least one value.
isMultiValued - Indicates whether this configuration attribute may have multiple values.
requiresAdminAction - Indicates whether changes to this configuration attribute require administrative action before they will take effect.
hasLowerBound - Indicates whether a lower bound will be enforced for values of this attribute.
lowerBound - The lower bound that will be enforced for values of this attribute.
hasUpperBound - Indicates whether an upper bound will be enforced for values of this attribute.
upperBound - The upper bound that will be enforced for values of this attribute.

IntegerConfigAttribute

public IntegerConfigAttribute(java.lang.String name,
                              Message description,
                              boolean isRequired,
                              boolean isMultiValued,
                              boolean requiresAdminAction,
                              boolean hasLowerBound,
                              long lowerBound,
                              boolean hasUpperBound,
                              long upperBound,
                              long value)
Creates a new integer configuration attribute with the provided information. No validation will be performed on the provided value.

Parameters:
name - The name for this configuration attribute.
description - The description for this configuration attribute.
isRequired - Indicates whether this configuration attribute is required to have at least one value.
isMultiValued - Indicates whether this configuration attribute may have multiple values.
requiresAdminAction - Indicates whether changes to this configuration attribute require administrative action before they will take effect.
hasLowerBound - Indicates whether a lower bound will be enforced for values of this attribute.
lowerBound - The lower bound that will be enforced for values of this attribute.
hasUpperBound - Indicates whether an upper bound will be enforced for values of this attribute.
upperBound - The upper bound that will be enforced for values of this attribute.
value - The value for this integer configuration attribute.

IntegerConfigAttribute

public IntegerConfigAttribute(java.lang.String name,
                              Message description,
                              boolean isRequired,
                              boolean isMultiValued,
                              boolean requiresAdminAction,
                              boolean hasLowerBound,
                              long lowerBound,
                              boolean hasUpperBound,
                              long upperBound,
                              java.util.List<java.lang.Long> values)
Creates a new integer configuration attribute with the provided information. No validation will be performed on the provided values.

Parameters:
name - The name for this configuration attribute.
description - The description for this configuration attribute.
isRequired - Indicates whether this configuration attribute is required to have at least one value.
isMultiValued - Indicates whether this configuration attribute may have multiple values.
requiresAdminAction - Indicates whether changes to this configuration attribute require administrative action before they will take effect.
hasLowerBound - Indicates whether a lower bound will be enforced for values of this attribute.
lowerBound - The lower bound that will be enforced for values of this attribute.
hasUpperBound - Indicates whether an upper bound will be enforced for values of this attribute.
upperBound - The upper bound that will be enforced for values of this attribute.
values - The set of values for this configuration attribute.

IntegerConfigAttribute

public IntegerConfigAttribute(java.lang.String name,
                              Message description,
                              boolean isRequired,
                              boolean isMultiValued,
                              boolean requiresAdminAction,
                              boolean hasLowerBound,
                              long lowerBound,
                              boolean hasUpperBound,
                              long upperBound,
                              java.util.List<java.lang.Long> activeValues,
                              java.util.List<java.lang.Long> pendingValues)
Creates a new integer configuration attribute with the provided information. No validation will be performed on the provided values.

Parameters:
name - The name for this configuration attribute.
description - The description for this configuration attribute.
isRequired - Indicates whether this configuration attribute is required to have at least one value.
isMultiValued - Indicates whether this configuration attribute may have multiple values.
requiresAdminAction - Indicates whether changes to this configuration attribute require administrative action before they will take effect.
hasLowerBound - Indicates whether a lower bound will be enforced for values of this attribute.
lowerBound - The lower bound that will be enforced for values of this attribute.
hasUpperBound - Indicates whether an upper bound will be enforced for values of this attribute.
upperBound - The upper bound that will be enforced for values of this attribute.
activeValues - The set of active values for this configuration attribute.
pendingValues - The set of pending values for this configuration attribute.
Method Detail

getDataType

public java.lang.String getDataType()
Retrieves the name of the data type for this configuration attribute. This is for informational purposes (e.g., inclusion in method signatures and other kinds of descriptions) and does not necessarily need to map to an actual Java type.

Specified by:
getDataType in class ConfigAttribute
Returns:
The name of the data type for this configuration attribute.

getSyntax

public AttributeSyntax getSyntax()
Retrieves the attribute syntax for this configuration attribute.

Specified by:
getSyntax in class ConfigAttribute
Returns:
The attribute syntax for this configuration attribute.

activeValue

public long activeValue()
                 throws ConfigException
Retrieves the active value for this configuration attribute as a long. This is only valid for single-valued attributes that have a value.

Returns:
The active value for this configuration attribute as a long.
Throws:
ConfigException - If this attribute does not have exactly one active value.

activeIntValue

public int activeIntValue()
                   throws ConfigException
Retrieves the active value for this configuration attribute as an integer. This is only valid for single-valued attributes that have a value within the integer range.

Returns:
The active value for this configuration attribute as an integer.
Throws:
ConfigException - If the active value of this attribute cannot be retrieved as an integer, including if there are no values, if there are multiple values, or if the value is not in the range of an integer.

activeValues

public java.util.List<java.lang.Long> activeValues()
Retrieves the set of active values for this configuration attribute.

Returns:
The set of active values for this configuration attribute.

pendingValue

public long pendingValue()
                  throws ConfigException
Retrieves the pending value for this configuration attribute as a long. This is only valid for single-valued attributes that have a value. If this attribute does not have any pending values, then the active value will be returned.

Returns:
The pending value for this configuration attribute as a long.
Throws:
ConfigException - If this attribute does not have exactly one pending value.

pendingIntValue

public int pendingIntValue()
                    throws ConfigException
Retrieves the pending value for this configuration attribute as an integer. This is only valid for single-valued attributes that have a value within the integer range. If this attribute does not have any pending values, then t he active value will be returned.

Returns:
The pending value for this configuration attribute as an integer.
Throws:
ConfigException - If the pending value of this attribute cannot be retrieved as an integer, including if there are no values, if there are multiple values, or if the value is not in the range of an integer.

pendingValues

public java.util.List<java.lang.Long> pendingValues()
Retrieves the set of pending values for this configuration attribute. If there are no pending values, then the set of active values will be returned.

Returns:
The set of pending values for this configuration attribute.

hasLowerBound

public boolean hasLowerBound()
Indicates whether a lower bound will be enforced for the value of this configuration attribute.

Returns:
true if a lower bound will be enforced for the value of this configuration attribute, or false if not.

getLowerBound

public long getLowerBound()
Retrieves the lower bound for the value of this configuration attribute.

Returns:
The lower bound for the value of this configuration attribute.

hasUpperBound

public boolean hasUpperBound()
Indicates whether an upper bound will be enforced for the calculated value of this configuration attribute.

Returns:
true if an upper bound will be enforced for the calculated value of this configuration attribute, or false if not.

getUpperBound

public long getUpperBound()
Retrieves the upper bound for the calculated value of this configuration attribute.

Returns:
The upper bound for the calculated value of this configuration attribute.

setValue

public void setValue(long value)
              throws ConfigException
Sets the value for this integer configuration attribute.

Parameters:
value - The value for this integer configuration attribute.
Throws:
ConfigException - If the provided value is not acceptable.

setValues

public void setValues(java.util.List<java.lang.Long> values)
               throws ConfigException
Sets the values for this integer configuration attribute.

Parameters:
values - The set of values for this integer configuration attribute.
Throws:
ConfigException - If the provided value set or any of the individual values are not acceptable.

applyPendingValues

public void applyPendingValues()
Applies the set of pending values, making them the active values for this configuration attribute. This will not take any action if there are no pending values.

Overrides:
applyPendingValues in class ConfigAttribute

valueIsAcceptable

public boolean valueIsAcceptable(AttributeValue value,
                                 java.lang.StringBuilder rejectReason)
Indicates whether the provided value is acceptable for use in this attribute. If it is not acceptable, then the reason should be written into the provided buffer.

Specified by:
valueIsAcceptable in class ConfigAttribute
Parameters:
value - The value for which to make the determination.
rejectReason - A buffer into which a human-readable reason for the reject may be written.
Returns:
true if the provided value is acceptable for use in this attribute, or false if not.

stringsToValues

public java.util.LinkedHashSet<AttributeValue> stringsToValues(java.util.List<java.lang.String> valueStrings,
                                                               boolean allowFailures)
                                                        throws ConfigException
Converts the provided set of strings to a corresponding set of attribute values.

Specified by:
stringsToValues in class ConfigAttribute
Parameters:
valueStrings - The set of strings to be converted into attribute values.
allowFailures - Indicates whether the decoding process should allow any failures in which one or more values could be decoded but at least one could not. If this is true and such a condition is acceptable for the underlying attribute type, then the returned set of values should simply not include those undecodable values.
Returns:
The set of attribute values converted from the provided strings.
Throws:
ConfigException - If an unrecoverable problem occurs while performing the conversion.

activeValuesToStrings

public java.util.List<java.lang.String> activeValuesToStrings()
Converts the set of active values for this configuration attribute into a set of strings that may be stored in the configuration or represented over protocol. The string representation used by this method should be compatible with the decoding used by the stringsToValues method.

Specified by:
activeValuesToStrings in class ConfigAttribute
Returns:
The string representations of the set of active values for this configuration attribute.

pendingValuesToStrings

public java.util.List<java.lang.String> pendingValuesToStrings()
Converts the set of pending values for this configuration attribute into a set of strings that may be stored in the configuration or represented over protocol. The string representation used by this method should be compatible with the decoding used by the stringsToValues method.

Specified by:
pendingValuesToStrings in class ConfigAttribute
Returns:
The string representations of the set of pending values for this configuration attribute, or null if there are no pending values.

getConfigAttribute

public ConfigAttribute getConfigAttribute(java.util.List<Attribute> attributeList)
                                   throws ConfigException
Retrieves a new configuration attribute of this type that will contain the values from the provided attribute.

Specified by:
getConfigAttribute in class ConfigAttribute
Parameters:
attributeList - The list of attributes to use to create the config attribute. The list must contain either one or two elements, with both attributes having the same base name and the only option allowed is ";pending" and only if this attribute is one that requires admin action before a change may take effect.
Returns:
The generated configuration attribute.
Throws:
ConfigException - If the provided attribute cannot be treated as a configuration attribute of this type (e.g., if one or more of the values of the provided attribute are not suitable for an attribute of this type, or if this configuration attribute is single-valued and the provided attribute has multiple values).

toJMXAttribute

public javax.management.Attribute toJMXAttribute()
Retrieves a JMX attribute containing the active value set for this configuration attribute.

Specified by:
toJMXAttribute in class ConfigAttribute
Returns:
A JMX attribute containing the active value set for this configuration attribute, or null if it does not have any active values.

toJMXAttributePending

public javax.management.Attribute toJMXAttributePending()
Retrieves a JMX attribute containing the pending value set for this configuration attribute.

Specified by:
toJMXAttributePending in class ConfigAttribute
Returns:
A JMX attribute containing the pending value set for this configuration attribute.

toJMXAttribute

public void toJMXAttribute(javax.management.AttributeList attributeList)
Adds information about this configuration attribute to the provided JMX attribute list. If this configuration attribute requires administrative action before changes take effect and it has a set of pending values, then two attributes should be added to the list -- one for the active value and one for the pending value. The pending value should be named with the pending option.

Specified by:
toJMXAttribute in class ConfigAttribute
Parameters:
attributeList - The attribute list to which the JMX attribute(s) should be added.

toJMXAttributeInfo

public void toJMXAttributeInfo(java.util.List<javax.management.MBeanAttributeInfo> attributeInfoList)
Adds information about this configuration attribute to the provided list in the form of a JMX MBeanAttributeInfo object. If this configuration attribute requires administrative action before changes take effect and it has a set of pending values, then two attribute info objects should be added to the list -- one for the active value (which should be read-write) and one for the pending value (which should be read-only). The pending value should be named with the pending option.

Specified by:
toJMXAttributeInfo in class ConfigAttribute
Parameters:
attributeInfoList - The list to which the attribute information should be added.

toJMXParameterInfo

public javax.management.MBeanParameterInfo toJMXParameterInfo()
Retrieves a JMX MBeanParameterInfo object that describes this configuration attribute.

Specified by:
toJMXParameterInfo in class ConfigAttribute
Returns:
A JMX MBeanParameterInfo object that describes this configuration attribute.

setValue

public void setValue(javax.management.Attribute jmxAttribute)
              throws ConfigException
Attempts to set the value of this configuration attribute based on the information in the provided JMX attribute.

Specified by:
setValue in class ConfigAttribute
Parameters:
jmxAttribute - The JMX attribute to use to attempt to set the value of this configuration attribute.
Throws:
ConfigException - If the provided JMX attribute does not have an acceptable value for this configuration attribute.

duplicate

public ConfigAttribute duplicate()
Creates a duplicate of this configuration attribute.

Specified by:
duplicate in class ConfigAttribute
Returns:
A duplicate of this configuration attribute.