Specify configuration objects with scripting and the wsadmin tool. Before starting this task, the wsadmin tool must be running. See the Starting the wsadmin scripting client article for more information.
Using Jacl:
set var [$AdminConfig getid /type:name/]
var = AdminConfig.getid('/type:name/')
where:
set | is a Jacl command |
var | is a variable name |
$ | is a Jacl operator for substituting a variable name with its value |
AdminConfig | is an object representing the WebSphere Application Server configuration |
getid | is an AdminConfig command |
/type:name/ | is the hierarchical containment path of the configuration object |
type | is the object type. The name of the object type that you input here is the one that is based on the XML configuration files and does not have to be the same name that is displayed in the administrative console. |
name | is the optional name of the object |
You can specify multiple /type:name/ value pairs in the string, for example, /type:name/type:name/type:name/. If you specify the type in the containment path without the name, include the colon, for example, /type:/. The containment path must be a path that contains the correct hierarchical order. For example, if you specify /Server:server1/Node:node/ as the containment path, you do not receive a valid configuration ID because Node is a parent of Server and comes before Server in the hierarchy.
This command returns all the configuration IDs that match the representation of the containment and assigns them to a variable.
To look for all the server configuration IDs that reside in the mynode node, use the code in the following example:
Using Jacl:
set nodeServers [$AdminConfig getid /Node:mynode/Server:/]
nodeServers = AdminConfig.getid('/Node:mynode/Server:/')
To look for the server1 configuration ID that resides in mynode, use the code in the following example:
Using Jacl:
set server1 [$AdminConfig getid /Node:mynode/Server:server1/]
server1 = AdminConfig.getid('/Node:mynode/Server:server1/')
To look for all the server configuration IDs, use the code in the following example:
Using Jacl:
set servers [$AdminConfig getid /Server:/]
servers = AdminConfig.getid('/Server:/')
Using Jacl:
set var [$AdminConfig list type]or
set var [$AdminConfig list type scopeId]
var = AdminConfig.list('type')or
var = AdminConfig.list('type', 'scopeId')
where:
set | is a Jacl command |
var | is a variable name |
$ | is a Jacl operator for substituting a variable name with its value |
AdminConfig | is an object that represents the WebSphere Application Server configuration |
list | is an AdminConfig command |
type | is the object type. The name of the object type that you input here is the one that is based on the XML configuration files and does not have to be the same name that is displayed in the administrative console. |
scopeId | is the configuration ID of a cell, a node, or a server object |
This command returns a list of configuration object IDs of a given type. If you specify the scopeId value, the list of objects is returned within the specified scope. The returned list is assigned to a variable.
To look for all the server configuration IDs, use the following example:
Using Jacl:
set servers [$AdminConfig list Server]
servers = AdminConfig.list('Server')
To look for all the server configuration IDs in the mynode node, use the code in the following example:
Using Jacl:
set scopeid [$AdminConfig getid /Node:mynode/] set nodeServers [$AdminConfig list Server $scopeid]
scopeid = AdminConfig.getid('/Node:mynode/') nodeServers = AdminConfig.list('Server', scopeid)
Using Jacl:
set allServers [$AdminConfig getid /Server:/] set aServer [lindex $allServers 0]
allServers = AdminConfig.getid('/Server:/') # get line separator import java lineSeparator = java.lang.System.getProperty('line.separator') arrayAllServers = allServers.split(lineSeparator) aServer = arrayAllServers[0]
For other ways to manipulate the list and perform pattern matching to look for a specified configuration object, refer to the Jacl syntax.