01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.workflow.loader;
06:
07: import com.opensymphony.workflow.FactoryException;
08:
09: import java.util.Properties;
10:
11: /**
12: * Abstract base class for all workflow factories.
13: * A workflow factory is a factory class that is able
14: * to provide workflow descriptors given a workflow name,
15: * as well as save descriptors.
16: *
17: * @author Hani Suleiman
18: * Date: May 10, 2002
19: * Time: 11:17:06 AM
20: */
21: public abstract class AbstractWorkflowFactory implements
22: WorkflowFactory {
23: //~ Instance fields ////////////////////////////////////////////////////////
24:
25: protected Properties properties = new Properties();
26:
27: //~ Methods ////////////////////////////////////////////////////////////////
28:
29: /**
30: * Get the configuration properties of this factory
31: */
32: public Properties getProperties() {
33: return properties;
34: }
35:
36: public final void init(Properties p) {
37: this .properties = p;
38: }
39:
40: /**
41: * Get a workflow descriptor given a workflow name.
42: * @param name The name of the workflow to get.
43: * @return The descriptor for the specified workflow.
44: * @throws FactoryException if the specified workflow name does not exist or cannot be located.
45: *
46: */
47: public WorkflowDescriptor getWorkflow(String name)
48: throws FactoryException {
49: return getWorkflow(name, true);
50: }
51:
52: /**
53: * Invoked after the properties of the factory have been set.
54: * Subclasses should override this method and add any specific
55: * setup code required. For example, connecting to an external resource
56: * or database.
57: * @throws FactoryException if there was an error during initialization.
58: */
59: public void initDone() throws FactoryException {
60: }
61: }
|