WebSphere Extended Deployment, Version 6.0.x
             Operating Systems: AIX, HP-UX, Linux, Solaris, Windows, z/OS


workclassoperations.py script

You can use the workclassoperations.py script to create, update, and manage work classes.

Purpose

You can perform 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
  • Fetch default actions
  • Set default actions
  • Add rules
  • Delete rules
  • Delete members

Location

The workclassoperations.py script is located in the install_root/bin directory.

Usage

The script usage for general help follows:
./wsadmin.sh|bat -lang jython -f workclassoperations.py
The script usage for operation-specific help follows:
./wsadmin.sh|bat -lang jython -f workclassoperations.py operation --help

Options

-addrule "priority?expr?actiontype?action"
Adds a rule for the created work class. The question mark is required in the sequence as a separator. If you add more than one rule at a time, list the rules in the order of priority starting from the lowest number to the highest number in sequence. Do not use the -addrule option with the -deleterule, -listrule, -getdefaultaction options on the same command invocation.
priority
Specifies the priority that you assign to the rule. Priority is an integer value, 0, 1, 2, 3, and so on, with 0 being the highest priority.
expr
Specifies the rule expression.
actiontype
Specifies the type of action to take. For routing policies, set the value to permit, permitsticky, reject, or redirect. For service policies, use the name of the transaction class as the value.
action
Specifies the recipient of the actiontype.
-appname appName
Specifies the name of the enterprise application or application edition without the .ear file extension.
-adduri
-addmember
Specifies a collection of URI patterns to associate with the work class Web module for the enterprise application. Separate URI patterns with a question mark and start each URI pattern with a forward slash.
-both
Indicates that the -listrule or the -getdefaultaction options should be applied for both routing and service policies on the specified work class.
-deleterule
Deletes a specific rule from the specified work class using the -wcname option. Do not use the -deleterule option with the -addrule, -listrule, or -getdefaultaction options on the same command invocation.
-deleteuri
-deletemember
Specifies a collection of URI patterns to delete from the Web module work class. This option is applicable to enterprise application work classes only.
-listuri
-listmember
Specifies the URI from the Web module element of the work class. This option is applicable only to enterprise application work classes.
-deletewc
Deletes a work class. With this option, you must also specify the -wctype option with a value of ARP (application routing policy), ASP (application service policy), GRP (generic routing policy), or GSP (generic server policy).
-getdefaultaction
Specifies the default actiontype and action that are defined in the specified work class using the -wcname option. Do not use this option with the -addrule, -deleterule, or -listrule options on the same command invocation.
-listrule
Specifies the rules defined in the work class. Do not use this option with -addrule, -deleterule, or -getdefaultaction options on the same command invocation.
-modifydefaultaction
Modifies the default action for the existing work class specified using the -wcname option. Specify the actiontype and action.
-odrname odrName
Specifies the name of the on demand router (ODR).
-odrnode odrNode
Specifies the name of the ODR node.
-setdefaultaction
Creates a rule with an expression denoted by an asterisk symbol. Specify the actiontype and action with values provided with the option.
-type
Specifies the protocol for which the work class applies. Acceptable values are HTTP and SOAP. If the -type option is not specified, the default is HTTP.
-vhost virtualHost
Specifies the name of the virtual host for the generic server cluster.
-webmodule webModule
Specifies the Web module without the .jar or .war file extension.
Tip: Although the parameter is named -webmodule, you can specify EJB and Web modules while managing JMS work classes only.
-wcname workClassName
Specifies the name of the work class. No spaces are allowed in the work class name. This option is always required.
-wctype
Specifies the work class type. This option takes a constant value of either APP for enterprise application or GSC for generic server cluster when creating work classes, because the default action type, actiontype, is used to distinguish between routing and service policy work classes. In operations where the distinction is not obvious, the ARP, ASP, GRP, and GSP values are used. If the -deletewc option is specified, acceptable values are ARP for delete application routing work class, ASP for delete application service policy work class, GRP for delete generic server cluster routing policy work class, and GSP for delete generic server service policy work class. There is no default, so you must specify a value.
-ejbName myEJBname [Version 6.0.1 and later]
Specifies the Enterprise JavaBeans bean name in the EJB .jar module.

Example

Create a routing policy work class, named my_Work_Class, for the my_App application. The work class applies to all URIs with pattern /test1 and /test2/* from the my_Web_Module Web module. The work class contains a single rule that permits requests from the ibm.com domain. The default action causes all other requests to be rejected with an error code of 404.
./wsadmin.sh|bat -lang jython -f workclassoperations.py -appname my_App -wcname my_Work_Class -type HTTP -wctype APP -webmodule my_Web_Module -adduri-addmember "/test1?/test2/*" -addrule  "1?clienthost LIKE \'\%%.ibm.com\'?permit?my_App" -setdefaultaction "reject?404"
Create an enterprise application work class for a routing policy. The work class has the default action of reject with a reject code of 404. If issuing this command on UNIX base operating system, replace the escape sequence \%% with \%.
./wsadmin.sh|bat -lang jython -f workclassoperations.py -appname A -wcname CustomWorkClass -type HTTP -wctype APP -webmodule myWebModule -adduri-addmember "/test1?/test2/*" -addrule "1?clienthost=\'localhost\' and serverhost like \'\%%.ibm.com\'?permit" -setdefaultaction "reject?404" 
Create an enterprise application work class for a service policy. If issuing this command on UNIX base operating system, replace the escape sequence\%% with \%.
./wsadmin.sh|bat -lang jython -f workclassoperations.py -appname A -wcname Custom2WorkClass -type HTTP -wctype APP -webmodule myWebModule -setdefaultaction "Default_TC"-adduri-addmember "/test1?/test2/*" -addrule "1?clienthost=\'localhost\' and serverhost like \'\%%.ibm.com\'?Default_TC" 
Create a work class for a routing policy with a default type of HTTP. The work class default action type is permit, and the action is the generic server cluster name where requests are routed to.
./wsadmin.sh|bat -lang jython -f workclassoperations.py -odrname ODR -odrnode myNode01 -wcname GSCWorkClass  -vhost default_host -wctype GSC -setdefaultaction "permit?myGSC" -adduri-addmember "/test1/*"
Create a work class for the service policy with a default type of HTTP. If issuing this command on UNIX base operating system, replace the escape sequence \%% with \%.
./wsadmin.sh|bat -lang jython -f workclassoperations.py -odrname ODR -odrnode myNode01 -wcname GSCWorkClass -vhost default_host -wctype GSC -addrule "1?serverhost=\'localhost\' and serverhost like \'\%%.ibm.com\'?TransactionClassA" -setdefaultaction "TransactionClassB"
Delete a rule with priority 1 in the CustomWorkClass work class for a routing policy.
./wsadmin.sh|bat -lang jython -f workclassoperations.py -deleterule 1 -wcname CustomWorkClass -appname A -wctype ARP" 
List rules in the CustomWorkClass work class for both routing and service policies for the enterprise application A.
./wsadmin.sh|bat -lang jython -f workclassoperations.py -listrule -wcname CustomWorkClass -both -appname A -wctype APP" 
List rules in the CustomWorkClass work class for both routing and service policies for the generic server cluster.
./wsadmin.sh|bat -lang jython -f workclassoperations.py -listrule -wcname CustomWorkClass -both -odrname ODR -odrnode theTestNode01 -wctype GSC"
Get default actions in work class named CustomWorkClass for both routing and service policies.
./wsadmin.sh|bat -lang jython -f workclassoperations.py -getdefaultaction -wcname CustomWorkClass -both -appname A -wctype APP"
Delete a routing policy work class named CustomWorkClass under the enterprise application A.
./wsadmin.sh|bat -lang jython -f workclassoperations.py -deletewc -wcname CustomWorkClass -appname A -wctype ARP"
Delete a service policy work class named CustomWorkClass under the enterprise application A edition.
./wsadmin.sh|bat -lang jython -f workclassoperations.py -deletewc -wcname CustomWorkClass -appname A -wctype ASP" 
Delete a service policy work class named CustomWorkClass under the ODR named myODR.
./wsadmin.sh|bat -lang jython -f workclassoperations.py -deletewc -wcname CustomWorkClass -odrname myODR -wctype GSP"
Delete a routing policy work class named CustomWorkClass under the ODR named myODR.
./wsadmin.sh|bat -lang jython -f workclassoperations.py -deletewc -wcname CustomWorkClass -odrname myODR -wctype GRP"
List the URIs in work class named CustomWorkClass for application A and Web module microwebapp.
./wsadmin.sh|bat -lang jython -f workclassoperations.py -listuri-listmember -wcname CustomWorkClass -appname A -webmodule microwebapp" 
Delete the URIs in work class named CustomWorkClass for application A and Web module microwebapp.
./wsadmin.sh|bat -lang jython -f workclassoperations.py -deleteuri-deletemember "/myURI/help.jsp" -wcname CustomWorkClass -appname A -webmodule microwebapp" 
Create an enterprise application work class for a routing policy with two additional rules and the default. If issuing this command on UNIX base operating system, replace the escape sequence \%% with \%.
./wsadmin.sh|bat -lang jython -f workclassoperations.py -appname A -webmodule microwebapp -wcname Custom2WorkClass -wctype APP -type HTTP -adduri-addmember "/test1?/test2/*" -setdefaultaction "redirect?http://www.ibm.com" -addrule "1?clienthost=\'localhost\' and serverhost like \'\%%.ibm.com\'?permit?A" -addrule "2?protocol IN (\'HTTP\',\'HTTPS\')?permitsticky?A"
Adds the URIs to an existing work class named CustomWorkClass for application A and Web module microwebapp.
./wsadmin.sh|bat -lang jython -f workclassoperations.py -adduri-addmember "/myURI/help.jsp" -wcname CustomWorkClass -appname A -webmodule microwebapp -wctype ARP"
Create an enterprise application SOAP work class for a routing policy. The work class has the default action of reject with a reject code of 404. If issuing this command on UNIX base operating system, replace the escape sequence \%% with \%.
./wsadmin.sh|bat -lang jython -f workclassoperations.py -appname A -wcname CustomWorkClass -type SOAP -wctype APP -webmodule myWebModule -adduri-addmember "RemoteTest:addJob?RemoteTest:removeJob" -addrule "1?clienthost=\'localhost\' and serverhost like \'\%%.ibm.com\'?permit" -setdefaultaction "reject?404"
[Version 6.0.1 and later] Create an IIOP work class named IIOPWorkClass_001 for a service policy mapping to the default transaction class for all EJBs, and all methods in EJB module named IIOPTestEjb_Server.jar contained in application named MyEjbApplication.
Important: Routing policy work classes are not supported for IIOP. Only service policy work classes are supported. Additionally, to specify more than one EJB or method, use the following format: <ejbName>:<ejbMethod>?<ejbName>:<ejbMethod>.
./wsadmin.sh|bat -lang jython -f workclassoperations.py -appname MyEjbApplication -wcname IIOPWorkClass_001 -type IIOP -wctype ASP -webmodule IIOPTestEjb_Server -setdefaultaction "Default_TC" -addmember *:*
Create an IIOP work class named IIOPWorkClass_002 for a service policy mapping to the transaction class named TC_A_IIOP_002 for EJB named Demo and all methods in the Demo EJB module named IIOPTestEjb_Server.jar contained in application named MyEjbApplication.
./wsadmin.sh|bat -lang jython -f workclassoperations.py -appname MyEjbApplication -wcname IIOPWorkClass_002 type IIOP -wctype ASP -webmodule IIOPTestEjb_Server -setdefaultaction "TC_A_IIOP_002" -addmember Demo:*
Create an IIOP work class named IIOPWorkClass_003 for a service policy mapping to the default transaction class for an EJB named Demo and all methods in the Demo EJB module named IIOPTestEjb_Server.jar contained in application named MyEjbApplication. If the method name is mySpecialMethod and the client host name is localhost, map the service policy to the transaction class TC_A_IIOP_003.
./wsadmin.sh|bat -lang jython -f workclassoperations.py -appname MyEjbApplication -wcname IIOPWorkClass_003 -type IIOP -wctype ASP -webmodule IIOPTestEjb_Server -setdefaultaction "Default_TC" -addmember Demo:mySpecialMethod -addrule "1?clienthost=\'localhost\'?TC_A_IIOP_003"
[Version 6.0.1 and later] Create a JMS work class. For JMS work classes, the format must be <bus>:<destination>?<bust>:<destination>. This example is for two entries.
./wsadmin.sh|bat -lang jython -f workclassoperations.py -appname A -wcname JMSWorkClass1 -type JMS -wctype ASP -webmodule microwebmodule -setdefaultaction "Default_TC" -addmember bus1:destination1
./wsadmin.sh|bat -lang jython -f workclassoperations.py -appname MdbAA -wcname JMSWorkClass2 -type JMS -wctype ASP -webmodule MDBAA -ejbNameMDBAA -setdefaultaction "Default_TC" -addmember bus1:destination2



Related reference
Routing and service policies
Scripts
Related information
Overview of work classes
Reference topic    

Terms of Use | Feedback

Last updated: Oct 16, 2009 11:14:15 AM EDT
http://publib.boulder.ibm.com/infocenter/wxdinfo/v6r0/index.jsp?topic=/com.ibm.websphere.xd.doc/info/reference/rodwcscript.html