1
2
3
4
5
6
7
8
9 package bexee.model;
10
11 import java.io.InputStream;
12
13 import org.apache.commons.logging.Log;
14 import org.apache.commons.logging.LogFactory;
15
16 import bexee.model.process.BPELProcess;
17 import bexee.model.process.impl.BPELProcessImpl;
18 import bexee.util.BexeeProperties;
19 import bexee.util.Constants;
20
21 /***
22 * Abstract class for creating <code>BPELProcessFactory</code>
23 * implementations.
24 *
25 * @version $Revision: 1.1 $, $Date: 2004/12/15 14:18:10 $
26 * @author Patric Fornasier
27 * @author Pawel Kowalski
28 */
29 public abstract class BPELProcessFactory {
30
31 private static Log log = LogFactory.getLog(BPELProcessFactory.class);
32
33 /***
34 * Creates a new <code>BPELProcessFactory</code>. The actual type is
35 * defined by the property <code>bexee.bpel.process.factory</code>.
36 * <p>
37 * If it is not set then {@link BPELProcessImpl}will be created.
38 *
39 * @return a <code>BPELProcessFactory</code> implementation
40 */
41 public static BPELProcessFactory getInstance() {
42
43 BPELProcessFactory factory = null;
44
45 String className = BexeeProperties
46 .getProperty(Constants.OPT_PROCESS_FACTORY);
47
48
49 if (className == null) {
50 log.debug(Constants.OPT_DAO_FACTORY
51 + " not set, creating default factory: "
52 + BPELProcessImpl.class.getName());
53 factory = new BPELProcessFactoryImpl();
54 } else {
55 try {
56
57 Class clazz = Class.forName(className);
58 factory = (BPELProcessFactory) clazz.newInstance();
59 } catch (Exception e) {
60 log.warn("unable to create " + className
61 + ", creating default factory: "
62 + BPELProcessImpl.class.getName());
63 factory = new BPELProcessFactoryImpl();
64 }
65 }
66
67 return factory;
68 }
69
70 /***
71 * The concrete factories will have to implement this method.
72 *
73 * @return a <code>BPELProcess</code> implementation
74 */
75 public abstract BPELProcess createBPELProcess(InputStream bpelDocumentStream)
76 throws BPELDocumentException;
77
78 }