net.shibboleth.metadata.pipeline
Class ScriptletStage

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<Item<?>>
              extended by net.shibboleth.metadata.pipeline.ScriptletStage
All Implemented Interfaces:
Stage<Item<?>>, 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

@ThreadSafe
public class ScriptletStage
extends BaseStage<Item<?>>

A pipeline stage that computes that transforms the collection of Item via a script.

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

This classes uses the JSR-223 scripting interface. As such, in order to use a language other than ECMAscript (a.k.a. javascript), you must ensure the scripting engine and any associated libraries necessary for its operation are on the classpath.


Field Summary
static String ITEMS
          Name of the scriptlet attribute, "items" , containing the Item collection to be transformed.
private  Logger log
          Class logger.
private  net.shibboleth.utilities.java.support.scripting.EvaluableScript script
          Script executed by this stage.
 
Constructor Summary
ScriptletStage()
           
 
Method Summary
protected  void doExecute(Collection<Item<?>> itemCollection)
          Performs the stage processing on the given Item collection.
protected  void doInitialize()
          
 net.shibboleth.utilities.java.support.scripting.EvaluableScript getScript()
          Gets the script executed by this stage.
 void setScript(net.shibboleth.utilities.java.support.scripting.EvaluableScript stageScript)
          Sets the script executed by this stage.
 
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, 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.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

ITEMS

public static final String ITEMS
Name of the scriptlet attribute, "items" , containing the Item collection to be transformed.

See Also:
Constant Field Values

log

private final Logger log
Class logger.


script

private net.shibboleth.utilities.java.support.scripting.EvaluableScript script
Script executed by this stage.

Constructor Detail

ScriptletStage

public ScriptletStage()
Method Detail

getScript

@Nullable
public net.shibboleth.utilities.java.support.scripting.EvaluableScript getScript()
Gets the script executed by this stage.

Returns:
the script executed by this stage

setScript

public void setScript(@Nonnull
                      net.shibboleth.utilities.java.support.scripting.EvaluableScript stageScript)
Sets the script executed by this stage.

Parameters:
stageScript - the script executed by this stage

doExecute

protected void doExecute(@Nonnull@NonnullElements
                         Collection<Item<?>> 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<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 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.