com.ibm.websphere.management.configservice
Class ConfigServiceHelper
- java.lang.Object
-
- com.ibm.websphere.management.configservice.ConfigServiceHelper
-
public class ConfigServiceHelper extends java.lang.ObjectThis class provides various helper methods to build data structures that are used by config service component such asObjectName,ConfigDataId, and manipulate genericAttributeListdata structure.
-
-
Constructor Summary
Constructors Constructor and Description ConfigServiceHelper()
-
Method Summary
Methods Modifier and Type Method and Description static booleancheckIfNameValid(java.lang.String aName)Check if the specified name is a valid object name.static ConfigDataIdconvertObjectNameToConfigDataId(javax.management.ObjectName on)Converts anObjectNameof dynamic MBean to the id of its corresponding Config data.static javax.management.ObjectNamecreateObjectName(javax.management.AttributeList attrList)Create an object name from the specified attribute list, the returnedObjectNamecan 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.ObjectNamecreateObjectName(ConfigDataId id)Create an object name from the specified config data id.static javax.management.ObjectNamecreateObjectName(ConfigDataId id, java.lang.String type)Create an object name from the specified config data id and config data type.static javax.management.ObjectNamecreateObjectName(ConfigDataId id, java.lang.String type, java.lang.String displayName)Create an object name from specified config data id, type and name.static javax.management.ObjectNamecreateObjectName(java.util.Properties props)create ObjectName using propertiesstatic javax.management.ObjectNamecreateObjectName(java.lang.String domain, java.util.Properties props)static java.lang.ObjectgetAttributeValue(javax.management.AttributeList attrList, java.lang.String name)Return the value of the named attribute.static ConfigDataIdgetConfigDataId(javax.management.AttributeList attrList)Assign the config data id for the specified attribute list.static ConfigDataIdgetConfigDataId(javax.management.ObjectName objName)Get the config data id information from the specifiedObjectName.static java.lang.StringgetConfigDataType(javax.management.ObjectName objName)Get the config data type from specifiedObjectNamestatic java.lang.StringgetDisplayName(javax.management.ObjectName objName)Get the config data name from specifiedObjectNamestatic java.util.PropertiesgetObjectLocation(javax.management.ObjectName objName)Get the location of the config data.static javax.management.AttributeListlookup(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.ObjectremoveAttribute(javax.management.AttributeList attrList, java.lang.String name)Delete the specified attribute from attribute list.static voidsetAttributeValue(javax.management.AttributeList attrList, java.lang.String name, java.lang.Object value)Set the attribute value for the specified attribute.
-
-
-
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.AttributeNotFoundExceptionReturn the value of the named attribute.- Parameters:
attrList- the attribute list.name- the name of attribute.- Throws:
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 returnedObjectNamecan 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 specifiedObjectName.
-
getConfigDataType
public static java.lang.String getConfigDataType(javax.management.ObjectName objName)
Get the config data type from specifiedObjectName
-
getDisplayName
public static java.lang.String getDisplayName(javax.management.ObjectName objName)
Get the config data name from specifiedObjectName
-
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", "versions", "serverTypes".
-
convertObjectNameToConfigDataId
public static ConfigDataId convertObjectNameToConfigDataId(javax.management.ObjectName on)
Converts anObjectNameof 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- theObjectNameof a dynamic MBean.- Returns:
- the id of MBean's Config data which can be used to query its detailed configuration information with ConfigService API.
-
createObjectName
public static javax.management.ObjectName createObjectName(java.util.Properties props) throws javax.management.MalformedObjectNameExceptioncreate ObjectName using properties- Throws:
javax.management.MalformedObjectNameException
-
createObjectName
public static javax.management.ObjectName createObjectName(java.lang.String domain, java.util.Properties props) throws javax.management.MalformedObjectNameException- Throws:
javax.management.MalformedObjectNameException
-
-