org.apache.commons.pipeline.config
Class PipelineRuleSet
java.lang.Object
org.apache.commons.digester.RuleSetBase
org.apache.commons.pipeline.config.PipelineRuleSet
- All Implemented Interfaces:
- org.apache.commons.digester.RuleSet
public class PipelineRuleSet
- extends org.apache.commons.digester.RuleSetBase
This is a Digester RuleSet that provides rules for parsing a pipeline
XML file.
The rules defined by this object are used for parsing the following tags:
-
<pipeline></pipeline>
The root element of the XML configuration file for a pipeline. This tag
supports two optional attributes that are for use only when configuring
branch pipelines, key
and configURI
. These
attributes are described more fully below in the <branch>
documentation.
-
<driverFactory className="MyDriverFactory" id="my_id" ... />
This tag is used to create and configure a StageDriverFactory
that
will be used to create StageDriver
instances for stages
in the parent pipeline. Each StageDriverFactory
is identified by a unique
string identifier that is used by the <stage>
tag
to identify the factory used to create the driver for the stage.
The class of the factory (which must supply a no-argument constructor)
is specified by the className
attribute, and all other
additional attributes are used by Digester to configure the associated properties
(using standard Java bean naming conventions) of the driver instance created.
-
<stage className="MyStageClass" driverFactoryId="name" ... ></stage>
A single stage is created, configured, and added to the parent pipeline using
this tag. Stages created in this manner are added to the pipeline in the order
that they occur in the configuration file. The class of the stage (which must
provide a no-argument constructor) is specified by the className attribute.
Each stage should be associated with a previously declared driver factory
by use of the driverFactoryId
attribute. All other attributes are
used by Digester to set bean properties on the newly created Stage object.
-
<feed/>
Enqueue an object onto the first stage in the pipeline. Note that this
must come after the first stage declaration in the configuration file,
otherwise the queue for the first stage does not exist yet and the fed
values will be discarded.
There are two types of usage available, provided by the following subtags:
-
<value>my_value</value>
Feed the string value of the body of this tag to the first stage in the
pipeline.
-
<object className="MyClass" ... />
This tag uses the standard Digester ObjectCreateRule to create an
arbitrary object of the specified class (which must provide a
no-argument constructor) to the first stage in the pipeline.
All attributes other than className are used by
Digester to set bean properties on the newly created object.
-
<branch/>
Add a branch to a pipeline. The contents of this tag should
be one or more <pipeline/>
declarations. Branch
pipelines added in this fashion must be configured with an attribute
named key
that holds the name by which the branch pipeline
will be referred to.
Branch pipelines may be configured either inline in the main
configuration file or in a separate file referred to by the
configURI
pipeline attribute.
Fields inherited from class org.apache.commons.digester.RuleSetBase |
namespaceURI |
Constructor Summary |
PipelineRuleSet()
Creates a new instance of the rule set used by Digester to configure a pipeline. |
PipelineRuleSet(List<org.apache.commons.digester.RuleSet> nestedRuleSets)
Creates a new pipeline rule set with the specified collection of additional
rule sets that may be used for recursive creation of branch pipelines. |
Method Summary |
void |
addRuleInstances(org.apache.commons.digester.Digester digester)
Adds the rule instances for pipeline, stage, and enqueue
tasks to the Digester instance supplied. |
Methods inherited from class org.apache.commons.digester.RuleSetBase |
getNamespaceURI |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PipelineRuleSet
public PipelineRuleSet()
- Creates a new instance of the rule set used by Digester to configure a pipeline.
PipelineRuleSet
public PipelineRuleSet(List<org.apache.commons.digester.RuleSet> nestedRuleSets)
- Creates a new pipeline rule set with the specified collection of additional
rule sets that may be used for recursive creation of branch pipelines.
- Parameters:
nestedRuleSets
- A list of other RuleSet instances that are being used in conjunction with the
PipelineRuleSet. In the case that branch pipelines are referred to by URI, these
rule sets will be added to a new Digester instance (along with a PipelineRuleSet
instance) that is used to parse the branch configuration file.
addRuleInstances
public void addRuleInstances(org.apache.commons.digester.Digester digester)
- Adds the rule instances for pipeline, stage, and enqueue
tasks to the Digester instance supplied.
- Specified by:
addRuleInstances
in interface org.apache.commons.digester.RuleSet
- Specified by:
addRuleInstances
in class org.apache.commons.digester.RuleSetBase
- Parameters:
digester
- The Digester instance to which the rules should be added.
Copyright © 2004-2009 The Apache Software Foundation. All Rights Reserved.