Tool agents, scripting

Q: How to invocate and integrate a system application which is developed by VB,VC,Delphi. This system application is also compiled to .exe file?
Q: Is it possible to start ToolAgent in any other cases than when starting AUTOMATIC activity?
Q: What expressions are supported?
Q: Executing ToolAgent on the client
Q: Is there any was I can have the original object supplied to me?
Q: Variables filtering
Q: How to invocate and integrate a system application which is developed by VB,VC,Delphi. This system application is also compiled to .exe file?
Q: Is it possible to start ToolAgent in any other cases than when starting AUTOMATIC activity?
Q: What expressions are supported?
Q: Executing ToolAgent on the client
Q: Is there any was I can have the original object supplied to me?
Q: Variables filtering
Q:

How to invocate and integrate a system application which is developed by VB,VC,Delphi. This system application is also compiled to .exe file?

Maybe, I can say it more simple, this is how invocation of .EXE file works in the shark. I think it has its actual value in the actual workflow process. Can you help me?

A:

Standard shark distribution comes with a ToolAgent called RuntimeApplicationToolAgent. It is supposed to execute system application (under Windows .exe application), and it can do it synchroniously (by waiting for application to finish, and then finishing activity), or asynchroniously (by starting application and finishing the activity). RuntimeApplication tool agent assumes that the application is on your system path, or that you've given the full path to application when performing its mapping (or in its extended attributes). In our test-JavaScript.xpdl example, you can see that we have defined a Package level Application called notepad. If in an existing process you add activity whose tool is a notepad application, the Windows notepad will be started when this activity comes to execution. Similar to that, you can specify an XPDL Application definition and map it (or specify its extended attributes) to some VB, VC,Delphi, ... .exe file. Of course, you must be aware that these applications will be started on the machine where the shark is running.

Q:

Is it possible to start ToolAgent in any other cases than when starting AUTOMATIC activity?

Eg. with activity state transitions (activate/suspend/resume)? WfMC reference model mentions also other possibilities than starting an activity, but it's left to implementation.

A:

The ToolAgent can be started when starting "Tool" activity (with Start mode set to AUTOMATIC), or when finishing Tool activity, whose Start mode is MANUAL (you can define Tool activity with Start mode MANUAL, and Finish mode AUTOMATIC, and in that case, this activity will appear in your worklist, and when you complete it, the Tool defined will be executed by ToolAgent). There are no other possibilities to start ToolAgent in shark.

Q:

What expressions are supported?

I am trying to determine what expressions are supported in JaWE and how to write these expressions.

     A == B
     A != B
     A > B
     A < B
     A >= B
     A <= B
  

Are these all supported expressions? Can JaWE handle mathematical expressions like the following:

     (A + B) > (C + D)
  
A:

I think that you are missing a point. You can write anything you like in JaWE - it is XPDL editor, and it does not restrict you at this point, but it is a problem what particular engine supports. I.e., shark supports a following kind of expressions: JavaScript expressions, BeanShell expressions (pure Java expressions) and Python expressions. To use i.e. JavaScript expression, your XPDL must have Script element value defined to be "text/javascript". Shark can handle (through the use of appropriate script interpreters) all of the expressions you've written.

Q:

Executing ToolAgent on the client

Is there a way to execute a ToolAgent in the Client-VM?

A:

Tool agents may be executed only by the shark, and not by the client applications that use shark (there is no client interface for ToolAgents). Note that when you use shark as a library (not through the EJB, CORBA or some other wrappers), you are using it in the VM of your client application.

Q:

Is there any was I can have the original object supplied to me?

I am passing a formal parameter to a java tool agent. The paramater is a mutable POJO. I would like to be able to update the POJO in this agent. However, I am passed a copy of the POJO (it looks like it has been copied through serialization). Is there any was I can have the original object supplied to me? I've tried toggling the parameter type of my application parameter, but that didn't seem to have any effect.

A:

Tool agents always get the copy of process context. If your POJO is Clonable, than it is cloned, and if it is not Clonable, it is being Serialized/Deserialized to get its copy (of course, process variables must be Serializable).

Q:

Variables filtering

When I get the activity process variables with the following code:

   WfActivity activity = assignment.activity();
   NameValue[] context = activity.process_context();
   for (int i = 0; i < context.length; ++i) {
      String type = WorkflowUtilities.getTypeKeyOfAnyObject(context[i].the_value);
      java.lang.Object val = WorkflowUtilities.exstractValueOfAnyObject(context[i].the_value,
                                                                        type);
      System.out.println("NameValue["+ i
                         +"] the name = "+ context[i].the_name
                         +"\nthe typecode = "+ type
                         +" the value = " + val );
   }

I get all of the processes variables and not just the ones for the> specific activity currently in progress.

A:

XPDL doesn't provide means to define which variables are specific for an activity, so Shark passes all variables from instance to all its activities.

We use some extended attributes, but these extensions are specific for our example applications - Shark kernel doesn't use any extended attribute from XPDL. For instance: in process definition: "specrelease" from test-JavaScript.xpdl activity test has extended attribute VariableToProcess_UPDATE with value status, signaling our application that this variable may be updated. This way *admin-application* "knows"to offer status variable for update.

top of page