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

@ThreadSafe public class DOMResourceSourceStage extends AbstractStage<Element>
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:

  • parserPool
  • domResource
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private Resource
    Resource used to fetch remote XML document.
    private boolean
    Whether an error parsing one source file causes this entire Stage to fail, or just excludes the material from the offending source file.
    private static final org.slf4j.Logger
    Class logger.
    private net.shibboleth.shared.xml.ParserPool
    Pool of parsers used to parse incoming DOM.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Performs the stage processing on the given Item collection.
    protected void
     
    final Resource
    Gets the resource from which the XML Document will be fetched.
    final boolean
    Gets whether an error reading and parsing the XML file causes this stage to fail.
    final net.shibboleth.shared.xml.ParserPool
    Gets the pool of DOM parsers used to parse the XML file in to a DOM.
    protected void
    Builds an DOMElementItem collection from a new XML document.
    void
    Sets the resource from which the XML document will be fetched.
    void
    setErrorCausesSourceFailure(boolean causesFailure)
    Sets whether an error reading and parsing the XML file causes this stage to fail.
    void
    setParserPool(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, setCollectionPredicate

    Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent

    setId

    Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent

    ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException

    Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

    checkComponentActive, checkSetterPreconditions, destroy, doDestroy, 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.shared.component.DestructableComponent

    destroy, isDestroyed

    Methods inherited from interface net.shibboleth.shared.component.IdentifiedComponent

    getId

    Methods inherited from interface net.shibboleth.shared.component.InitializableComponent

    initialize, isInitialized
  • Field Details

    • LOG

      @Nonnull private static final org.slf4j.Logger LOG
      Class logger.
    • domResource

      @NonnullAfterInit private Resource domResource
      Resource used to fetch remote XML document.
    • parserPool

      @NonnullAfterInit private net.shibboleth.shared.xml.ParserPool parserPool
      Pool of parsers used to parse incoming DOM.
    • errorCausesSourceFailure

      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. Default value: true
  • Constructor Details

    • DOMResourceSourceStage

      public DOMResourceSourceStage()
  • Method Details

    • getDOMResource

      @Nullable public final Resource getDOMResource()
      Gets the resource from which the XML Document will be fetched.
      Returns:
      resource from which the XML document will be fetched
    • setDOMResource

      public void setDOMResource(@Nonnull Resource resource)
      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
    • setParserPool

      public void setParserPool(@Nonnull net.shibboleth.shared.xml.ParserPool pool)
      Sets the pool of DOM parsers used to parse the XML file in to a DOM.
      Parameters:
      pool - 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: AbstractStage
      Performs 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:
      doExecute in class AbstractStage<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 an DOMElementItem collection 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 added
      data - XML input file
      resource - 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:
      doInitialize in class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
      Throws:
      net.shibboleth.shared.component.ComponentInitializationException