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