Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.management.oss.impl
Class AttributeAccessImpl

    java.lang.Object
      com.sun.management.oss.impl.AttributeAccessImpl

All Implemented Interfaces:
  AttributeAccess, java.lang.Cloneable, java.io.Serializable, SerializerFactory

Direct Known Subclasses:
  IRPEventImpl, ManagedEntityValueImpl, QueryValueImpl

public abstract class AttributeAccessImpl
extends java.lang.Object
implements AttributeAccess, SerializerFactory

Implemtation of AttributeAccess. Uses a HashMap to store the attributes. The class has generic methods for setting arbitrary attributes. As long as all attributes are initialized to null in the constructor (of any sub-class) all methods in this class are generic and do not have to be overridden. Like for instance the isFullyPopulated() method. Note, clone() need to be overriden if new class members are added that need "deep-copy".

Author:
  Henrik Lindstrom, Ericsson
See Also:
  Serialized Form

Constructor Summary
`AttributeAccessImpl()` Creates a new attribute acccess.

Method Summary
`java.lang.Object` | `clone()`
`java.util.Map` | `getAllPopulatedAttributes()` Get all populated attribute values.
`java.lang.String[]` | `getAttributeNames()` Return all attribute names, which are available in this value object.
`java.lang.Object` | `getAttributeValue(java.lang.String attributeName)` Return the value of the specified attribute.
`java.util.Map` | `getAttributeValues(java.lang.String[] attributeNames)` Get multiple attribute values given an array of attribute names.
`java.lang.String[]` | `getPopulatedAttributeNames()` Get the names of all populated attributes.
`java.lang.String[]` | `getSupportedOptionalAttributeNames()` Provide run-time support for the discovery of optional attributes.
`java.lang.String[]` | `getSupportedSerializerTypes()` Return all the serializer types than can be created by this factory.
`boolean` | `isFullyPopulated()` Return true, if all attributes in this value object are populated.
`boolean` | `isPopulated(java.lang.String name)` Check if a specific attribute is populated.
`Serializer` | `makeSerializer(java.lang.String serializerType)` Manufacture a Serializer for the object type inheriting the interface.
`void` | `setAttributeValue(java.lang.String attributeName, java.lang.Object value)` Assign a new value to an attribute.
`void` | `setAttributeValues(java.util.Map attributeNamesAndValuePairs)` Set multiple attribute values.
`void` | `unpopulateAllAttributes()` Reset all the attributes to unpopulated.
`void` | `unpopulateAttribute(java.lang.String attr_name)` Mark a single attribute as unpopulated.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AttributeAccessImpl

    public AttributeAccessImpl()

  Creates a new attribute acccess. It is required that a subclass initialize all legal attributes in the map to null values in the constructor. Otherwise they can not be populated later.

Method Detail

### clone

    public java.lang.Object clone()

### getAttributeValues

    public java.util.Map getAttributeValues(java.lang.String[] attributeNames)
                                     throws java.lang.IllegalArgumentException,
                                            java.lang.IllegalStateException

  Description copied from interface: `AttributeAccess`
  Get multiple attribute values given an array of attribute names.

  Specified by:
    `getAttributeValues` in interface `AttributeAccess`
  Parameters:
    `attributeNames` -
  Throws:
    `java.lang.IllegalArgumentException` - (if null array is provided or if one of the attributes is not recognized)
    `java.lang.IllegalStateException` - (if one of the attributes is not populated)

### setAttributeValues

    public void setAttributeValues(java.util.Map attributeNamesAndValuePairs)
                            throws java.lang.IllegalArgumentException,
                                   java.lang.IllegalStateException

  Description copied from interface: `AttributeAccess`
  Set multiple attribute values.

  Specified by:
    `setAttributeValues` in interface `AttributeAccess`
  Parameters:
    `attributeNamesAndValuePairs` -
  Throws:
    `java.lang.IllegalArgumentException` - (one of the attributes is not well formed or unrecognized)
    `java.lang.IllegalStateException`

### getAllPopulatedAttributes

    public java.util.Map getAllPopulatedAttributes()
                                            throws java.lang.IllegalStateException

  Description copied from interface: `AttributeAccess`
  Get all populated attribute values. If no attributes are populated an empty Map is returned.

  Specified by:
    `getAllPopulatedAttributes` in interface `AttributeAccess`
  Throws:
    `java.lang.IllegalStateException`

### getAttributeValue

    public java.lang.Object getAttributeValue(java.lang.String attributeName)
                                       throws java.lang.IllegalArgumentException,
                                              java.lang.IllegalStateException

  Description copied from interface: `AttributeAccess`
  Return the value of the specified attribute.

  Specified by:
    `getAttributeValue` in interface `AttributeAccess`
  Parameters:
    `attributeName` - the attribute's name
  Returns:
    the attribute's value. Primitive types are wrapped in their respective classes.
  Throws:
    `java.lang.IllegalArgumentException` - (the attribute name is null or is not recognized)
    `java.lang.IllegalStateException` - (the attribute is not populated)

### setAttributeValue

    public void setAttributeValue(java.lang.String attributeName,
                                  java.lang.Object value)
                           throws java.lang.IllegalArgumentException

  Description copied from interface: `AttributeAccess`
  Assign a new value to an attribute.

  Even though some attributes may be read-only in the server implementation, they can be set here nonetheless. This is because value objects are also used as templates for a "query by template". To see which attributes can be set in the server implementation, the client needs to call `getSettableAttributeNames()`.

  Specified by:
    `setAttributeValue` in interface `AttributeAccess`
  Parameters:
    `attributeName` - The attribute's name which shall be changed
    `value` - The attribute's new value. This can either be:
    - An object of the type associated with `attributeName`
    - A wrapper object for a primitive type, e.g. an `Integer` wrapping an `int`
  Throws:
    `java.lang.IllegalArgumentException` - (the attribute name is null or is not recognized, or the value is bad)

### getAttributeNames

    public java.lang.String[] getAttributeNames()

  Description copied from interface: `AttributeAccess`
  Return all attribute names, which are available in this value object.

  The returned names may be used as arguments to the generic methods `getAttributeValue(...)` and `setAttributeValue(...)`.

  This method may be used by generic clients to obtain information on the attributes. It does not say anything about the state of an attribute, i.e. if it is populated or not.

  Specified by:
    `getAttributeNames` in interface `AttributeAccess`
  Returns:
    an array containing all attribute names in no particular order.

### getPopulatedAttributeNames

    public java.lang.String[] getPopulatedAttributeNames()

  Description copied from interface: `AttributeAccess`
  Get the names of all populated attributes.

  Although an attribute is populated, it can be `null`!

  Specified by:
    `getPopulatedAttributeNames` in interface `AttributeAccess`
  Returns:
    names of all poplulated attributes. When no attributes are populated an empty array is returned. It is required to return a subset of the array returned by `getAttributeNames()`.

### isPopulated

    public boolean isPopulated(java.lang.String name)
                        throws java.lang.IllegalArgumentException

  Description copied from interface: `AttributeAccess`
  Check if a specific attribute is populated.

  Specified by:
    `isPopulated` in interface `AttributeAccess`
  Parameters:
    `name` - the name of the attribute which is to be checked for population.
  Returns:
    true, if this attribute is populated, false otherwise.
  Throws:
    `java.lang.IllegalArgumentException` - when there is no attribute with this name.
  See Also:
    `AttributeAccess.isFullyPopulated()`

### isFullyPopulated

    public boolean isFullyPopulated()

  Description copied from interface: `AttributeAccess`
  Return true, if all attributes in this value object are populated.

  Specified by:
    `isFullyPopulated` in interface `AttributeAccess`
  Returns:
    true, if all attributes are populated, false otherwise.
  See Also:
    `AttributeAccess.isPopulated(String attribute)`

### unpopulateAllAttributes

    public void unpopulateAllAttributes()

  Description copied from interface: `AttributeAccess`
  Reset all the attributes to unpopulated.

  Specified by:
    `unpopulateAllAttributes` in interface `AttributeAccess`

### unpopulateAttribute

    public void unpopulateAttribute(java.lang.String attr_name)
                             throws java.lang.IllegalArgumentException

  Description copied from interface: `AttributeAccess`
  Mark a single attribute as unpopulated. After this call getAttribute( String attributeName ) must raise the IllegalStateException.

  Specified by:
    `unpopulateAttribute` in interface `AttributeAccess`
  Parameters:
    `attr_name` - name of the attribute to be unpopulated.
  Throws:
    `java.lang.IllegalArgumentException` - if this is not a valid attribute name.
  See Also:
    `AttributeAccess.unpopulateAllAttributes()`

### getSupportedOptionalAttributeNames

    public java.lang.String[] getSupportedOptionalAttributeNames()

  Description copied from interface: `AttributeAccess`
  Provide run-time support for the discovery of optional attributes.

  Specified by:
    `getSupportedOptionalAttributeNames` in interface `AttributeAccess`
  Returns:
    the names of the optional attributes supported by the server.

### getSupportedSerializerTypes

    public java.lang.String[] getSupportedSerializerTypes()

  Description copied from interface: `SerializerFactory`
  Return all the serializer types than can be created by this factory. This may return an empty array, in case no serializer is implemented.

  Specified by:
    `getSupportedSerializerTypes` in interface `SerializerFactory`
  Returns:
    an array of supported serializer types.

### makeSerializer

    public Serializer makeSerializer(java.lang.String serializerType)
                              throws java.lang.IllegalArgumentException

  Description copied from interface: `SerializerFactory`
  Manufacture a Serializer for the object type inheriting the interface.

  Specified by:
    `makeSerializer` in interface `SerializerFactory`
  Parameters:
    `serializerType` - the class name of the serializer interface that must be created. For example `XmlSerializer.getClass().getName()`
  Returns:
    a serializer matching the serializer type .
  Throws:
    `java.lang.IllegalArgumentException` - if no serializer can be created matching the provided Serializer Type.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD