How to embed XFlow engine into your application.

Very simple: instantiate the engine and tell it not to try sending notification. See test cases

103   
104    public static WorkflowEngine getWorkflowEngine() { 
105      synchronized( guard ){ 
106        if( workflowEngine == null ){ 
107          workflowEngine = new WorkflowEngine(); 
108          try { 
109            WorkflowProcessor.getInstance().setEventsEnabled( false ); 
110          } catch (SQLException e) { 
111            e.printStackTrace(); 
112            throw new RuntimeException( e ); 
113          } 
114          JMSPublisher.setSendingEnabled( false ); 
115        } 
116        return workflowEngine; 
117      } 
118   
119    }

Typical use could be illustrated by such code:

1    package xflow.server.case_or; 
2     
3    import xflow.protocol.*; 
4    import xflow.server.controller.AbstractServerTestCase; 
5    import xflow.common.WorkItem; 
6     
7    import java.io.IOException; 
8     
9    /** 
10    * User: kosta 
11    * Date: Jul 11, 2004 
12    * Time: 8:09:49 PM 
13    */ 
14   public class CaseOrTest extends AbstractServerTestCase{ 
15    
16     public static final String MODEL_NAME = "case_or"; 
17    
18    
19     public CaseOrTest() { 
20     } 
21    
22     public CaseOrTest(String s) { 
23       super(s); 
24     } 
25    
26    
27     public void testClearDB(){ 
28       assertTrue( "There is already deployed model with the same name",!  doesModelExist( MODEL_NAME ) ); 
29     } 
30    
31     public void testDeployWF() throws IOException { 
32       deployWF( MODEL_NAME, "tests/xflow/server/case_or/case_or.xf.xml" ); 
33     } 
34    
35     public void testStartWF() throws IOException { 
36       startWF( MODEL_NAME ); 
37     } 
38    
39     public void testRunWF(){ 
40       assertTrue( "Proc3 has work", ! processHasWorkItems( MODEL_NAME, "proc3" ) ); 
41       GetNextWorkItemResponse response1 = getNextWorkItemForProcess( MODEL_NAME, "proc1"); 
42       Integer wfID = response1.workItem.getWorkflowId(); 
43       completeWorkItem(  MODEL_NAME, "proc1", response1.workItem ); 
44       assertTrue( "Workflow is finished", isWorkFlowActive( wfID ) ); 
45       assertTrue( "Proc3 has no work", processHasWorkItems( MODEL_NAME, "proc3" ) ); 
46     } 
47    
48    
49     public void testFinalNode(){ 
50       GetNextWorkItemResponse responseProc3 = getNextWorkItemForProcess(  MODEL_NAME,"proc3" ) ; 
51       WorkItem workItem = responseProc3.workItem; 
52       completeWorkItem(  MODEL_NAME, "proc3", workItem ); 
53       assertTrue( "Workflow is not finished", !isWorkFlowActive( workItem.getWorkflowId() ) ); 
54     } 
55    
56    
57     static public junit.framework.Test suite() { 
58       junit.framework.TestSuite newSuite = new junit.framework.TestSuite(); 
59       newSuite.addTest( new CaseOrTest( "testClearDB" ) ); 
60       newSuite.addTest( new CaseOrTest( "testDeployWF" ) ); 
61       newSuite.addTest( new CaseOrTest( "testStartWF" ) ); 
62       newSuite.addTest( new CaseOrTest( "testRunWF" ) ); 
63       newSuite.addTest( new CaseOrTest( "testFinalNode" ) ); 
64       return newSuite; 
65     }; 
66    
67   } 
68