| | |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.config; |
| | | import org.opends.messages.Message; |
| | | |
| | | |
| | | |
| | |
| | | import org.opends.server.protocols.asn1.ASN1OctetString; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeValue; |
| | | 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.ErrorLogger.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import static org.opends.server.messages.ConfigMessages.*; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | | |
| | | |
| | | import org.opends.server.loggers.ErrorLogger; |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | /** |
| | | * This class defines an integer configuration attribute, which can hold zero or |
| | | * more integer values. For scalability, the actual values will be stored as |
| | |
| | | * @param upperBound The upper bound that will be enforced for |
| | | * values of this attribute. |
| | | */ |
| | | public IntegerConfigAttribute(String name, String description, |
| | | public IntegerConfigAttribute(String name, Message description, |
| | | boolean isRequired, boolean isMultiValued, |
| | | boolean requiresAdminAction, |
| | | boolean hasLowerBound, long lowerBound, |
| | |
| | | * @param value The value for this integer configuration |
| | | * attribute. |
| | | */ |
| | | public IntegerConfigAttribute(String name, String description, |
| | | public IntegerConfigAttribute(String name, Message description, |
| | | boolean isRequired, boolean isMultiValued, |
| | | boolean requiresAdminAction, |
| | | boolean hasLowerBound, long lowerBound, |
| | |
| | | * @param values The set of values for this configuration |
| | | * attribute. |
| | | */ |
| | | public IntegerConfigAttribute(String name, String description, |
| | | public IntegerConfigAttribute(String name, Message description, |
| | | boolean isRequired, boolean isMultiValued, |
| | | boolean requiresAdminAction, |
| | | boolean hasLowerBound, long lowerBound, |
| | |
| | | * @param pendingValues The set of pending values for this |
| | | * configuration attribute. |
| | | */ |
| | | public IntegerConfigAttribute(String name, String description, |
| | | public IntegerConfigAttribute(String name, Message description, |
| | | boolean isRequired, boolean isMultiValued, |
| | | boolean requiresAdminAction, |
| | | boolean hasLowerBound, long lowerBound, |
| | |
| | | { |
| | | if ((activeValues == null) || activeValues.isEmpty()) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_NO_INT_VALUE; |
| | | String message = getMessage(msgID, getName()); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_NO_INT_VALUE.get(getName()); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | if (activeValues.size() > 1) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_MULTIPLE_INT_VALUES; |
| | | String message = getMessage(msgID, getName()); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_MULTIPLE_INT_VALUES.get(getName()); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | return activeValues.get(0); |
| | |
| | | { |
| | | if ((activeValues == null) || activeValues.isEmpty()) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_NO_INT_VALUE; |
| | | String message = getMessage(msgID, getName()); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_NO_INT_VALUE.get(getName()); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | if (activeValues.size() > 1) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_MULTIPLE_INT_VALUES; |
| | | String message = getMessage(msgID, getName()); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_MULTIPLE_INT_VALUES.get(getName()); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | long longValue = activeValues.get(0); |
| | |
| | | } |
| | | else |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_VALUE_OUT_OF_INT_RANGE; |
| | | String message = getMessage(msgID, getName()); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_VALUE_OUT_OF_INT_RANGE.get(getName()); |
| | | throw new ConfigException(message); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | if ((pendingValues == null) || pendingValues.isEmpty()) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_NO_INT_VALUE; |
| | | String message = getMessage(msgID, getName()); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_NO_INT_VALUE.get(getName()); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | if (pendingValues.size() > 1) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_MULTIPLE_INT_VALUES; |
| | | String message = getMessage(msgID, getName()); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_MULTIPLE_INT_VALUES.get(getName()); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | return pendingValues.get(0); |
| | |
| | | |
| | | if ((pendingValues == null) || pendingValues.isEmpty()) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_NO_INT_VALUE; |
| | | String message = getMessage(msgID, getName()); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_NO_INT_VALUE.get(getName()); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | if (pendingValues.size() > 1) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_MULTIPLE_INT_VALUES; |
| | | String message = getMessage(msgID, getName()); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_MULTIPLE_INT_VALUES.get(getName()); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | long longValue = pendingValues.get(0); |
| | |
| | | } |
| | | else |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_VALUE_OUT_OF_INT_RANGE; |
| | | String message = getMessage(msgID, getName()); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_VALUE_OUT_OF_INT_RANGE.get(getName()); |
| | | throw new ConfigException(message); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | if (hasLowerBound && (value < lowerBound)) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_INT_BELOW_LOWER_BOUND; |
| | | String message = getMessage(msgID, getName(), value, lowerBound); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_INT_BELOW_LOWER_BOUND.get( |
| | | getName(), value, lowerBound); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | if (hasUpperBound && (value > upperBound)) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_INT_ABOVE_UPPER_BOUND; |
| | | String message = getMessage(msgID, getName(), value, upperBound); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_INT_ABOVE_UPPER_BOUND.get( |
| | | getName(), value, upperBound); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | if (requiresAdminAction()) |
| | |
| | | { |
| | | if (isRequired()) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_IS_REQUIRED; |
| | | String message = getMessage(msgID, getName()); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_IS_REQUIRED.get(getName()); |
| | | throw new ConfigException(message); |
| | | } |
| | | else |
| | | { |
| | |
| | | int numValues = values.size(); |
| | | if ((! isMultiValued()) && (numValues > 1)) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED; |
| | | String message = getMessage(msgID, getName()); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = |
| | | ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(getName()); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | if (hasLowerBound && (value < lowerBound)) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_INT_BELOW_LOWER_BOUND; |
| | | String message = getMessage(msgID, getName(), value, lowerBound); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_INT_BELOW_LOWER_BOUND.get( |
| | | getName(), value, lowerBound); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | if (hasUpperBound && (value > upperBound)) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_INT_ABOVE_UPPER_BOUND; |
| | | String message = getMessage(msgID, getName(), value, upperBound); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_INT_ABOVE_UPPER_BOUND.get( |
| | | getName(), value, upperBound); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | String valueString = String.valueOf(value); |
| | |
| | | |
| | | if (valueSet.contains(attrValue)) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_ADD_VALUES_ALREADY_EXISTS; |
| | | String message = getMessage(msgID, getName(), valueString); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_ADD_VALUES_ALREADY_EXISTS.get( |
| | | getName(), valueString); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | valueSet.add(attrValue); |
| | |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | rejectReason.append(getMessage(MSGID_CONFIG_ATTR_INVALID_INT_VALUE, |
| | | stringValue, String.valueOf(e))); |
| | | rejectReason.append(ERR_CONFIG_ATTR_INVALID_INT_VALUE.get( |
| | | getName(), stringValue, String.valueOf(e))); |
| | | return false; |
| | | } |
| | | |
| | |
| | | // Perform any necessary bounds checking. |
| | | if (hasLowerBound && (longValue < lowerBound)) |
| | | { |
| | | rejectReason.append(getMessage(MSGID_CONFIG_ATTR_INT_BELOW_LOWER_BOUND, |
| | | getName(), longValue, lowerBound)); |
| | | rejectReason.append(ERR_CONFIG_ATTR_INT_BELOW_LOWER_BOUND.get( |
| | | getName(), longValue, lowerBound)); |
| | | return false; |
| | | } |
| | | |
| | | if (hasUpperBound && (longValue > upperBound)) |
| | | { |
| | | rejectReason.append(getMessage(MSGID_CONFIG_ATTR_INT_ABOVE_UPPER_BOUND, |
| | | getName(), longValue, upperBound)); |
| | | rejectReason.append(ERR_CONFIG_ATTR_INT_ABOVE_UPPER_BOUND.get( |
| | | getName(), longValue, upperBound)); |
| | | return false; |
| | | } |
| | | |
| | |
| | | { |
| | | if (isRequired()) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_IS_REQUIRED; |
| | | String message = getMessage(msgID, getName()); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_IS_REQUIRED.get(getName()); |
| | | throw new ConfigException(message); |
| | | } |
| | | else |
| | | { |
| | |
| | | int numValues = valueStrings.size(); |
| | | if ((! isMultiValued()) && (numValues > 1)) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED; |
| | | String message = getMessage(msgID, getName()); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = |
| | | ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(getName()); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | |
| | |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_ATTR_INT_COULD_NOT_PARSE; |
| | | String message = getMessage(msgID, valueString, getName(), |
| | | String.valueOf(e)); |
| | | Message message = ERR_CONFIG_ATTR_INT_COULD_NOT_PARSE.get( |
| | | valueString, getName(), |
| | | String.valueOf(e)); |
| | | |
| | | if (allowFailures) |
| | | { |
| | | logError(ErrorLogCategory.CONFIGURATION, ErrorLogSeverity.MILD_ERROR, |
| | | message, msgID); |
| | | ErrorLogger.logError(message); |
| | | continue; |
| | | } |
| | | else |
| | | { |
| | | throw new ConfigException(msgID, message); |
| | | throw new ConfigException(message); |
| | | } |
| | | } |
| | | |
| | | |
| | | if (hasLowerBound && (longValue < lowerBound)) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_INT_BELOW_LOWER_BOUND; |
| | | String message = getMessage(msgID, getName(), longValue, lowerBound); |
| | | |
| | | Message message = ERR_CONFIG_ATTR_INT_BELOW_LOWER_BOUND.get( |
| | | getName(), longValue, lowerBound); |
| | | if (allowFailures) |
| | | { |
| | | logError(ErrorLogCategory.CONFIGURATION, ErrorLogSeverity.MILD_ERROR, |
| | | message, msgID); |
| | | ErrorLogger.logError(message); |
| | | continue; |
| | | } |
| | | else |
| | | { |
| | | throw new ConfigException(msgID, message); |
| | | throw new ConfigException(message); |
| | | } |
| | | } |
| | | |
| | | |
| | | if (hasUpperBound && (longValue > upperBound)) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_INT_ABOVE_UPPER_BOUND; |
| | | String message = getMessage(msgID, getName(), longValue, upperBound); |
| | | Message message = ERR_CONFIG_ATTR_INT_ABOVE_UPPER_BOUND.get( |
| | | getName(), longValue, upperBound); |
| | | |
| | | if (allowFailures) |
| | | { |
| | | logError(ErrorLogCategory.CONFIGURATION, ErrorLogSeverity.MILD_ERROR, |
| | | message, msgID); |
| | | ErrorLogger.logError(message); |
| | | continue; |
| | | } |
| | | else |
| | | { |
| | | throw new ConfigException(msgID, message); |
| | | throw new ConfigException(message); |
| | | } |
| | | } |
| | | |
| | |
| | | // attribute and if so deal with it accordingly. |
| | | if ((isRequired()) && valueSet.isEmpty()) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_IS_REQUIRED; |
| | | String message = getMessage(msgID, getName()); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_IS_REQUIRED.get(getName()); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | |
| | |
| | | if (pendingValues != null) |
| | | { |
| | | // We cannot have multiple pending value sets. |
| | | int msgID = MSGID_CONFIG_ATTR_MULTIPLE_PENDING_VALUE_SETS; |
| | | String message = getMessage(msgID, a.getName()); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = |
| | | ERR_CONFIG_ATTR_MULTIPLE_PENDING_VALUE_SETS.get(a.getName()); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | |
| | |
| | | if (isRequired()) |
| | | { |
| | | // This is illegal -- it must have a value. |
| | | int msgID = MSGID_CONFIG_ATTR_IS_REQUIRED; |
| | | String message = getMessage(msgID, a.getName()); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_IS_REQUIRED.get(a.getName()); |
| | | throw new ConfigException(message); |
| | | } |
| | | else |
| | | { |
| | |
| | | if ((numValues > 1) && (! isMultiValued())) |
| | | { |
| | | // This is illegal -- the attribute is single-valued. |
| | | int msgID = MSGID_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED; |
| | | String message = getMessage(msgID, a.getName()); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = |
| | | ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(a.getName()); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | pendingValues = new ArrayList<Long>(numValues); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_INT_COULD_NOT_PARSE; |
| | | String message = getMessage(msgID, v.getStringValue(), |
| | | a.getName(), String.valueOf(e)); |
| | | throw new ConfigException(msgID, message, e); |
| | | Message message = ERR_CONFIG_ATTR_INT_COULD_NOT_PARSE.get( |
| | | v.getStringValue(), a.getName(), String.valueOf(e)); |
| | | throw new ConfigException(message, e); |
| | | } |
| | | |
| | | |
| | | // Check the bounds set for this attribute. |
| | | if (hasLowerBound && (longValue < lowerBound)) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_INT_BELOW_LOWER_BOUND; |
| | | String message = getMessage(msgID, a.getName(), longValue, |
| | | lowerBound); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_INT_BELOW_LOWER_BOUND.get( |
| | | a.getName(), longValue, lowerBound); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | if (hasUpperBound && (longValue > upperBound)) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_INT_ABOVE_UPPER_BOUND; |
| | | String message = getMessage(msgID, a.getName(), longValue, |
| | | upperBound); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_INT_ABOVE_UPPER_BOUND.get( |
| | | a.getName(), longValue, upperBound); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | pendingValues.add(longValue); |
| | |
| | | { |
| | | // This is illegal -- only the pending option is allowed for |
| | | // configuration attributes. |
| | | int msgID = MSGID_CONFIG_ATTR_OPTIONS_NOT_ALLOWED; |
| | | String message = getMessage(msgID, a.getName()); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = |
| | | ERR_CONFIG_ATTR_OPTIONS_NOT_ALLOWED.get( |
| | | a.getName()); |
| | | throw new ConfigException(message); |
| | | } |
| | | } |
| | | else |
| | |
| | | if (activeValues!= null) |
| | | { |
| | | // We cannot have multiple active value sets. |
| | | int msgID = MSGID_CONFIG_ATTR_MULTIPLE_ACTIVE_VALUE_SETS; |
| | | String message = getMessage(msgID, a.getName()); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = |
| | | ERR_CONFIG_ATTR_MULTIPLE_ACTIVE_VALUE_SETS.get(a.getName()); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | |
| | |
| | | if (isRequired()) |
| | | { |
| | | // This is illegal -- it must have a value. |
| | | int msgID = MSGID_CONFIG_ATTR_IS_REQUIRED; |
| | | String message = getMessage(msgID, a.getName()); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_IS_REQUIRED.get(a.getName()); |
| | | throw new ConfigException(message); |
| | | } |
| | | else |
| | | { |
| | |
| | | if ((numValues > 1) && (! isMultiValued())) |
| | | { |
| | | // This is illegal -- the attribute is single-valued. |
| | | int msgID = MSGID_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED; |
| | | String message = getMessage(msgID, a.getName()); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = |
| | | ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(a.getName()); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | activeValues = new ArrayList<Long>(numValues); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_INT_COULD_NOT_PARSE; |
| | | String message = getMessage(msgID, v.getStringValue(), |
| | | a.getName(), String.valueOf(e)); |
| | | throw new ConfigException(msgID, message, e); |
| | | Message message = ERR_CONFIG_ATTR_INT_COULD_NOT_PARSE.get( |
| | | v.getStringValue(), a.getName(), String.valueOf(e)); |
| | | throw new ConfigException(message, e); |
| | | } |
| | | |
| | | |
| | | // Check the bounds set for this attribute. |
| | | if (hasLowerBound && (longValue < lowerBound)) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_INT_BELOW_LOWER_BOUND; |
| | | String message = getMessage(msgID, a.getName(), longValue, |
| | | lowerBound); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_INT_BELOW_LOWER_BOUND.get( |
| | | a.getName(), longValue, lowerBound); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | if (hasUpperBound && (longValue > upperBound)) |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_INT_ABOVE_UPPER_BOUND; |
| | | String message = getMessage(msgID, a.getName(), longValue, |
| | | upperBound); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_INT_ABOVE_UPPER_BOUND.get( |
| | | a.getName(), longValue, upperBound); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | activeValues.add(longValue); |
| | |
| | | if (activeValues == null) |
| | | { |
| | | // This is not OK. The value set must contain an active value. |
| | | int msgID = MSGID_CONFIG_ATTR_NO_ACTIVE_VALUE_SET; |
| | | String message = getMessage(msgID, getName()); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_NO_ACTIVE_VALUE_SET.get(getName()); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | if (pendingValues == null) |
| | |
| | | { |
| | | attributeInfoList.add(new MBeanAttributeInfo(getName(), |
| | | JMX_TYPE_LONG_ARRAY, |
| | | getDescription(), true, true, |
| | | false)); |
| | | String.valueOf( |
| | | getDescription()), |
| | | true, true, false)); |
| | | } |
| | | else |
| | | { |
| | | attributeInfoList.add(new MBeanAttributeInfo(getName(), |
| | | Long.class.getName(), |
| | | getDescription(), true, true, |
| | | false)); |
| | | String.valueOf( |
| | | getDescription()), |
| | | true, true, false)); |
| | | } |
| | | |
| | | |
| | |
| | | if (isMultiValued()) |
| | | { |
| | | attributeInfoList.add(new MBeanAttributeInfo(name, JMX_TYPE_LONG_ARRAY, |
| | | getDescription(), true, |
| | | false, false)); |
| | | String.valueOf( |
| | | getDescription()), |
| | | true, false, false)); |
| | | } |
| | | else |
| | | { |
| | | attributeInfoList.add(new MBeanAttributeInfo(name, Long.class.getName(), |
| | | getDescription(), true, |
| | | false, false)); |
| | | String.valueOf( |
| | | getDescription()), |
| | | true, false, false)); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (isMultiValued()) |
| | | { |
| | | return new MBeanParameterInfo(getName(), JMX_TYPE_LONG_ARRAY, |
| | | getDescription()); |
| | | String.valueOf(getDescription())); |
| | | } |
| | | else |
| | | { |
| | | return new MBeanParameterInfo(getName(), Long.TYPE.getName(), |
| | | getDescription()); |
| | | String.valueOf(getDescription())); |
| | | } |
| | | } |
| | | |
| | |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_ATTR_INT_COULD_NOT_PARSE; |
| | | String message = getMessage(msgID, String.valueOf(value), getName(), |
| | | String.valueOf(e)); |
| | | throw new ConfigException(msgID, message, e); |
| | | Message message = ERR_CONFIG_ATTR_INT_COULD_NOT_PARSE.get( |
| | | String.valueOf(value), getName(), String.valueOf(e)); |
| | | throw new ConfigException(message, e); |
| | | } |
| | | } |
| | | else if (value.getClass().isArray()) |
| | |
| | | } |
| | | else |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_INT_INVALID_ARRAY_TYPE; |
| | | String message = getMessage(msgID, componentType); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = |
| | | ERR_CONFIG_ATTR_INT_INVALID_ARRAY_TYPE.get( |
| | | jmxAttribute.getName(), componentType); |
| | | throw new ConfigException(message); |
| | | } |
| | | } |
| | | catch (ConfigException ce) |
| | |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_ATTR_INT_COULD_NOT_PARSE; |
| | | String message = getMessage(msgID, componentType + "[" + length + "]", |
| | | getName(), String.valueOf(e)); |
| | | throw new ConfigException(msgID, message, e); |
| | | Message message = ERR_CONFIG_ATTR_INT_COULD_NOT_PARSE.get( |
| | | componentType + "[" + length + "]", getName(), String.valueOf(e)); |
| | | throw new ConfigException(message, e); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | int msgID = MSGID_CONFIG_ATTR_INT_INVALID_TYPE; |
| | | String message = getMessage(msgID, String.valueOf(value), getName(), |
| | | value.getClass().getName()); |
| | | throw new ConfigException(msgID, message); |
| | | Message message = ERR_CONFIG_ATTR_INT_INVALID_TYPE.get( |
| | | String.valueOf(value), getName(), value.getClass().getName()); |
| | | throw new ConfigException(message); |
| | | } |
| | | } |
| | | |