Some AdminTask commands have a very simple interface. Others have a very complex interface.
Some commands take no arguments whatsoever. Some have a list of optional arguments. Other commands
require quite a bit of data. The overwhelming majority of AdminTask commands return
plain string data. The general pattern for calling AdminTask commands is as follows:
AdminTask.methodName( target, \
'[ -argument value -anotherArgument value2 ' \
+ ' -stepName [ -stepArg01 val01 -stepArg02 val02 ]' \
+ ' -nextStepName [ -arg03 val03 ] \
+ ' -yetAnotherStep ]'
There are AdminTask commands that do not take any arguments at all.
Examples of such commands would be:
print AdminTask.reportConfiguredPorts()
print AdminTask.generateSecConfigReport()
print AdminTask.listSIBuses()
Some AdminTask commands will accept arguments, but none of those arguments
are required. You can call these commands with no arguments. Usually, these
commands give you information about your entire cell.
print AdminTask.listJDBCProviders()
print AdminTask.listDataSources()
print AdminTask.showVariables()
Any optional arguments that you choose to provide to this kind
of AdminTask will generally serve to limit the scope of the data returned.
The examples below limit the scope to JDBCProviders in the ApplicationCluster scope,
DataSources in the server d01 scope, and variables in the node C01N01 scope.
print AdminTask.listJDBCProviders( '[ -scope "Cluster=ApplicationCluster" ]' )
print AdminTask.listDataSources( '[ -scope "Node=DemoNode01,Server=d01" ]' )
print AdminTask.showVariables( '[ -scope "Node=C01N01" ]' )
There are some AdminTask commands that require a target. Often.
the target is often either a configuration ID or a name of something.
print AdminTask.showServerInfo( \
'a03(cells/KevinCell/nodes/C01N02/servers/a03|server.xml#Server_1276638379874)' \
)
print AdminTask.listServerPorts( 'd01' )
In addition to an optional target, there might or might not be arguments.
If there are arguments, some might be mandatory. Others might be optional. Arguments will be name value pairs.
The argument name will be preceded by a dash. The values for each argument
will either be a string or some primitave value like a number. Arguments will almost never take complex values
like a list or a dictionary.
print AdminTask.createSIBus( [ ' -bus DingDongBus ' ] )
print AdminTask.setJVMProperties( \
'[-serverName a01 -nodeName C01N01 -verboseModeGarbageCollection true ]' )
Some AdminTasks take arguments called steps. Others do not. Think of steps as potentially complex arguments.
Most steps take a list of name/value pairs as their value. A small minority of steps take no value at all.
The step just acts like a flag. Steps tend to show up in AdminTask commands that create or delete something
complex, like a server.
print AdminTask.createClusterMember('[-clusterName GreenCluster ' \
+ ' -memberConfig [-memberNode C0N01 -memberName junk01 ] ]')
In the example above, memberConfig is a step. Notice that it takes a list ( delimited by [ ] )
as a parameter. The list is composed of name/value pairs.
print AdminTask.createApplicationServerTemplate( [ ' -templateName MyGreateTemplate ' \
+ ' -serverName a03 -nodeName C01N02 -description "I use this kind of server all the time" ' \
+ ' -DeleteSIBEngines ' ] )
In the example above, DeleteSIBEngines is a step that is used as a flag. If it is present,
something happens. If it is missing, that something does not happen. In this case,
the server template this command creates will not include any SIBEngines that may or may not
be configured on server a03 in node C01N02.
AdminTask.deleteServer( '[ -nodeName BartNode03 -serverName Sparkle -CleanupSIBuses ]' )
In the example above, CleanupSIBuses is a step that acts like a flag. In this case,
the flag will cause any messaging engines that were part of server Sparkle to be deleted.
Without the flag, the engines would not be deleted. It is not intuitively obvious that
CleanupSIBuses is a step. The only way you can tell is by reading the documentation.
AdminTask is a WebSphere Application Server scripting object that contains over 1,100 different commands. That number grows with
- Each major and minor release of WebSphere Application Server
- Each augmentation to WebSphere Application Server
IBM provides online help for the AdminTask script object. With so many methods in this scripting object, IBM provides several ways to get help.
- AdminTask.help( '-commands' ) will get you the names of all the methods along with a short description of each. The methods are in alphabetical order
- AdminTask.help( 'createCluster' ) will get you detailed help for an individual method -- in this case, the createCluster() method
- Some AdminTask methods have steps. AdminTask.help( 'createCluster','memberConfig' ) will get you help for the memberConfig step of the createCluster() method
- IBM bunches AdminTask methods into groups. The average method belongs to more than one group. AdminTask.help( '-commandGroups' ) will get you the names of all the groups
- Once you know the groups, AdminTask.help( 'AdminReports' ) will get you the names of all the methods that are part of that particular group
A list of the AdminTask methods grouped by command group is here. (Your WAS installation may have more methods or fewer.) docFunctions.py is a python file that contains a method to get all the available help from AdminTask and deposit it in one XML file. A sample of the output from that file is here.
documentAdminTask( 'someFileName.xml' ) is the method in the python file that produced the sample output. If you run this script on a MicroSoft Windows(R) machine, remember to use forward slashes as directory delimiters. The rest of the code in the python file is code that gets called by documentAdminTask()
See also these related articles: |
|