@ThreadSafe public class DOMFilesystemSourceStage extends BaseStage<Element>
DOMElementItem collection.
This stage requires the following properties be set prior to initialization:
parserPoolsource| Modifier and Type | Field and Description |
|---|---|
private boolean |
errorCausesSourceFailure
Whether an error parsing one source file causes this entire
Stage to
fail, or just excludes the material from the offending source file. |
private Logger |
log
Class logger.
|
private boolean |
noSourceFilesAnError
Whether the lack of source files is treated as an error.
|
private net.shibboleth.utilities.java.support.xml.ParserPool |
parserPool
Pool of DOM parsers used to parse the XML file in to a DOM.
|
private boolean |
recurseDirectories
Whether or not directories are recursed if the given input file is a directory.
|
private File |
sourceFile
The file path to the DOM material provided by this source.
|
private FileFilter |
sourceFileFilter
Filter used to determine if a file should be included.
|
| Constructor and Description |
|---|
DOMFilesystemSourceStage() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doDestroy() |
protected void |
doExecute(Collection<Item<Element>> itemCollection)
Performs the stage processing on the given Item collection.
|
protected void |
doInitialize() |
boolean |
getErrorCausesSourceFailure()
Gets whether an error parsing a single file causes the source to fail.
|
net.shibboleth.utilities.java.support.xml.ParserPool |
getParserPool()
Gets the pool of DOM parsers used to parse the XML file in to a DOM.
|
boolean |
getRecurseDirectories()
Gets whether directories will be recursively searched for XML input files.
|
File |
getSource()
Gets the path to the DOM material provided by this source.
|
FileFilter |
getSourceFileFilter()
Gets the filter used to determine if a file, in a directory, should be treated as a source file.
|
protected void |
getSourceFiles(File input,
List<File> collector)
Gets the source files from a given input.
|
boolean |
isNoSourceFilesAnError()
Get whether the lack of source files is considered an error.
|
protected DOMElementItem |
processSourceFile(File source)
Reads in an XML source file, parses it, and creates the appropriate
DOMElementItem for the data. |
void |
setErrorCausesSourceFailure(boolean causesFailure)
Sets whether an error parsing a single file causes the source to fail.
|
void |
setNoSourceFilesAnError(boolean isError)
Sets whether the lack of source files is considered an error.
|
void |
setParserPool(net.shibboleth.utilities.java.support.xml.ParserPool pool)
Sets the pool of DOM parsers used to parse the XML file in to a DOM.
|
void |
setRecurseDirectories(boolean recurse)
Sets whether directories will be recursively searched for XML input files.
|
void |
setSource(File source)
Sets the path to the DOM material provided by this source.
|
void |
setSourceFileFilter(FileFilter filter)
Sets the filter used to determine if a file, in a directory, should be treated as a source file.
|
execute, getCollectionPredicate, setCollectionPredicatesetIdgetIddestroy, initialize, isDestroyed, isInitializedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdestroy, isDestroyedprivate final Logger log
private net.shibboleth.utilities.java.support.xml.ParserPool parserPool
private File sourceFile
private FileFilter sourceFileFilter
sourceFile is a
directory.private boolean recurseDirectories
falseprivate boolean noSourceFilesAnError
falseprivate boolean errorCausesSourceFailure
Stage to
fail, or just excludes the material from the offending source file. Default value: true@Nullable public net.shibboleth.utilities.java.support.xml.ParserPool getParserPool()
public void setParserPool(@Nonnull net.shibboleth.utilities.java.support.xml.ParserPool pool)
pool - pool of DOM parsers used to parse the XML file in to a DOM@Nullable public File getSource()
public void setSource(@Nonnull File source)
source - path to the DOM material provided by this source@Nullable public FileFilter getSourceFileFilter()
public void setSourceFileFilter(@Nonnull FileFilter filter)
filter - filter used to determine if a file, in a directory, should be treated as a source file, may be nullpublic boolean getRecurseDirectories()
public void setRecurseDirectories(boolean recurse)
recurse - whether directories will be recursively searched for XML input filespublic boolean isNoSourceFilesAnError()
public void setNoSourceFilesAnError(boolean isError)
isError - whether the lack of source files is considered an errorpublic boolean getErrorCausesSourceFailure()
public void setErrorCausesSourceFailure(boolean causesFailure)
causesFailure - whether an error parsing a single file causes the source to failprotected void doExecute(@Nonnull@NonnullElements Collection<Item<Element>> itemCollection) throws StageProcessingException
The stage is guaranteed to be have been initialized and not destroyed when this is invoked.
doExecute in class BaseStage<Element>itemCollection - collection to be processedStageProcessingException - thrown if there is an unrecoverable problem when processing the stageprotected void getSourceFiles(@Nonnull File input, @Nonnull@NonnullElements@Live List<File> collector)
recurseDirectories is true, then this process is repeated for each child direcrory.input - the source input file, never nullcollector - the collector of XML input files@Nonnull protected DOMElementItem processSourceFile(@Nonnull File source) throws StageProcessingException
DOMElementItem for the data.source - XML file to read inDOMElementItem, may be null if there was an error parsing the data and
errorCausesSourceFailure is falseStageProcessingException - thrown if there is a problem reading in the Element and
errorCausesSourceFailure is trueprotected void doDestroy()
doDestroy in class net.shibboleth.utilities.java.support.component.AbstractInitializableComponentprotected void doInitialize()
throws net.shibboleth.utilities.java.support.component.ComponentInitializationException
doInitialize in class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponentnet.shibboleth.utilities.java.support.component.ComponentInitializationExceptionCopyright © 1999–2016. All rights reserved.