-
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月15日
shark的学习路线
Geeta的总结。
Are you also new to workflow in general? In which case, you should try and read up on the WfMC specs. Here's a link I found really helpful for the definitions: http://www.wfmc.org/standards/docs/tc003v11.pdf
Once you have at least an overall idea of the specs and the definitions involved, you can look at JaWE, the java Workflow editor which ships with Shark. There is a tutorial in JaWE which is pretty helpful.
Then you can read up on Shark documentation on the Shark website. Especially look at all the links here: http://shark.objectweb.org/doc/1.1/index.html as well as http://shark.objectweb.org/doc/faq.html
There is also a "getting started" page which you can work through. Also, browse though the mail archives. There's a lot of stuff hidden there..
Finally if you are used to web applications, look at the code in http://shark.objectweb.org/components.html#_apps_ . It is a beginner's web app which uses Shark as a client and may help orient you.
-
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?"
-
2005年08月10日
下载ObjectWeb上的软件的方法
最近访问ObjectWeb都不太稳定,而且要下载上面的软件还要填表,填完后提交就死了,又要重填,有时要填几次才能下载到。分析后发现,可以直接去到镜像站点下载的,不用填表。如要下载Shark,直接去到http://download.zh.forge.objectweb.org/shark/下载就可以了。
不过目前CVS还是无法更新。







