ConfigResponse (Hyperic HQ Plugin API)
Keywords: org.hyperic.util.config.ConfigResponse class

Overview | Package | Class | Tree | Deprecated | Index | Help
| Hyperic HQ Plugin API v. 4.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hyperic.util.config
Class ConfigResponse

    java.lang.Object
      org.hyperic.util.config.ConfigResponse

All Implemented Interfaces:
  java.io.Serializable, GenericValueMap

    public class ConfigResponse

extends java.lang.Object
implements GenericValueMap, java.io.Serializable

See Also:
  Serialized Form

Field Summary
`static byte[]` | `EMPTY_CONFIG` Empty, encoded ConfigResponse.

Constructor Summary
`ConfigResponse()` Create a ConfigResponse that will not be validated against any schema.
`ConfigResponse(ConfigSchema schema)` Create a ConfigResponse that will be validated against the specified schema.
`ConfigResponse(java.util.Map attributes)` Create a ConfigResponse that will not be validated against any schema.

Method Summary
`static ConfigResponse` | `decode(byte[] data)` Decode a ConfigResponse from a byte array with no schema validation.
`static ConfigResponse` | `decode(ConfigSchema schema, byte[] data)` Decode a ConfigResponse from a byte array according to the specified schema.
`byte[]` | `encode()`
`boolean` | `equals(java.lang.Object o)`
`java.util.Set` | `getKeys()`
`java.util.List` | `getPreferenceAsList(java.lang.String key, java.lang.String delimiter)` Break the named preference
`java.lang.String` | `getValue(java.lang.String key)`
`java.lang.String` | `getValue(java.lang.String key, java.lang.String defaultValue)`
`int` | `hashCode()`
`void` | `merge(ConfigResponse other, boolean overWrite)` Merge the values from another ConfigResponse into this object.
`static byte[]` | `safeEncode(ConfigResponse cr)`
`void` | `setValue(java.lang.String key, boolean value)`
`void` | `setValue(java.lang.String key, int value)`
`void` | `setValue(java.lang.String key, long value)`
`void` | `setValue(java.lang.String key, java.lang.String value)` Set the value for an option.
`int` | `size()`
`java.util.Properties` | `toProperties()`
`java.lang.String` | `toString()`
`void` | `unsetValue(java.lang.String key)` Set the value for an option.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### EMPTY_CONFIG

    public static final byte[] EMPTY_CONFIG

  Empty, encoded ConfigResponse.

Constructor Detail

### ConfigResponse

    public ConfigResponse(ConfigSchema schema)

  Create a ConfigResponse that will be validated against the specified schema. Any default values in the Schema will be set in the ConfigResponse

  Parameters:
    `schema` - The schema to validate option settings against. If this is null then no schema validation will be done, this is equivalent to using the no-argument constructor.

### ConfigResponse

    public ConfigResponse()

  Create a ConfigResponse that will not be validated against any schema.

### ConfigResponse

    public ConfigResponse(java.util.Map attributes)

  Create a ConfigResponse that will not be validated against any schema.

  Parameters:
    `attributes` - The config properties normally populated by setValue().

Method Detail

### setValue

    public void setValue(java.lang.String key,
                         boolean value)

### setValue

    public void setValue(java.lang.String key,
                         int value)

### setValue

    public void setValue(java.lang.String key,
                         long value)

### setValue

    public void setValue(java.lang.String key,
                         java.lang.String value)
                  throws InvalidOptionException,
                         InvalidOptionValueException

  Set the value for an option.

  Specified by:
    `setValue` in interface `GenericValueMap`
  Parameters:
    `key` - The name of the option to set
    `value` - The value to set the option to.
  Throws:
    `InvalidOptionException` - If this ConfigResponse does not support the specified option.
    `InvalidOptionValueException` - If the value supplied is not a legal/valid value for the option.

### unsetValue

    public void unsetValue(java.lang.String key)
                    throws InvalidOptionException,
                           InvalidOptionValueException

  Set the value for an option.

  Parameters:
    `key` - The name of the option to set
  Throws:
    `InvalidOptionException` - If this ConfigResponse does not support the specified option.
    `InvalidOptionValueException` - If the value supplied is not a legal/valid value for the option.

### getValue

    public java.lang.String getValue(java.lang.String key)

  Specified by:
    `getValue` in interface `GenericValueMap`

### getValue

    public java.lang.String getValue(java.lang.String key,
                                     java.lang.String defaultValue)

### getKeys

    public java.util.Set getKeys()

  Specified by:
    `getKeys` in interface `GenericValueMap`

### decode

    public static ConfigResponse decode(byte[] data)
                                 throws EncodingException

  Decode a ConfigResponse from a byte array with no schema validation.

  Parameters:
    `data` - The response data to decode.
  Throws:
    `EncodingException` - If the encoding is incorrect.

### decode

    public static ConfigResponse decode(ConfigSchema schema,
                                        byte[] data)
                                 throws EncodingException,
                                        InvalidOptionException,
                                        InvalidOptionValueException

  Decode a ConfigResponse from a byte array according to the specified schema.

  Parameters:
    `schema` - The schema to validate against.
    `data` - The response data to decode.
  Throws:
    `EncodingException` - If the encoding is incorrect.
    `InvalidOptionException` - If the data specifies as option that is not valid for the given schema.
    `InvalidOptionValueException` - If the data specifies an illegal/invalid value for one of the options it contains.

### safeEncode

    public static byte[] safeEncode(ConfigResponse cr)
                             throws EncodingException

  Returns:
    the encoded config, or null if the ConfigResponse passed in is null. This is a handy method to avoid NPEs.
  Throws:
    `EncodingException`

### encode

    public byte[] encode()
                  throws EncodingException

  Throws:
    `EncodingException`

### merge

    public void merge(ConfigResponse other,
                      boolean overWrite)

  Merge the values from another ConfigResponse into this object.

  Parameters:
    `other` - Other ConfigResponse to merge data from
    `overWrite` - If true, values from the 'other' response will overwrite values with the same name in the object.

### toProperties

    public java.util.Properties toProperties()

  Returns:
    The ConfigResponse as a Properties object

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### size

    public int size()

### equals

    public boolean equals(java.lang.Object o)

  Overrides:
    `equals` in class `java.lang.Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

### getPreferenceAsList

    public java.util.List getPreferenceAsList(java.lang.String key,
                                              java.lang.String delimiter)
                                       throws InvalidOptionException

  Break the named preference

  Parameters:
    `delimiter` - the delimeter to break it up by
    `key` - the name of the preference
  Returns:
    `List` of `String` tokens
  Throws:
    `InvalidOptionException`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Hyperic HQ Plugin API v. 4.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.