com.ibm.websphere.management.configservice
Class ConfigServiceHelper

java.lang.Object
  |
  +--com.ibm.websphere.management.configservice.ConfigServiceHelper

public class ConfigServiceHelper
extends java.lang.Object

This class provides various helper methods to build data structures that are used by config service component such as ObjectName, ConfigDataId, and manipulate generic AttributeList data structure.


Constructor Summary
ConfigServiceHelper()
           
 
Method Summary
static boolean checkIfNameValid(java.lang.String aName)
          Check if the specified name is a valid object name.
 ConfigDataId convertObjectNameToConfigDataId(javax.management.ObjectName on)
          Converts an ObjectName of dynamic MBean to the id of its corresponding Config data.
static javax.management.ObjectName createObjectName(javax.management.AttributeList attrList)
          Create an object name from the specified attribute list, the returned ObjectName can be used to identify the config data represented by the specified attribute list, then be used in subsequent calls to ConfigService to further query or modify this config data.
static javax.management.ObjectName createObjectName(ConfigDataId id)
          Create an object name from the specified config data id.
static javax.management.ObjectName createObjectName(ConfigDataId id, java.lang.String type)
          Create an object name from the specified config data id and config data type.
static javax.management.ObjectName createObjectName(ConfigDataId id, java.lang.String type, java.lang.String displayName)
          Create an object name from specified config data id, type and name.
static java.lang.Object getAttributeValue(javax.management.AttributeList attrList, java.lang.String name)
          Return the value of the named attribute.
static ConfigDataId getConfigDataId(javax.management.AttributeList attrList)
          Assign the config data id for the specified attribute list.
static ConfigDataId getConfigDataId(javax.management.ObjectName objName)
          Get the config data id information from the specified ObjectName.
static java.lang.String getConfigDataType(javax.management.ObjectName objName)
          Get the config data type from specified ObjectName
static java.lang.String getDisplayName(javax.management.ObjectName objName)
          Get the config data name from specified ObjectName
static java.util.Properties getObjectLocation(javax.management.ObjectName objName)
          Get the location of the config data.
static javax.management.AttributeList lookup(javax.management.AttributeList attrList, ConfigDataId id)
          Search through the attribute list recursively and look up the attribute list with the specified config data id.
static java.lang.Object removeAttribute(javax.management.AttributeList attrList, java.lang.String name)
          Delete the specified attribute from attribute list.
static void setAttributeValue(javax.management.AttributeList attrList, java.lang.String name, java.lang.Object value)
          Set the attribute value for the specified attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigServiceHelper

public ConfigServiceHelper()
Method Detail

getConfigDataId

public static ConfigDataId getConfigDataId(javax.management.AttributeList attrList)
Assign the config data id for the specified attribute list. If the config id attribute exist already then just return the config data id, otherwise this method assign a local ref id.


getAttributeValue

public static java.lang.Object getAttributeValue(javax.management.AttributeList attrList,
                                                 java.lang.String name)
                                          throws javax.management.AttributeNotFoundException
Return the value of the named attribute.

Parameters:
attrList - the attribute list.
name - the name of attribute.
javax.management.AttributeNotFoundException

setAttributeValue

public static void setAttributeValue(javax.management.AttributeList attrList,
                                     java.lang.String name,
                                     java.lang.Object value)
Set the attribute value for the specified attribute. If the attribute exists, then this method overwrites the attribute value, otherwise it add the attribute to the attribute list.

Parameters:
attrList - the attribute list.
name - the name of attribute.
value - the value of the attribute.

removeAttribute

public static java.lang.Object removeAttribute(javax.management.AttributeList attrList,
                                               java.lang.String name)
Delete the specified attribute from attribute list.

Returns:
the value of the removed attribute.

lookup

public static javax.management.AttributeList lookup(javax.management.AttributeList attrList,
                                                    ConfigDataId id)
Search through the attribute list recursively and look up the attribute list with the specified config data id.

Parameters:
attrList - the attribute list to be checked.
id - the config data id.
Returns:
the nested attribute list that matches the id, null if it is not found.

createObjectName

public static javax.management.ObjectName createObjectName(javax.management.AttributeList attrList)
Create an object name from the specified attribute list, the returned ObjectName can be used to identify the config data represented by the specified attribute list, then be used in subsequent calls to ConfigService to further query or modify this config data.


createObjectName

public static javax.management.ObjectName createObjectName(ConfigDataId id)
Create an object name from the specified config data id.


createObjectName

public static javax.management.ObjectName createObjectName(ConfigDataId id,
                                                           java.lang.String type)
Create an object name from the specified config data id and config data type.


createObjectName

public static javax.management.ObjectName createObjectName(ConfigDataId id,
                                                           java.lang.String type,
                                                           java.lang.String displayName)
Create an object name from specified config data id, type and name.


getConfigDataId

public static ConfigDataId getConfigDataId(javax.management.ObjectName objName)
Get the config data id information from the specified ObjectName.


getConfigDataType

public static java.lang.String getConfigDataType(javax.management.ObjectName objName)
Get the config data type from specified ObjectName


getDisplayName

public static java.lang.String getDisplayName(javax.management.ObjectName objName)
Get the config data name from specified ObjectName


checkIfNameValid

public static boolean checkIfNameValid(java.lang.String aName)
Check if the specified name is a valid object name.


getObjectLocation

public static java.util.Properties getObjectLocation(javax.management.ObjectName objName)
Get the location of the config data.

Parameters:
objName - object name of the object.
Returns:
a Properties object holds the location for the config data. The possible keys are "cell", "node", "server", "cluster", "application".

convertObjectNameToConfigDataId

public ConfigDataId convertObjectNameToConfigDataId(javax.management.ObjectName on)
Converts an ObjectName of dynamic MBean to the id of its corresponding Config data. Note this method doesn't check the existance of ObjectName or config data id. This method just does the format conversion. User can call the queryConfigObjects method on ConfigService to verify if the config data really exists.

Parameters:
on - the ObjectName of a dynamic MBean.
Returns:
the id of MBean's Config data which can be used to query its detailed configuration information with ConfigService API.


 

WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.

 

IBM is a trademark of the IBM Corporation in the United States, other countries, or both.