craigmcc 01/08/13 14:16:23
Added: workflow/src/java/org/apache/commons/workflow/core
DuplicateStep.java ExitStep.java GetStep.java
PopStep.java PutStep.java RemoveStep.java
StringStep.java SuspendStep.java SwapStep.java
Log:
Initial check-in of the workflow management system proposal.
Revision Changes Path
1.1
jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/core/DuplicateStep.java
Index: DuplicateStep.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/core/DuplicateStep.java,v
1.1 2001/08/13 21:16:22 craigmcc Exp $
* $Revision: 1.1 $
* $Date: 2001/08/13 21:16:22 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", 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 [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.workflow.core;
import java.util.EmptyStackException;
import org.apache.commons.workflow.Context;
import org.apache.commons.workflow.StepException;
import org.apache.commons.workflow.base.BaseStep;
/**
* <p>Push a new copy of the top item on the evaluation
* stack onto the stack.</p>
*
* @version $Revision: 1.1 $ $Date: 2001/08/13 21:16:22 $
* @author Craig R. McClanahan
*/
public class DuplicateStep extends BaseStep {
// --------------------------------------------------------- Public Methods
/**
* Perform the executable actions related to this Step, in the context of
* the specified Context.
*
* @param context The Context that is tracking our execution state
*
* @exception StepException if a processing error has occurred
*/
public void execute(Context context) throws StepException {
// Peek at the top value on the evaluation stack
Object value = null;
try {
value = context.peek();
} catch (EmptyStackException e) {
throw new StepException("Evaluation stack is empty", e, this);
}
// Push another copy of this value
context.push(value);
}
}
1.1
jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/core/ExitStep.java
Index: ExitStep.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/core/ExitStep.java,v
1.1 2001/08/13 21:16:22 craigmcc Exp $
* $Revision: 1.1 $
* $Date: 2001/08/13 21:16:22 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", 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 [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.workflow.core;
import java.util.EmptyStackException;
import org.apache.commons.workflow.Context;
import org.apache.commons.workflow.StepException;
import org.apache.commons.workflow.base.BaseStep;
/**
* <p>Signal our Context that we have completed the current Activity.</p>
*
* @version $Revision: 1.1 $ $Date: 2001/08/13 21:16:22 $
* @author Craig R. McClanahan
*/
public class ExitStep extends BaseStep {
// --------------------------------------------------------- Public Methods
/**
* Perform the executable actions related to this Step, in the context of
* the specified Context.
*
* @param context The Context that is tracking our execution state
*
* @exception StepException if a processing error has occurred
*/
public void execute(Context context) throws StepException {
context.setNextStep(null);
}
}
1.1
jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/core/GetStep.java
Index: GetStep.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/core/GetStep.java,v
1.1 2001/08/13 21:16:22 craigmcc Exp $
* $Revision: 1.1 $
* $Date: 2001/08/13 21:16:22 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", 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 [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.workflow.core;
import org.apache.commons.workflow.Context;
import org.apache.commons.workflow.StepException;
import org.apache.commons.workflow.base.BaseStep;
/**
* <p>Make a copy of the specified bean in the specified scope, and push
* it on to the evaluation stack.</p>
*
* <p>Supported Attributes:</p>
* <ul>
* <li><strong>name</strong> - Name under which the requested bean is retrieved
* in the specified scope.</li>
* <li><strong>scope</strong> - Name of the scope in which to search for
* this bean, or omitted to search for the bean in any scope.</li>
* </ul>
*
* @version $Revision: 1.1 $ $Date: 2001/08/13 21:16:22 $
* @author Craig R. McClanahan
*/
public class GetStep extends BaseStep {
// ------------------------------------------------------------- Properties
/**
* The name of the bean to be copied.
*/
protected String name = null;
public String getName() {
return (this.name);
}
public void setName(String name) {
this.name = name;
}
/**
* The scope containing the bean to be copied.
*/
public String scope = null;
public String getScope() {
return (this.scope);
}
public void setScope(String scope) {
this.scope = scope;
}
// --------------------------------------------------------- Public Methods
/**
* Perform the executable actions related to this Step, in the context of
* the specified Context.
*
* @param context The Context that is tracking our execution state
*
* @exception StepException if a processing error has occurred
*/
public void execute(Context context) throws StepException {
// Retrieve the specified bean value
Object value = null;
if (scope == null)
value = context.get(name);
int scopeId = context.getScopeId(scope);
if (scopeId < 0)
throw new StepException("Cannot find scope '" + scope + "'", this);
else
value = context.get(name, scopeId);
if (value == null)
throw new StepException("Cannot find bean '" + name + "'", this);
// Push the value onto the evaluation stack
context.push(value);
}
}
1.1
jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/core/PopStep.java
Index: PopStep.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/core/PopStep.java,v
1.1 2001/08/13 21:16:22 craigmcc Exp $
* $Revision: 1.1 $
* $Date: 2001/08/13 21:16:22 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", 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 [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.workflow.core;
import java.util.EmptyStackException;
import org.apache.commons.workflow.Context;
import org.apache.commons.workflow.StepException;
import org.apache.commons.workflow.base.BaseStep;
/**
* <p>Pop the top value from the evaluation stack and throw it away.</p>
*
* @version $Revision: 1.1 $ $Date: 2001/08/13 21:16:22 $
* @author Craig R. McClanahan
*/
public class PopStep extends BaseStep {
// --------------------------------------------------------- Public Methods
/**
* Perform the executable actions related to this Step, in the context of
* the specified Context.
*
* @param context The Context that is tracking our execution state
*
* @exception StepException if a processing error has occurred
*/
public void execute(Context context) throws StepException {
// Pop the evaluation stack
Object value = null;
try {
value = context.pop();
} catch (EmptyStackException e) {
throw new StepException("Evaluation stack is empty", e, this);
}
}
}
1.1
jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/core/PutStep.java
Index: PutStep.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/core/PutStep.java,v
1.1 2001/08/13 21:16:22 craigmcc Exp $
* $Revision: 1.1 $
* $Date: 2001/08/13 21:16:22 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", 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 [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.workflow.core;
import java.util.EmptyStackException;
import org.apache.commons.workflow.Context;
import org.apache.commons.workflow.StepException;
import org.apache.commons.workflow.base.BaseStep;
/**
* <p>Pop the top value from the evaluation stack and store it under the
* specified name in the specified scope (replacing any previous value
* stored under that name).</p>
*
* <p>Supported Attributes:</p>
* <ul>
* <li><strong>name</strong> - Name under which the requested bean is stored
* in the specified scope.</li>
* <li><strong>scope</strong> - Name of the scope in which to store
* this bean, or omitted for storage in local scope.</li>
* </ul>
*
* @version $Revision: 1.1 $ $Date: 2001/08/13 21:16:22 $
* @author Craig R. McClanahan
*/
public class PutStep extends BaseStep {
// ------------------------------------------------------------- Properties
/**
* The name of the bean to be stored.
*/
protected String name = null;
public String getName() {
return (this.name);
}
public void setName(String name) {
this.name = name;
}
/**
* The scope containing the bean to be stored.
*/
public String scope = null;
public String getScope() {
return (this.scope);
}
public void setScope(String scope) {
this.scope = scope;
}
// --------------------------------------------------------- Public Methods
/**
* Perform the executable actions related to this Step, in the context of
* the specified Context.
*
* @param context The Context that is tracking our execution state
*
* @exception StepException if a processing error has occurred
*/
public void execute(Context context) throws StepException {
// Pop the evaluation stack
Object value = null;
try {
value = context.pop();
} catch (EmptyStackException e) {
throw new StepException("Evaluation stack is empty", e, this);
}
// Identify the scope we are interested in
int scopeId = -1;
if (scope != null) {
scopeId = context.getScopeId(scope);
if (scopeId < 0)
throw new StepException("Cannot find scope '" + scope + "'",
this);
}
// Store the value into the specified scope
if (scopeId < 0)
context.put(name, value);
else
context.put(name, value, scopeId);
}
}
1.1
jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/core/RemoveStep.java
Index: RemoveStep.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/core/RemoveStep.java,v
1.1 2001/08/13 21:16:22 craigmcc Exp $
* $Revision: 1.1 $
* $Date: 2001/08/13 21:16:22 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", 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 [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.workflow.core;
import org.apache.commons.workflow.Context;
import org.apache.commons.workflow.StepException;
import org.apache.commons.workflow.base.BaseStep;
/**
* <p>Remove the specified bean from the specified scope, if it exists.</p>
*
* <p>Supported Attributes:</p>
* <ul>
* <li><strong>name</strong> - Name under which the requested bean is removed
* in the specified scope.</li>
* <li><strong>scope</strong> - Name of the scope in which to search for
* this bean, or omitted to search for the bean in any scope.</li>
* </ul>
*
* @version $Revision: 1.1 $ $Date: 2001/08/13 21:16:22 $
* @author Craig R. McClanahan
*/
public class RemoveStep extends BaseStep {
// ------------------------------------------------------------- Properties
/**
* The name of the bean to be removed.
*/
protected String name = null;
public String getName() {
return (this.name);
}
public void setName(String name) {
this.name = name;
}
/**
* The scope containing the bean to be copied.
*/
public String scope = null;
public String getScope() {
return (this.scope);
}
public void setScope(String scope) {
this.scope = scope;
}
// --------------------------------------------------------- Public Methods
/**
* Perform the executable actions related to this Step, in the context of
* the specified Context.
*
* @param context The Context that is tracking our execution state
*
* @exception StepException if a processing error has occurred
*/
public void execute(Context context) throws StepException {
// Identify the scope we are interested in
int scopeId = -1;
if (scope != null) {
scopeId = context.getScopeId(scope);
if (scopeId < 0)
throw new StepException("Cannot find scope '" + scope + "'",
this);
}
// Remove the specified bean value
if (scopeId < 0)
context.remove(name);
else
context.remove(name, scopeId);
}
}
1.1
jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/core/StringStep.java
Index: StringStep.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/core/StringStep.java,v
1.1 2001/08/13 21:16:22 craigmcc Exp $
* $Revision: 1.1 $
* $Date: 2001/08/13 21:16:22 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", 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 [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.workflow.core;
import org.apache.commons.workflow.Context;
import org.apache.commons.workflow.StepException;
import org.apache.commons.workflow.base.BaseStep;
/**
* <p>Push the specified String value onto the top of the evaluation
* stack.</p>
*
* <p>Supported Attributes:</p>
* <ul>
* <li><strong>value</strong> - String value to be pushed.</li>
* </ul>
*
* @version $Revision: 1.1 $ $Date: 2001/08/13 21:16:22 $
* @author Craig R. McClanahan
*/
public class StringStep extends BaseStep {
// ------------------------------------------------------------- Properties
/**
* The string value to be pushed.
*/
protected String value = null;
public String getValue() {
return (this.value);
}
public void setValue(String value) {
this.value = value;
}
// --------------------------------------------------------- Public Methods
/**
* Perform the executable actions related to this Step, in the context of
* the specified Context.
*
* @param context The Context that is tracking our execution state
*
* @exception StepException if a processing error has occurred
*/
public void execute(Context context) throws StepException {
// Validate that a value has been specified
if (value == null)
throw new StepException("No value specified", this);
// Push the value onto the evaluation stack
context.push(value);
}
}
1.1
jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/core/SuspendStep.java
Index: SuspendStep.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/core/SuspendStep.java,v
1.1 2001/08/13 21:16:22 craigmcc Exp $
* $Revision: 1.1 $
* $Date: 2001/08/13 21:16:22 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", 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 [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.workflow.core;
import java.util.EmptyStackException;
import org.apache.commons.workflow.Context;
import org.apache.commons.workflow.StepException;
import org.apache.commons.workflow.base.BaseStep;
/**
* <p>Signal our Context to suspend execution until control is returned.</p>
*
* @version $Revision: 1.1 $ $Date: 2001/08/13 21:16:22 $
* @author Craig R. McClanahan
*/
public class SuspendStep extends BaseStep {
// --------------------------------------------------------- Public Methods
/**
* Perform the executable actions related to this Step, in the context of
* the specified Context.
*
* @param context The Context that is tracking our execution state
*
* @exception StepException if a processing error has occurred
*/
public void execute(Context context) throws StepException {
context.setSuspend(true);
}
}
1.1
jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/core/SwapStep.java
Index: SwapStep.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/core/SwapStep.java,v
1.1 2001/08/13 21:16:22 craigmcc Exp $
* $Revision: 1.1 $
* $Date: 2001/08/13 21:16:22 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", 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 [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.workflow.core;
import java.util.EmptyStackException;
import org.apache.commons.workflow.Context;
import org.apache.commons.workflow.StepException;
import org.apache.commons.workflow.base.BaseStep;
/**
* <p>Swap the positions of the top two values on the evaluation stack.</p>
*
* @version $Revision: 1.1 $ $Date: 2001/08/13 21:16:22 $
* @author Craig R. McClanahan
*/
public class SwapStep extends BaseStep {
// --------------------------------------------------------- Public Methods
/**
* Perform the executable actions related to this Step, in the context of
* the specified Context.
*
* @param context The Context that is tracking our execution state
*
* @exception StepException if a processing error has occurred
*/
public void execute(Context context) throws StepException {
// Retrieve the top value from the evaluation stack
Object oldTop = null;
try {
oldTop = context.pop();
} catch (EmptyStackException e) {
throw new StepException("Evaluation stack is empty", e, this);
}
// Retrieve the next value from the evaluation stack
Object oldBottom = null;
try {
oldBottom = context.pop();
} catch (EmptyStackException e) {
throw new StepException("Evaluation stack is empty", e, this);
}
// Push the items back onto the evaluation stack in reverse order
context.push(oldTop);
context.push(oldBottom);
}
}