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.loader.WorkflowFactory;
11: import com.opensymphony.workflow.spi.WorkflowStore;
12: import com.opensymphony.workflow.util.DefaultVariableResolver;
13: import com.opensymphony.workflow.util.VariableResolver;
14:
15: import java.net.URL;
16:
17: import java.util.Map;
18:
19: /**
20: * @author Quake Wang
21: * @since 2004-5-2
22: * @version $Revision: 1.4 $
23: *
24: **/
25: public class SpringConfiguration implements Configuration {
26: //~ Instance fields ////////////////////////////////////////////////////////
27:
28: //we init this for backward compat since existing spring configs likely don't specify this
29: private VariableResolver variableResolver = new DefaultVariableResolver();
30: private WorkflowFactory factory;
31: private WorkflowStore store;
32:
33: //~ Methods ////////////////////////////////////////////////////////////////
34:
35: public void setFactory(WorkflowFactory factory) {
36: this .factory = factory;
37: }
38:
39: public boolean isInitialized() {
40: return false;
41: }
42:
43: public boolean isModifiable(String name) {
44: return factory.isModifiable(name);
45: }
46:
47: public String getPersistence() {
48: return null;
49: }
50:
51: public Map getPersistenceArgs() {
52: return null;
53: }
54:
55: public void setStore(WorkflowStore store) {
56: this .store = store;
57: }
58:
59: public void setVariableResolver(VariableResolver variableResolver) {
60: this .variableResolver = variableResolver;
61: }
62:
63: public VariableResolver getVariableResolver() {
64: return variableResolver;
65: }
66:
67: public WorkflowDescriptor getWorkflow(String name)
68: throws FactoryException {
69: WorkflowDescriptor workflow = factory.getWorkflow(name);
70:
71: if (workflow == null) {
72: throw new FactoryException("Unknown workflow name");
73: }
74:
75: return workflow;
76: }
77:
78: public String[] getWorkflowNames() throws FactoryException {
79: return factory.getWorkflowNames();
80: }
81:
82: public WorkflowStore getWorkflowStore() throws StoreException {
83: return store;
84: }
85:
86: public void load(URL url) throws FactoryException {
87: }
88:
89: public boolean removeWorkflow(String workflow)
90: throws FactoryException {
91: return factory.removeWorkflow(workflow);
92: }
93:
94: public boolean saveWorkflow(String name,
95: WorkflowDescriptor descriptor, boolean replace)
96: throws FactoryException {
97: return factory.saveWorkflow(name, descriptor, replace);
98: }
99: }
|