Specify running objects using wsadmin


 

+

Search Tips   |   Advanced Search

 

To specify running objects using wsadmin

Jython...

### Obtain the configuration ID...
var = AdminControl.completeObjectName(template)

### Obtain the object name...
var = AdminControl.queryNames(template)

### Look for server1 MBean in mynode...
server1 = AdminControl.completeObjectName('node=mynode,type=Server,name=server1,*')

### Retrieve the first running object from the server list...
allServers = AdminControl.queryNames('type=Server,*')

### If more than one running object is returned from queryNames,
### the objects are returned in list syntax.

### Get line separator
import java
lineSeparator = java.lang.System.getProperty('line.separator')
aServer = allServers.split(lineSeparator)[0]

Jacl...

### Obtain the configuration ID...
set var [$AdminControl completeObjectName template]

### Obtain the object name...
set var [$AdminControl queryNames template]

###Look for server1 MBean in mynode...
set server1 [$AdminControl completeObjectName node=mynode,type=Server,name=server1,*]

### Retrieve the first running object from the server list...
set allServers [$AdminControl queryNames type=Server,*]
set aServer [lindex $allServers 0]

Format of template is...

[domainName]:property=value[,property=value]*

If there are several MBeans that match the template, completeObjectName only returns the first match. The matching MBean object name is then assigned to a variable.

 

Results

We can now use the running object in with other AdminControl commands that require an object name as a parameter.

 

Related tasks

ObjectName, Attribute, and AttributeList classes
Use AdminControl for scripted administration

 

Related

Commands for AdminControl