-
1. Re: Can I call external application from each node in proces
aeawjang Jul 31, 2005 12:46 PM (in response to kukeltje)So far, I can not open browser but I will try again and again. The another question is whether can I call external application in each node or not. Thanks.
-
2. Re: Can I call external application from each node in proces
aeawjang Aug 1, 2005 5:20 AM (in response to kukeltje)Can I call external tool in node?
-
3. Re: Can I call external application from each node in proces
kukeltje Aug 1, 2005 6:48 AM (in response to kukeltje)you can call any java code or script in action either on nodes, events or transitions (See docs) from within that java code you can call any application you like if it is callable from java
-
4. Re: Can I call external application from each node in proces
aeawjang Aug 1, 2005 7:55 AM (in response to kukeltje)Thanks. I can not see an example for calling external tool. This document just tell the concept. I miss somthing? Where can I see? Do you have some example for calling external tool?
-
5. Re: Can I call external application from each node in proces
kukeltje Aug 1, 2005 2:34 PM (in response to kukeltje) -
6. Re: Can I call external application from each node in proces
aeawjang Aug 2, 2005 12:24 AM (in response to kukeltje)Sory again,
I am not clear. Do you have full application that call external tool in node? Now, I try to create action (MessageActionHandler.java) that have to call fuction inside and it is acted in processdefinition.xml. It is not work.
start ---> auction ----> end
action node is to be called external tool.
processdefinition.xml
<?xml version="1.0" encoding="UTF-8" ?>
- <process-definition name="jbay">
- <!-- SWIMLANES (= process roles)
-->
-
- <!-- Node -->
- <start-state name="start">
-
-
</start-state>
-
-
-
developer
-
- <!-- END
-->
<end-state name="end1" />
</process-definition>
MessageActionHandler.java (This file, I want to open .txt file in auction node)
package com.sample.action;
//import java.io.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;
public class MessageActionHandler implements ActionHandler {
public static boolean isExecuted = false;
private static final long serialVersionUID = 1L;
//String message;
String swimlane;
public void execute(ExecutionContext executionContext) {
//executionContext.getContextInstance().createVariable("greeting","Hello world");
String actorId = executionContext.getTaskMgmtInstance()
.getSwimlaneInstance(swimlane)
.getActorId();
String taskName = executionContext.getTaskInstance().getName();
log.info("###############################################");
log.info("### "+actorId+", task '"+taskName+"' is waiting for you.");
log.info("###############################################");
try{
FileReader fileReader = new FileReader("C:/BlastAll/bin/input/test.txt");
int aChar = 0;
while ((aChar = fileReader.read()) >= 0)
{
System.out.print((char)aChar);
}
}
catch(Exception a)
{
System.out.println("can not read");
}
executionContext.leaveNode();
}
private static final Log log = LogFactory.getLog(MessageActionHandler.class);
}
HellTest.java
package com.jbay;
import junit.framework.TestCase;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
public class HelloTest extends TestCase {
public void testHelloTest() throws Exception {
// Extract a process definition from the processdefinition.xml file.
ProcessDefinition definition = ProcessDefinition.parseXmlResource("aeaw.par/processdefinition.xml");
assertNotNull("Definition should not be null", definition);
// Create an instance of the process definition.
ProcessInstance instance = new ProcessInstance(definition);
assertEquals(
"Instance is in start state",
instance.getRootToken().getNode().getName(),
"start");
assertNull(
"Message variable should not exist yet",
instance.getContextInstance().getVariable("message"));
// Move the process instance from its start state to the first state.
// The configured action should execute and the appropriate message
// should appear in the message process variable.
instance.signal();
assertEquals(
"Instance is in first state",
instance.getRootToken().getNode().getName(),
"auction");
assertEquals(
"Message variable contains message",
instance.getContextInstance().getVariable("greeting"),
null);
// Move the process instance to the end state. The configured action
// should execute again. The message variable contains a new value.
instance.signal();
assertEquals(
"Instance is in end state",
instance.getRootToken().getNode().getName(),
"end1");
assertTrue("Instance has ended", instance.hasEnded());
assertEquals(
"Message variable is changed",
instance.getContextInstance().getVariable("greeting"),
null);
}
}
could you please help me? -
7. Re: Can I call external application from each node in proces
aeawjang Aug 2, 2005 12:26 AM (in response to kukeltje)processdefinition.xml
<?xml version="1.0" encoding="UTF-8"?>
<process-definition name="jbay">
<!-- SWIMLANES (= process roles) -->
<!-- Node -->
<start-state name="start">
</start-state>
developer
<!-- END -->
<end-state name="end1"></end-state>
</process-definition> -
8. Re: Can I call external application from each node in proces
aeawjang Aug 2, 2005 12:29 AM (in response to kukeltje)I am so sorry (that I try to post more source code here, particulaly, xml file. This file can not be posted). I take time to solve it by myself. So, if someone help me, may be keep right way.
Thanks a lot. -
9. Re: Can I call external application from each node in proces
aaw_tom Aug 2, 2005 4:08 AM (in response to kukeltje)Hey,
I have the same problem. I can not call external java file. I am not clear like "a". Document don't give step by step to create them. Have anyone help me? thanks. -
10. Re: Can I call external application from each node in proces
kukeltje Aug 2, 2005 4:37 AM (in response to kukeltje)Please learn to use the forum. Code and xml can be inserted here by surrounding it with a '
' tag. Do not use the instant reply for that but the 'post reply' Ronald
-
11. Re: Can I call external application from each node in proces
kukeltje Aug 2, 2005 4:49 AM (in response to kukeltje)hmmm.. here I messed up myself ;-) but hope anyone gets the idea.
Ronald -
12. Re: Can I call external application from each node in proces
kukeltje Aug 2, 2005 6:12 PM (in response to kukeltje)surround the code/xml with a 'code' tag. Do not use the 'instant reply' but the 'postreply'
Ronald -
13. Re: Can I call external application from each node in proces
kukeltje Aug 2, 2005 6:13 PM (in response to kukeltje)AAFGGGGGHHHHHH got to get used to this paging... What a dork..... (that's to myself ;-))
-
14. Re: Can I call external application from each node in proces
aeawjang Aug 2, 2005 10:51 PM (in response to kukeltje)I am so sorry for strategy of my posted question, I don't know before.
For my question, Could you please help me? how to call external application or java file. I try to put java code in actionhandler java file but It don't work. Please give me some idea.