View Javadoc

1   /*
2    * $Id: BPMS.java 22048 2011-05-31 14:39:03Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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.module.bpm;
12  
13  import org.mule.api.NameableObject;
14  
15  import java.util.Map;
16  
17  /**
18   * A generic interface for any Process Engine.  Theoretically, any Process Engine can be "plugged into" 
19   * Mule if it implements this interface.  
20   * 
21   * @see MessageService
22   */
23  public interface BPMS extends NameableObject
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       * Deploy (not start) a process to the BPMS based on a process definition file.
36       * @param resource - process definition file
37       * @throws Exception
38       */
39      public void deployProcess(String resource) throws Exception;
40      
41      /**
42       * Undeploy a process from the BPMS.
43       * @param resource - process definition file
44       * @throws Exception
45       */
46      public void undeployProcess(String resource) throws Exception;
47      
48      /**
49       * Start a new process.
50       * This method is REQUIRED.
51       * 
52       * @param processType - the type of process to start
53       * @param processVariables - optional process variables/parameters to set
54       * @return an object representing the new process
55       */
56      public Object startProcess(Object processType, Object transition, Map processVariables) throws Exception;
57  
58      /**
59       * Advance an already-running process.
60       * This method is REQUIRED.
61       * 
62       * @param processId - an ID which identifies the running process
63       * @param transition - optionally specify which transition to take from the
64       *            current state
65       * @param processVariables - optional process variables/parameters to set
66       * @return an object representing the process in its new (i.e., advanced) state
67       */
68      public Object advanceProcess(Object processId, Object transition, Map processVariables) throws Exception;
69  
70      /**
71       * Update the variables/parameters for an already-running process.
72       * This method is OPTIONAL.
73       *
74       * @param processId - an ID which identifies the running process
75       * @param processVariables - process variables/parameters to set
76       * @return an object representing the process in its new (i.e., updated) state
77       */
78      public Object updateProcess(Object processId, Map processVariables) throws Exception;
79  
80      /**
81       * Abort a running process (end abnormally).
82       * This method is OPTIONAL.
83       * 
84       * @param processId - an ID which identifies the running process
85       */
86      public void abortProcess(Object processId) throws Exception;
87  
88      /**
89       * Looks up an already-running process.
90       * This method is OPTIONAL.
91       * 
92       * @return an object representing the process
93       */
94      public Object lookupProcess(Object processId) throws Exception;
95  
96      /**
97       * @return an ID which identifies the given process.
98       * This method is OPTIONAL.
99       */
100     public Object getId(Object process) throws Exception;
101 
102     /**
103      * @return the current state of the given process.
104      * This method is OPTIONAL.
105      */
106     public Object getState(Object process) throws Exception;
107 
108     /**
109      * @return true if the given process has ended.
110      * This method is OPTIONAL.
111      */
112     public boolean hasEnded(Object process) throws Exception;
113 
114     /**
115      * @return true if the object is a valid process
116      * This method is OPTIONAL.
117      */
118     public boolean isProcess(Object obj) throws Exception;
119 }