com.sun.management.oss
Interface AttributeAccess

All Superinterfaces:
java.lang.Cloneable, java.io.Serializable
All Known Subinterfaces:
IRPEvent, ManagedEntityValue, OperationalStatusDataAvailableEvent, OperationalStatusDataEvent, OperationalStatusMonitorByClassesValue, OperationalStatusMonitorByObjectsValue, OperationalStatusMonitorValue, PerformanceDataAvailableEvent, PerformanceDataEvent, PerformanceMonitorByClassesValue, PerformanceMonitorByObjectsValue, PerformanceMonitorValue, QueryByDNValue, QueryByDNValue, QueryOperationalStatusMonitorValue, QueryPerformanceMonitorValue, QueryValue
All Known Implementing Classes:
AttributeAccessImpl, IRPEventImpl, ManagedEntityValueImpl, OperationalStatusDataAvailableEventImpl, OperationalStatusDataEventImpl, OperationalStatusMonitorByClassesValueImpl, OperationalStatusMonitorByObjectsValueImpl, OperationalStatusMonitorValueImpl, PerformanceDataAvailableEventImpl, PerformanceDataEventImpl, PerformanceMonitorByClassesValueImpl, PerformanceMonitorByObjectsValueImpl, PerformanceMonitorValueImpl, QueryByDNValueImpl, QueryByDNValueImpl, QueryOperationalStatusMonitorValueImpl, QueryPerformanceMonitorValueImpl, QueryValueImpl

public interface AttributeAccess
extends java.io.Serializable, java.lang.Cloneable

Base interface from which all Value objects must be derived. Represents both an attribute dirty marker and a generic attribute accessor. Classes implementing a value interface provide several ways to access the attributes:

A client needs to know which attributes exist in order to provide correct attributeNames. It can get this information with a call to public String[] getAttributeNames().

An attribute may or may not be populated with a value. An attribute is populated by calling public void setAttributeValue(...). A client can determine if an attribute is populated by calling public boolean isPopulated(String attributeName).


Method Summary
 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.
 boolean isFullyPopulated()
          Return true, if all attributes in this value object are populated.
 boolean isPopulated(java.lang.String attributeName)
          Check if a specific attribute is populated.
 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 attributeName)
          Mark a single attribute as unpopulated.
 

Method Detail

getAttributeValues

public java.util.Map getAttributeValues(java.lang.String[] attributeNames)
                                 throws java.lang.IllegalArgumentException,
                                        java.lang.IllegalStateException,
                                        UnsupportedAttributeException
Get multiple attribute values given an array of attribute names.

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)
UnsupportedAttributeException - (if one of the attributes is not supported)

setAttributeValues

public void setAttributeValues(java.util.Map attributeNamesAndValuePairs)
                        throws java.lang.IllegalArgumentException,
                               UnsupportedAttributeException
Set multiple attribute values.

Parameters:
attributeNamesAndValuePairs -
Throws:
java.lang.IllegalArgumentException - (one of the attributes is not well formed or unrecognized)
UnsupportedAttributeException - (one of the attributes is optional and is not supported)

getAllPopulatedAttributes

public java.util.Map getAllPopulatedAttributes()
Get all populated attribute values. If no attributes are populated an empty Map is returned.


getAttributeValue

public java.lang.Object getAttributeValue(java.lang.String attributeName)
                                   throws java.lang.IllegalArgumentException,
                                          java.lang.IllegalStateException,
                                          UnsupportedAttributeException
Return the value of the specified attribute.

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)
UnsupportedAttributeException - (the attribute is optional and not supported)

setAttributeValue

public void setAttributeValue(java.lang.String attributeName,
                              java.lang.Object value)
                       throws java.lang.IllegalArgumentException,
                              UnsupportedAttributeException
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().

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)
UnsupportedAttributeException - (the attribute is optional and is not supported)

getAttributeNames

public java.lang.String[] getAttributeNames()
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.

Returns:
an array containing all attribute names in no particular order.

getPopulatedAttributeNames

public java.lang.String[] getPopulatedAttributeNames()
Get the names of all populated attributes.

Although an attribute is populated, it can be null!

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 attributeName)
                    throws java.lang.IllegalArgumentException
Check if a specific attribute is populated.

Parameters:
attributeName - 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:
isFullyPopulated()

isFullyPopulated

public boolean isFullyPopulated()
Return true, if all attributes in this value object are populated.

Returns:
true, if all attributes are populated, false otherwise.
See Also:
isPopulated(String attribute)

unpopulateAllAttributes

public void unpopulateAllAttributes()
Reset all the attributes to unpopulated.


unpopulateAttribute

public void unpopulateAttribute(java.lang.String attributeName)
                         throws java.lang.IllegalArgumentException
Mark a single attribute as unpopulated. After this call getAttribute( String attributeName ) must raise the IllegalStateException.

Parameters:
attributeName - name of the attribute to be unpopulated.
Throws:
java.lang.IllegalArgumentException - if this is not a valid attribute name.
See Also:
unpopulateAllAttributes()

getSupportedOptionalAttributeNames

public java.lang.String[] getSupportedOptionalAttributeNames()
Provide run-time support for the discovery of optional attributes.

Returns:
the names of the optional attributes supported by the server.