01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.workflow.config;
06:
07: import com.opensymphony.workflow.FactoryException;
08: import com.opensymphony.workflow.StoreException;
09: import com.opensymphony.workflow.loader.WorkflowDescriptor;
10: import com.opensymphony.workflow.spi.WorkflowStore;
11: import com.opensymphony.workflow.util.VariableResolver;
12:
13: import java.net.URL;
14:
15: import java.util.Map;
16:
17: /**
18: * Configuration object that is responsible for all 'static' workflow information.
19: * This includes loading of workflow configurations, setting up the workflow
20: * descriptor factory, as well as proxying calls to the underlying descriptor
21: * factory.
22: * Date: Mar 22, 2004
23: * Time: 3:42:19 PM
24: *
25: * @author hani
26: */
27: public interface Configuration {
28: //~ Methods ////////////////////////////////////////////////////////////////
29:
30: /**
31: * @return true if this factory has been initialised.
32: * If the factory is not initialised, then {@link #load(java.net.URL)}
33: * will be called.
34: */
35: boolean isInitialized();
36:
37: /**
38: * Check if a particular workflow can be modified or not.
39: * @param name The workflow name.
40: * @return true if the workflow can be modified, false otherwise.
41: */
42: boolean isModifiable(String name);
43:
44: /**
45: * Get the fully qualified class name of the persistence store.
46: */
47: String getPersistence();
48:
49: /**
50: * Get the persistence args for the persistence store.
51: * Note that this returns the actual args and not a copy,
52: * so modifications to the returned Map could potentially
53: * affect store behaviour.
54: */
55: Map getPersistenceArgs();
56:
57: /**
58: * Return the resolver to use for all variables specified in scripts
59: */
60: VariableResolver getVariableResolver();
61:
62: /**
63: * Get the named workflow descriptor.
64: * @param name the workflow name
65: * @throws FactoryException if there was an error looking up the descriptor or if it could not be found.
66: */
67: WorkflowDescriptor getWorkflow(String name) throws FactoryException;
68:
69: /**
70: * Get a list of all available workflow descriptor names.
71: * @throws FactoryException if the underlying factory does not support this method
72: * or if there was an error looking up workflow names.
73: */
74: String[] getWorkflowNames() throws FactoryException;
75:
76: WorkflowStore getWorkflowStore() throws StoreException;
77:
78: /**
79: * Load the specified configuration file.
80: * @param url url to the configuration file.
81: */
82: void load(URL url) throws FactoryException;
83:
84: /**
85: * Remove the specified workflow.
86: * @param workflow The workflow name of the workflow to remove.
87: * @return true if the workflow was removed, false otherwise.
88: * @throws FactoryException If the underlying workflow factory has an error removing the workflow,
89: * or if it does not support the removal of workflows.
90: */
91: boolean removeWorkflow(String workflow) throws FactoryException;
92:
93: boolean saveWorkflow(String name, WorkflowDescriptor descriptor,
94: boolean replace) throws FactoryException;
95: }
|