001: /*--
002:
003: Copyright (C) 2002-2005 Adrian Price.
004: All rights reserved.
005:
006: Redistribution and use in source and binary forms, with or without
007: modification, are permitted provided that the following conditions
008: are met:
009:
010: 1. Redistributions of source code must retain the above copyright
011: notice, this list of conditions, and the following disclaimer.
012:
013: 2. Redistributions in binary form must reproduce the above copyright
014: notice, this list of conditions, and the disclaimer that follows
015: these conditions in the documentation and/or other materials
016: provided with the distribution.
017:
018: 3. The names "OBE" and "Open Business Engine" must not be used to
019: endorse or promote products derived from this software without prior
020: written permission. For written permission, please contact
021: adrianprice@sourceforge.net.
022:
023: 4. Products derived from this software may not be called "OBE" or
024: "Open Business Engine", nor may "OBE" or "Open Business Engine"
025: appear in their name, without prior written permission from
026: Adrian Price (adrianprice@users.sourceforge.net).
027:
028: THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
029: WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
030: OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
031: DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
032: INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
033: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
034: SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
035: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
036: STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
037: IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
038: POSSIBILITY OF SUCH DAMAGE.
039:
040: For more information on OBE, please see
041: <http://obe.sourceforge.net/>.
042:
043: */
044:
045: package org.obe.spi.service;
046:
047: import org.obe.spi.WorkflowService;
048: import org.obe.spi.event.*;
049: import org.obe.spi.model.ActivityInstance;
050: import org.obe.spi.model.AttributeInstance;
051: import org.obe.spi.model.ProcessInstance;
052: import org.obe.spi.model.WorkItem;
053: import org.obe.xpdl.model.activity.Activity;
054: import org.obe.xpdl.model.data.DataField;
055: import org.obe.xpdl.model.pkg.XPDLPackage;
056: import org.obe.xpdl.model.transition.Transition;
057: import org.obe.xpdl.model.workflow.WorkflowProcess;
058:
059: /**
060: * Provides access to OBE run-time events.
061: * The event object passed to a listener provides access to the entity that was
062: * the source of the event. The listener may call methods on that entity (thus
063: * potentially affecting the entity's state and causing further notifications).
064: * When running in a transactional environment (such as the J2EE server),
065: * listeners are also able to veto the transaction, by calling
066: * <code>setRollbackOnly()</code> on the <code>UserTransaction</code> object.
067: * At present, exceptions thrown by listener methods are logged and ignored;
068: * this behaviour may well change.
069: *
070: * @author Adrian Price
071: */
072: public interface WorkflowEventBroker extends WorkflowService {
073: String SERVICE_NAME = "WorkflowEventBroker";
074:
075: /**
076: * Subscribes to activity instance events.
077: *
078: * @param listener The activity instance event listener to add.
079: * @param mask Bitmask to specify which events to notify.
080: */
081: void addActivityInstanceListener(ActivityInstanceListener listener,
082: int mask);
083:
084: /**
085: * Subscribes to activity instance events.
086: *
087: * @param listener The activity instance event listener to add.
088: * @param mask Bitmask to specify which events to notify.
089: */
090: void addActivityInstanceListener(ApplicationEventListener listener,
091: int mask);
092:
093: /**
094: * Subscribes to attribute instance events.
095: *
096: * @param listener The attribute instance event listener to add.
097: * @param mask Bitmask to specify which events to notify.
098: */
099: void addAttributeInstanceListener(
100: AttributeInstanceListener listener, int mask);
101:
102: /**
103: * Subscribes to attribute instance events.
104: *
105: * @param listener The attribute instance event listener to add.
106: * @param mask Bitmask to specify which events to notify.
107: */
108: void addAttributeInstanceListener(
109: ApplicationEventListener listener, int mask);
110:
111: /**
112: * Subscribes to package events.
113: *
114: * @param listener The package event listener to add.
115: * @param mask Bitmask to specify which events to notify.
116: */
117: void addPackageListener(PackageListener listener, int mask);
118:
119: /**
120: * Subscribes to package events.
121: *
122: * @param listener The package event listener to add.
123: * @param mask Bitmask to specify which events to notify.
124: */
125: void addPackageListener(ApplicationEventListener listener, int mask);
126:
127: /**
128: * Subscribes to process definition events.
129: *
130: * @param listener The process definition event listener to add.
131: * @param mask Bitmask to specify which events to notify.
132: */
133: void addProcessDefinitionListener(
134: ProcessDefinitionListener listener, int mask);
135:
136: /**
137: * Subscribes to process definition events.
138: *
139: * @param listener The process definition event listener to add.
140: * @param mask Bitmask to specify which events to notify.
141: */
142: void addProcessDefinitionListener(
143: ApplicationEventListener listener, int mask);
144:
145: /**
146: * Subscribes to process instance events.
147: *
148: * @param listener The process instance event listener to add.
149: * @param mask Bitmask to specify which events to notify.
150: */
151: void addProcessInstanceListener(ProcessInstanceListener listener,
152: int mask);
153:
154: /**
155: * Subscribes to process instance events.
156: *
157: * @param listener The process instance event listener to add.
158: * @param mask Bitmask to specify which events to notify.
159: */
160: void addProcessInstanceListener(ApplicationEventListener listener,
161: int mask);
162:
163: /**
164: * Subscribes to transition events.
165: *
166: * @param listener The transition event listener to add.
167: * @param mask Bitmask to specify which events to notify.
168: */
169: void addTransitionListener(TransitionListener listener, int mask);
170:
171: /**
172: * Subscribes to transition events.
173: *
174: * @param listener The transition event listener to add.
175: * @param mask Bitmask to specify which events to notify.
176: */
177: void addTransitionListener(ApplicationEventListener listener,
178: int mask);
179:
180: /**
181: * Subscribes to work item events.
182: *
183: * @param listener The work item event listener to add.
184: * @param mask Bitmask to specify which events to notify.
185: */
186: void addWorkItemListener(WorkItemListener listener, int mask);
187:
188: /**
189: * Subscribes to work item events.
190: *
191: * @param listener The work item event listener to add.
192: * @param mask Bitmask to specify which events to notify.
193: */
194: void addWorkItemListener(ApplicationEventListener listener, int mask);
195:
196: /**
197: * Internal use only - do not call.
198: */
199: void fireActivityInstanceEvent(ActivityInstance src, int id,
200: Activity defn, int previousState);
201:
202: /**
203: * Internal use only - do not call.
204: */
205: void fireActivityInstanceAborted(ActivityInstance src,
206: Activity defn, int previousState);
207:
208: /**
209: * Internal use only - do not call.
210: */
211: void fireActivityInstanceCompleted(ActivityInstance src,
212: Activity defn, int previousState);
213:
214: /**
215: * Internal use only - do not call.
216: */
217: void fireActivityInstanceCreated(ActivityInstance src, Activity defn);
218:
219: /**
220: * Internal use only - do not call.
221: */
222: void fireActivityInstanceResumed(ActivityInstance src,
223: Activity defn, int previousState);
224:
225: /**
226: * Internal use only - do not call.
227: */
228: void fireActivityInstanceStarted(ActivityInstance src,
229: Activity defn, int previousState);
230:
231: /**
232: * Internal use only - do not call.
233: */
234: void fireActivityInstanceStopped(ActivityInstance src,
235: Activity defn, int previousState);
236:
237: /**
238: * Internal use only - do not call.
239: */
240: void fireActivityInstanceSuspended(ActivityInstance src,
241: Activity defn, int previousState);
242:
243: /**
244: * Internal use only - do not call.
245: */
246: void fireActivityInstanceTerminated(ActivityInstance src,
247: Activity defn, int previousState);
248:
249: /**
250: * Internal use only - do not call.
251: */
252: void fireAttributeInstanceCreated(AttributeInstance src,
253: DataField defn);
254:
255: /**
256: * Internal use only - do not call.
257: */
258: void fireAttributeInstanceDeleted(AttributeInstance src,
259: DataField defn);
260:
261: /**
262: * Internal use only - do not call.
263: */
264: void fireAttributeInstanceUpdated(AttributeInstance src,
265: DataField defn, Object previousValue);
266:
267: /**
268: * Internal use only - do not call.
269: */
270: void firePackageCreated(XPDLPackage src);
271:
272: /**
273: * Internal use only - do not call.
274: */
275: void firePackageDeleted(XPDLPackage src);
276:
277: /**
278: * Internal use only - do not call.
279: */
280: void firePackageUpdated(XPDLPackage src);
281:
282: /**
283: * Internal use only - do not call.
284: */
285: void fireProcessDefinitionCreated(WorkflowProcess src);
286:
287: /**
288: * Internal use only - do not call.
289: */
290: void fireProcessDefinitionDeleted(WorkflowProcess src);
291:
292: /**
293: * Internal use only - do not call.
294: */
295: void fireProcessDefinitionDisabled(WorkflowProcess src);
296:
297: /**
298: * Internal use only - do not call.
299: */
300: void fireProcessDefinitionEnabled(WorkflowProcess src);
301:
302: /**
303: * Internal use only - do not call.
304: */
305: void fireProcessDefinitionUpdated(WorkflowProcess src);
306:
307: /**
308: * Internal use only - do not call.
309: */
310: void fireProcessInstanceEvent(ProcessInstance src, int id,
311: WorkflowProcess defn, int previousState);
312:
313: /**
314: * Internal use only - do not call.
315: */
316: void fireProcessInstanceAborted(ProcessInstance src,
317: WorkflowProcess defn, int previousState);
318:
319: /**
320: * Internal use only - do not call.
321: */
322: void fireProcessInstanceCompleted(ProcessInstance src,
323: WorkflowProcess defn, int previousState);
324:
325: /**
326: * Internal use only - do not call.
327: */
328: void fireProcessInstanceCreated(ProcessInstance src,
329: WorkflowProcess defn);
330:
331: /**
332: * Internal use only - do not call.
333: */
334: void fireProcessInstanceDeleted(ProcessInstance src,
335: WorkflowProcess defn, int previousState);
336:
337: /**
338: * Internal use only - do not call.
339: */
340: void fireProcessInstanceResumed(ProcessInstance src,
341: WorkflowProcess defn, int previousState);
342:
343: /**
344: * Internal use only - do not call.
345: */
346: void fireProcessInstanceStarted(ProcessInstance src,
347: WorkflowProcess defn, int previousState);
348:
349: /**
350: * Internal use only - do not call.
351: */
352: void fireProcessInstanceSuspended(ProcessInstance src,
353: WorkflowProcess defn, int previousState);
354:
355: /**
356: * Internal use only - do not call.
357: */
358: void fireProcessInstanceTerminated(ProcessInstance src,
359: WorkflowProcess defn, int previousState);
360:
361: /**
362: * Internal use only - do not call.
363: */
364: void fireTransitionEvent(ActivityInstance activityInstance, int id,
365: Transition defn);
366:
367: /**
368: * Internal use only - do not call.
369: */
370: void fireTransitionFired(ActivityInstance activityInstance,
371: Transition defn);
372:
373: /**
374: * Internal use only - do not call.
375: */
376: void fireWorkItemEvent(WorkItem src, int id, Activity defn,
377: int previousState);
378:
379: /**
380: * Internal use only - do not call.
381: */
382: void fireWorkItemAborted(WorkItem src, Activity defn,
383: int previousState);
384:
385: /**
386: * Internal use only - do not call.
387: */
388: void fireWorkItemAssigned(WorkItem src, Activity defn);
389:
390: /**
391: * Internal use only - do not call.
392: */
393: void fireWorkItemCompleted(WorkItem src, Activity defn,
394: int previousState);
395:
396: /**
397: * Internal use only - do not call.
398: */
399: void fireWorkItemCreated(WorkItem src, Activity defn);
400:
401: /**
402: * Internal use only - do not call.
403: */
404: void fireWorkItemResumed(WorkItem src, Activity defn,
405: int previousState);
406:
407: /**
408: * Internal use only - do not call.
409: */
410: void fireWorkItemStarted(WorkItem src, Activity defn,
411: int previousState);
412:
413: /**
414: * Internal use only - do not call.
415: */
416: void fireWorkItemStopped(WorkItem src, Activity defn,
417: int previousState);
418:
419: /**
420: * Internal use only - do not call.
421: */
422: void fireWorkItemSuspended(WorkItem src, Activity defn,
423: int previousState);
424:
425: /**
426: * Internal use only - do not call.
427: */
428: void fireWorkItemTerminated(WorkItem src, Activity defn,
429: int previousState);
430:
431: /**
432: * Unsubscribes from activity instance events.
433: *
434: * @param listener The activity instance event listener to remove.
435: */
436: void removeActivityInstanceListener(
437: ActivityInstanceListener listener);
438:
439: /**
440: * Unsubscribes from activity instance events.
441: *
442: * @param listener The activity instance event listener to remove.
443: */
444: void removeActivityInstanceListener(
445: ApplicationEventListener listener);
446:
447: /**
448: * Unsubscribes from attribute instance events.
449: *
450: * @param listener The attribute instance event listener to remove.
451: */
452: void removeAttributeInstanceListener(
453: AttributeInstanceListener listener);
454:
455: /**
456: * Unsubscribes from attribute instance events.
457: *
458: * @param listener The attribute instance event listener to remove.
459: */
460: void removeAttributeInstanceListener(
461: ApplicationEventListener listener);
462:
463: /**
464: * Unsubscribes from package events.
465: *
466: * @param listener The package event listener to remove.
467: */
468: void removePackageListener(PackageListener listener);
469:
470: /**
471: * Unsubscribes from package events.
472: *
473: * @param listener The package event listener to remove.
474: */
475: void removePackageListener(ApplicationEventListener listener);
476:
477: /**
478: * Unsubscribes from process definition events.
479: *
480: * @param listener The process definition event listener to remove.
481: */
482: void removeProcessDefinitionListener(
483: ProcessDefinitionListener listener);
484:
485: /**
486: * Unsubscribes from process definition events.
487: *
488: * @param listener The process definition event listener to remove.
489: */
490: void removeProcessDefinitionListener(
491: ApplicationEventListener listener);
492:
493: /**
494: * Unsubscribes from process instance events.
495: *
496: * @param listener The process instance event listener to remove.
497: */
498: void removeProcessInstanceListener(ProcessInstanceListener listener);
499:
500: /**
501: * Unsubscribes from process instance events.
502: *
503: * @param listener The process instance event listener to remove.
504: */
505: void removeProcessInstanceListener(ApplicationEventListener listener);
506:
507: /**
508: * Unsubscribes from transition events.
509: *
510: * @param listener The transition event listener to remove.
511: */
512: void removeTransitionListener(WorkItemListener listener);
513:
514: /**
515: * Unsubscribes from transition events.
516: *
517: * @param listener The transition event listener to remove.
518: */
519: void removeTransitionListener(ApplicationEventListener listener);
520:
521: /**
522: * Unsubscribes from work item events.
523: *
524: * @param listener The work item event listener to remove.
525: */
526: void removeWorkItemListener(WorkItemListener listener);
527:
528: /**
529: * Unsubscribes from work item events.
530: *
531: * @param listener The work item event listener to remove.
532: */
533: void removeWorkItemListener(ApplicationEventListener listener);
534: }
|