-
2005年10月18日
结合ToolAgent与自定义数据类型实现下拉列表
Geeta的总结:
1. Using JaWE, defined in xpdl a new "Type declartion". Relevant props: Id="AgentListType", Type="External reference" and "Location=com.intellicare.shaleNShark.model.AgentListType"
2. Defined a new application "AgentListApp" with one formal param called "listParam", Mode="in and Out", type="Declared Type", and SubType="AgentListType"
3. Defined a new wfdata variable called "agentListWf", with type="declared type" and Subtype="AgentListType".
4. Finally, mapped the tool to my activity to an application "AgentListApp" in the usual way, with AppName as com.intellicare.shark.toolagent.AgentListToolAgent and mapping the formal to actual param etc again as usual.
the rest is easy: com.intellicare.shaleNShark.model.AgentListType is a class with just one attribute, String[].
com.intellicare.shark.toolagent.AgentListToolAgent has an public static void execute(AppParameter param1) which calls appropraite methods to populate my list of agnets, create a AgentListType object aList, then set the (in and out) param param1 with: param1.the_value = aList;
You should be able to do something very similar and thus avoid having to use servlets etc.. -
2005年09月15日
Shark里面如何使用自定义数据类型
gramani总结得很好。
Step 1. Write a trivial class (I called mine com.intellicare.asterisk.Agent.java). Make sure it is serializable (important!).
Step 2. Open your JaWE editor. Open the xpdl that you want to use.
Step 3. pull down Package -> Type Declarations. Click "New". Enter: id:agent, name: agent, Type: External reference, Location: com.intellicare.asterisk.Agent. Click OK.
Step 4. pull down menu Package -> workflow relevant data. Click New. Enter: id: agentWfdata, name: agentWfdata, isArray: false, Type: declared type. The dropdown menu subtype will now appear with your item "agent" in it. Pick that.Click Ok.
You are done with your xpdl now.
Now the wf data variable agentWfdata will be available to your Java/Shark app as follows:
1. In order to access/initialise it within your Java program, here's what you do: Assume you have Shark initialised and your process has started. Assume you have objects WfActivity currentActivity and Agent agent. Then you can update the wfdata variable with agent as follows:
Map processContextMap = currentActivity.container().process_context();
processContextMap.put("agentWfdata", agent);
currentActivity.set_result(processContextMap);
currentActivity.complete();
2. Now wf data variable agentWfdata is available to all activities of your process. For example you can declare an application in your xpdl this way:
step(i) Open your xpdl in JaWE editor. pull down Package -> Application. Enter id:myApp, name:myApp, Then "new" formal parameter with id:agentFormalParam, mode:in and out, type:declared type. Again you should get the choice of "agent" in your drop down menu for decalred type. Click OK. Now suppose one of your activities has "Tools" mapped to this application, then the *actual* parameter that you can map to the formal parameter "agentFormalParam" is "agentWfData". This is because they both are of type decalred type "agent".
step (ii). Now in your Java/Shark program you can write a toolagent which can access the wfdata "agentWfdata " as follows:
Assume your toolagent has just that one AppParam, thenwithin the execute method:
public static void execute(AppParameter param1) {
Agent agent = (Agent) param1.the_value; //this is ok since we declared this to be *in* and out param
//now do whatveer you want with agent variable..
Agent agent2 = new Agent(..blah..);
param1.value = agent2; //this is ok since we declared this is to be in and *out* param
//etc..
}
-
2005年09月02日
how to use the Deadline Activity property
Q:
Can somebody explain how to use the Deadline Activity property? I have the case that I will need to instantiate a process and set a variable, let say start_date, to the date that this process was instantiated. After that in one of its activities, say Activity1 I want to make a deadline such that if (start_date+2days) have passed it will move to the next activity if not triggered manually? Is this possible to be done and if so how?
A:
Set the deadline to Synchronous and enter as condition something like:
var d = new java.util.Date(start_date.getTime() + WAIT_TIME_OUT);
d;
where start_date is of type Date and WAIT_TIME_OUT is in milliseconds. WAIT_TIME_OUT can be a process- or package-level WRD with initial value (some kind of constant), or just a numeric value - it is your choice.
Fill in the Exception name with some meaningfull string, for example
TimeToContinueException
Then set two outgoing transitions:
- By exception ("TimeToContinueException");
- By condition - the normal activity completion.
If you need exactly the process start date, you can use the Shark supplied value PROCESS_STARTED_TIME instead your own variable start_date.
For more details see the "how_to" document, point "How to write deadline expressions for activities?"
-
2004年12月03日
如何测试shark与异种工作流引擎的交互性
You can test engine interoperability (shark communicating with Fujitsu engine)
through Shark's XPDL process in asap_test.xpdl:NOTE: to test this, you need to configure shark to use database different than HSQL, because you will need to have two different Shark VMs using the same DB (a kind of shark cluster)
First stop the Shark's AXIS service
1) after creating i.e. PostreSQL DB, edit conf/Shark.conf file and turn-off dods caches:
DatabaseManager.defaults.cache.maxCacheSize=0
DatabaseManager.defaults.cache.maxSimpleCacheSize=0
DatabaseManager.defaults.cache.maxComplexCacheSize=0and turn-off shark's caches:
comment the line:
CacheManagerClassName=org.enhydra.shark.caching.LRUCacheMgr2) setup ASAP tool agent property in Shark.conf file:
ASAPToolAgent.Observer=http://www.prozone.co.yu:8080/axis/services/asapObserverBinding
to your IP address instead of www.prozone.co.yu and your port to the wanted one (must be the same as in conf/sharkAxisWrapper.conf file
3) edit conf/sharkAxisWrapper.conf file, and do the same as for the previous test(setup IP address and port)
4) start the Shark's SOAP service - 1st shark VM
5) start shark's swing admin (runSA)- 2nd shark VM
6) upload asap_test.xpdl
7) start process Test asap 1, and do not change any variables
8) go to the worklist, and execute Choose service activity by entering either
http://interop.i-flow.com/iflowjsp/jsp/ProcDef.jsp?planName=Retaileror
http://interop.i-flow.com/iflowjsp/jsp/ProcDef.jsp?planName=Manufacturer
when asked to update variables.
After that, Fujitsu engine is contacted and asked for a process context signature.
9) Activity Enter parameters should appear in your worklist. Choose it, and this signature is displayed in admin application as a context op HashMap when executing it and entering variables. Enter some variables.
At this time Fujitsu engine is again contacted, but this time we call it to create new process instance and pass it the parameters you've entered.
When Fujitsu engine finishes the process, it will call the shark engine deployed as a webservice (the observer), which will respond by completing the activity that called Fujitsu engine that is modeled as a Tool activity with MANUAL end (new shark feature).10) When you refresh your admin, application, you'll see activity View result. View the variables, and you'll see the results Fujitsu engine sent back.
You can also test this interoperability (using the same XPDL process) with two shark engines working on different DBs. Two be able to perform tests and to see it visually, each engine should run in a cluster - 1VM for WEB service, and other for admin application.
-
2004年12月03日
How to test shark as WEB service?
Shark can be deployed as a WEB service, and it provides basic SOAP interfaces defined by ASAP schema and wsdl that you can find in
Shark/modules/SharkWebService/ASAP/API/source folder.
You can test shark using public ASAP client at: http://67.113.139.106/ASAPClient/ :
NOTE: to test it this way, you must have real IP address:
1) edit conf/sharkAxisWrapper.conf file, and uncomment line:
#wrapper.java.additional.1=-Dasap.test.myadd=www.prozone.co.yu
and instead of www.prozone.co.yu put your address
edit the line:
wrapper.app.parameter.4=8080
if you want to change the port where AXIS will listen for SOAP requests
2) deploy shark as a WEB service by using sharkAxisServiceInstall.bat and sharkAxisServiceStart.bat scripts under windows or
appropriate startup script under linux (in this moment, shark will be deployed as a WEB service, and XPDL test-JavaScript.xpdl will
be loaded into it
3) in ASAP client, enter the address where the shark is deployed, i.e:
http://www.prozone.co.yu:8080/axis/services/asapFactoryBinding
and press submit button
4) You will get the next screen with a description of shark's test-JavaScript.XPDL's math_operations process. Press create Instance
button
5) enter the process name and description, and at the bottom of the page, enter parameters P1 and P2 (delete other parameter rows)
and press button create (for the operation, you can enter multiplication, division or substraction if you want operation other than
addition to be performed on these numbers)
6) after this step, you've started shark's process for adding two numbers you've entered. This process should be immediately
finished, so press refresh button to get current state. After that go to Details where you'll see the Result sent by shark engine
(amongst other things)







