net.shibboleth.metadata.dom
Class AbstractXSLProcessingStage

java.lang.Object
  extended by net.shibboleth.utilities.java.support.component.AbstractDestructableInitializableComponent
      extended by net.shibboleth.utilities.java.support.component.AbstractDestructableIdentifiableInitializableComponent
          extended by net.shibboleth.metadata.pipeline.BaseStage<DomElementItem>
              extended by net.shibboleth.metadata.dom.AbstractXSLProcessingStage
All Implemented Interfaces:
Stage<DomElementItem>, net.shibboleth.utilities.java.support.component.Component, net.shibboleth.utilities.java.support.component.DestructableComponent, net.shibboleth.utilities.java.support.component.IdentifiableComponent, net.shibboleth.utilities.java.support.component.InitializableComponent
Direct Known Subclasses:
MultiOutputXSLTransformationStage, XSLTransformationStage, XSLValidationStage

@ThreadSafe
public abstract class AbstractXSLProcessingStage
extends BaseStage<DomElementItem>

A pipeline stage which applies and XSLT to each element in the DomElementItem collection.

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


Nested Class Summary
 class AbstractXSLProcessingStage.StatusInfoAppendingErrorListener
          Transformer ErrorListener that sets an ErrorStatus or WarningStatus on its Item depending on the TransformerException message.
 
Field Summary
private  Logger log
          Class logger.
private  Map<String,Object> transformAttributes
          Attributes set on the Transformer used by this stage.
private  Map<String,Boolean> transformFeatures
          Features set on the Transformer used by this stage.
private  Map<String,Object> transformParameters
          Collection of named parameters to make available to the transform.
private  net.shibboleth.utilities.java.support.resource.Resource xslResource
          Resource that provides the XSL document.
private  Templates xslTemplate
          XSL template used to transform Elements.
 
Constructor Summary
AbstractXSLProcessingStage()
           
 
Method Summary
protected  void doDestroy()
          
protected  void doExecute(Collection<DomElementItem> itemCollection)
          Performs the stage processing on the given Item collection.
protected  void doInitialize()
          
protected abstract  void executeTransformer(Transformer transformer, Collection<DomElementItem> itemCollection)
          Executes the XSLT transform on the given collection of Items.
 Map<String,Object> getTransformAttributes()
          Gets the unmodifiable collection of attributes used by the XSLT transformer.
 Map<String,Boolean> getTransformFeatures()
          Gets the unmodifiable collection of features used by the XSLT transformer.
 Map<String,Object> getTransformParameters()
          Gets the unmodifiable collection of parameters used by the XSLT transformer.
 net.shibboleth.utilities.java.support.resource.Resource getXslResource()
          Gets the resource that provides the XSL document.
 void setTransformAttributes(Map<String,Object> attributes)
          Sets the collection of attributes used by the XSLT transformer.
 void setTransformFeatures(Map<String,Boolean> features)
          Sets the collection of features used by the XSLT transformer.
 void setTransformParameters(Map<String,Object> parameters)
          Sets the named parameters for the transform.
 void setXslResource(net.shibboleth.utilities.java.support.resource.Resource resource)
          Sets the resource that provides the XSL document.
 
Methods inherited from class net.shibboleth.metadata.pipeline.BaseStage
execute, setId
 
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractDestructableIdentifiableInitializableComponent
getId
 
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractDestructableInitializableComponent
destroy, 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.utilities.java.support.component.DestructableComponent
destroy, isDestroyed
 
Methods inherited from interface net.shibboleth.utilities.java.support.component.IdentifiableComponent
getId
 
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
 

Field Detail

log

private final Logger log
Class logger.


xslResource

private net.shibboleth.utilities.java.support.resource.Resource xslResource
Resource that provides the XSL document.


xslTemplate

private Templates xslTemplate
XSL template used to transform Elements.


transformAttributes

private Map<String,Object> transformAttributes
Attributes set on the Transformer used by this stage.


transformFeatures

private Map<String,Boolean> transformFeatures
Features set on the Transformer used by this stage.


transformParameters

private Map<String,Object> transformParameters
Collection of named parameters to make available to the transform. If not set, an empty collection.

Constructor Detail

AbstractXSLProcessingStage

public AbstractXSLProcessingStage()
Method Detail

getXslResource

@Nullable
public net.shibboleth.utilities.java.support.resource.Resource getXslResource()
Gets the resource that provides the XSL document.

Returns:
resource that provides the XSL document

setXslResource

public void setXslResource(@Nonnull
                           net.shibboleth.utilities.java.support.resource.Resource resource)
Sets the resource that provides the XSL document.

Parameters:
resource - resource that provides the XSL document

getTransformAttributes

@Nonnull
@NonnullElements
@Unmodifiable
public Map<String,Object> getTransformAttributes()
Gets the unmodifiable collection of attributes used by the XSLT transformer.

Returns:
unmodifiable collection of attributes used by the XSLT transformer, never null nor containing null keys

setTransformAttributes

public void setTransformAttributes(@Nullable@NullableElements
                                   Map<String,Object> attributes)
Sets the collection of attributes used by the XSLT transformer.

Parameters:
attributes - collection of attributes used by the XSLT transformer, may be null or contain null keys

getTransformFeatures

@Nonnull
@NonnullElements
@Unmodifiable
public Map<String,Boolean> getTransformFeatures()
Gets the unmodifiable collection of features used by the XSLT transformer.

Returns:
unmodifiable collection of features used by the XSLT transformer, never null nor containing null keys

setTransformFeatures

public void setTransformFeatures(@Nullable@NullableElements
                                 Map<String,Boolean> features)
Sets the collection of features used by the XSLT transformer.

Parameters:
features - collection of features used by the XSLT transformer, may be null or contain null keys

getTransformParameters

@Nonnull
@NonnullElements
@Unmodifiable
public Map<String,Object> getTransformParameters()
Gets the unmodifiable collection of parameters used by the XSLT transformer.

Returns:
parameters used by the XSLT transformer, never null nor containing null keys

setTransformParameters

public void setTransformParameters(@Nullable@NullableElements
                                   Map<String,Object> parameters)
Sets the named parameters for the transform.

Parameters:
parameters - parameters for the transform, may be null or contain null keys

doExecute

protected void doExecute(@Nonnull@NonnullElements
                         Collection<DomElementItem> itemCollection)
                  throws StageProcessingException
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 BaseStage<DomElementItem>
Parameters:
itemCollection - collection to be processed
Throws:
StageProcessingException - thrown if there is an unrecoverable problem when processing the stage

executeTransformer

protected abstract void executeTransformer(@Nonnull
                                           Transformer transformer,
                                           @Nonnull@NonnullElements
                                           Collection<DomElementItem> itemCollection)
                                    throws StageProcessingException,
                                           TransformerConfigurationException
Executes the XSLT transform on the given collection of Items.

Parameters:
transformer - The transform to be applied to each Item. Already has all transformParameters set.
itemCollection - the Items to which the transform should be applied
Throws:
StageProcessingException - thrown if there is a problem applying the transform to Items
TransformerConfigurationException - thrown if there is a problem with the Transform itself

doDestroy

protected void doDestroy()

Overrides:
doDestroy in class net.shibboleth.utilities.java.support.component.AbstractDestructableInitializableComponent

doInitialize

protected void doInitialize()
                     throws net.shibboleth.utilities.java.support.component.ComponentInitializationException

Overrides:
doInitialize in class net.shibboleth.utilities.java.support.component.AbstractDestructableIdentifiableInitializableComponent
Throws:
net.shibboleth.utilities.java.support.component.ComponentInitializationException


Copyright © 1999-2012. All Rights Reserved.