View Javadoc

1   /*
2    * $Id: BPMS.java 10489 2008-01-23 17:53:38Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.transport.bpm;
12  
13  import java.util.Map;
14  
15  /**
16   * A generic interface for any Process Engine.  
17   * 
18   * Theoretically, any Process Engine can be "plugged into" Mule via the BPM connector
19   * if it implements this interface.  
20   * 
21   * @see {@link MessageService}
22   */
23  public interface BPMS
24  {
25      /**
26       * {@link MessageService} contains a callback method used to generate Mule messages from your process.
27       * This method is REQUIRED.
28       * 
29       * @param msgService An interface within Mule which the BPMS may call to generate
30       *            Mule messages.
31       */
32      public void setMessageService(MessageService msgService);
33  
34      /**
35       * Start a new process.
36       * This method is REQUIRED.
37       * 
38       * @param processType - the type of process to start
39       * @param processVariables - optional process variables/parameters to set
40       * @return an object representing the new process
41       */
42      public Object startProcess(Object processType, Object transition, Map processVariables) throws Exception;
43  
44      /**
45       * Advance an already-running process.
46       * This method is REQUIRED.
47       * 
48       * @param processId - an ID which identifies the running process
49       * @param transition - optionally specify which transition to take from the
50       *            current state
51       * @param processVariables - optional process variables/parameters to set
52       * @return an object representing the process in its new (i.e., advanced) state
53       */
54      public Object advanceProcess(Object processId, Object transition, Map processVariables) throws Exception;
55  
56      /**
57       * Update the variables/parameters for an already-running process.
58       * This method is OPTIONAL.
59       *
60       * @param processId - an ID which identifies the running process
61       * @param processVariables - process variables/parameters to set
62       * @return an object representing the process in its new (i.e., updated) state
63       */
64      public Object updateProcess(Object processId, Map processVariables) throws Exception;
65  
66      /**
67       * Abort a running process (end abnormally).
68       * This method is OPTIONAL.
69       * 
70       * @param processId - an ID which identifies the running process
71       */
72      public void abortProcess(Object processId) throws Exception;
73  
74      /**
75       * Looks up an already-running process.
76       * This method is OPTIONAL.
77       * 
78       * @return an object representing the process
79       */
80      public Object lookupProcess(Object processId) throws Exception;
81  
82      /**
83       * @return an ID which identifies the given process.
84       * This method is OPTIONAL.
85       */
86      public Object getId(Object process) throws Exception;
87  
88      /**
89       * @return the current state of the given process.
90       * This method is OPTIONAL.
91       */
92      public Object getState(Object process) throws Exception;
93  
94      /**
95       * @return true if the given process has ended.
96       * This method is OPTIONAL.
97       */
98      public boolean hasEnded(Object process) throws Exception;
99  
100     /**
101      * @return true if the object is a valid process
102      * This method is OPTIONAL.
103      */
104     public boolean isProcess(Object obj) throws Exception;
105 }