|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opends.server.config.ConfigAttribute
org.opends.server.config.IntegerWithUnitConfigAttribute
@PublicAPI(stability=VOLATILE, mayInstantiate=true, mayExtend=false, mayInvoke=true) public final class IntegerWithUnitConfigAttribute
This class defines a configuration attribute that stores both an integer value and an associated unit. The unit will contain both a string and a floating-point value. When a unit is selected, then the associated value will be used as a multiplier for the integer value to achieve the actual value for this parameter. For example, the attribute could be used to specify a size in bytes, but a value with a unit of "kb" could multiply that value by 1024, or "mb" by 1048576, or "gb" by 1073741824. In this case, a value of "50 gb" would be the logical equivalent of "53687091200 b". Upper and lower bounds may be imposed, and in that case they will be imposed on the actual value not on merely the integer portion. This attribute may only hold a single value and it will always be required.
Constructor Summary | |
---|---|
IntegerWithUnitConfigAttribute(java.lang.String name,
Message description,
boolean requiresAdminAction,
java.util.HashMap<java.lang.String,java.lang.Double> units,
boolean hasLowerBound,
long lowerBound,
boolean hasUpperBound,
long upperBound)
Creates a new integer with unit configuration attribute stub with the provided information but no values. |
|
IntegerWithUnitConfigAttribute(java.lang.String name,
Message description,
boolean requiresAdminAction,
java.util.HashMap<java.lang.String,java.lang.Double> units,
boolean hasLowerBound,
long lowerBound,
boolean hasUpperBound,
long upperBound,
long intValue,
java.lang.String selectedUnit)
Creates a new integer with unit configuration attribute with the provided information. |
|
IntegerWithUnitConfigAttribute(java.lang.String name,
Message description,
boolean requiresAdminAction,
java.util.HashMap<java.lang.String,java.lang.Double> units,
boolean hasLowerBound,
long lowerBound,
boolean hasUpperBound,
long upperBound,
long activeIntValue,
java.lang.String activeSelectedUnit,
long pendingIntValue,
java.lang.String pendingSelectedUnit)
Creates a new integer with unit configuration attribute with the provided information. |
Method Summary | |
---|---|
long |
activeCalculatedValue()
Retrieves the calculated active value for this configuration attribute. |
long |
activeIntValue()
Retrieves the integer component of the active value for this configuration attribute. |
java.lang.String |
activeUnit()
Retrieves the name of the active unit 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 calculated value of this configuration attribute. |
AttributeSyntax |
getSyntax()
Retrieves the attribute syntax for this configuration attribute. |
java.util.HashMap<java.lang.String,java.lang.Double> |
getUnits()
Retrieves the mapping between the allowed names for the units and their multipliers 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 calculated value of this configuration attribute. |
boolean |
hasUpperBound()
Indicates whether an upper bound will be enforced for the calculated value of this configuration attribute. |
long |
pendingCalculatedValue()
Retrieves the calculated pending value for this configuration attribute. |
long |
pendingIntValue()
Retrieves the integer component of the pending value for this configuration attribute. |
java.lang.String |
pendingUnit()
Retrieves the name of the pending unit 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 intValue,
java.lang.String unit)
Sets the value for this configuration attribute. |
void |
setValue(java.lang.String value)
Sets the value for this 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. |
boolean |
valueIsAcceptable(java.lang.String lowerValue,
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 |
---|
public IntegerWithUnitConfigAttribute(java.lang.String name, Message description, boolean requiresAdminAction, java.util.HashMap<java.lang.String,java.lang.Double> units, boolean hasLowerBound, long lowerBound, boolean hasUpperBound, long upperBound)
setInitialValue
method. Mo validation will be performed on
the set of allowed units.
name
- The name for this configuration attribute.description
- The description for this configuration
attribute.requiresAdminAction
- Indicates whether changes to this
configuration attribute require administrative
action before they will take effect.units
- The set of units and their associated
multipliers for this configuration attribute.hasLowerBound
- Indicates whether a lower bound will be
enforced for the calculated value.lowerBound
- The lower bound for the calculated value.hasUpperBound
- Indicates whether an upper bound will be
enforced for the calculated value.upperBound
- The upper bound for the calculated value.public IntegerWithUnitConfigAttribute(java.lang.String name, Message description, boolean requiresAdminAction, java.util.HashMap<java.lang.String,java.lang.Double> units, boolean hasLowerBound, long lowerBound, boolean hasUpperBound, long upperBound, long intValue, java.lang.String selectedUnit)
name
- The name for this configuration attribute.description
- The description for this configuration
attribute.requiresAdminAction
- Indicates whether changes to this
configuration attribute require administrative
action before they will take effect.units
- The set of units and their associated
multipliers for this configuration attribute.hasLowerBound
- Indicates whether a lower bound will be
enforced for the calculated value.lowerBound
- The lower bound for the calculated value.hasUpperBound
- Indicates whether an upper bound will be
enforced for the calculated value.upperBound
- The upper bound for the calculated value.intValue
- The selected value for this configuration
attribute.selectedUnit
- The selected unit for this configuration
attribute.public IntegerWithUnitConfigAttribute(java.lang.String name, Message description, boolean requiresAdminAction, java.util.HashMap<java.lang.String,java.lang.Double> units, boolean hasLowerBound, long lowerBound, boolean hasUpperBound, long upperBound, long activeIntValue, java.lang.String activeSelectedUnit, long pendingIntValue, java.lang.String pendingSelectedUnit)
name
- The name for this configuration attribute.description
- The description for this configuration
attribute.requiresAdminAction
- Indicates whether changes to this
configuration attribute require administrative
action before they will take effect.units
- The set of units and their associated
multipliers for this configuration attribute.hasLowerBound
- Indicates whether a lower bound will be
enforced for the calculated value.lowerBound
- The lower bound for the calculated value.hasUpperBound
- Indicates whether an upper bound will be
enforced for the calculated value.upperBound
- The upper bound for the calculated value.activeIntValue
- The active selected value for this
configuration attribute.activeSelectedUnit
- The active selected unit for this
configuration attribute.pendingIntValue
- The pending selected value for this
configuration attribute.pendingSelectedUnit
- The pending selected unit for this
configuration attribute.Method Detail |
---|
public java.lang.String getDataType()
getDataType
in class ConfigAttribute
public AttributeSyntax getSyntax()
getSyntax
in class ConfigAttribute
public long activeIntValue()
public java.lang.String activeUnit()
public long activeCalculatedValue()
public long pendingIntValue()
public java.lang.String pendingUnit()
public long pendingCalculatedValue()
public java.util.HashMap<java.lang.String,java.lang.Double> getUnits()
public boolean hasLowerBound()
true
if a lower bound will be enforced for the
calculated value of this configuration attribute, or
false
if not.public long getLowerBound()
public boolean hasUpperBound()
true
if an upper bound will be enforced for the
calculated value of this configuration attribute, or
false
if not.public long getUpperBound()
public void setValue(long intValue, java.lang.String unit) throws ConfigException
intValue
- The integer component for the value of this configuration
attribute.unit
- The unit for the value of this configuration attribute.
ConfigException
- If the provided unit is not recognized, or if the
resulting calculated value is outside the
acceptable bounds.public void setValue(java.lang.String value) throws ConfigException
value
- The string representation of the value to use for this
configuration attribute.
ConfigException
- If the provided value is invalid for some reason.public void applyPendingValues()
applyPendingValues
in class ConfigAttribute
public boolean valueIsAcceptable(AttributeValue value, java.lang.StringBuilder rejectReason)
valueIsAcceptable
in class ConfigAttribute
value
- The value for which to make the determination.rejectReason
- A buffer into which a human-readable reason for the
reject may be written.
true
if the provided value is acceptable for use in
this attribute, or false
if not.public boolean valueIsAcceptable(java.lang.String lowerValue, java.lang.StringBuilder rejectReason)
lowerValue
- The lowercase version of the value for which to make
the determination.rejectReason
- A buffer into which a human-readable reason for the
reject may be written.
true
if the provided value is acceptable for use in
this attribute, or false
if not.public java.util.LinkedHashSet<AttributeValue> stringsToValues(java.util.List<java.lang.String> valueStrings, boolean allowFailures) throws ConfigException
stringsToValues
in class ConfigAttribute
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.
ConfigException
- If an unrecoverable problem occurs while
performing the conversion.public java.util.List<java.lang.String> activeValuesToStrings()
stringsToValues
method.
activeValuesToStrings
in class ConfigAttribute
public java.util.List<java.lang.String> pendingValuesToStrings()
stringsToValues
method.
pendingValuesToStrings
in class ConfigAttribute
null
if there are no
pending values.public ConfigAttribute getConfigAttribute(java.util.List<Attribute> attributeList) throws ConfigException
getConfigAttribute
in class ConfigAttribute
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.
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).public javax.management.Attribute toJMXAttribute()
toJMXAttribute
in class ConfigAttribute
null
if it does not have
any active values.public javax.management.Attribute toJMXAttributePending()
toJMXAttributePending
in class ConfigAttribute
null
if it does not have
any active values.public void toJMXAttribute(javax.management.AttributeList attributeList)
toJMXAttribute
in class ConfigAttribute
attributeList
- The attribute list to which the JMX attribute(s) should
be added.public void toJMXAttributeInfo(java.util.List<javax.management.MBeanAttributeInfo> attributeInfoList)
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.
toJMXAttributeInfo
in class ConfigAttribute
attributeInfoList
- The list to which the attribute information
should be added.public javax.management.MBeanParameterInfo toJMXParameterInfo()
MBeanParameterInfo
object that describes this
configuration attribute.
toJMXParameterInfo
in class ConfigAttribute
MBeanParameterInfo
object that describes this
configuration attribute.public void setValue(javax.management.Attribute jmxAttribute) throws ConfigException
setValue
in class ConfigAttribute
jmxAttribute
- The JMX attribute to use to attempt to set the value
of this configuration attribute.
ConfigException
- If the provided JMX attribute does not have an
acceptable value for this configuration
attribute.public ConfigAttribute duplicate()
duplicate
in class ConfigAttribute
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |