View Javadoc

1   /*
2    * $Id: FlowThread.java,v 1.1 2004/12/15 14:18:10 patforna Exp $
3    *
4    * Copyright (c) 2004 Patric Fornasier, Pawel Kowalski
5    * Berne University of Applied Sciences
6    * School of Engineering and Information Technology
7    * All rights reserved.
8    */
9   package bexee.core;
10  
11  import org.apache.commons.logging.Log;
12  import org.apache.commons.logging.LogFactory;
13  
14  import bexee.model.activity.Activity;
15  
16  /***
17   * This class is used to implement "Flow" BPEL activities. i.e. parallel
18   * activity execution.
19   * 
20   * @author Patric Fornasier
21   * @author Pawel Kowalski
22   * @version $Revision: 1.1 $, $Date: 2004/12/15 14:18:10 $
23   */
24  public class FlowThread extends Thread {
25  
26      private static Log log = LogFactory.getLog(FlowThread.class);
27  
28      private ProcessController processController;
29  
30      private ProcessInstance processInstance;
31  
32      private Activity activity;
33  
34      /***
35       * Create a new FlowThread with a ProcessController, ProcessInstance and the
36       * Activity to be executed.
37       * 
38       * @param processController
39       *            the controller to be passed to the activity
40       * @param processInstance
41       *            the process instance
42       * @param activity
43       *            the activity to be executed
44       */
45      public FlowThread(ProcessController processController,
46              ProcessInstance processInstance, Activity activity) {
47          this.processController = processController;
48          this.processInstance = processInstance;
49          this.activity = activity;
50      }
51  
52      /***
53       * The overriden <code>Thread.run()</code> method.
54       */
55      public void run() {
56          try {
57              activity.accept(processController, processInstance);
58          } catch (Exception e) {
59              log.error("Activity execution failed, activity: "
60                      + activity.getName());
61              e.printStackTrace();
62          }
63      }
64  }