Network Deployment (Distributed operating systems), v8.0 > Scripting the application serving environment (wsadmin) > Use the wsadmin scripting AdminControl object for scripted administration


Specify running objects using wsadmin.sh

Use scripting and wsadmin.sh to specify running objects.

See the topic on starting the wsadmin scripting client.

We can run wsadmin commands that obtain object names and 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:

        ### Jacl

        set var [$AdminControl completeObjectName template]
        

        ### Jython

        var = AdminControl.completeObjectName(template)
        

      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:

        ### Jacl

        set server1 [$AdminControl completeObjectName node=mynode,type=Server,name=server1,*]
        

        ### Jython

        server1 = AdminControl.completeObjectName('node=mynode,type=Server,name=server1,*')
        

    • Obtain the object name with the queryNames command, for example:

        ### Jacl

        set var [$AdminControl queryNames template]
        

        ### Jython

        var = AdminControl.queryNames(template)
        

  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:

      ### Jacl

      set allServers [$AdminControl queryNames type=Server,*]
      set aServer [lindex $allServers 0]
      

      ### 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 topic on Jacl syntax.


Results

We can now use the running object in with other AdminControl commands that require an object name as a parameter.
ObjectName, Attribute, and AttributeList classes using wsadmin.sh
Use wsadmin scripting with Jacl
Start the wsadmin scripting client using wsadmin.sh
Use the wsadmin scripting AdminControl object for scripted administration


Related


Commands for the AdminControl object using wsadmin.sh

+

Search Tips   |   Advanced Search