01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: */
18:
19: /* $Id: Workflow.java 479309 2006-11-26 08:24:35Z andreas $ */
20:
21: package org.apache.lenya.workflow;
22:
23: /**
24: * <p>A workflow schema.</p>
25: * <p>
26: * A workflow schema defines a state machine (deterministic finite
27: * automaton - DFA), consisting of
28: * </p>
29: * <ul>
30: * <li>states, including a marked initial state,</li>
31: * <li>transitions, and</li>
32: * <li>state variables.</li>
33: */
34: public interface Workflow {
35: /**
36: * <code>NAMESPACE</code> Workflow namespace URI
37: */
38: String NAMESPACE = "http://apache.org/cocoon/lenya/workflow/1.0";
39: /**
40: * <code>DEFAULT_PREFIX</code> Default workflow namespace prefix
41: */
42: String DEFAULT_PREFIX = "wf";
43:
44: /**
45: * Returns the initial state of this workflow.
46: * @return The initial state
47: */
48: String getInitialState();
49:
50: /**
51: * Returns the transitions that leave a state.
52: * This method is used, e.g., to disable menu items.
53: * @param state A state.
54: * @return The transitions that leave the state.
55: * @throws WorkflowException if the state is not contained.
56: */
57: Transition[] getLeavingTransitions(String state)
58: throws WorkflowException;
59:
60: /**
61: * Returns the variable names.
62: * @return A string array.
63: */
64: String[] getVariableNames();
65:
66: /**
67: * @return The name of this workflow.
68: */
69: String getName();
70:
71: /**
72: * @param variableName The variable name.
73: * @return The initial value of the variable.
74: * @throws WorkflowException if the variable does not exist.
75: */
76: boolean getInitialValue(String variableName)
77: throws WorkflowException;
78:
79: /**
80: * @return The events.
81: */
82: String[] getEvents();
83:
84: /**
85: * @return The states.
86: */
87: String[] getStates();
88: }
|