Class ScriptletStage<T>

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.metadata.pipeline.AbstractStage<T>
net.shibboleth.metadata.pipeline.ScriptletStage<T>
Type Parameters:
T - type of item the stage operates on
All Implemented Interfaces:
Stage<T>, net.shibboleth.shared.component.Component, net.shibboleth.shared.component.DestructableComponent, net.shibboleth.shared.component.IdentifiableComponent, net.shibboleth.shared.component.IdentifiedComponent, net.shibboleth.shared.component.InitializableComponent

@ThreadSafe public class ScriptletStage<T> extends AbstractStage<T>
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:

  • scriptFile

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

    Fields
    Modifier and Type
    Field
    Description
    private net.shibboleth.shared.scripting.EvaluableScript
    Script executed by this stage.
    private String
    Name of the scriptlet attribute containing the Item collection to be transformed.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    doExecute(List<Item<T>> items)
    Performs the stage processing on the given Item collection.
    protected void
     
    final net.shibboleth.shared.scripting.EvaluableScript
    Gets the script executed by this stage.
    final String
    Gets the variable name to contain the list of items.
    void
    setScript(net.shibboleth.shared.scripting.EvaluableScript stageScript)
    Sets the script executed by this stage.
    final void
    Sets the variable name to contain the list of items.

    Methods inherited from class net.shibboleth.metadata.pipeline.AbstractStage

    execute, getCollectionPredicate, setCollectionPredicate

    Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent

    setId

    Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent

    ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException

    Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

    checkComponentActive, checkSetterPreconditions, 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.shared.component.DestructableComponent

    destroy, isDestroyed

    Methods inherited from interface net.shibboleth.shared.component.IdentifiedComponent

    getId

    Methods inherited from interface net.shibboleth.shared.component.InitializableComponent

    initialize, isInitialized
  • Field Details

    • variableName

      @Nonnull @NotEmpty private String variableName
      Name of the scriptlet attribute containing the Item collection to be transformed.

      Defaults to items.

    • script

      @NonnullAfterInit private net.shibboleth.shared.scripting.EvaluableScript script
      Script executed by this stage.
  • Constructor Details

    • ScriptletStage

      public ScriptletStage()
  • Method Details

    • getVariableName

      public final String getVariableName()
      Gets the variable name to contain the list of items.
      Returns:
      the variable name
    • setVariableName

      public final void setVariableName(@Nonnull @NotEmpty String name)
      Sets the variable name to contain the list of items.
      Parameters:
      name - the variable name
    • getScript

      @NonnullAfterInit public final net.shibboleth.shared.scripting.EvaluableScript getScript()
      Gets the script executed by this stage.
      Returns:
      the script executed by this stage
    • setScript

      public void setScript(@Nonnull net.shibboleth.shared.scripting.EvaluableScript stageScript)
      Sets the script executed by this stage.
      Parameters:
      stageScript - the script executed by this stage
    • doExecute

      protected void doExecute(@Nonnull @NonnullElements List<Item<T>> items) throws StageProcessingException
      Description copied from class: AbstractStage
      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 AbstractStage<T>
      Parameters:
      items - collection to be processed
      Throws:
      StageProcessingException - thrown if there is an unrecoverable problem when processing the stage
    • doInitialize

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