net.shibboleth.metadata.pipeline
Class ScriptletStage

java.lang.Object
  extended by net.shibboleth.metadata.pipeline.AbstractComponent
      extended by net.shibboleth.metadata.pipeline.BaseStage<Item<?>>
          extended by net.shibboleth.metadata.pipeline.ScriptletStage
All Implemented Interfaces:
Component, Stage<Item<?>>

@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
private  CompiledScript compiledScript
          The compiled form of the script, if the script engine supports compiling.
static String ITEM
          Name of the scriptlet attribute, "item" , containing the Item collection to be transformed.
private  Logger log
          Class logger.
private  ScriptEngine scriptEngine
          The script engine to execute the script.
private  File scriptFile
          Filesystem path script file.
private  String scriptLanguage
          Name of the scripting language in use.
 
Constructor Summary
ScriptletStage()
           
 
Method Summary
protected  void doExecute(Collection<Item<?>> itemCollection)
          Performs the stage processing on the given Item collection.
protected  void doInitialize()
          Do the initialization of the component.
 File getScriptFile()
          Gets the script file used.
 String getScriptLanguage()
          Gets the scripting language used.
 void setScriptFile(File file)
          Sets the script file used.
 void setScriptLanguage(String language)
          Sets the scripting language used.
 
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

ITEM

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

See Also:
Constant Field Values

log

private final Logger log
Class logger.


scriptLanguage

private String scriptLanguage
Name of the scripting language in use. Default value: ecmascript


scriptFile

private File scriptFile
Filesystem path script file.


scriptEngine

private ScriptEngine scriptEngine
The script engine to execute the script.


compiledScript

private CompiledScript compiledScript
The compiled form of the script, if the script engine supports compiling.

Constructor Detail

ScriptletStage

public ScriptletStage()
Method Detail

getScriptLanguage

public String getScriptLanguage()
Gets the scripting language used.

Returns:
scripting language used

setScriptLanguage

public void setScriptLanguage(String language)
Sets the scripting language used.

Parameters:
language - scripting language used

getScriptFile

public File getScriptFile()
Gets the script file used.

Returns:
script file used

setScriptFile

public void setScriptFile(File file)
Sets the script file used.

Parameters:
file - script file used

doExecute

protected void doExecute(Collection<Item<?>> itemCollection)
                  throws StageProcessingException
Performs the stage processing on the given Item collection.

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