Package net.shibboleth.metadata.dom
Class DOMResourceSourceStage
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.metadata.pipeline.AbstractStage<Element>
net.shibboleth.metadata.dom.DOMResourceSourceStage
- All Implemented Interfaces:
Stage<Element>,net.shibboleth.shared.component.Component,net.shibboleth.shared.component.DestructableComponent,net.shibboleth.shared.component.IdentifiableComponent,net.shibboleth.shared.component.IdentifiedComponent,net.shibboleth.shared.component.InitializableComponent
A pipeline stage which reads an XML document from an
Resource, parses the document, and places the resultant
document (root) element in to the provided DOMElementItem collection.
This stage requires the following properties be set prior to initialization:
parserPooldomResource
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ResourceResource used to fetch remote XML document.private booleanWhether an error parsing one source file causes this entireStageto fail, or just excludes the material from the offending source file.private static final org.slf4j.LoggerClass logger.private net.shibboleth.shared.xml.ParserPoolPool of parsers used to parse incoming DOM. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidPerforms the stage processing on the given Item collection.protected voidfinal ResourceGets the resource from which the XML Document will be fetched.final booleanGets whether an error reading and parsing the XML file causes this stage to fail.final net.shibboleth.shared.xml.ParserPoolGets the pool of DOM parsers used to parse the XML file in to a DOM.protected voidpopulateItemCollection(List<Item<Element>> items, InputStream data, Resource resource) Builds anDOMElementItemcollection from a new XML document.voidsetDOMResource(Resource resource) Sets the resource from which the XML document will be fetched.voidsetErrorCausesSourceFailure(boolean causesFailure) Sets whether an error reading and parsing the XML file causes this stage to fail.voidsetParserPool(net.shibboleth.shared.xml.ParserPool pool) Sets the pool of DOM parsers used to parse the XML file in to a DOM.Methods inherited from class net.shibboleth.metadata.pipeline.AbstractStage
execute, getCollectionPredicate, setCollectionPredicateMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
setIdMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentExceptionMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.DestructableComponent
destroy, isDestroyedMethods inherited from interface net.shibboleth.shared.component.IdentifiedComponent
getIdMethods inherited from interface net.shibboleth.shared.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
LOG
@Nonnull private static final org.slf4j.Logger LOGClass logger. -
domResource
Resource used to fetch remote XML document. -
parserPool
@NonnullAfterInit private net.shibboleth.shared.xml.ParserPool parserPoolPool of parsers used to parse incoming DOM. -
errorCausesSourceFailure
private boolean errorCausesSourceFailureWhether an error parsing one source file causes this entireStageto fail, or just excludes the material from the offending source file. Default value:true
-
-
Constructor Details
-
DOMResourceSourceStage
public DOMResourceSourceStage()
-
-
Method Details
-
getDOMResource
Gets the resource from which the XML Document will be fetched.- Returns:
- resource from which the XML document will be fetched
-
setDOMResource
Sets the resource from which the XML document will be fetched.- Parameters:
resource- resource from which the XML document will be fetched
-
getParserPool
@NonnullAfterInit public final net.shibboleth.shared.xml.ParserPool getParserPool()Gets the pool of DOM parsers used to parse the XML file in to a DOM.- Returns:
- pool of DOM parsers used to parse the XML file in to a DOM
-
getErrorCausesSourceFailure
public final boolean getErrorCausesSourceFailure()Gets whether an error reading and parsing the XML file causes this stage to fail.- Returns:
- whether an error reading and parsing the XML file causes this stage to fail
-
setErrorCausesSourceFailure
public void setErrorCausesSourceFailure(boolean causesFailure) Sets whether an error reading and parsing the XML file causes this stage to fail.- Parameters:
causesFailure- whether an error reading and parsing the XML file causes this stage to fail
-
doExecute
protected void doExecute(@Nonnull @NonnullElements List<Item<Element>> items) throws StageProcessingException Description copied from class:AbstractStagePerforms the stage processing on the given Item collection.The stage is guaranteed to be have been initialized and not destroyed when this is invoked.
- Specified by:
doExecutein classAbstractStage<Element>- Parameters:
items- collection to be processed- Throws:
StageProcessingException- thrown if there is an unrecoverable problem when processing the stage
-
populateItemCollection
protected void populateItemCollection(@Nonnull @NonnullElements List<Item<Element>> items, @Nonnull InputStream data, @Nonnull Resource resource) throws StageProcessingException Builds anDOMElementItemcollection from a new XML document. Also caches DOM Element in its parsed form for later use.- Parameters:
items- collection to which the read in and parsed document element is addeddata- XML input fileresource- the resource to read from- Throws:
StageProcessingException- thrown if there is a problem reading and parsing the response
-
doInitialize
protected void doInitialize() throws net.shibboleth.shared.component.ComponentInitializationException- Overrides:
doInitializein classnet.shibboleth.shared.component.AbstractIdentifiedInitializableComponent- Throws:
net.shibboleth.shared.component.ComponentInitializationException
-