![[AIX Solaris HP-UX Linux Windows]](../images/dist.gif)
![[z/OS]](../images/ngzos.gif)
workclassoperations.py script
You can use the workclassoperations.py script to create, update, and manage work classes.
Purpose
You can complete the following actions
with the workclassoperations.py script:
- Create and update work classes for enterprise applications and generic server clusters.
- List the rules in work classes.
- List the members of work classes.
- Delete work classes for the various policies and communication protocols.
- Set default actions.
- Modify default actions.
- Fetch default actions.
- Add rules.
- Delete rules.
- Delete members.
Location
The workclassoperations.py script is in the app_server_root/bin directory.
Usage
The script usage for general help
follows:
./wsadmin.sh -lang jython -f workclassoperations.py
The
script usage for operation-specific help follows:
./wsadmin.sh -lang jython -f workclassoperations.py operation --help
Depending
on where you are issuing the command, you might have to specify the
path to the workclassoperation.py script. For example,
you create a profile named Dmgr01 located in the c:\app_server_root\profiles\Dmgr01\bin directory.
./wsadmin.sh -lang jython -f ../../../bin/workclassoperations.pyNote that if the deployment manager is not started, you must include the additional parameter -conntype NONE:
./wsadmin.sh -lang jython -conntype NONE workclassoperations.py
Operations
- listWorkClasses
- Lists work classes by type. The format of listing is workclassname
type appname/odrname deploymentname
- --type: Specifies the type of work class
to list:
- ASP: application service policy
- ARP: application routing policy
- GSP: generic server service policy
- GRP: generic server routing policy
- --appname: Specifies the name of the application. Required if you specify the --type parameter as ASP or ARP.
- --odrname: Specifies the name of the on demand router (ODR). Required if you specify the --type parameter as GSP or GRP.
- --type: Specifies the type of work class
to list:
- createWorkClass
- Creates a work class. The new service policy does not contain
any application modules or classification rules. You must create and
associate application modules and classification rules separately.
- :
- --type: Specifies the type of work class
to list:
- ASP: application service policy
- ARP: application routing policy
- GSP: generic server service policy
- GRP: generic server routing policy
- --appname: Specifies the name of the application. Required if you specify the --type parameter as ASP or ARP.
- --odrname: Specifies the name of the on demand router (ODR). Required if you specify the --type parameter as GSP or GRP.
- --nodename: Specifies the name of the node. Required if you specify the --type parameter as GSP or GRP.
- --wcname: Specifies the unique name for the work class within the specified type.
- --protocol: Specifies the communications protocol that transmits the request. Currently supported protocols are HTTP, IIOP, SOAP, and JMS.
- --wcaction: Specifies the default action to take when a request is matched to a member for the specified work class.
- --module: Specifies the application module to associate members. Required if you specify the --appname and --members parameters.
- --members: Specifies the protocol-specific
pattern:
- HTTP: /test1?/test2/*
- IIOP: ejbName:ejbMethod?ejbName:ejbMethod
- SOAP: webService:operationName?webService:operationName
- JMS: bus:destination?bus:destination
- --rule: Specifies a classification rule in the format of "priority?rule?action"
- --virtualhost: Specifies the virtual host. Required if you specify the --type parameter as GSP or GRP.
- --type: Specifies the type of work class
to list:
- removeWorkClass: Removes a work class.
- --type: Specifies the type of work class
to remove:
- ASP: application service policy
- ARP: application routing policy
- GSP: generic server service policy
- GRP: generic server routing policy
- --appname: Specifies the name of the application. Required if you specify the --type parameter as ASP or ARP.
- --odrname: Specifies the name of the on demand router (ODR). Required if you specify the --type parameter as GSP or GRP.
- --wcname: Specifies the unique name for the work class within the specified type.
- --type: Specifies the type of work class
to remove:
- addMembers: Adds members to a work class.
The ODR uses the new member to match incoming requests.
- --type: Specifies the type of work class
to remove:
- ASP: application service policy
- ARP: application routing policy
- GSP: generic server service policy
- GRP: generic server routing policy
- --appname: Specifies the name of the application. Required if you specify the --type parameter as ASP or ARP.
- --odrname: Specifies the name of the on demand router (ODR). Required if you specify the --type parameter as GSP or GRP.
- --wcname: Specifies the unique name for the work class within the specified type.
- --protocol: Specifies the communications protocol that transmits the request. Currently supported protocols are HTTP, IIOP, SOAP, and JMS.
- --module: Specifies the application module to associate members. Required if you specify the --appname and --members parameters.
- --members: Specifies the protocol-specific
pattern:
- HTTP: /test1?/test2/*
- IIOP: ejbName:ejbMethod?ejbName:ejbMethod
- SOAP: webService:operationName?webService:operationName
- JMS: bus:destination?bus:destination
- --ejbname: Specifies the name of the EJB. Required only when you specify the --protocol parameter as JMS and the --module parameter as IIOP.
- --type: Specifies the type of work class
to remove:
- removeMembers: Removes members from a work
class. The member is no longer used by the ODR.
- --type: Specifies the type of work class
to modify:
- ASP: application service policy
- ARP: application routing policy
- GSP: generic server service policy
- GRP: generic server routing policy
- --appname: Specifies the name of the application. Required if you specify the --type parameter as ASP or ARP.
- --odrname: Specifies the name of the on demand router (ODR). Required if you specify the --type parameter as GSP or GRP.
- --wcname: Specifies the unique name for the work class within the specified type.
- --protocol: Specifies the communications protocol that transmits the request. Currently supported protocols are HTTP, IIOP, SOAP, and JMS.
- --module: Specifies the application module from which to disassociate members. Required if you specify the --appname and --members parameters.
- --members: Specifies the protocol-specific
pattern:
- HTTP: /test1?/test2/*
- IIOP: ejbName:ejbMethod?ejbName:ejbMethod
- SOAP: webService:operationName?webService:operationName
- JMS: bus:destination?bus:destination
- --type: Specifies the type of work class
to modify:
- listMembers: Lists members of a work class.
- --type: Specifies the type of work class
to list:
- ASP: application service policy
- ARP: application routing policy
- GSP: generic server service policy
- GRP: generic server routing policy
- --appname: Specifies the name of the application. Required if you specify the --type parameter as ASP or ARP.
- --odrname: Specifies the name of the on demand router (ODR). Required if you specify the --type parameter as GSP or GRP.
- --nodename: Specifies the name of the node. Required if you specify the --type parameter as GSP or GRP.
- --wcname: Specifies the unique name for the work class within the specified type.
- --protocol: Specifies the communications protocol that transmits the request. Currently supported protocols are HTTP, IIOP, SOAP, and JMS.
- --type: Specifies the type of work class
to list:
- addRules: Adds a classification rule that
is used by the ODR to a work class. If you issue the command with
the like wildcard '%' on UNIX operating
systems, replace the escape sequence (\%%) with (\%).
- --type: Specifies the type of work class
to modify:
- ASP: application service policy
- ARP: application routing policy
- GSP: generic server service policy
- GRP: generic server routing policy
- --appname: Specifies the name of the application. Required if you specify the --type parameter as ASP or ARP.
- --odrname: Specifies the name of the on demand router (ODR). Required if you specify the --type parameter as GSP or GRP.
- --nodename: Specifies the name of the node. Required if you specify the --type parameter as GSP or GRP.
- --wcname: Specifies the unique name for the work class within the specified type.
- --rule: Specifies a classification rule in the format of "priority?rule?action"
- --type: Specifies the type of work class
to modify:
- removeRule: Removes a classification rule
from a work class. The rule is no longer used by the ODR.
- --type: Specifies the type of work class
to modify:
- ASP: application service policy
- ARP: application routing policy
- GSP: generic server service policy
- GRP: generic server routing policy
- --appname: Specifies the name of the application. Required if you specify the --type parameter as ASP or ARP.
- --odrname: Specifies the name of the on demand router (ODR). Required if you specify the --type parameter as GSP or GRP.
- --wcname: Specifies the unique name for the work class within the specified type.
- --expression: Specifies the rule expression.
- --priority: Specifies the priority of the rule to match. The rule with the lowest priority is matched first.
- --type: Specifies the type of work class
to modify:
- listRules: Lists classification rules.
- --type: Specifies the type of work class
to modify:
- ASP: application service policy
- ARP: application routing policy
- GSP: generic server service policy
- GRP: generic server routing policy
- --appname: Specifies the name of the application. Required if you specify the --type parameter as ASP or ARP.
- --odrname: Specifies the name of the on demand router (ODR). Required if you specify the --type parameter as GSP or GRP.
- --wcname: Specifies the unique name for the work class within the specified type.
- --type: Specifies the type of work class
to modify:
- modifyDefaultAction: Edits the default action
for a work class.
- --type: Specifies the type of work class
to modify:
- ASP: application service policy
- ARP: application routing policy
- GSP: generic server service policy
- GRP: generic server routing policy
- --appname: Specifies the name of the application. Required if you specify the --type parameter as ASP or ARP.
- --odrname: Specifies the name of the on demand router (ODR). Required if you specify the --type parameter as GSP or GRP.
- --wcname: Specifies the unique name for the work class within the specified type.
- --wcaction: Specifies the default action to take when a request is matched to a member for the specified work class.
- --type: Specifies the type of work class
to modify:
- getDefaultAction: Specifies the default action
for a work class.
- --type: Specifies the type of work class
to list:
- ASP: application service policy
- ARP: application routing policy
- GSP: generic server service policy
- GRP: generic server routing policy
- --appname: Specifies the name of the application. Required if you specify the --type parameter as ASP or ARP.
- --odrname: Specifies the name of the on demand router (ODR). Required if you specify the --type parameter as GSP or GRP.
- --wcname: Specifies the unique name for the work class within the specified type.
- --type: Specifies the type of work class
to list:
- modifyVirtualHost: Edits the virtual host
for a work class.
- --type: Specifies the type of work class to modify. The valid types are GSP and GRP.
- --odrname: Specifies the name of the on demand router (ODR). Required if you specify the --type parameter as GSP or GRP.
- --wcname: Specifies the unique name for the work class within the specified type.
- --virtualhost: Specifies the virtual host. Required if you specify the --type parameter as GSP or GRP.
- getVirtualHost: Lists the virtual host for
a work class.
- --type: Specifies the type of work class to list. The valid types are GSP and GRP.
- --odrname: Specifies the name of the on demand router (ODR). Required if you specify the --type parameter as GSP or GRP.
- --wcname: Specifies the unique name for the work class within the specified type.
- :
Example
List all work classes:
./wsadmin.sh -lang jython -f workclassoperations.py listWorkClasses
List
all work classes for application Trade:
./wsadmin.sh -lang jython -f workclassoperations.py listWorkClasses
--appname Trade
Create a HTTP application routing policy
work class for application Trade with a default
action of reject and reject code of 404:
./wsadmin.sh -lang jython -f workclassoperations.py createWorkClass
--type ARP --wcname CustomWorkClass --protocol HTTP --wcaction "reject?404" --appname Trade
--module myModule.war --members "/test1?/test2"
List all
routing policy work classes for application Trade:
./wsadmin.sh -lang jython -f workclassoperations.py listWorkClasses
--type ARP --appname Trade
View the default action of
a HTTP application routing policy work class for application Trade:
./wsadmin.sh -lang jython -f workclassoperations.py getDefaultAction
--type ARP --wcname CustomWorkClass --appname Trade
Modify
the default action to Default_TC in a HTTP
application service policy work class for application Trade-edition1.0:
./wsadmin.sh -lang jython -f workclassoperations.py modifyDefaultAction --type ASP --wcname Default_HTTP_WC --wcaction Default_TC --appname Trade-edition1.0
Map the default HTTP work class of edition 1.2 of the
DayTrader application to the default transaction class for the service policy
GOLD:
For transitioning users: The WebSphere® Virtual
Enterprise command that
equates to IMPPYModules.py is XDPYModules.py. If you are
making the transition from WebSphere Virtual
Enterprise, you can continue to
use the XDPYModules.py command, which operates the same as the
IMPPYModules.py command.trns
import java.lang.System as System wasinstallroot=System.getProperty("was.install.root") execfile(wasinstallroot+"/bin/IMPPYModules.py") import java.lang.System as System wasinstallroot=System.getProperty("was.install.root") execfile(wasinstallroot+"/bin/IMPPYModules.py") #application with name DayTrader installed with edition 1.2 appName="DayTrader-edition1.2" #Default_TC_GOLD is the default transaction class mapped to service policy GOLD modifyAppSLADefaultAction("Default_HTTP_WC", appName, tcName, 0) AdminConfig.save()

Add
a classification rule to the application service policy work class
for application Trade:
./wsadmin.sh -lang jython -f workclassoperations.py addRules --wcname CustomWorkClass
--appname Trade --type ARP --rule "1?clienthost=\'localhost\' and serverhost like \'\%%.ibm.com\'?permit?Trade"
Remove
a classification rule by priority from the application service policy
work class for application Trade:
./wsadmin.sh -lang jython -f workclassoperations.py removeRule --wcname
CustomWorkClass --appname Trade --type ARP --priority 1
Remove
a HTTP application routing policy work class for application Trade:
./wsadmin.sh -lang jython -f workclassoperations.py removeWorkClass --type ARP
--wcname CustomWorkClass --appname Trade