public class ConfigServiceProxy extends java.lang.Object implements ConfigService
ConfigService MBean in the server.
As config service is implemented as a MBean in the server, all the method calls on the MBean have to go through
invoke method which is cumbersome and error prone.
This the a helper class to allow user using remote config service component more easily.| Constructor and Description |
|---|
ConfigServiceProxy(AdminClient adminClient)
Constructor a proxy object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addElement(Session inSession,
javax.management.ObjectName configData,
java.lang.String attribute,
java.lang.Object element,
int position)
Add an element into a collection type attribute of a config data.
|
void |
clearServerPortCache(Session session)
Clear the cache in the session used for a server port resolution
|
javax.management.ObjectName |
createConfigData(Session inSession,
javax.management.ObjectName parent,
java.lang.String attributeName,
java.lang.String type,
javax.management.AttributeList attrList)
create a Config Data.
|
javax.management.ObjectName |
createConfigDataByTemplate(Session inSession,
javax.management.ObjectName parent,
java.lang.String attributeName,
javax.management.AttributeList attrList,
javax.management.ObjectName template)
Create a config data based on specified template.
|
void |
deleteConfigData(Session inSession,
javax.management.ObjectName configData)
Delete the specified config data and its children.
|
void |
discard(Session session)
Discard changes made in the session since the last save or discard call.
|
AdminClient |
getAdminClient()
return the AdminClient object that this proxy uses to communicate with remote server.
|
java.lang.Object |
getAttribute(Session inSession,
javax.management.ObjectName configData,
java.lang.String attribute)
Get the attribute value of the specified config data.
|
java.lang.Object |
getAttribute(Session session,
javax.management.ObjectName configData,
java.lang.String attribute,
boolean recursive)
Get the attribute value of the specified config data.
|
javax.management.AttributeList |
getAttributes(Session inSession,
javax.management.ObjectName configData,
java.lang.String[] attributes,
boolean recursive)
Get the attribute values of the config data.
|
javax.management.AttributeList |
getAttributesMetaInfo(java.lang.String configDataType)
Get the meta information about the attributes of specified config data type.
|
java.util.Map |
getConflictDocuments(Session session)
Get the list of documents that have conflict updates made by other sessions.
|
javax.management.ObjectName[] |
getRelationship(Session inSession,
javax.management.ObjectName configData,
java.lang.String relationship)
Get the relationship value of the specified config object and relationship name.
|
javax.management.AttributeList |
getRelationships(Session inSession,
javax.management.ObjectName configData,
java.lang.String[] relationshipNames)
Get the named relationship values of specified config object.
|
javax.management.AttributeList |
getRelationshipsMetaInfo(java.lang.String configObjectType)
Get the meta information about the relationships of specified config data type, such as the type of the
relationship value, the multiplicity of the relationship value etc.
|
java.lang.String[] |
getSupportedConfigObjectTypes()
returns the list of supported Config object types.
|
java.lang.String[] |
getUnsavedChanges(Session session)
Get all the documents that changed in the session after last save or discard call.
|
javax.management.ObjectName[] |
queryConfigObjects(Session inSession,
javax.management.ObjectName scope,
javax.management.ObjectName name,
javax.management.QueryExp query)
The query method for config data in the config repository.
|
javax.management.ObjectName[] |
queryConfigObjectsAtCurrentScope(Session inSession,
javax.management.ObjectName scope,
java.lang.String type)
The query method for config data in the config repository
|
javax.management.ObjectName[] |
queryTemplates(Session inSession,
java.lang.String type)
The query method for templates.
|
void |
removeElement(Session inSession,
javax.management.ObjectName configData,
java.lang.String attribute,
java.lang.Object element)
Remove an element from collection type attribute of a config data.
|
void |
resetAttributes(Session inSession,
javax.management.ObjectName configData,
javax.management.AttributeList attrList)
Reset the attributes for the config data.
|
javax.management.ObjectName[] |
resolve(Session inSession,
javax.management.ObjectName scope,
java.lang.String containmentPath)
Resolve the config object based on the specified containment path.
|
javax.management.ObjectName[] |
resolve(Session inSession,
java.lang.String containmentPath)
Resolve the config object based on the specified containment path.
|
void |
save(Session session,
boolean overwriteOnConflict)
Save the changes made in the session to config repository.
|
void |
setAttributes(Session inSession,
javax.management.ObjectName configData,
javax.management.AttributeList attrList)
Modify attributes of the specified config data.
|
void |
setProperties(Session session,
java.util.HashMap props)
Set properties that associates with the specified session.
|
void |
unsetAttributes(Session inSession,
javax.management.ObjectName configData,
java.lang.String[] attributes)
Clear the specified attributes from the config data.
|
ValidationResult |
validate(Session session,
javax.management.ObjectName scope)
Validate the configuration within the specified scope.
|
public ConfigServiceProxy(AdminClient adminClient) throws javax.management.InstanceNotFoundException, ConnectorException
adminClient - an AdminClient object that this proxy uses to communicate with remote server.javax.management.InstanceNotFoundExceptionConnectorExceptionpublic AdminClient getAdminClient()
public void setProperties(Session session, java.util.HashMap props) throws ConfigServiceException, ConnectorException
ConfigServicesetProperties in interface ConfigServicesession - session id.props - the session property. SessionPropertyConstants for valid session property key.ConfigServiceExceptionConnectorExceptionpublic ValidationResult validate(Session session, javax.management.ObjectName scope) throws ConfigServiceException, ConnectorException
ConfigServicevalidate in interface ConfigServicesession - session id.scope - the scope of validation. Scope can be the ObjectName of a cell, node or server.
if null is specified, then whole repository will be validated. If any other type object is specified, use its nearest ancestor that
can be a valid scope.ConfigServiceExceptionConnectorExceptionpublic void save(Session session, boolean overwriteOnConflict) throws ConfigServiceException, ConnectorException
ConfigServicesave in interface ConfigServicesession - the session id.overwriteOnConflict - overwrite if there is any conflict detected during saving.ConfigServiceExceptionConnectorExceptionpublic void discard(Session session) throws ConfigServiceException, ConnectorException
ConfigServicediscard in interface ConfigServicesession - the session id.ConfigServiceExceptionConnectorExceptionpublic java.lang.String[] getUnsavedChanges(Session session) throws ConfigServiceException, ConnectorException
ConfigServicegetUnsavedChanges in interface ConfigServicesession - the session id.ConfigServiceExceptionConnectorExceptionpublic void clearServerPortCache(Session session) throws ConfigServiceException, ConnectorException
ConfigServiceclearServerPortCache in interface ConfigServicesession - the session id.ConfigServiceExceptionConnectorExceptionpublic java.util.Map getConflictDocuments(Session session) throws ConfigServiceException, ConnectorException
ConfigServicegetConflictDocuments in interface ConfigServicesession - the session id.ConfigServiceExceptionConnectorExceptionpublic java.lang.String[] getSupportedConfigObjectTypes()
throws ConfigServiceException,
ConnectorException
getSupportedConfigObjectTypes in interface ConfigServiceConfigServiceExceptionConnectorExceptionpublic javax.management.AttributeList getAttributesMetaInfo(java.lang.String configDataType)
throws ConfigServiceException,
ConnectorException
ConfigServicegetAttributesMetaInfo in interface ConfigServiceconfigDataType - the type of the config data.ConfigServiceExceptionConnectorExceptionpublic javax.management.AttributeList getRelationshipsMetaInfo(java.lang.String configObjectType)
throws ConfigServiceException,
ConnectorException
ConfigServicegetRelationshipsMetaInfo in interface ConfigServiceconfigObjectType - config ojbect type. It must be one of the types returned
from getSupportedConfigObjectTypes method.ConfigServiceExceptionConnectorExceptionpublic javax.management.ObjectName[] queryConfigObjects(Session inSession, javax.management.ObjectName scope, javax.management.ObjectName name, javax.management.QueryExp query) throws ConfigServiceException, ConnectorException
ConfigServicequeryConfigObjects in interface ConfigServicescope - the scope of query. It may be an ObjectName of a cell, node or server. Whole repository will be
queried if scope is null.name - the object name pattern that identifies MBeans to be returned.
SystemAttributes._WEBSPHERE_CONFIG_DATA_TYPE is required
to minimize the scope of query. SystemAttributes._WEBSPHERE_CONFIG_DATA_TYPE
must be one the supported config object types it presentsquery - The query expression to be applied for selecting config ojbects.
If null is specified, no query expression will be applied for selecting config objects.
Current implementation only supports null input.ConfigServiceExceptionConnectorExceptionpublic javax.management.ObjectName[] queryConfigObjectsAtCurrentScope(Session inSession, javax.management.ObjectName scope, java.lang.String type) throws ConfigServiceException, ConnectorException
ConfigServicequeryConfigObjectsAtCurrentScope in interface ConfigServicescope - the scope of query. It may be an ObjectName of a cell, node, server or cluster. It only queries the given scopetype - the config object type. It must be one the supported config object type.ConfigServiceExceptionConnectorExceptionpublic javax.management.ObjectName[] queryTemplates(Session inSession, java.lang.String type) throws ConfigServiceException, ConnectorException
ConfigServicequeryTemplates in interface ConfigServiceinSession - the seesion id.type - the type of template.ConfigServiceExceptionConnectorExceptionpublic javax.management.ObjectName[] resolve(Session inSession, java.lang.String containmentPath) throws ConfigServiceException, ConnectorException
ConfigServiceresolve in interface ConfigServiceinSession - the seesion id.containmentPath - the containment path of config data.
The format this arguemnt is type=name:type=name:...
For example, Node=node1:Server=process1:Application=myAppServer.
The type is the config data type, name if the config data name. The name
field is optional. If name is not specified, then only type is matched.
The name field may be double quoted. If the name field is not quoted,
then the space around of value field will be trimed.ConfigServiceExceptionConnectorExceptionpublic javax.management.ObjectName[] resolve(Session inSession, javax.management.ObjectName scope, java.lang.String containmentPath) throws ConfigServiceException, ConnectorException
ConfigServiceresolve in interface ConfigServiceinSession - the seesion id.scope - the scope of resolve. It may be an ObjectName of a cell, node or server. Whole repository will be
queried if scope is nullcontainmentPath - the containment path of config data.
The format this arguemnt is type=name:type=name:...
For example, Node=node1:Server=process1:Application=myAppServer.
The type is the config data type, name if the config data name. The name
field is optional. If name is not specified, then only type is matched.
The name field may be double quoted. If the name field is not quoted,
then the space around of value field will be trimed.ConfigServiceExceptionConnectorExceptionpublic javax.management.ObjectName createConfigDataByTemplate(Session inSession, javax.management.ObjectName parent, java.lang.String attributeName, javax.management.AttributeList attrList, javax.management.ObjectName template) throws ConfigServiceException, ConnectorException
ConfigServicecreateConfigDataByTemplate in interface ConfigServiceinSession - the seesion id.parent - the ObjectName of the parent config data.attributeName - - the name of the relationship or attribute name between the parent and child config data.attrList - - the AttributeList of created config object.template - - the template to be used during creation. Use system default template
if null is supplied. The template can be one of the template returned
from queryTemplates call, but it can be a config object or data in the
repository.ConfigServiceExceptionConnectorExceptionpublic javax.management.ObjectName createConfigData(Session inSession, javax.management.ObjectName parent, java.lang.String attributeName, java.lang.String type, javax.management.AttributeList attrList) throws ConfigServiceException, ConnectorException
ConfigServicecreateConfigData in interface ConfigServiceinSession - the seesion id.parent - the id of the parent config data.attributeName - the name of the relationship or attribute between the parent and child config data.type - the type of created config data. The type can be the type
of the attribute specified in the attribute meta info, it
can also be one of the subtypes listed in the attribute
_ATTRIBUTE_METAINFO_SUBTYPES in the meta info of the attribute.attrList - the AttributeList of created config object.ConfigServiceExceptionConnectorExceptionpublic void setAttributes(Session inSession, javax.management.ObjectName configData, javax.management.AttributeList attrList) throws ConfigServiceException, ConnectorException
ConfigServicesetAttributes in interface ConfigServiceinSession - the seesion id.configData - - the ObjectName of the config data.attrList - - the AttributeList that contains the list of attributes to be modified.ConfigServiceExceptionConnectorExceptionpublic void addElement(Session inSession, javax.management.ObjectName configData, java.lang.String attribute, java.lang.Object element, int position) throws ConfigServiceException, ConnectorException
ConfigServiceaddElement in interface ConfigServiceinSession - the seesion id.configData - the ObjectName of the config data.attribute - the name of the attribute.element - the value of the element. It might be a primary data type, an attribute list
or a object reference.position - the position added in the list. Element will be appended at the end if -1.ConfigServiceExceptionConnectorExceptionpublic void removeElement(Session inSession, javax.management.ObjectName configData, java.lang.String attribute, java.lang.Object element) throws ConfigServiceException, ConnectorException
ConfigServiceremoveElement in interface ConfigServiceinSession - the seesion idconfigData - the ObjectName of the config data.attribute - the name of the attribute.element - the ObjectName of the element. In case of primitive data type, it should be the element value itself.ConfigServiceExceptionConnectorExceptionpublic void unsetAttributes(Session inSession, javax.management.ObjectName configData, java.lang.String[] attributes) throws ConfigServiceException, ConnectorException
ConfigServiceunsetAttributes in interface ConfigServiceinSession - the seesion id.configData - the object name of the config data.attributes - an array of attributes to be cleared.ConfigServiceExceptionConnectorExceptionpublic void resetAttributes(Session inSession, javax.management.ObjectName configData, javax.management.AttributeList attrList) throws ConfigServiceException, ConnectorException
ConfigServiceresetAttributes in interface ConfigServiceinSession - the seesion id.configData - the ObjectName of the config object.attrList - the value of attribute list.ConfigServiceExceptionConnectorExceptionpublic javax.management.AttributeList getAttributes(Session inSession, javax.management.ObjectName configData, java.lang.String[] attributes, boolean recursive) throws ConfigServiceException, ConnectorException
ConfigServicegetAttributes in interface ConfigServiceinSession - the seesion id.configData - ObjectName of config data.attributes - an array of attribute names whose value should be returned.
null means all the attributes.recursive - returns a nested attribute list as the value of nested config data attribute if set to be true;
return the ObjectName of nested config data as the value of nested config data attribute if set to be false.ConfigServiceExceptionConnectorExceptionpublic java.lang.Object getAttribute(Session inSession, javax.management.ObjectName configData, java.lang.String attribute) throws ConfigServiceException, ConnectorException
ConfigServicegetAttribute in interface ConfigServiceinSession - the seesion id.configData - the ObjectName of the config data.attribute - an attribute name.ConfigServiceExceptionConnectorExceptionpublic java.lang.Object getAttribute(Session session, javax.management.ObjectName configData, java.lang.String attribute, boolean recursive) throws ConfigServiceException, ConnectorException
ConfigServicegetAttribute in interface ConfigServicesession - the seesion id.configData - the ObjectName of the config data.attribute - an attribute name.recursive - returns a attribute values as the value of nested config data attribute if set to be true;
return the Object of config data if set to be false.ConfigServiceExceptionConnectorExceptionpublic void deleteConfigData(Session inSession, javax.management.ObjectName configData) throws ConfigServiceException, ConnectorException
ConfigServicedeleteConfigData in interface ConfigServiceinSession - the seesion id.configData - ObjectName of the config data.ConfigServiceExceptionConnectorExceptionpublic javax.management.AttributeList getRelationships(Session inSession, javax.management.ObjectName configData, java.lang.String[] relationshipNames) throws ConfigServiceException, ConnectorException
ConfigServiceThis method skips invalid relationship name instead of throwing exception like getAttributes.
getRelationships in interface ConfigServiceinSession - the seesion id.configData - ObjectName of the config data.relationshipNames - an array of the relationship names.AttributeList. The name of
the Attribute is a relationship name and the value of the
the Attribute is the value of the relationship which is represented in a form of ObjectName.ConfigServiceExceptionConnectorExceptionpublic javax.management.ObjectName[] getRelationship(Session inSession, javax.management.ObjectName configData, java.lang.String relationship) throws ConfigServiceException, ConnectorException
ConfigServicegetRelationship in interface ConfigServiceinSession - the seesion id.configData - ObjectName of the config data.relationship - the name of the relationship.ConfigServiceExceptionConnectorException