| | |
| | | */ |
| | | public String getDataType() |
| | | { |
| | | |
| | | return "IntegerWithUnit"; |
| | | } |
| | | |
| | |
| | | */ |
| | | public AttributeSyntax getSyntax() |
| | | { |
| | | |
| | | return DirectoryServer.getDefaultStringSyntax(); |
| | | } |
| | | |
| | |
| | | */ |
| | | public long activeIntValue() |
| | | { |
| | | |
| | | return activeIntValue; |
| | | } |
| | | |
| | |
| | | */ |
| | | public String activeUnit() |
| | | { |
| | | |
| | | return activeUnit; |
| | | } |
| | | |
| | |
| | | */ |
| | | public long activeCalculatedValue() |
| | | { |
| | | |
| | | return activeCalculatedValue; |
| | | } |
| | | |
| | |
| | | */ |
| | | public long pendingIntValue() |
| | | { |
| | | |
| | | if (hasPendingValues()) |
| | | { |
| | | return pendingIntValue; |
| | |
| | | */ |
| | | public String pendingUnit() |
| | | { |
| | | |
| | | if (hasPendingValues()) |
| | | { |
| | | return pendingUnit; |
| | |
| | | */ |
| | | public long pendingCalculatedValue() |
| | | { |
| | | |
| | | if (hasPendingValues()) |
| | | { |
| | | return pendingCalculatedValue; |
| | |
| | | */ |
| | | public HashMap<String,Double> getUnits() |
| | | { |
| | | |
| | | return units; |
| | | } |
| | | |
| | |
| | | */ |
| | | public boolean hasLowerBound() |
| | | { |
| | | |
| | | return hasLowerBound; |
| | | } |
| | | |
| | |
| | | */ |
| | | public long getLowerBound() |
| | | { |
| | | |
| | | return lowerBound; |
| | | } |
| | | |
| | |
| | | */ |
| | | public boolean hasUpperBound() |
| | | { |
| | | |
| | | return hasUpperBound; |
| | | } |
| | | |
| | |
| | | */ |
| | | public long getUpperBound() |
| | | { |
| | | |
| | | return upperBound; |
| | | } |
| | | |
| | |
| | | public void setValue(long intValue, String unit) |
| | | throws ConfigException |
| | | { |
| | | |
| | | if ((unit == null) || (! units.containsKey(unit))) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_INVALID_UNIT; |
| | |
| | | public void setValue(String value) |
| | | throws ConfigException |
| | | { |
| | | |
| | | int spacePos = value.indexOf(' '); |
| | | if (spacePos <= 0) |
| | | { |
| | |
| | | private static LinkedHashSet<AttributeValue> getValueSet(long intValue, |
| | | String unit) |
| | | { |
| | | |
| | | if (unit == null) |
| | | { |
| | | return null; |
| | |
| | | */ |
| | | public void applyPendingValues() |
| | | { |
| | | |
| | | if (! hasPendingValues()) |
| | | { |
| | | return; |
| | |
| | | public boolean valueIsAcceptable(AttributeValue value, |
| | | StringBuilder rejectReason) |
| | | { |
| | | |
| | | |
| | | // Get a string representation of the value and convert it to lowercase. |
| | | String lowerValue = value.getStringValue().toLowerCase(); |
| | | |
| | |
| | | public boolean valueIsAcceptable(String lowerValue, |
| | | StringBuilder rejectReason) |
| | | { |
| | | |
| | | |
| | | // Find the first space in the value, since it should separate the integer |
| | | // from the unit. |
| | | int spacePos = lowerValue.indexOf(' '); |
| | |
| | | stringsToValues(List<String> valueStrings, boolean allowFailures) |
| | | throws ConfigException |
| | | { |
| | | |
| | | if ((valueStrings == null) || valueStrings.isEmpty()) |
| | | { |
| | | if (isRequired()) |
| | |
| | | */ |
| | | public List<String> activeValuesToStrings() |
| | | { |
| | | |
| | | ArrayList<String> valueStrings = new ArrayList<String>(1); |
| | | valueStrings.add(activeIntValue + " " + activeUnit); |
| | | |
| | |
| | | */ |
| | | public List<String> pendingValuesToStrings() |
| | | { |
| | | |
| | | if (hasPendingValues()) |
| | | { |
| | | ArrayList<String> valueStrings = new ArrayList<String>(1); |
| | |
| | | public ConfigAttribute getConfigAttribute(List<Attribute> attributeList) |
| | | throws ConfigException |
| | | { |
| | | |
| | | |
| | | long activeIntValue = 0; |
| | | long pendingIntValue = 0; |
| | | String activeUnit = null; |
| | |
| | | */ |
| | | public javax.management.Attribute toJMXAttribute() |
| | | { |
| | | |
| | | return new javax.management.Attribute(getName(), |
| | | activeIntValue + " " + activeUnit); |
| | | } |
| | |
| | | */ |
| | | public void toJMXAttribute(AttributeList attributeList) |
| | | { |
| | | |
| | | String activeValue = activeIntValue + " " + activeUnit; |
| | | attributeList.add(new javax.management.Attribute(getName(), activeValue)); |
| | | |
| | |
| | | */ |
| | | public void toJMXAttributeInfo(List<MBeanAttributeInfo> attributeInfoList) |
| | | { |
| | | |
| | | attributeInfoList.add(new MBeanAttributeInfo(getName(), |
| | | String.class.getName(), |
| | | getDescription(), true, true, |
| | |
| | | */ |
| | | public MBeanParameterInfo toJMXParameterInfo() |
| | | { |
| | | |
| | | return new MBeanParameterInfo(getName(), String.class.getName(), |
| | | getDescription()); |
| | | } |
| | |
| | | public void setValue(javax.management.Attribute jmxAttribute) |
| | | throws ConfigException |
| | | { |
| | | |
| | | Object value = jmxAttribute.getValue(); |
| | | if (value instanceof String) |
| | | { |
| | |
| | | */ |
| | | public ConfigAttribute duplicate() |
| | | { |
| | | |
| | | return new IntegerWithUnitConfigAttribute(getName(), getDescription(), |
| | | requiresAdminAction(), units, |
| | | hasLowerBound, lowerBound, |