com.ibm.websphere.pmi.client
Class PmiClient

java.lang.Object
  |
  +--com.ibm.websphere.pmi.client.PmiClient
All Implemented Interfaces:
PmiConstants

public class PmiClient
extends java.lang.Object
implements PmiConstants

The PmiClient class is called by client application to access performance data. The purpose is to free the programmer from implementing the remote data access manually.

The class has two set of APIs. One set of APIs are 4.0 APIs, that use PerfDescriptor to get PMI data and the returned PMI data are CpdData/CpdCollection objects. In both 3.5.5+ and 4.0, the PmiClient API looks up a session bean in adminserver and invokes remote APIs on the session bean.

Another set of APIs are JMX-based API new in 5.0. The new APIs use ObjectName/MBeanStatDescriptor" to get PMI data via JMX interface.

A brief calling flow is shown here. Details can be found in InfoCenter and sample code. First, a client application needs create an instance of the PmiClient object by passing the correct host name, port number, version name, and JMX connector types. If the PmiClient instance is successfully created, you are ready to call the methods on it to retrieve the data. You need to set the instrumentation level to enable the data for the first time because PMI data is disabled by default. You can call various list methods to navigate the WebSphere domain for nodes, servers, MBeans (or PerfDescriptor for 4.0 API). If you know the names for the node, server, PMI module, or data, you can call pmiClient to create the MBeanStatDescriptor (or PerfDescriptor for 4.0 API) object. Once you get the ObjectName, MBeansStatDescriptor, or PerfDescriptor, you can call the corresponding getXXX methods to get the PMI data.

Note that the setInstrumentationLevel method changes the level at the server side which means it effects other clients monitoring the same server.

Both 4.0 APIs and 5.0 APIs will be supported in 5.0. However, since the returned data are in different types when using 4.0 and 5.0 APIs, it is recommanded that you do not mix the two APIs together.


Field Summary
static java.lang.String COPYRIGHT
           
static java.lang.String DEFAULT_CONNECTOR_PORT
           
static java.lang.String DEFAULT_CONNECTOR_TYPE
           
static int FAILED_TO_CREATE_PMISERVICE_BEAN_OBJECT
           
static int FAILED_TO_DISABLE_DATA
           
static int FAILED_TO_ENABLE_DATA
           
static int FAILED_TO_GET_ADMIN_STATE
           
static int FAILED_TO_GET_DATA
           
static int FAILED_TO_GET_INITIAL_CONTEXT
           
static int FAILED_TO_GET_LEVEL
           
static int FAILED_TO_LIST_MEMBERS
           
static int FAILED_TO_LIST_NODES
           
static int FAILED_TO_LIST_SERVERS
           
static int FAILED_TO_SET_LEVEL
           
static java.util.HashMap moduleNLSMap
           
static int NO_COLLECTOR_FOUND
           
static int NO_ERROR
           
static int NO_PERFMBEAN_FOUND
           
static int NO_SUCH_A_NODE
           
static int NO_SUCH_A_SERVER
           
static com.ibm.ejs.sm.client.ui.NLS pmiNLS
           
static java.util.HashMap prefixNLSMap
           
static java.lang.String SEPERATOR40
           
static java.lang.String SEPERATOR50
           
static int SERVER_STOPPED
           
static java.lang.String VERSION_AE
           
static java.lang.String VERSION_AES
           
static java.lang.String VERSION_EPM
           
static java.lang.String VERSION_WAS50
           
static java.lang.String VERSION_WAS50ND
           
 
Fields inherited from interface com.ibm.websphere.pmi.PmiConstants
AE_35, AE_40, AES_40, ALL_DATA, APPSERVER_MODULE, BEAN_METHODS_SUBMODULE, BEAN_MODULE, CACHE_MODULE, COLLECTION_DESC, CONNPOOL_MODULE, DEFAULT_MODULE_PREFIX, EJB_ENTITY, EJB_MESSAGEDRIVEN, EJB_STATEFUL, EJB_STATELESS, INITIALIZATION_FAILED, INITIALIZING, INTERCEPTOR_SUBMODULE, J2C_CF, J2C_DS, J2C_JMS_CONNECTIONS, J2C_MODULE, JAVA_TIME_CONVERT_RATIO, JVMPI_MODULE, LEVEL_DISABLE, LEVEL_ENABLE, LEVEL_HIGH, LEVEL_HIGH_STRING, LEVEL_LOW, LEVEL_LOW_STRING, LEVEL_MAX, LEVEL_MAX_STRING, LEVEL_MEDIUM, LEVEL_MEDIUM_STRING, LEVEL_NONE, LEVEL_NONE_STRING, LEVEL_UNDEFINED, LOAD_AVG, LOST_CONTACT, METHODS_SUBMODULE_SHORTNAME, MSG_BUNDLE, NOT_IN_SUBMODULE, ORBPERF_MODULE, PMI_DISABLE_STRING, ROOT_DESC, ROOT_NAME, RUNNING, RUNTIME_MODULE, SERVLET_SUBMODULE, SERVLETS_SUBMODULE_SHORTNAME, SESSIONS_MODULE, STOPPED, SYSTEM_MODULE, TEMPLATE_SUBMODULE, TERMINATING, THREADPOOL_MODULE, TRAN_MODULE, TYPE_CATEGORY, TYPE_COLLECTION, TYPE_DATA, TYPE_DOUBLE, TYPE_INSTANCE, TYPE_INT, TYPE_INVALID, TYPE_LOAD, TYPE_LONG, TYPE_MODULE, TYPE_MODULEROOT, TYPE_NODE, TYPE_ROOT, TYPE_SERVER, TYPE_STAT, TYPE_SUBINSTANCE, TYPE_SUBMODULE, TYPE_UNDEFINED, UNINITIALIZED, UNKNOWN_ID, WEBAPP_MODULE, WEBSERVICES_MODULE, WEBSERVICES_SUBMODULE, WLM_CLIENT_MODULE, WLM_MODULE, WLM_SERVER_MODULE, WSGW_MODULE, XML_COLLECTION, XML_COUNT, XML_CREATETIME, XML_DOUBLE, XML_ENDCOLLECTION, XML_ENDLINE, XML_ENDMODULE, XML_ENDNODE, XML_ENDSERVER, XML_ENDTAG, XML_ID, XML_INT, XML_INTEGRAL, XML_LASTVALUE, XML_LOAD, XML_LONG, XML_MODULE, XML_NAME, XML_NODE, XML_QUOTE, XML_SERVER, XML_START, XML_STAT, XML_SUMOFSQUARES, XML_TIME, XML_TOTAL, XML_VALUE, XML_VIEW
 
Constructor Summary
PmiClient()
          Constructor: assume all defaults: local host, port DEFAULT_CONNECTOR_PORT, and WAS50 version.
PmiClient(boolean inAppServer)
          Use this constructor only when you are calling it inside an appserver.
PmiClient(java.util.Properties props, java.lang.String version)
          Constructor: take a Properties and the version.
PmiClient(java.lang.String host, java.lang.String port)
          Constructor:
PmiClient(java.lang.String host, java.lang.String port, java.lang.String version)
          Constructor: take host, port, and version.
PmiClient(java.lang.String host, java.lang.String port, java.lang.String version, boolean inAppServer, java.lang.String connectorType)
          Constructor: take host, port, and version.
PmiClient(java.lang.String host, java.lang.String nodeName, java.lang.String port, java.lang.String version)
          Constructor: take host, nodeName, port, and version.
 
Method Summary
 void add(PerfDescriptor pd)
          4.0 API.
 CpdCollection createCpdCollection(PerfDescriptor colPd, com.ibm.ws.pmi.wire.WpdCollection wCol)
          4.0 API: create a CpdCollection object from WpdCollection
static CpdData createCpdData(PmiModuleConfig moduleConfig, PerfDescriptor parent, com.ibm.ws.pmi.wire.WpdData wData)
          4.0 API: create a CpdData object from WpdData
static com.ibm.websphere.pmi.stat.MBeanLevelSpec createMBeanLevelSpec(javax.management.ObjectName oname, int level)
          5.0 API: Create an MBeanLevelSpec object.
static com.ibm.websphere.pmi.stat.MBeanLevelSpec createMBeanLevelSpec(javax.management.ObjectName oname, com.ibm.websphere.pmi.stat.StatDescriptor sd, int level)
          5.0 API: Create an MBeanLevelSpec object.
static PerfDescriptor createPerfDescriptor()
          4.0 API.
static PerfDescriptor createPerfDescriptor(PerfDescriptor parent, int dataId)
          4.0 API.
static PerfDescriptor createPerfDescriptor(PerfDescriptor parent, int[] dataIds)
          4.0 API.
static PerfDescriptor createPerfDescriptor(PerfDescriptor parent, java.lang.String name)
          4.0 API.
static PerfDescriptor createPerfDescriptor(java.lang.String qualifiedDataPath)
          4.0 API.
static PerfDescriptor createPerfDescriptor(java.lang.String[] dataPath)
          4.0 API.
static PerfDescriptor createPerfDescriptor(java.lang.String[] dataPath, int dataId)
          4.0 API.
static PerfDescriptor createPerfDescriptor(java.lang.String[] dataPath, int[] dataIds)
          4.0 API.
static PerfDescriptor createPerfDescriptor(java.lang.String qualifiedDataPath, int dataId)
          4.0 API.
static PerfDescriptor createPerfDescriptor(java.lang.String qualifiedDataPath, int[] dataIds)
          4.0 API.
 PerfLevelSpec createPerfLevelSpec(int level)
          4.0 API.
 PerfLevelSpec createPerfLevelSpec(java.lang.String[] path, int level)
          4.0 API.
static CpdCollection createRootCollection()
          4.0 API: Create the root collection for the domain
 void end()
          Call this method before and ONLY before you are done with PmiClient
static PmiModuleConfig findConfig(PmiModuleConfig[] configs, javax.management.ObjectName on)
          Return the config for the MBean ObjectName
static PmiModuleConfig findConfig(PmiModuleConfig[] configs, java.lang.String moduleID)
          Return the config for the moduleID
 CpdCollection get(PerfDescriptor pd, boolean recursive)
          4.0 API: Get PMI data.
 int getAdminState(java.lang.String nodeName)
          Get the administratio state of the node, i.e., start or stop.
 int getAdminState(java.lang.String nodeName, java.lang.String serverName)
          Get the administratio state of the server, i.e., start or stop.
 PmiModuleConfig getConfig(java.lang.String moduleName)
          Return PmiModuleConfig for the module.
 PmiModuleConfig getConfig(java.lang.String nodeName, java.lang.String serverName, javax.management.ObjectName oName)
          5.0 API: Get PmiModuleConfig for a particular MBean.
 PmiModuleConfig getConfig(java.lang.String nodeName, java.lang.String serverName, java.lang.String moduleName)
          Get PmiModuleConfig for a particular PMI module.
 PmiModuleConfig[] getConfigs()
          Get an array of PmiModuleConfig for all the PMI modules.
 PmiModuleConfig[] getConfigs(java.lang.String nodeName, java.lang.String serverName)
          5.0 API: Get all PmiModuleConfigs for the server.
 java.lang.String getConnectedHost()
          Return the connected host name: it should be the name of host name passed to PmiClient or the actual localhost name if "localhost" is passed to PmiClient.
 int getDataId(java.lang.String moduleName, java.lang.String dataName)
          Convert data name to dataId
 java.lang.String getDataName(java.lang.String moduleName, int dataId)
          Convert data id to data name
 int getErrorCode()
          Check the error code, which could be one of the error constants defined in this class.
 int getErrorCode(java.lang.String nodeName)
          Check the error code, which could be one of the error constants defined in this class.
 java.lang.String getErrorMessage()
          Check the error message.
 java.lang.String getErrorMessage(java.lang.String nodeName)
          Check the error message.
 PerfLevelSpec[] getInstrumentationLevel(java.lang.String nodeName, java.lang.String serverName)
          4.0 API.
static java.lang.String getNLSValue(java.lang.String key)
          Deprecated. Replaced by getNLSValue (key, moduleID)
static java.lang.String getNLSValue(java.lang.String key, java.lang.String moduleID)
          Get translated key from the resource bundle.
 CpdCollection[] gets(boolean recursive)
          Get all the data you requested by calling add method.
 CpdCollection[] gets(PerfDescriptor[] pds, boolean recursive)
          4.0 API.
 CpdCollection[] gets(PerfDescriptorList pdList, boolean recursive)
          4.0 API.
 com.ibm.websphere.pmi.stat.MBeanLevelSpec[] getStatLevel(java.lang.String nodeName, java.lang.String serverName, com.ibm.websphere.pmi.stat.MBeanStatDescriptor msd, boolean recursive)
          5.0 API: Get MBeanLevelSpec[] based on a MBeanStatDescriptor.
 com.ibm.websphere.pmi.stat.MBeanLevelSpec[] getStatLevel(java.lang.String nodeName, java.lang.String serverName, javax.management.ObjectName oName, boolean recursive)
          5.0 API: Get MBeanLevelSpec[] based on an ObjectName.
 com.ibm.websphere.pmi.stat.Stats[] getStats(java.lang.String nodeName, java.lang.String serverName, com.ibm.websphere.pmi.stat.MBeanStatDescriptor[] msds, boolean recursive)
          5.0 API: Return an array of Stats objects.
 com.ibm.websphere.pmi.stat.Stats getStats(java.lang.String nodeName, java.lang.String serverName, com.ibm.websphere.pmi.stat.MBeanStatDescriptor msd, boolean recursive)
          5.0 API: Return a Stats object.
 com.ibm.websphere.pmi.stat.Stats[] getStats(java.lang.String nodeName, java.lang.String serverName, javax.management.ObjectName[] oNames, boolean recursive)
          5.0 API: Return an array of Stats objects.
 com.ibm.websphere.pmi.stat.Stats getStats(java.lang.String nodeName, java.lang.String serverName, javax.management.ObjectName oName, boolean recursive)
          5.0 API: Return a Stats object.
 javax.management.ObjectName[] listMBeans(java.lang.String nodeName, java.lang.String serverName)
          5.0 API: List all the MBeans in the server.
 PerfDescriptor[] listMembers(PerfDescriptor pd)
          4.0 API: List all the PMI members (modules, submodules, or data) under the PerfDescriptor.
 PerfDescriptor[] listNodes()
          List all the nodes in WebSphere domain.
 PerfDescriptor[] listServers(PerfDescriptor pd)
          List all the serves in the node.
 PerfDescriptor[] listServers(java.lang.String nodeName)
          List all the servers in the node.
 com.ibm.websphere.pmi.stat.MBeanStatDescriptor[] listStatMembers(java.lang.String nodeName, java.lang.String serverName, com.ibm.websphere.pmi.stat.MBeanStatDescriptor msd)
          5.0 API: List the MBeanStatDescriptors (if any) under it.
 com.ibm.websphere.pmi.stat.MBeanStatDescriptor[] listStatMembers(java.lang.String nodeName, java.lang.String serverName, javax.management.ObjectName oName)
          5.0 API: List the MBeanStatDescriptors (if any) under it.
 void refreshModuleConfig(java.lang.String node, java.lang.String server)
          Get the module configuration for all the modules from the given node and server
 void setDebug(boolean enableDebug)
          Pass true to it to enable debug, which is disabled by default.
 void setInstrumentationLevel(java.lang.String nodeName, java.lang.String serverName, PerfLevelSpec[] specs, boolean recursive)
          4.0 API.
 void setPerfConfigInfo(java.lang.String nodeName, java.lang.String serverName, javax.management.ObjectName oName, com.ibm.websphere.pmi.stat.StatDescriptor sd, com.ibm.websphere.pmi.stat.Stats stats)
           
 void setPerfConfigInfo(java.lang.String nodeName, java.lang.String serverName, javax.management.ObjectName oName, com.ibm.websphere.pmi.stat.Stats stats)
          5.0 API: Set performance config info for each stats.
 void setStatLevel(java.lang.String nodeName, java.lang.String serverName, com.ibm.websphere.pmi.stat.MBeanLevelSpec[] msds, boolean recursive)
          5.0 API: Set level.
 void setStatLevel(java.lang.String nodeName, java.lang.String serverName, com.ibm.websphere.pmi.stat.MBeanLevelSpec mls, boolean recursive)
          5.0 API: Set level.
static java.lang.String[] stringToArray(java.lang.String qualifiedName)
          4.0 API.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
See Also:
Constant Field Values

VERSION_AE

public static final java.lang.String VERSION_AE
See Also:
Constant Field Values

VERSION_AES

public static final java.lang.String VERSION_AES
See Also:
Constant Field Values

VERSION_EPM

public static final java.lang.String VERSION_EPM
See Also:
Constant Field Values

VERSION_WAS50

public static final java.lang.String VERSION_WAS50
See Also:
Constant Field Values

VERSION_WAS50ND

public static final java.lang.String VERSION_WAS50ND
See Also:
Constant Field Values

NO_ERROR

public static final int NO_ERROR
See Also:
Constant Field Values

FAILED_TO_GET_INITIAL_CONTEXT

public static final int FAILED_TO_GET_INITIAL_CONTEXT
See Also:
Constant Field Values

FAILED_TO_CREATE_PMISERVICE_BEAN_OBJECT

public static final int FAILED_TO_CREATE_PMISERVICE_BEAN_OBJECT
See Also:
Constant Field Values

FAILED_TO_LIST_NODES

public static final int FAILED_TO_LIST_NODES
See Also:
Constant Field Values

FAILED_TO_LIST_SERVERS

public static final int FAILED_TO_LIST_SERVERS
See Also:
Constant Field Values

FAILED_TO_LIST_MEMBERS

public static final int FAILED_TO_LIST_MEMBERS
See Also:
Constant Field Values

FAILED_TO_ENABLE_DATA

public static final int FAILED_TO_ENABLE_DATA
See Also:
Constant Field Values

FAILED_TO_DISABLE_DATA

public static final int FAILED_TO_DISABLE_DATA
See Also:
Constant Field Values

FAILED_TO_SET_LEVEL

public static final int FAILED_TO_SET_LEVEL
See Also:
Constant Field Values

FAILED_TO_GET_LEVEL

public static final int FAILED_TO_GET_LEVEL
See Also:
Constant Field Values

FAILED_TO_GET_DATA

public static final int FAILED_TO_GET_DATA
See Also:
Constant Field Values

FAILED_TO_GET_ADMIN_STATE

public static final int FAILED_TO_GET_ADMIN_STATE
See Also:
Constant Field Values

SERVER_STOPPED

public static final int SERVER_STOPPED
See Also:
Constant Field Values

NO_COLLECTOR_FOUND

public static final int NO_COLLECTOR_FOUND
See Also:
Constant Field Values

NO_SUCH_A_NODE

public static final int NO_SUCH_A_NODE
See Also:
Constant Field Values

NO_SUCH_A_SERVER

public static final int NO_SUCH_A_SERVER
See Also:
Constant Field Values

NO_PERFMBEAN_FOUND

public static final int NO_PERFMBEAN_FOUND
See Also:
Constant Field Values

SEPERATOR50

public static final java.lang.String SEPERATOR50
See Also:
Constant Field Values

SEPERATOR40

public static final java.lang.String SEPERATOR40
See Also:
Constant Field Values

DEFAULT_CONNECTOR_TYPE

public static final java.lang.String DEFAULT_CONNECTOR_TYPE
See Also:
Constant Field Values

DEFAULT_CONNECTOR_PORT

public static final java.lang.String DEFAULT_CONNECTOR_PORT
See Also:
Constant Field Values

pmiNLS

public static final com.ibm.ejs.sm.client.ui.NLS pmiNLS

moduleNLSMap

public static java.util.HashMap moduleNLSMap

prefixNLSMap

public static java.util.HashMap prefixNLSMap
Constructor Detail

PmiClient

public PmiClient()
          throws java.rmi.RemoteException
Constructor: assume all defaults: local host, port DEFAULT_CONNECTOR_PORT, and WAS50 version.


PmiClient

public PmiClient(boolean inAppServer)
          throws java.rmi.RemoteException
Use this constructor only when you are calling it inside an appserver.

Parameters:
inAppServer - may be true if you are calling it inside an appserver

PmiClient

public PmiClient(java.lang.String host,
                 java.lang.String port)
          throws java.rmi.RemoteException
Constructor:

Parameters:
host - is the host name where adminserver/netManager is running
port - is the port number for adminserver/netManager Use default version, i.e., WAS50.

PmiClient

public PmiClient(java.lang.String host,
                 java.lang.String port,
                 java.lang.String version)
          throws java.rmi.RemoteException
Constructor: take host, port, and version.

Parameters:
host - is the host name where adminserver/netManager is running
port - is the port number for adminserver/netManager
version - could be "WAS50" for 5.0, "AE" for 4.0x AE, "AES" for 4.0x AEs, and "EPM" for 3.5

PmiClient

public PmiClient(java.lang.String host,
                 java.lang.String nodeName,
                 java.lang.String port,
                 java.lang.String version)
          throws java.rmi.RemoteException
Constructor: take host, nodeName, port, and version. Only applicable to 3.5.x server.

Parameters:
host - is the host name where adminserver/netManager is running
port - is the port number for adminserver/netManager
version - could be "WAS50" for 5.0, "AE" for 4.0x AE, "AES" for 4.0x AEs, and "EPM" for 3.5

PmiClient

public PmiClient(java.lang.String host,
                 java.lang.String port,
                 java.lang.String version,
                 boolean inAppServer,
                 java.lang.String connectorType)
          throws java.rmi.RemoteException
Constructor: take host, port, and version.

Parameters:
host - is the host name where adminserver/netManager is running. If not passed, the default is localhost.
port - is the port number for adminserver/netManager. If not passed, the default is DEFAULT_CONNECTOR_PORT.
version - could be "WAS50" for 5.0, "AE" for 4.0x and "EPM" for 3.5. If not passed, the default is WAS50.
inAppServer - should be false unless you are calling from an appserver. If not passed, the default is false.
connectorType - is either RMI or SOAP. If not passed, the default is DEFAULT_CONNECTOR_TYPE.

PmiClient

public PmiClient(java.util.Properties props,
                 java.lang.String version)
          throws java.rmi.RemoteException
Constructor: take a Properties and the version. This is a generic way to pass all the necessary paramter.

If you do not use the default host (localhost), port (8880) and connector type (AdminClient.CONNECTOR_TYPE_SOAP), you have to set the following properties props.setProperty(AdminClient.CONNECTOR_HOST, hostName); props.setProperty(AdminClient.CONNECTOR_PORT, portNumber); props.setProperty(AdminClient.CONNECTOR_TYPE, connectorType);

Enable security for WAS 5.0. The following instruction is copied from AdminClient.

For SOAP based AdminClient, the users need to specifiy the "username" and "password" and explicitly set "securityEnabled" as "true". Some other properties are also required in order to make a SSL connection, these properties can be either specified as a Java system properties or passed as paramemters when invoking AdminClientFactory.createAdminClient(Properties). These properties include

  • javax.net.ssl.trustStore
  • javax.net.ssl.keyStore
  • javax.net.ssl.trustStorePassword
  • javax.net.ssl.keyStorePassword
The javax.net.ssl.trustStore and javax.net.ssl.keyStore are mandatory, the passwords for these two stores are required only when the stores are key protected.

An exmample to make a secure SOAP based AdminClient:


      Properties props = new Properties();        
      props.setProperty(AdminClient.CONNECTOR_HOST, "localhost");
      props.setProperty(AdminClient.CONNECTOR_PORT, "8880");
      props.setProperty(AdminClient.CONNECTOR_TYPE, AdminClient.CONNECTOR_TYPE_SOAP);
      props.setProperty(AdminClient.CONNECTOR_SECURITY_ENABLED, "true");
      props.setProperty(AdminClient.USERNAME, "user1");
      props.setProperty(AdminClient.PASSWORD, "password1");
        props.setProperty("javax.net.ssl.trustStore", "C:/WebSphere/AppServer/etc/DummyClientTrustFile.jks");
      props.setProperty("javax.net.ssl.keyStore", "C:/WebSphere/AppServer/etc/DummyClientKeyFile.jks");
      props.setProperty("javax.net.ssl.trustStorePassword", "WebAS");
      props.setProperty("javax.net.ssl.keyStorePassword", "WebAS");
      AdminClient client = AdminClientFactory.createAdminClient(props);
 
 

To make a secure RMI based AdminClient is a little easier because you can rely on existing "com.ibm.CORBA.ConfigURL" which normal points to a property file, for instance, $WAS_ROOT/properties/sas.client.properites. There are a couple different ways to specify the login username and password and it's determined by "com.ibm.CORBA.loginSource" in "com.ibm.CORBA.ConfigURL". For programmatic login, you can set "com.ibm.CORBA.loginSource" as "none" and then provide your username/password when you create a AdminClient using AdminClientFactory.

For example,

      Properties props = new Properties();
      props.setProperty(AdminClient.CONNECTOR_HOST, "localhost");
      props.setProperty(AdminClient.CONNECTOR_PORT, "2809");
      props.setProperty(AdminClient.CONNECTOR_TYPE, AdminClient.CONNECTOR_TYPE_RMI);
      props.setProperty(AdminClient.CONNECTOR_SECURITY_ENABLED, "true");
      props.setProperty(AdminClient.USERNAME, "test");
      props.setProperty(AdminClient.PASSWORD, "user4test");
      AdminClient client = AdminClientFactory.createAdminClient(props);
 
 

Method Detail

getConnectedHost

public java.lang.String getConnectedHost()
Return the connected host name: it should be the name of host name passed to PmiClient or the actual localhost name if "localhost" is passed to PmiClient. Note: you can pass "localhost" when calling "new PmiClient", but you cannot use "localhost" when calling methods on PmiClient. You have to call this method to get the real host name and pass as parameter to methods in PmiClient.


createCpdData

public static CpdData createCpdData(PmiModuleConfig moduleConfig,
                                    PerfDescriptor parent,
                                    com.ibm.ws.pmi.wire.WpdData wData)
4.0 API: create a CpdData object from WpdData


createCpdCollection

public CpdCollection createCpdCollection(PerfDescriptor colPd,
                                         com.ibm.ws.pmi.wire.WpdCollection wCol)
4.0 API: create a CpdCollection object from WpdCollection


createRootCollection

public static CpdCollection createRootCollection()
4.0 API: Create the root collection for the domain


listNodes

public PerfDescriptor[] listNodes()
                           throws PmiException
List all the nodes in WebSphere domain. You can call PerfDescriptor[i].getName() to get a list of node names in WebSphere domain.

PmiException

listServers

public PerfDescriptor[] listServers(java.lang.String nodeName)
                             throws PmiException
List all the servers in the node. You can call PerfDescriptor[i].getName() to get a list of server names on the node.

PmiException

listServers

public PerfDescriptor[] listServers(PerfDescriptor pd)
                             throws PmiException
List all the serves in the node. You can call PerfDescriptor[i].getName() to get a list of server names on the node.

PmiException

listMembers

public PerfDescriptor[] listMembers(PerfDescriptor pd)
                             throws PmiException
4.0 API: List all the PMI members (modules, submodules, or data) under the PerfDescriptor.

PmiException

getConfigs

public PmiModuleConfig[] getConfigs()
Get an array of PmiModuleConfig for all the PMI modules. It may contain all the modules avaialbe in WebSphere app server. A specific appserver may or may not use all of the them.


refreshModuleConfig

public void refreshModuleConfig(java.lang.String node,
                                java.lang.String server)
Get the module configuration for all the modules from the given node and server


getConfig

public PmiModuleConfig getConfig(java.lang.String moduleName)
Return PmiModuleConfig for the module.


get

public CpdCollection get(PerfDescriptor pd,
                         boolean recursive)
                  throws PmiException
4.0 API: Get PMI data. The PerfDescriptor uniquely identifies the PMI data in an appserver. It will return null if pd is wrong or server is down.

Parameters:
recursive - If recursive is true, it will return all the subcollections with data. If recursive is false, it will return the data immediately under the PerfDescriptor and no subcollection will be returned.
PmiException

gets

public CpdCollection[] gets(boolean recursive)
                     throws PmiException
Get all the data you requested by calling add method.

PmiException

gets

public CpdCollection[] gets(PerfDescriptor[] pds,
                            boolean recursive)
                     throws PmiException
4.0 API. Get PMI data. Each pd uniquely identifies the PMI data in an appserver.

Parameters:
recursive - If recursive is true, it will return all the subcollections with data. If recursive is false, it will return the data immediately under the PerfDescriptor and no subcollection will be returned.
PmiException

gets

public CpdCollection[] gets(PerfDescriptorList pdList,
                            boolean recursive)
                     throws PmiException
4.0 API. Get PMI data. Each pd uniquely identifies the PMI data in an appserver.

Parameters:
recursive - If recursive is true, it will return all the subcollections with data. If recursive is false, it will return the data immediately under the PerfDescriptor and no subcollection will be returned.
PmiException

getAdminState

public int getAdminState(java.lang.String nodeName)
                  throws PmiException
Get the administratio state of the node, i.e., start or stop.

PmiException

getAdminState

public int getAdminState(java.lang.String nodeName,
                         java.lang.String serverName)
                  throws PmiException
Get the administratio state of the server, i.e., start or stop.

PmiException

getErrorCode

public int getErrorCode()
Check the error code, which could be one of the error constants defined in this class. You may want to call it when you think the return result is not expected.


getErrorMessage

public java.lang.String getErrorMessage()
Check the error message. You may want to call it when you think the return result is not expected.


getErrorCode

public int getErrorCode(java.lang.String nodeName)
Check the error code, which could be one of the error constants defined in this class. You may want to call it when you think the return result is not expected.


getErrorMessage

public java.lang.String getErrorMessage(java.lang.String nodeName)
Check the error message. You may want to call it when you think the return result is not expected.


add

public void add(PerfDescriptor pd)
4.0 API. Add pd to the PmiClient and later call gets(boolean recursive) to retrieve data for all the pds you have added.


stringToArray

public static java.lang.String[] stringToArray(java.lang.String qualifiedName)
4.0 API. A help method.

Parameters:
qualifiedName - it should look like the following: nodename,servername,modulename,instancename

The qualifierName can also be nodename/servername/modulename/instancename as supported in 4.0. However, "/" can not be in any name in the path if you use the 4.0 format. Otherwise, PMI will not be able to construct path correctly. You can use a substring of the above starting from node name


createPerfDescriptor

public static PerfDescriptor createPerfDescriptor()
4.0 API. Return a PerfDescriptor especially for the root in the domain. Take no param.


createPerfDescriptor

public static PerfDescriptor createPerfDescriptor(java.lang.String[] dataPath)
4.0 API. Return a PerfDescriptor with given dataPath


createPerfDescriptor

public static PerfDescriptor createPerfDescriptor(java.lang.String qualifiedDataPath)
4.0 API.

Parameters:
qualifiedDataPath - it should look like the following: nodename/servername/modulename/instancename. e.g. node1/server1/connectionPoolModule/datasource1 node1/server1/beanModule/container1.bean1

createPerfDescriptor

public static PerfDescriptor createPerfDescriptor(java.lang.String[] dataPath,
                                                  int dataId)
4.0 API. Return a PerfDescriptor with given dataPath and single dataId


createPerfDescriptor

public static PerfDescriptor createPerfDescriptor(java.lang.String qualifiedDataPath,
                                                  int dataId)
4.0 API.

Parameters:
qualifiedDataPath - it should look like the following: nodename/servername/modulename/instancename. e.g. node1/server1/connectionPoolModule/datasource1 node1/server1/beanModule/container1.bean1

createPerfDescriptor

public static PerfDescriptor createPerfDescriptor(java.lang.String[] dataPath,
                                                  int[] dataIds)
4.0 API. Return a PerfDescriptor with given dataPath and multiple dataIds under same dataPath.


createPerfDescriptor

public static PerfDescriptor createPerfDescriptor(java.lang.String qualifiedDataPath,
                                                  int[] dataIds)
4.0 API.

Parameters:
qualifiedDataPath - it should look like the following: nodename/servername/modulename/instancename. e.g. node1/server1/connectionPoolModule/datasource1 node1/server1/beanModule/container1.bean1

createPerfDescriptor

public static PerfDescriptor createPerfDescriptor(PerfDescriptor parent,
                                                  java.lang.String name)
4.0 API. Return a PerfDescriptor with the given parent.


createPerfDescriptor

public static PerfDescriptor createPerfDescriptor(PerfDescriptor parent,
                                                  int dataId)
4.0 API. Return a PerfDescriptor with given dataPath and single dataId


createPerfDescriptor

public static PerfDescriptor createPerfDescriptor(PerfDescriptor parent,
                                                  int[] dataIds)
4.0 API. Return a PerfDescriptor with given dataPath and multiple dataIds under same dataPath.


createPerfLevelSpec

public PerfLevelSpec createPerfLevelSpec(java.lang.String[] path,
                                         int level)
4.0 API. Return a PerfLevelSpec with given path and level


createPerfLevelSpec

public PerfLevelSpec createPerfLevelSpec(int level)
4.0 API. Return a PerfLevelSpec - no path means for all the paths in the app server


getDataName

public java.lang.String getDataName(java.lang.String moduleName,
                                    int dataId)
Convert data id to data name


getDataId

public int getDataId(java.lang.String moduleName,
                     java.lang.String dataName)
Convert data name to dataId


getInstrumentationLevel

public PerfLevelSpec[] getInstrumentationLevel(java.lang.String nodeName,
                                               java.lang.String serverName)
                                        throws PmiException
4.0 API. Get instrumentation level for all the modules/submodules in the appserver.

PmiException

setInstrumentationLevel

public void setInstrumentationLevel(java.lang.String nodeName,
                                    java.lang.String serverName,
                                    PerfLevelSpec[] specs,
                                    boolean recursive)
                             throws PmiException
4.0 API.

Note: setting levels from PmiClient will change the levels in the affected app server. It will impact other PMI clients that retrieve PMI data from the same app server.

PmiException

setPerfConfigInfo

public void setPerfConfigInfo(java.lang.String nodeName,
                              java.lang.String serverName,
                              javax.management.ObjectName oName,
                              com.ibm.websphere.pmi.stat.Stats stats)
5.0 API: Set performance config info for each stats. Note the config info not passed by server in order to reduce communication cost.


setPerfConfigInfo

public void setPerfConfigInfo(java.lang.String nodeName,
                              java.lang.String serverName,
                              javax.management.ObjectName oName,
                              com.ibm.websphere.pmi.stat.StatDescriptor sd,
                              com.ibm.websphere.pmi.stat.Stats stats)

getStats

public com.ibm.websphere.pmi.stat.Stats getStats(java.lang.String nodeName,
                                                 java.lang.String serverName,
                                                 javax.management.ObjectName oName,
                                                 boolean recursive)
                                          throws PmiException
5.0 API: Return a Stats object.

PmiException

getStats

public com.ibm.websphere.pmi.stat.Stats getStats(java.lang.String nodeName,
                                                 java.lang.String serverName,
                                                 com.ibm.websphere.pmi.stat.MBeanStatDescriptor msd,
                                                 boolean recursive)
                                          throws PmiException
5.0 API: Return a Stats object.

PmiException

getStats

public com.ibm.websphere.pmi.stat.Stats[] getStats(java.lang.String nodeName,
                                                   java.lang.String serverName,
                                                   javax.management.ObjectName[] oNames,
                                                   boolean recursive)
                                            throws PmiException
5.0 API: Return an array of Stats objects.

PmiException

getStats

public com.ibm.websphere.pmi.stat.Stats[] getStats(java.lang.String nodeName,
                                                   java.lang.String serverName,
                                                   com.ibm.websphere.pmi.stat.MBeanStatDescriptor[] msds,
                                                   boolean recursive)
                                            throws PmiException
5.0 API: Return an array of Stats objects.

PmiException

listMBeans

public javax.management.ObjectName[] listMBeans(java.lang.String nodeName,
                                                java.lang.String serverName)
5.0 API: List all the MBeans in the server.


listStatMembers

public com.ibm.websphere.pmi.stat.MBeanStatDescriptor[] listStatMembers(java.lang.String nodeName,
                                                                        java.lang.String serverName,
                                                                        javax.management.ObjectName oName)
5.0 API: List the MBeanStatDescriptors (if any) under it.


listStatMembers

public com.ibm.websphere.pmi.stat.MBeanStatDescriptor[] listStatMembers(java.lang.String nodeName,
                                                                        java.lang.String serverName,
                                                                        com.ibm.websphere.pmi.stat.MBeanStatDescriptor msd)
5.0 API: List the MBeanStatDescriptors (if any) under it.


getConfigs

public PmiModuleConfig[] getConfigs(java.lang.String nodeName,
                                    java.lang.String serverName)
5.0 API: Get all PmiModuleConfigs for the server.


getConfig

public PmiModuleConfig getConfig(java.lang.String nodeName,
                                 java.lang.String serverName,
                                 javax.management.ObjectName oName)
5.0 API: Get PmiModuleConfig for a particular MBean.


getConfig

public PmiModuleConfig getConfig(java.lang.String nodeName,
                                 java.lang.String serverName,
                                 java.lang.String moduleName)
Get PmiModuleConfig for a particular PMI module.


setStatLevel

public void setStatLevel(java.lang.String nodeName,
                         java.lang.String serverName,
                         com.ibm.websphere.pmi.stat.MBeanLevelSpec mls,
                         boolean recursive)
5.0 API: Set level. It will enable/disable PMI data in the server.


setStatLevel

public void setStatLevel(java.lang.String nodeName,
                         java.lang.String serverName,
                         com.ibm.websphere.pmi.stat.MBeanLevelSpec[] msds,
                         boolean recursive)
5.0 API: Set level. It will enable/disable PMI data in the server.


getStatLevel

public com.ibm.websphere.pmi.stat.MBeanLevelSpec[] getStatLevel(java.lang.String nodeName,
                                                                java.lang.String serverName,
                                                                javax.management.ObjectName oName,
                                                                boolean recursive)
5.0 API: Get MBeanLevelSpec[] based on an ObjectName.


getStatLevel

public com.ibm.websphere.pmi.stat.MBeanLevelSpec[] getStatLevel(java.lang.String nodeName,
                                                                java.lang.String serverName,
                                                                com.ibm.websphere.pmi.stat.MBeanStatDescriptor msd,
                                                                boolean recursive)
5.0 API: Get MBeanLevelSpec[] based on a MBeanStatDescriptor.


createMBeanLevelSpec

public static com.ibm.websphere.pmi.stat.MBeanLevelSpec createMBeanLevelSpec(javax.management.ObjectName oname,
                                                                             int level)
5.0 API: Create an MBeanLevelSpec object.


createMBeanLevelSpec

public static com.ibm.websphere.pmi.stat.MBeanLevelSpec createMBeanLevelSpec(javax.management.ObjectName oname,
                                                                             com.ibm.websphere.pmi.stat.StatDescriptor sd,
                                                                             int level)
5.0 API: Create an MBeanLevelSpec object.


end

public void end()
Call this method before and ONLY before you are done with PmiClient


getNLSValue

public static java.lang.String getNLSValue(java.lang.String key)
Deprecated. Replaced by getNLSValue (key, moduleID)

Translate the key to the language you choose. Returns the key if ResourceBundle is missing.


getNLSValue

public static java.lang.String getNLSValue(java.lang.String key,
                                           java.lang.String moduleID)
Get translated key from the resource bundle.

Parameters:
key - key to be translated
moduleID - the module name from the PmiModuleConfig. Pass null to use default resource bundle
Returns:
Returns translated key or the key if resoure bundle is not available.

setDebug

public void setDebug(boolean enableDebug)
Pass true to it to enable debug, which is disabled by default.


findConfig

public static PmiModuleConfig findConfig(PmiModuleConfig[] configs,
                                         java.lang.String moduleID)
Return the config for the moduleID


findConfig

public static PmiModuleConfig findConfig(PmiModuleConfig[] configs,
                                         javax.management.ObjectName on)
Return the config for the MBean ObjectName



 

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.