Class FilesInDirectoryMultiOutputStrategy<T>

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.metadata.pipeline.FilesInDirectoryMultiOutputStrategy<T>
Type Parameters:
T - the type of Item to operate on
All Implemented Interfaces:
MultiOutputSerializationStage.OutputStrategy<T>, net.shibboleth.shared.component.Component, net.shibboleth.shared.component.DestructableComponent, net.shibboleth.shared.component.InitializableComponent

@ThreadSafe public class FilesInDirectoryMultiOutputStrategy<T> extends net.shibboleth.shared.component.AbstractInitializableComponent implements MultiOutputSerializationStage.OutputStrategy<T>
An output strategy for use with the MultiOutputSerializationStage which generates individual files within a directory. The files are named by a combination of:
  • an optional prefix string,
  • each item's ItemId transformed by an optional Function,
  • an optional suffix string.
Since:
0.9.2
  • Field Details

    • LOG

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

      @Nonnull private String namePrefix
      String to use as a prefix for file names generated by this strategy. Default value: empty string.
    • nameTransformer

      @Nonnull private Function<String,String> nameTransformer
      Function to use to transform the Item's ItemId. Default: identity transform.
    • nameSuffix

      @Nonnull private String nameSuffix
      String to use as a suffix for file names generated by this strategy. Default value: empty string.
    • directory

      @NonnullAfterInit private File directory
      Directory into which to write files.
  • Constructor Details

    • FilesInDirectoryMultiOutputStrategy

      public FilesInDirectoryMultiOutputStrategy()
  • Method Details

    • getNamePrefix

      @Nonnull public final String getNamePrefix()
      Gets the name prefix in use.
      Returns:
      the name prefix in use
    • setNamePrefix

      public void setNamePrefix(@Nonnull String prefix)
      Sets the name prefix to use.
      Parameters:
      prefix - the name prefix to use
    • getNameTransformer

      @Nonnull public final Function<String,String> getNameTransformer()
      Gets the name transformer in use.
      Returns:
      the name transformer in use.
    • setNameTransformer

      public void setNameTransformer(@Nonnull Function<String,String> transformer)
      Sets the name transformer to use.
      Parameters:
      transformer - the name transformer to use
    • getNameSuffix

      @Nonnull public final String getNameSuffix()
      Gets the name suffix in use.
      Returns:
      the name suffix in use
    • setNameSuffix

      public void setNameSuffix(@Nonnull String suffix)
      Sets the name suffix to use.
      Parameters:
      suffix - the name suffix to use
    • getDirectory

      @NonnullAfterInit public final File getDirectory()
      Gets the directory in use.
      Returns:
      the directory in use
    • setDirectory

      public void setDirectory(@Nonnull File dir)
      Sets the directory to use.
      Parameters:
      dir - the directory to use
    • getDestination

      @Nonnull public MultiOutputSerializationStage.Destination getDestination(@Nonnull Item<T> item) throws StageProcessingException
      Description copied from interface: MultiOutputSerializationStage.OutputStrategy
      Gets a MultiOutputSerializationStage.Destination to which an item should be serialized.
      Specified by:
      getDestination in interface MultiOutputSerializationStage.OutputStrategy<T>
      Parameters:
      item - Item for which to generate a MultiOutputSerializationStage.Destination
      Returns:
      MultiOutputSerializationStage.Destination for the item
      Throws:
      StageProcessingException - if an output stream cannot be generated for the Item
    • doInitialize

      protected void doInitialize() throws net.shibboleth.shared.component.ComponentInitializationException
      Overrides:
      doInitialize in class net.shibboleth.shared.component.AbstractInitializableComponent
      Throws:
      net.shibboleth.shared.component.ComponentInitializationException