Class SerializationStage<T>

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.metadata.pipeline.AbstractStage<T>
net.shibboleth.metadata.pipeline.SerializationStage<T>
Type Parameters:
T - type of items upon which this stage operates
All Implemented Interfaces:
Stage<T>, 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 SerializationStage<T> extends AbstractStage<T>
A stage which writes the given item collection out to a file using a provided ItemCollectionSerializer.

This stage requires the following properties be set prior to initialization:

  • outputFile
  • serializer
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final org.slf4j.Logger
    Class logger.
    private File
    File to which the item will be written.
    private boolean
    Whether an existing output file should be overwritten.
    Serializer used to write the collection to the output stream.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    doExecute(List<Item<T>> items)
    Performs the stage processing on the given Item collection.
    protected void
     
    final File
    Gets the file to which the item will be written.
    Gets the serializer used to write item to the output file.
    final boolean
    Gets whether an existing output file should be overwritten.
    void
    Sets the file to which the item will be written.
    void
    setOverwritingExistingOutputFile(boolean isOverwriting)
    Sets whether an existing output file should be overwritten.
    void
    Sets the serializer used to write item to the output file.

    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.
    • outputFile

      @NonnullAfterInit private File outputFile
      File to which the item will be written.
    • overwritingExistingOutputFile

      private boolean overwritingExistingOutputFile
      Whether an existing output file should be overwritten. Default value: true
    • serializer

      @NonnullAfterInit private ItemCollectionSerializer<T> serializer
      Serializer used to write the collection to the output stream.
  • Constructor Details

    • SerializationStage

      public SerializationStage()
  • Method Details

    • getOutputFile

      @NonnullAfterInit public final File getOutputFile()
      Gets the file to which the item will be written.
      Returns:
      file to which the item will be written
    • setOutputFile

      public void setOutputFile(@Nonnull File file)
      Sets the file to which the item will be written.
      Parameters:
      file - file to which the item will be written
    • isOverwritingExistingOutputFile

      public final boolean isOverwritingExistingOutputFile()
      Gets whether an existing output file should be overwritten.
      Returns:
      whether an existing output file should be overwritten
    • setOverwritingExistingOutputFile

      public void setOverwritingExistingOutputFile(boolean isOverwriting)
      Sets whether an existing output file should be overwritten.
      Parameters:
      isOverwriting - whether an existing output file should be overwritten
    • getSerializer

      @NonnullAfterInit public final ItemCollectionSerializer<T> getSerializer()
      Gets the serializer used to write item to the output file.
      Returns:
      serializer used to write item to the output file
    • setSerializer

      public void setSerializer(@Nonnull ItemCollectionSerializer<T> itemSerializer)
      Sets the serializer used to write item to the output file.
      Parameters:
      itemSerializer - serializer used to write item to the output file
    • doExecute

      protected void doExecute(@Nonnull @NonnullElements List<Item<T>> 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<T>
      Parameters:
      items - collection to be processed
      Throws:
      StageProcessingException - thrown if there is an unrecoverable problem when processing the stage
    • 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