public class FilterChain extends FilterStep
Represents a chain of FilterSteps that can be applied to XML input in a specified order to produce a result.
| Modifier and Type | Method and Description |
|---|---|
void |
addStep(FilterStep filterStep)
Adds a
FilterStep to the end of the FilterChain. |
void |
appendFilterChain(FilterChain chain)
Adds
FilterSteps to the end of this FilterChain. |
java.io.File |
getDebugDir()
Returns the
File representing the directory in which debug files will be output. |
FilterStep |
getStep(int position)
Returns the
FilterStep Object at the given position in the FilterChain. |
FilterStep |
getStep(java.lang.String stepName)
Returns the
FilterStep Object with the given name. |
java.lang.Object |
getUnderlyingFilter()
Returns the filter Object that this
FilterStep wraps. |
void |
includeChainNameInDebug(boolean value)
Whether or not to use the
FilterChain name as a second-level of directory structure when outputting debug files. |
void |
includeChainNameInDebug(boolean value,
boolean applyToSubChains)
Whether or not to use the
FilterChain name as a second-level of directory structure when outputting debug files. |
void |
insertStepAfterName(FilterStep filterStep,
java.lang.String name)
|
void |
insertStepAtPosition(FilterStep filterStep,
int pos)
Inserts the supplied
FilterStep at the specified position in the FilterChain. |
boolean |
isChainNameInDebug()
States whether the
FilterChain name will be used in the debug output directory structure. |
boolean |
isDebug()
States whether debug information will be output by this
FilterChain. |
boolean |
isLocked()
States whether this
FilterChain is locked or not. |
int |
length()
Returns a count of the number of steps in the
FilterChain. |
void |
lockChain()
Locks this
FilterChain so that FilterSteps cannot be added, removed or replaced. |
void |
prependFilterChain(FilterChain chain)
Adds
FilterSteps to the start of this FilterChain. |
void |
removeStep(int position)
Removes the
FilterStep at the given position from the FilterChain. |
void |
removeStep(java.lang.String stepName)
Removes the
FilterStep with the supplied name from the FilterChain. |
void |
replaceStep(FilterStep step)
Replaces an existing
FilterStep by name. |
void |
setDebug(boolean value)
Sets whether to output intermediate debug files from this
FilterChain. |
void |
setDebug(boolean value,
boolean applyToSubChains)
Sets whether to output intermediate debug files from this
FilterChain. |
void |
setDebugDir(java.io.File dir)
Sets the top-level directory in which to place any debug output.
|
void |
setDebugDir(java.io.File dir,
boolean applyToSubChains)
Sets the top-level directory in which to place any debug output.
|
void |
setParameterValue(java.lang.String paramName,
java.lang.Object value)
Sets a parameter on this
FilterStep. |
getParameterNames, getParameterType, getParameterTypeName, getParameterValue, getStepName, getStepSource, isEnabled, setEnabledpublic void appendFilterChain(FilterChain chain) throws DuplicateStepNameException, java.lang.IllegalStateException
Adds FilterSteps to the end of this FilterChain.
All FilterSteps held in the specified FilterChain are added at the end of this FilterChain. The
FilterChain passed as a parameter method is not affected except as detailed below.
N.B. The FilterSteps are NOT cloned, they are added by reference. Therefore, each FilterStep
instance now exists in both FilterChain instances. Changes to the individual FilterSteps will be reflected in
this FilterChain but subsequent changes to the supplied FilterChain will NOT affect this FilterChain.
If the specified FilterChain contains FilterSteps with names that clash with FilterSteps in this
FilterChain, a DuplicateStepNameException will be thrown and this FilterChain will remain unchanged;
no steps will be added.
chain - the FilterChain containing the FilterSteps to add at the end of this oneDuplicateStepNameException - if the specified FilterChain contains FilterSteps whose names duplicate
names of FilterSteps held in this FilterChainjava.lang.IllegalStateException - if the FilterChain is lockedpublic void prependFilterChain(FilterChain chain) throws DuplicateStepNameException, java.lang.IllegalStateException
Adds FilterSteps to the start of this FilterChain.
All FilterSteps held in the specified FilterChain are added at the start of this FilterChain. The
FilterChain passed as a parameter method is not affected except as detailed below.
N.B. The FilterSteps are NOT cloned, they are added by reference. Therefore, each FilterStep
instance now exists in both FilterChain instances. Changes to the individual FilterSteps will be reflected in
this FilterChain but subsequent changes to the supplied FilterChain will NOT affect this FilterChain.
If the specified FilterChain contains FilterSteps with names that clash with FilterSteps in this
FilterChain, a DuplicateStepNameException will be thrown and this FilterChain will remain unchanged;
no steps will be added.
chain - the FilterChain containing the FilterSteps to add at the start of this oneDuplicateStepNameException - if the specified FilterChain contains FilterSteps whose names duplicate
names of FilterSteps held in this FilterChainjava.lang.IllegalStateException - if the FilterChain is lockedpublic void addStep(FilterStep filterStep) throws java.lang.IllegalArgumentException, DuplicateStepNameException, java.lang.IllegalStateException
Adds a FilterStep to the end of the FilterChain.
filterStep - the FilterStep to add to the end of the FilterChainjava.lang.IllegalArgumentException - if the supplied FilterStep is nullDuplicateStepNameException - if the FilterChain already contains a FilterStep with the same name as the
supplied onejava.lang.IllegalStateException - if the FilterChain is lockedpublic void insertStepAtPosition(FilterStep filterStep, int pos) throws java.lang.IndexOutOfBoundsException, DuplicateStepNameException, java.lang.IllegalStateException
Inserts the supplied FilterStep at the specified position in the FilterChain.
filterStep - the FilterStep to insertpos - the position at which to insert the supplied FilterStepjava.lang.IndexOutOfBoundsException - if the supplied position is less than zero or greater than the size of the
FilterChainDuplicateStepNameException - if the FilterChain already contains a FilterStep with the same name as the
provided FilterStepjava.lang.IllegalStateException - if this FilterChain is lockedFilterChain.isLocked()public void insertStepAfterName(FilterStep filterStep, java.lang.String name) throws DuplicateStepNameException, java.lang.IllegalArgumentException, java.lang.IllegalStateException
Inserts the supplied FilterStep into the FilterChain after the FilterStep with the supplied name.
filterStep - the FilterStep to insertname - the name of the existing FilterStep after which the insertion should happenDuplicateStepNameException - if the FilterChain already contains a FilterStep with the same name as the
one suppliedjava.lang.IllegalArgumentException - if the FilterChain does not contain a FilterStep with the name supplied as
the second argumentjava.lang.IllegalStateException - if this FilterChain is lockedFilterChain.isLocked()public void replaceStep(FilterStep step) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
Replaces an existing FilterStep by name.
step - the FilterStep to insert as a replacementjava.lang.IllegalArgumentException - if there is no existing FilterStep that has the same name as the specified stepjava.lang.IllegalStateException - if the FilterChain is lockedpublic void removeStep(java.lang.String stepName)
throws java.lang.IllegalStateException
Removes the FilterStep with the supplied name from the FilterChain.
N.B. If the FilterChain does not contain a FilterStep with the supplied name, this method
will have no effect.
stepName - the name of the FilterStep to remove from the FilterChainjava.lang.IllegalStateException - if the FilterChain is lockedpublic void removeStep(int position)
throws java.lang.IndexOutOfBoundsException,
java.lang.IllegalStateException
Removes the FilterStep at the given position from the FilterChain.
position - a zero-based index position of the the FilterStep to remove from the FilterChainjava.lang.IndexOutOfBoundsException - if the supplied position is < 0 or >= the size of the FilterChainjava.lang.IllegalStateException - if the FilterChain is lockedpublic FilterStep getStep(java.lang.String stepName) throws java.lang.IllegalArgumentException
Returns the FilterStep Object with the given name.
If the FilterChain does not contains a FilterStep with the given name, the return value will be
null
stepName - the name of the FilterStep to returnFilterStep with the given name, or null if no such FilterStep exists in the
FilterChainjava.lang.IllegalArgumentException - if the supplied stepName is nullpublic FilterStep getStep(int position) throws java.lang.IndexOutOfBoundsException
Returns the FilterStep Object at the given position in the FilterChain.
position - a zero-based index position of the FilterStep to returnFilterStep at the given position in the FilterChainjava.lang.IndexOutOfBoundsException - if the supplied position is < 0 or >= the size of the FilterChainpublic void lockChain()
Locks this FilterChain so that FilterSteps cannot be added, removed or replaced.
N.B. A locked FilterChain cannot be unlocked.
public boolean isLocked()
States whether this FilterChain is locked or not.
public int length()
Returns a count of the number of steps in the FilterChain. Note, this method does not count nested steps.
FilterChainpublic void setParameterValue(java.lang.String paramName,
java.lang.Object value)
throws java.lang.IllegalArgumentException,
FilterParameterizationException
FilterStepFilterStep.setParameterValue in class FilterStepparamName - the name of the parameter to setvalue - the value to set the parameter tojava.lang.IllegalArgumentException - if the parameter name is nullFilterParameterizationException - if the parameter name provided is not a valid parameter for this FilterStep
or if there is a problem setting the valuepublic void setDebug(boolean value)
Sets whether to output intermediate debug files from this FilterChain.
After each FilterStep, the current result will be output as an XML file with the filename [pos]-stepName
where 'pos' is the zero-based position of the step within the chain.
Note that FilterSteps that are also FilterChains are NOT affected by this method call.
value - whether or not to output debug filespublic void setDebug(boolean value,
boolean applyToSubChains)
Sets whether to output intermediate debug files from this FilterChain.
After each FilterStep, the current result will be output as an XML file with the filename [pos]-stepName
where 'pos' is the zero-based position of the step within the chain.
If the second parameter to this method is true, FilterSteps that are also FilterChains will have
FilterChain.setDebug(boolean, boolean) called on them.
value - whether or not to output debug filesapplyToSubChains - whether to set debug on sub-chains as wellpublic boolean isDebug()
States whether debug information will be output by this FilterChain.
public void setDebugDir(java.io.File dir)
Sets the top-level directory in which to place any debug output.
Note that any FilterSteps that are also FilterChains will NOT be affected by this method call.
dir - a File representing a directory in which to place debug outputpublic void setDebugDir(java.io.File dir,
boolean applyToSubChains)
Sets the top-level directory in which to place any debug output.
If the second parameter to this method is true, FilterSteps that are also FilterChains will have
FilterChain.setDebugDir(File, boolean) called on them.
dir - a File representing a directory in which to place debug outputapplyToSubChains - whether to set a debug dir on sub-chains as wellpublic java.io.File getDebugDir()
Returns the File representing the directory in which debug files will be output.
File object representing the directory in which debug files will be placedpublic void includeChainNameInDebug(boolean value)
Whether or not to use the FilterChain name as a second-level of directory structure when outputting debug files.
Typically, this should be set to false for 'top-level' FilterChains but true for sub–
FilterChains so that it is easier to understand the arrangement of the debug output.
Note that any FilterSteps that are also FilterChains will NOT be affected by this method call.
value - whether or not to include the FilterChain name in the directory structure for debug outputpublic void includeChainNameInDebug(boolean value,
boolean applyToSubChains)
Whether or not to use the FilterChain name as a second-level of directory structure when outputting debug files.
Typically, this should be set to false for 'top-level' FilterChains but true for sub–
FilterChains so that it is easier to understand the arrangement of the debug output.
If the second parameter to this method is true, FilterSteps that are also FilterChains will have
FilterChain.includeChainNameInDebug(boolean, boolean) called on them.
value - whether or not to include the FilterChain name in the directory structure for debug outputapplyToSubChains - whether to apply setting to sub-chains as wellpublic boolean isChainNameInDebug()
States whether the FilterChain name will be used in the debug output directory structure.
public java.lang.Object getUnderlyingFilter()
FilterStepFilterStep wraps.getUnderlyingFilter in class FilterStepXMLFilterImpl or an
XsltExecutableCopyright © 2001-2018 DeltaXML Ltd. All Rights Reserved.