WebSphere Application Server Network Deployment, Version 6.1
             Operating Systems: AIX, HP-UX, i5/OS, Linux, Solaris, Windows, z/OS

             Personalize the table of contents and search results

Specifying running objects using the wsadmin tool

Use scripting and the wsadmin tool to specify running objects.

Before you begin

Before starting this task, the wsadmin tool must be running. See the Starting the wsadmin scripting client article for more information.

About this task

Perform the following steps to specify running objects:

Procedure

  1. Obtain the configuration ID with one of the following ways:
    • Obtain the object name with the completeObjectName command, for example:
      • Using Jacl:
        set var [$AdminControl completeObjectName template]
      • Using Jython:
        var = AdminControl.completeObjectName(template)
      where:
      set is a Jacl command
      var is a variable name
      $ is a Jacl operator for substituting a variable name with its value
      AdminControl is an object that enables the manipulation of MBeans running in a WebSphere server process
      completeObjectName is an AdminControl command
      template is a string containing 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]*. See Object name, Attribute, Attribute list for more information.

      If there are several MBeans that match the template, the completeObjectName command only returns 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:
      Note: For both the Jacl and Jython examples, the value of the keyword type= is the MBean name.
      • Using Jacl:
        set server1 [$AdminControl completeObjectName node=mynode,type=Server,name=server1,*]
      • Using Jython:
        server1 = AdminControl.completeObjectName('node=mynode,type=Server,name=server1,*')
    • Obtain the object name with the queryNames command, for example:
      • Using Jacl:
        set var [$AdminControl queryNames template]
      • Using Jython:
        var = AdminControl.queryNames(template)
      where:
      set is a Jacl command
      var is a variable name
      $ is a Jacl operator for substituting a variable name with its value
      AdminControl is an object that enables the manipulation of MBeans running in a WebSphere Application server process.
      queryNames is an AdminControl command
      template is a string containing 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]*
  2. 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 lindex command in Jacl and split command in Jython. The following example retrieves the first running object from the server list:
    • Using Jacl:
      set allServers [$AdminControl queryNames type=Server,*]
      set aServer [lindex $allServers 0]
    • Using Jython:
      allServers = AdminControl.queryNames('type=Server,*')
      
      # get line separator 
      import  java
      lineSeparator = java.lang.System.getProperty('line.separator')
      
      aServer = allServers.split(lineSeparator)[0]
    For 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.



In this information ...


IBM Redbooks, demos, education, and more


Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

IBM Suggests
Task topic    

Terms of Use | Feedback

Last updated: Feb 25, 2009 9:32:38 AM CST
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.nd.multiplatform.doc/info/ae/ae/txml_specifyrunobj.html