You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2004/03/01 12:14:16 UTC
cvs commit: cocoon-lenya/src/java/org/apache/lenya/workflow/impl BooleanVariableImpl.java TransitionImpl.java BooleanVariableCondition.java Version.java History.java WorkflowImpl.java WorkflowInstanceImpl.java BooleanVariableInstanceImpl.java WorkflowBuilder.java AbstractCondition.java BooleanVariableAssignmentImpl.java ActionImpl.java EventImpl.java ConditionFactory.java StateImpl.java SynchronizedWorkflowInstancesImpl.java
andreas 2004/03/01 03:14:16
Modified: src/java/org/apache/lenya/workflow
BooleanVariableInstance.java
BooleanVariableAssignment.java
WorkflowListener.java BooleanVariable.java
Event.java Transition.java WorkflowException.java
SynchronizedWorkflowInstances.java State.java
WorkflowInstance.java Action.java Condition.java
Situation.java Workflow.java
src/java/org/apache/lenya/workflow/impl
BooleanVariableImpl.java TransitionImpl.java
BooleanVariableCondition.java Version.java
History.java WorkflowImpl.java
WorkflowInstanceImpl.java
BooleanVariableInstanceImpl.java
WorkflowBuilder.java AbstractCondition.java
BooleanVariableAssignmentImpl.java ActionImpl.java
EventImpl.java ConditionFactory.java StateImpl.java
SynchronizedWorkflowInstancesImpl.java
Log:
added javadocs
Revision Changes Path
1.4 +5 -2 cocoon-lenya/src/java/org/apache/lenya/workflow/BooleanVariableInstance.java
Index: BooleanVariableInstance.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/BooleanVariableInstance.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BooleanVariableInstance.java 23 Jul 2003 13:21:13 -0000 1.3
+++ BooleanVariableInstance.java 1 Mar 2004 11:14:15 -0000 1.4
@@ -57,10 +57,13 @@
/**
+ * An instance of a boolean variable.
*
- * @author andreas
+ * @author <a href="mailto:andreas@apache.org">Andreas Hartmann</a>
+ * @version $Id$
*/
public interface BooleanVariableInstance {
+
/**
* Sets the value of this variable.
* @param value A boolean value.
1.4 +4 -4 cocoon-lenya/src/java/org/apache/lenya/workflow/BooleanVariableAssignment.java
Index: BooleanVariableAssignment.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/BooleanVariableAssignment.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BooleanVariableAssignment.java 23 Jul 2003 13:21:13 -0000 1.3
+++ BooleanVariableAssignment.java 1 Mar 2004 11:14:15 -0000 1.4
@@ -57,10 +57,10 @@
/**
- * @author andreas
+ * Boolean variable assignment.
*
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
+ * @author <a href="mailto:andreas@apache.org">Andreas Hartmann</a>
+ * @version $Id$
*/
public interface BooleanVariableAssignment extends Action {
}
1.5 +5 -2 cocoon-lenya/src/java/org/apache/lenya/workflow/WorkflowListener.java
Index: WorkflowListener.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/WorkflowListener.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- WorkflowListener.java 23 Jul 2003 13:21:13 -0000 1.4
+++ WorkflowListener.java 1 Mar 2004 11:14:15 -0000 1.5
@@ -57,10 +57,13 @@
/**
- * @author andreas
+ * Workflow listener interface.
*
+ * @author <a href="mailto:andreas@apache.org">Andreas Hartmann</a>
+ * @version $Id$
*/
public interface WorkflowListener {
+
/**
* This method is invoked when a transition has fired.
*
1.6 +11 -4 cocoon-lenya/src/java/org/apache/lenya/workflow/BooleanVariable.java
Index: BooleanVariable.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/BooleanVariable.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- BooleanVariable.java 23 Jul 2003 13:21:13 -0000 1.5
+++ BooleanVariable.java 1 Mar 2004 11:14:15 -0000 1.6
@@ -57,16 +57,23 @@
/**
+ * <p>Boolean state variable.</p>
+ * <p>
+ * A workflow schema can contain a set of state variables.
+ * For each instance, the state variables hold certain values.
+ * Values can be assigned during transitions, so a variable can
+ * change its value when a transition fires. Currently,
+ * the workflow supports only boolean state variables.
+ * </p>
*
- * @author andreas
+ * @author <a href="mailto:andreas@apache.org">Andreas Hartmann</a>
+ * @version $Id$
*/
public interface BooleanVariable {
/**
* Returns the name of this variable.
- *
* @return the name
- *
*/
String getName();
1.6 +8 -13 cocoon-lenya/src/java/org/apache/lenya/workflow/Event.java
Index: Event.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/Event.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Event.java 23 Jul 2003 13:21:13 -0000 1.5
+++ Event.java 1 Mar 2004 11:14:15 -0000 1.6
@@ -1,6 +1,4 @@
/*
-$Id$
-<License>
============================================================================
The Apache Software License, Version 1.1
@@ -24,7 +22,7 @@
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Apache Lenya" and "Apache Software Foundation" must not be
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
used to endorse or promote products derived from this software without
prior written permission. For written permission, please contact
apache@apache.org.
@@ -46,26 +44,23 @@
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- Michael Wechner <mi...@apache.org>. For more information on the Apache Soft-
- ware Foundation, please see <http://www.apache.org/>.
+ Stefano Mazzocchi <st...@apache.org>. For more information on the Apache
+ Software Foundation, please see <http://www.apache.org/>.
- Lenya includes software developed by the Apache Software Foundation, W3C,
- DOM4J Project, BitfluxEditor, Xopus, and WebSHPINX.
-</License>
*/
package org.apache.lenya.workflow;
-
/**
+ * A workflow event.
*
- * @author andreas
+ * @author <a href="mailto:andreas@apache.org">Andreas Hartmann</a>
+ * @version $Id$
*/
public interface Event {
/**
- * Get the name of this event
- *
- * @return the name
+ * Get the name of this event.
+ * @return A string.
*/
String getName();
}
1.8 +20 -3 cocoon-lenya/src/java/org/apache/lenya/workflow/Transition.java
Index: Transition.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/Transition.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Transition.java 2 Oct 2003 15:27:42 -0000 1.7
+++ Transition.java 1 Mar 2004 11:14:15 -0000 1.8
@@ -57,8 +57,25 @@
/**
- *
- * @author andreas
+ * <p>
+ * A transition describes the switching of a workflow instance
+ * from one state to another. A transition has
+ * </p>
+ *
+ * <ul>
+ * <li>a source state,</li>
+ * <li>a destination state,</li>
+ * <li>an event,</li>
+ * <li>a set of conditions,</li>
+ * <li>a set of assignments.</li>
+ * </ul>
+ *
+ * <p>
+ * Additionally, a transition can be marked as synchronized.
+ * </p>
+ *
+ * @author <a href="mailto:andreas@apache.org">Andreas Hartmann</a>
+ * @version $Id$
*/
public interface Transition {
1.5 +4 -4 cocoon-lenya/src/java/org/apache/lenya/workflow/WorkflowException.java
Index: WorkflowException.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/WorkflowException.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- WorkflowException.java 23 Jul 2003 13:21:13 -0000 1.4
+++ WorkflowException.java 1 Mar 2004 11:14:15 -0000 1.5
@@ -57,10 +57,10 @@
/**
- * @author andreas
+ * Workflow exception.
*
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
+ * @author <a href="mailto:andreas@apache.org">Andreas Hartmann</a>
+ * @version $Id$
*/
public class WorkflowException extends Exception {
/**
1.2 +28 -1 cocoon-lenya/src/java/org/apache/lenya/workflow/SynchronizedWorkflowInstances.java
Index: SynchronizedWorkflowInstances.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/SynchronizedWorkflowInstances.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SynchronizedWorkflowInstances.java 10 Oct 2003 16:42:12 -0000 1.1
+++ SynchronizedWorkflowInstances.java 1 Mar 2004 11:14:15 -0000 1.2
@@ -57,6 +57,33 @@
/**
+ * <p>
+ * Synchronized workflow instances.
+ * </p>
+ *
+ * <p>
+ * A set of workflow instances with the same workflow schema can be synchronized.
+ * If a transition in this schema is marked as synchronized, it can only be invoked
+ * on all instances in the set at the same time.
+ * </p>
+ *
+ * <p>
+ * When a workflow event is invoked on a set of synchronized workflow instances,
+ * the transition is invoked only if
+ * </p>
+ * <ul>
+ * <li>all instances are in the source state of the transition, and</li>
+ * <li>all conditions of the transition are complied for all instances.</li>
+ * </ul>
+ *
+ * <p>
+ * Then the transition is invoked for all instances in the set.
+ * </p>
+ * <p>
+ * A common usecase of this concept is the simultaneous publishing of
+ * a set of documents (all language versions of a document, a section, ...).
+ * </p>
+ *
* @author <a href="mailto:andreas@apache.org">Andreas Hartmann</a>
*/
public interface SynchronizedWorkflowInstances {
1.4 +4 -3 cocoon-lenya/src/java/org/apache/lenya/workflow/State.java
Index: State.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/State.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- State.java 23 Jul 2003 13:21:13 -0000 1.3
+++ State.java 1 Mar 2004 11:14:15 -0000 1.4
@@ -55,10 +55,11 @@
*/
package org.apache.lenya.workflow;
-
/**
+ * Workflow state.
*
- * @author andreas
+ * @author <a href="mailto:andreas@apache.org">Andreas Hartmann</a>
+ * @version $Id$
*/
public interface State {
}
1.9 +8 -2 cocoon-lenya/src/java/org/apache/lenya/workflow/WorkflowInstance.java
Index: WorkflowInstance.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/WorkflowInstance.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- WorkflowInstance.java 2 Oct 2003 15:27:42 -0000 1.8
+++ WorkflowInstance.java 1 Mar 2004 11:14:15 -0000 1.9
@@ -56,8 +56,14 @@
package org.apache.lenya.workflow;
/**
+ * <p>A workflow instance is an incarnation of a workflow schema. It consists of</p>
+ * <ul>
+ * <li>a current state,</li>
+ * <li>a mapping which assigns values to all state variables.</li>
+ * </ul>
*
- * @author andreas
+ * @author <a href="mailto:andreas@apache.org">Andreas Hartmann</a>
+ * @version $Id$
*/
public interface WorkflowInstance {
/**
1.6 +4 -4 cocoon-lenya/src/java/org/apache/lenya/workflow/Action.java
Index: Action.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/Action.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Action.java 23 Jul 2003 13:21:13 -0000 1.5
+++ Action.java 1 Mar 2004 11:14:15 -0000 1.6
@@ -57,16 +57,16 @@
/**
+ * Workflow action.
*
- * @author andreas
+ * @author <a href="mailto:andreas@apache.org">Andreas Hartmann</a>
+ * @version $Id$
*/
public interface Action {
/**
* Executes this action for a given workflow instance.
- *
* @param instance the workflow instance
- *
* @throws WorkflowException if the execution failed
*/
void execute(WorkflowInstance instance) throws WorkflowException;
1.5 +10 -2 cocoon-lenya/src/java/org/apache/lenya/workflow/Condition.java
Index: Condition.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/Condition.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Condition.java 2 Sep 2003 13:17:22 -0000 1.4
+++ Condition.java 1 Mar 2004 11:14:15 -0000 1.5
@@ -56,8 +56,16 @@
package org.apache.lenya.workflow;
/**
+ * <p>A condition can prevent a transition from firing,
+ * based on the current situation. Examples:</p>
+ * <ul>
+ * <li>Does the current user have a certain role on the current URL?</li>
+ * <li>Does a certain state variable have a certain value (e.g., is the document published)? (BooleanVariableCondition)<li>
+ * <li>Is the sun shining? (e.g., if the weather report may only be published on sunny days)</li>
+ * </ul>
*
- * @author andreas
+ * @author <a href="mailto:andreas@apache.org">Andreas Hartmann</a>
+ * @version $Id$
*/
public interface Condition {
1.4 +4 -2 cocoon-lenya/src/java/org/apache/lenya/workflow/Situation.java
Index: Situation.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/Situation.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Situation.java 23 Jul 2003 13:21:13 -0000 1.3
+++ Situation.java 1 Mar 2004 11:14:15 -0000 1.4
@@ -59,7 +59,9 @@
/**
* A situation contains all information that is needed to decide which
* workflow transitions can fire at a certain moment.
- * @author andreas
+ *
+ * @author <a href="mailto:andreas@apache.org">Andreas Hartmann</a>
+ * @version $Id$
*/
public interface Situation {
}
1.6 +12 -3 cocoon-lenya/src/java/org/apache/lenya/workflow/Workflow.java
Index: Workflow.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/Workflow.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Workflow.java 28 Aug 2003 10:17:29 -0000 1.5
+++ Workflow.java 1 Mar 2004 11:14:15 -0000 1.6
@@ -55,10 +55,19 @@
*/
package org.apache.lenya.workflow;
-
/**
+ * <p>A workflow schema.</p>
+ * <p>
+ * A workflow schema defines a state machine (deterministic finite
+ * automaton - DFA), consisting of
+ * </p>
+ * <ul>
+ * <li>states, including a marked initial state,</li>
+ * <li>transitions, and</li>
+ * <li>state variables.</li>
*
- * @author andreas
+ * @author <a href="mailto:andreas@apache.org">Andreas Hartmann</a>
+ * @version $Id$
*/
public interface Workflow {
String NAMESPACE = "http://apache.org/cocoon/lenya/workflow/1.0";
1.7 +1 -2 cocoon-lenya/src/java/org/apache/lenya/workflow/impl/BooleanVariableImpl.java
Index: BooleanVariableImpl.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/impl/BooleanVariableImpl.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- BooleanVariableImpl.java 2 Sep 2003 13:17:21 -0000 1.6
+++ BooleanVariableImpl.java 1 Mar 2004 11:14:16 -0000 1.7
@@ -70,7 +70,6 @@
* @param initialValue The initial value of the corresponding variable instances.
*/
protected BooleanVariableImpl(String variableName, boolean initialValue) {
- assert variableName != null;
name = variableName;
this.initialValue = initialValue;
1.9 +17 -31 cocoon-lenya/src/java/org/apache/lenya/workflow/impl/TransitionImpl.java
Index: TransitionImpl.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/impl/TransitionImpl.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- TransitionImpl.java 2 Oct 2003 15:27:42 -0000 1.8
+++ TransitionImpl.java 1 Mar 2004 11:14:16 -0000 1.9
@@ -82,9 +82,6 @@
* @param destinationState The destination state.
*/
protected TransitionImpl(StateImpl sourceState, StateImpl destinationState) {
- assert sourceState != null;
- assert destinationState != null;
-
source = sourceState;
destination = destinationState;
}
@@ -93,72 +90,62 @@
private boolean isSynchronized = false;
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Returns the actions which are assigned tothis transition.
+ * @return An array of actions.
*/
public Action[] getActions() {
return (Action[]) actions.toArray(new Action[actions.size()]);
}
/**
- * DOCUMENT ME!
- *
- * @param action DOCUMENT ME!
+ * Assigns an action to this transition.
+ * @param action The action.
*/
public void addAction(Action action) {
- assert action != null;
actions.add(action);
}
private List conditions = new ArrayList();
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Returns the conditions which are assigned to this transition.
+ * @return An array of conditions.
*/
public Condition[] getConditions() {
return (Condition[]) conditions.toArray(new Condition[conditions.size()]);
}
/**
- * DOCUMENT ME!
- *
- * @param condition DOCUMENT ME!
+ * Assigns a condition to this transition.
+ * @param condition The condition.
*/
public void addCondition(Condition condition) {
- assert condition != null;
conditions.add(condition);
}
private Event event;
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Returns the event which invokes this transition.
+ * @return An event.
*/
public Event getEvent() {
return event;
}
/**
- * DOCUMENT ME!
- *
- * @param anEvent DOCUMENT ME!
+ * Sets the event to invoke this transition.
+ * @param anEvent An event.
*/
public void setEvent(Event anEvent) {
- assert anEvent != null;
event = anEvent;
}
private StateImpl source;
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Returns the source state of this transition.
+ * @return A state.
*/
public StateImpl getSource() {
return source;
@@ -167,9 +154,8 @@
private StateImpl destination;
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Returns the destination state of this transition.
+ * @return A state.
*/
public StateImpl getDestination() {
return destination;
1.3 +1 -1 cocoon-lenya/src/java/org/apache/lenya/workflow/impl/BooleanVariableCondition.java
Index: BooleanVariableCondition.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/impl/BooleanVariableCondition.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
1.2 +1 -4 cocoon-lenya/src/java/org/apache/lenya/workflow/impl/Version.java
Index: Version.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/impl/Version.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Version.java 20 Aug 2003 18:53:46 -0000 1.1
+++ Version.java 1 Mar 2004 11:14:16 -0000 1.2
@@ -91,10 +91,7 @@
* @param state The destination state.
*/
public Version(Event event, State state) {
- assert event != null;
this.event = event;
-
- assert state != null;
this.state = state;
}
1.18 +14 -6 cocoon-lenya/src/java/org/apache/lenya/workflow/impl/History.java
Index: History.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/impl/History.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- History.java 11 Feb 2004 13:51:54 -0000 1.17
+++ History.java 1 Mar 2004 11:14:16 -0000 1.18
@@ -82,10 +82,16 @@
import org.w3c.dom.Element;
/**
- * @author andreas
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
+ * <p>The history of a workflow instance contains a list of all
+ * versions of the instance. A version contains
+ * </p>
+ * <ul>
+ * <li>the state,</li>
+ * <li>the event that caused the transition (omitted in the first version).</li>
+ * </ul>
+ *
+ * @author <a href="mailto:andreas@apache.org">Andreas Hartmann</a>
+ * @version $Id$
*/
public abstract class History implements WorkflowListener {
public static final String WORKFLOW_ATTRIBUTE = "workflow";
@@ -447,7 +453,9 @@
* @throws WorkflowException when something went wrong.
*/
protected Version restoreVersion(NamespaceHelper helper, Element element) throws WorkflowException {
- assert element.getLocalName().equals(VERSION_ELEMENT);
+ if (!element.getLocalName().equals(VERSION_ELEMENT)) {
+ throw new WorkflowException("Invalid history XML!");
+ }
Event event = null;
String eventId = element.getAttribute(EVENT_ATTRIBUTE);
1.8 +9 -20 cocoon-lenya/src/java/org/apache/lenya/workflow/impl/WorkflowImpl.java
Index: WorkflowImpl.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/impl/WorkflowImpl.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- WorkflowImpl.java 2 Feb 2004 02:50:38 -0000 1.7
+++ WorkflowImpl.java 1 Mar 2004 11:14:16 -0000 1.8
@@ -107,7 +107,6 @@
* @param transition The transition.
*/
protected void addTransition(TransitionImpl transition) {
- assert transition != null;
transitions.add(transition);
addState(transition.getSource());
addState(transition.getDestination());
@@ -127,8 +126,6 @@
*
*/
protected State getDestination(Transition transition) {
- assert transition instanceof TransitionImpl;
-
return ((TransitionImpl) transition).getDestination();
}
@@ -188,18 +185,14 @@
* @param event An event.
*/
protected void addEvent(EventImpl event) {
- assert event != null;
events.put(event.getName(), event);
}
/**
- * DOCUMENT ME!
- *
- * @param name DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- *
- * @throws WorkflowException DOCUMENT ME!
+ * Returns the event for a certain event name.
+ * @param name A string.
+ * @return The event with this name.
+ * @throws WorkflowException when no event with the given name exists.
*/
public EventImpl getEvent(String name) throws WorkflowException {
if (!events.containsKey(name)) {
@@ -216,18 +209,14 @@
* @param variable A variable.
*/
protected void addVariable(BooleanVariableImpl variable) {
- assert variable != null;
variables.put(variable.getName(), variable);
}
/**
- * DOCUMENT ME!
- *
- * @param name DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- *
- * @throws WorkflowException DOCUMENT ME!
+ * Returns the variable for a certain name.
+ * @param name The name of the variable.
+ * @return A variable.
+ * @throws WorkflowException if no variable with the given name exists.
*/
public BooleanVariableImpl getVariable(String name)
throws WorkflowException {
1.12 +1 -4 cocoon-lenya/src/java/org/apache/lenya/workflow/impl/WorkflowInstanceImpl.java
Index: WorkflowInstanceImpl.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/impl/WorkflowInstanceImpl.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- WorkflowInstanceImpl.java 2 Feb 2004 02:50:38 -0000 1.11
+++ WorkflowInstanceImpl.java 1 Mar 2004 11:14:16 -0000 1.12
@@ -215,7 +215,6 @@
* @param state The state to set.
*/
protected void setCurrentState(State state) {
- assert (state != null) && ((WorkflowImpl) getWorkflow()).containsState(state);
this.currentState = state;
}
@@ -231,7 +230,6 @@
* @param workflow A workflow object.
*/
protected void setWorkflow(WorkflowImpl workflow) {
- assert workflow != null;
this.workflow = workflow;
setCurrentState(getWorkflow().getInitialState());
initVariableInstances();
@@ -243,7 +241,6 @@
* @throws WorkflowException if something goes wrong.
*/
protected void setWorkflow(String workflowName) throws WorkflowException {
- assert (workflowName != null) && !"".equals(workflowName);
setWorkflow(getWorkflow(workflowName));
}
1.5 +1 -1 cocoon-lenya/src/java/org/apache/lenya/workflow/impl/BooleanVariableInstanceImpl.java
Index: BooleanVariableInstanceImpl.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/impl/BooleanVariableInstanceImpl.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
1.13 +5 -28 cocoon-lenya/src/java/org/apache/lenya/workflow/impl/WorkflowBuilder.java
Index: WorkflowBuilder.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/impl/WorkflowBuilder.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- WorkflowBuilder.java 2 Feb 2004 02:50:38 -0000 1.12
+++ WorkflowBuilder.java 1 Mar 2004 11:14:16 -0000 1.13
@@ -89,13 +89,10 @@
}
/**
- * DOCUMENT ME!
- *
- * @param file DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- *
- * @throws WorkflowException DOCUMENT ME!
+ * Builds a workflow schema from a file.
+ * @param file The file.
+ * @return A workflow schema implementation.
+ * @throws WorkflowException if the file does not represent a valid workflow schema.
*/
public static WorkflowImpl buildWorkflow(File file) throws WorkflowException {
WorkflowImpl workflow;
@@ -143,8 +140,6 @@
}
}
- assert initialState != null;
-
WorkflowImpl workflow = new WorkflowImpl(initialState);
// load variables
@@ -187,8 +182,6 @@
* @return A boolean value.
*/
protected static boolean isInitialStateElement(Element element) {
- assert element.getLocalName().equals(STATE_ELEMENT);
-
String initialAttribute = element.getAttribute(INITIAL_ATTRIBUTE);
return (initialAttribute != null)
@@ -218,8 +211,6 @@
* @return A state.
*/
protected static StateImpl buildState(Element element) {
- assert element.getLocalName().equals(STATE_ELEMENT);
-
String id = element.getAttribute(ID_ATTRIBUTE);
StateImpl state = new StateImpl(id);
@@ -246,31 +237,19 @@
log.debug("Building transition");
}
- assert element.getLocalName().equals(TRANSITION_ELEMENT);
-
String sourceId = element.getAttribute(SOURCE_ATTRIBUTE);
String destinationId = element.getAttribute(DESTINATION_ATTRIBUTE);
- assert sourceId != null;
- assert destinationId != null;
-
StateImpl source = (StateImpl) states.get(sourceId);
StateImpl destination = (StateImpl) states.get(destinationId);
- assert source != null;
- assert destination != null;
-
TransitionImpl transition = new TransitionImpl(source, destination);
// set event
Element eventElement =
(Element) element.getElementsByTagNameNS(Workflow.NAMESPACE, EVENT_ELEMENT).item(0);
String id = eventElement.getAttribute(ID_ATTRIBUTE);
- assert id != null;
-
Event event = (Event) events.get(id);
- assert event != null;
-
transition.setEvent(event);
if (log.isDebugEnabled()) {
@@ -321,8 +300,6 @@
*/
protected static EventImpl buildEvent(Element element) {
String id = element.getAttribute(ID_ATTRIBUTE);
- assert id != null;
-
EventImpl event = new EventImpl(id);
return event;
1.2 +1 -2 cocoon-lenya/src/java/org/apache/lenya/workflow/impl/AbstractCondition.java
Index: AbstractCondition.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/impl/AbstractCondition.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractCondition.java 2 Sep 2003 13:17:21 -0000 1.1
+++ AbstractCondition.java 1 Mar 2004 11:14:16 -0000 1.2
@@ -72,7 +72,6 @@
* @see org.apache.lenya.workflow.impl.AbstractCondition#setExpression(java.lang.String)
*/
public void setExpression(String expression) throws WorkflowException {
- assert expression != null;
this.expression = expression.trim();
}
1.5 +1 -2 cocoon-lenya/src/java/org/apache/lenya/workflow/impl/BooleanVariableAssignmentImpl.java
Index: BooleanVariableAssignmentImpl.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/impl/BooleanVariableAssignmentImpl.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- BooleanVariableAssignmentImpl.java 2 Sep 2003 13:17:21 -0000 1.4
+++ BooleanVariableAssignmentImpl.java 1 Mar 2004 11:14:16 -0000 1.5
@@ -74,7 +74,6 @@
* @param value The value.
*/
protected BooleanVariableAssignmentImpl(BooleanVariableImpl variable, boolean value) {
- assert variable != null;
this.variable = variable;
this.value = value;
1.7 +3 -5 cocoon-lenya/src/java/org/apache/lenya/workflow/impl/ActionImpl.java
Index: ActionImpl.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/impl/ActionImpl.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ActionImpl.java 2 Sep 2003 13:17:21 -0000 1.6
+++ ActionImpl.java 1 Mar 2004 11:14:16 -0000 1.7
@@ -71,16 +71,14 @@
* @param actionId The action ID.
*/
protected ActionImpl(String actionId) {
- assert actionId != null;
id = actionId;
}
private String id;
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Returns the action ID.
+ * @return A string.
*/
public String getId() {
return id;
1.7 +5 -12 cocoon-lenya/src/java/org/apache/lenya/workflow/impl/EventImpl.java
Index: EventImpl.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/impl/EventImpl.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- EventImpl.java 2 Sep 2003 13:17:21 -0000 1.6
+++ EventImpl.java 1 Mar 2004 11:14:16 -0000 1.7
@@ -69,7 +69,6 @@
* @param eventName The event name.
*/
protected EventImpl(String eventName) {
- assert eventName != null;
name = eventName;
}
@@ -83,12 +82,8 @@
return getName();
}
- /**
- * DOCUMENT ME!
- *
- * @param otherObject DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object otherObject) {
boolean equals = false;
@@ -103,10 +98,8 @@
return equals;
}
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
*/
public int hashCode() {
return getName().hashCode();
1.7 +1 -3 cocoon-lenya/src/java/org/apache/lenya/workflow/impl/ConditionFactory.java
Index: ConditionFactory.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/impl/ConditionFactory.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ConditionFactory.java 2 Sep 2003 13:17:21 -0000 1.6
+++ ConditionFactory.java 1 Mar 2004 11:14:16 -0000 1.7
@@ -80,8 +80,6 @@
*/
protected static Condition createCondition(String className, String expression)
throws WorkflowException {
- assert className != null;
- assert expression != null;
Condition condition;
1.6 +1 -2 cocoon-lenya/src/java/org/apache/lenya/workflow/impl/StateImpl.java
Index: StateImpl.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/impl/StateImpl.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- StateImpl.java 2 Sep 2003 13:17:21 -0000 1.5
+++ StateImpl.java 1 Mar 2004 11:14:16 -0000 1.6
@@ -69,7 +69,6 @@
* @param stateId The state ID.
*/
protected StateImpl(String stateId) {
- assert stateId != null;
id = stateId;
}
1.3 +1 -1 cocoon-lenya/src/java/org/apache/lenya/workflow/impl/SynchronizedWorkflowInstancesImpl.java
Index: SynchronizedWorkflowInstancesImpl.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/workflow/impl/SynchronizedWorkflowInstancesImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org