001    /*
002     * Copyright 1999-2001,2004 The Apache Software Foundation.
003     * 
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     * 
008     *      http://www.apache.org/licenses/LICENSE-2.0
009     * 
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    
017    
018    package org.apache.commons.workflow.core;
019    
020    
021    import org.apache.commons.digester.Digester;
022    import org.apache.commons.workflow.base.BaseRuleSet;
023    
024    
025    /**
026     * <p><strong>RuleSet</strong> for the Step definitions supported by the
027     * <em>core</em> library.  This library is normally associated with the
028     * following namespace URI:</p>
029     * <pre>
030     *   http://commons.apache.org/workflow/core
031     * </pre>
032     *
033     * @author Craig R. McClanahan
034     * @author Preston Sheldon
035     * @version $Revision: 561366 $ $Date: 2007-07-31 16:58:29 +0100 (Tue, 31 Jul 2007) $
036     */
037    
038    public class CoreRuleSet extends BaseRuleSet {
039    
040    
041        // ------------------------------------------------------------ Constructor
042    
043    
044        /**
045         * Construct a default instance of the <code>RuleSet</code>.
046         */
047        public CoreRuleSet() {
048    
049            super();
050            setNamespaceURI("http://commons.apache.org/workflow/core");
051    
052        }
053    
054    
055        // --------------------------------------------------------- Public Methods
056    
057    
058        /**
059         * <p>Add the set of Rule instances defined in this RuleSet to the
060         * specified <code>Digester</code> instance, associating them with
061         * our namespace URI (if any).  This method should only be called
062         * by a Digester instance.</p>
063         *
064         * @param digester Digester instance to which the new Rule instances
065         *  should be added.
066         */
067        public void addRuleInstances(Digester digester) {
068    
069            // Add rules for each Step defined in this package
070            addStandardStep(digester, "and",
071                            "org.apache.commons.workflow.core.AndStep");
072            addStandardStep(digester, "break",
073                            "org.apache.commons.workflow.core.BreakStep");
074            addStandardStep(digester, "call",
075                            "org.apache.commons.workflow.core.CallStep");
076            addStandardStep(digester, "construct",
077                            "org.apache.commons.workflow.core.ConstructStep");
078            addStandardStep(digester, "duplicate",
079                            "org.apache.commons.workflow.core.DuplicateStep");
080            addStandardStep(digester, "exit",
081                            "org.apache.commons.workflow.core.ExitStep");
082            addStandardStep(digester, "get",
083                            "org.apache.commons.workflow.core.GetStep");
084            addStandardStep(digester, "goto",
085                            "org.apache.commons.workflow.core.GotoStep");
086            addStandardStep(digester, "if",
087                            "org.apache.commons.workflow.core.IfStep");
088            addStandardStep(digester, "ifAny",
089                            "org.apache.commons.workflow.core.IfAnyStep");
090            addStandardStep(digester, "ifNot",
091                            "org.apache.commons.workflow.core.IfNotStep");
092            addStandardStep(digester, "ifNotAny",
093                            "org.apache.commons.workflow.core.IfNotAnyStep");
094            addStandardStep(digester, "invoke",
095                            "org.apache.commons.workflow.core.InvokeStep");
096            addStandardStep(digester, "load",
097                            "org.apache.commons.workflow.core.LoadStep");
098            addStandardStep(digester, "notAnd",
099                            "org.apache.commons.workflow.core.NotAndStep");
100            addStandardStep(digester, "notOr",
101                            "org.apache.commons.workflow.core.NotOrStep");
102            addStandardStep(digester, "or",
103                            "org.apache.commons.workflow.core.OrStep");
104            addStandardStep(digester, "pop",
105                            "org.apache.commons.workflow.core.PopStep");
106            addStandardStep(digester, "put",
107                            "org.apache.commons.workflow.core.PutStep");
108            addStandardStep(digester, "remove",
109                            "org.apache.commons.workflow.core.RemoveStep");
110            addStandardStep(digester, "string",
111                            "org.apache.commons.workflow.core.StringStep");
112            addStandardStep(digester, "suspend",
113                            "org.apache.commons.workflow.core.SuspendStep");
114            addStandardStep(digester, "swap",
115                            "org.apache.commons.workflow.core.SwapStep");
116            addStandardStep(digester, "while",
117                            "org.apache.commons.workflow.core.WhileStep");
118            addStandardStep(digester, "whileAny",
119                            "org.apache.commons.workflow.core.WhileAnyStep");
120            addStandardStep(digester, "whileNot",
121                            "org.apache.commons.workflow.core.WhileNotStep");
122            addStandardStep(digester, "whileNotAny",
123                            "org.apache.commons.workflow.core.WhileNotAnyStep");
124    
125            // Add rules for all variations on descriptors being matched
126            addStandardDescriptor(digester, "bean");         // For invoke
127            addStandardDescriptor(digester, "class");        // For construct
128            addStandardDescriptor(digester, "descriptor");   // Standard version
129    
130        }
131    
132    
133    }