net.shibboleth.metadata.pipeline
Class SerializationStage<ItemType extends Item<?>>

java.lang.Object
  extended by net.shibboleth.metadata.pipeline.AbstractComponent
      extended by net.shibboleth.metadata.pipeline.BaseStage<ItemType>
          extended by net.shibboleth.metadata.pipeline.SerializationStage<ItemType>
Type Parameters:
ItemType - type of items upon which this stage operates
All Implemented Interfaces:
Component, Stage<ItemType>

public class SerializationStage<ItemType extends Item<?>>
extends BaseStage<ItemType>

A stage which writes the given item collection out to a file.

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


Field Summary
private  File outputFile
          File to which the item will be written.
private  boolean overwritingExistingOutputFile
          Whether an existing output file should be overwritten.
private  ItemSerializer<ItemType> serializer
          Serializer used to write the item to the output stream.
 
Constructor Summary
SerializationStage()
           
 
Method Summary
protected  void doExecute(Collection<ItemType> itemCollection)
          Performs the stage processing on the given Item collection.
protected  void doInitialize()
          Do the initialization of the component.
 File getOutputFile()
          Gets the file to which the item will be written.
 ItemSerializer<ItemType> getSerializer()
          Gets the serializer used to write item to the output file.
 boolean isOverwritingExistingOutputFile()
          Gets whether an existing output file should be overwritten.
 void setOutputFile(File file)
          Sets the file to which the item will be written.
 void setOverwritingExistingOutputFile(boolean isOverwriting)
          Sets whether an existing output file should be overwritten.
 void setSerializer(ItemSerializer<ItemType> itemSerializer)
          Sets the serializer used to write item to the output file.
 
Methods inherited from class net.shibboleth.metadata.pipeline.BaseStage
execute
 
Methods inherited from class net.shibboleth.metadata.pipeline.AbstractComponent
equals, getId, getInitializationInstant, hashCode, initialize, isInitialized, setId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.shibboleth.metadata.pipeline.Component
getId, getInitializationInstant, initialize, isInitialized
 

Field Detail

outputFile

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

private ItemSerializer<ItemType extends Item<?>> serializer
Serializer used to write the item to the output stream.

Constructor Detail

SerializationStage

public SerializationStage()
Method Detail

getOutputFile

public 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(File file)
Sets the file to which the item will be written.

Parameters:
file - file to which the item will be written

isOverwritingExistingOutputFile

public 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

public ItemSerializer<ItemType> 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(ItemSerializer<ItemType> 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(Collection<ItemType> itemCollection)
                  throws StageProcessingException
Performs the stage processing on the given Item collection.

Specified by:
doExecute in class BaseStage<ItemType extends Item<?>>
Parameters:
itemCollection - collection to be processed
Throws:
StageProcessingException - thrown if there is an unrecoverable problem when processing the stage

doInitialize

protected void doInitialize()
                     throws ComponentInitializationException
Do the initialization of the component. Default implementation of this method is a no-op. Extending classes should override this method to perform any initialization logic necessary.

Overrides:
doInitialize in class AbstractComponent
Throws:
ComponentInitializationException - throw if there is a problem initializing the component


Copyright © 2009-2011. All Rights Reserved.