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: * @author hani Date: Feb 15, 2005 Time: 11:18:48 PM
13: */
14: public interface WorkflowFactory {
15: //~ Methods ////////////////////////////////////////////////////////////////
16:
17: void setLayout(String workflowName, Object layout);
18:
19: Object getLayout(String workflowName);
20:
21: boolean isModifiable(String name);
22:
23: String getName();
24:
25: Properties getProperties();
26:
27: WorkflowDescriptor getWorkflow(String name) throws FactoryException;
28:
29: /**
30: * Get a workflow descriptor given a workflow name.
31: * @param name The name of the workflow to get.
32: * @return The descriptor for the specified workflow.
33: * @throws com.opensymphony.workflow.FactoryException if the specified workflow name does not exist or cannot be located.
34: */
35: WorkflowDescriptor getWorkflow(String name, boolean validate)
36: throws FactoryException;
37:
38: /**
39: * Get all workflow names in the current factory
40: * @return An array of all workflow names
41: * @throws com.opensymphony.workflow.FactoryException if the factory cannot determine the names of the workflows it has.
42: */
43: String[] getWorkflowNames() throws FactoryException;
44:
45: void createWorkflow(String name);
46:
47: void init(Properties p);
48:
49: void initDone() throws FactoryException;
50:
51: boolean removeWorkflow(String name) throws FactoryException;
52:
53: void renameWorkflow(String oldName, String newName);
54:
55: void save();
56:
57: /**
58: * Save the workflow.
59: * Is it the responsibility of the caller to ensure that the workflow is valid,
60: * through the {@link WorkflowDescriptor#validate()} method. Invalid workflows will
61: * be saved without being checked.
62: * @param name The name of the workflow to same.
63: * @param descriptor The descriptor for the workflow.
64: * @param replace true if an existing workflow with this name should be replaced.
65: * @return true if the workflow was saved.
66: * @throws com.opensymphony.workflow.FactoryException if there was an error saving the workflow
67: * @throws com.opensymphony.workflow.InvalidWorkflowDescriptorException if the descriptor specified is invalid
68: */
69: boolean saveWorkflow(String name, WorkflowDescriptor descriptor,
70: boolean replace) throws FactoryException;
71: }
|