Specify running objects using the wsadmin tool
Overview
Use the wsadmin tool to specify running objects.
Procedure
Obtain the configuration ID with one of the following ways:
- Obtain the object name with the completeObjectName command, for example:
var = AdminControl.completeObjectName(template)Where template string contains a segment of the object name to be matched. The template has the same format as an object name with the following pattern:
[domainName]:property=value[,property=value]*If there are several MBeans that match the template, the completeObjectName command only retuns the first match. The matching MBean object name is then assigned to a variable.
To look for server1 MBean in mynode, use the following example:
server1 = AdminControl.completeObjectName('node=mynode,type=Server,name=server1,*')
- Obtain the object name with the queryNames command...
var = AdminControl.queryNames(template)The template has the same format as an object name with the following pattern:[domainName]:property=value[,property=value]*If there are more than one running objects returned from the queryNames command, the objects are returned in a list syntax. One simple way to retrieve a single element from the list is to use the split command in Jython. The following example retrieves the first running object from the server list:
allServers = AdminControl.queryNames('type=Server,*')
# get line separator
import java
ls = java.lang.System.getProperty('line.separator')
aServer = allServers.split(ls)[0]For example...
[wasuser@hostname wsadmin]$ wsadmin.sh -lang jython -f FirstElement.py
WASX7209I: Connected to process "dmgr" on node dmgr_node using SOAP connector; The type of process is: DeploymentManager
WebSphere:name=xyz_stage, process=xyz_stage, platform=proxy, node=foobar_node, j2eeType=J2EEServer, version=6.0.2.29, type=Server, mbeanIdentifier=cells/dmgr_cell/nodes/foobar_node/servers/xyz_stage/server.xml#Server_1218819941892, cell=dmgr_cell,processType=ManagedProcessFor other ways to manipulate the list and then perform pattern matching to look for a specified configuration object, refer to the Jacl syntax.
Results
You can now use the running object in with other AdminControl commands that require an object name as a parameter.
ObjectName, Attribute, and AttributeList classes
Related tasks
Use the AdminControl object for scripted administration
Related Reference
Commands for the AdminControl object