|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.shibboleth.utilities.java.support.component.AbstractDestructableInitializableComponent
net.shibboleth.utilities.java.support.component.AbstractDestructableIdentifiableInitializableComponent
net.shibboleth.metadata.pipeline.BaseStage<DomElementItem>
net.shibboleth.metadata.dom.DomFilesystemSourceStage
@ThreadSafe public class DomFilesystemSourceStage
A stage which reads XML information from the filesystem and places it in the given DomElementItem collection.
This stage requires the following properties be set prior to initialization:
parserPoolsource
| Field Summary | |
|---|---|
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 Summary | |
|---|---|
DomFilesystemSourceStage()
|
|
| Method Summary | |
|---|---|
protected void |
doDestroy()
|
protected void |
doExecute(Collection<DomElementItem> 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. |
| Methods inherited from class net.shibboleth.metadata.pipeline.BaseStage |
|---|
execute, setId |
| Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractDestructableIdentifiableInitializableComponent |
|---|
getId |
| Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractDestructableInitializableComponent |
|---|
destroy, initialize, isDestroyed, isInitialized |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface net.shibboleth.utilities.java.support.component.DestructableComponent |
|---|
destroy, isDestroyed |
| Methods inherited from interface net.shibboleth.utilities.java.support.component.IdentifiableComponent |
|---|
getId |
| Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent |
|---|
initialize, isInitialized |
| Field Detail |
|---|
private 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
false
private boolean noSourceFilesAnError
false
private boolean errorCausesSourceFailure
Stage to
fail, or just excludes the material from the offending source file. Default value: true
| Constructor Detail |
|---|
public DomFilesystemSourceStage()
| Method Detail |
|---|
@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 fail
protected void doExecute(@Nonnull@NonnullElements
Collection<DomElementItem> itemCollection)
throws StageProcessingException
The stage is guaranteed to be have been initialized and not destroyed when this is invoked.
doExecute in class BaseStage<DomElementItem>itemCollection - collection to be processed
StageProcessingException - thrown if there is an unrecoverable problem when processing the stage
protected 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 in
errorCausesSourceFailure is false
StageProcessingException - 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.AbstractDestructableInitializableComponent
protected void doInitialize()
throws net.shibboleth.utilities.java.support.component.ComponentInitializationException
doInitialize in class net.shibboleth.utilities.java.support.component.AbstractDestructableIdentifiableInitializableComponentnet.shibboleth.utilities.java.support.component.ComponentInitializationException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||