edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.attributeDefinition
Class ScriptedAttributeDefinition

java.lang.Object
  extended by edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.AbstractResolutionPlugIn<BaseAttribute>
      extended by edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.attributeDefinition.BaseAttributeDefinition
          extended by edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.attributeDefinition.ScriptedAttributeDefinition
All Implemented Interfaces:
AttributeDefinition, ResolutionPlugIn<BaseAttribute>

public class ScriptedAttributeDefinition
extends BaseAttributeDefinition

An attribute definition the computes the attribute definition by executing a script written in some JSR-223 supporting language.


Field Summary
private  CompiledScript compiledScript
          The compiled form of the script, if the script engine supports compiling.
private  org.slf4j.Logger log
          Class logger.
private  String script
          The script to execute.
private  ScriptEngine scriptEngine
          The script engine to execute the script.
private  String scriptLanguage
          The scripting language.
 
Constructor Summary
ScriptedAttributeDefinition(String language)
          Constructor.
 
Method Summary
protected  void compileScript()
          Compiles the script if the scripting engine supports it.
protected  BaseAttribute<?> doResolve(ShibbolethResolutionContext resolutionContext)
          Creates and populates the values for the resolved attribute.
 String getScript()
          Gets the script that will be executed.
protected  ScriptContext getScriptContext(ShibbolethResolutionContext resolutionContext)
          Creates the script execution context from the resolution context.
 String getScriptLanguage()
          Gets the scripting language used.
 void initialize()
          Initializes this attribute definition.
 void setScript(String newScript)
          Sets the script that will be executed.
 void validate()
          Validate the internal state of this plug-in.
 
Methods inherited from class edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.attributeDefinition.BaseAttributeDefinition
getAttributeEncoders, getDisplayDescriptions, getDisplayNames, getSourceAttributeID, getValuesFromAllDependencies, isDependencyOnly, resolve, setDependencyOnly, setSourceAttributeID
 
Methods inherited from class edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.AbstractResolutionPlugIn
getDependencyIds, getId, getValuesFromAllDependencies, getValuesFromAttributeDependency, getValuesFromConnectorDependency, setId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.ResolutionPlugIn
getDependencyIds, getId
 

Field Detail

log

private final org.slf4j.Logger log
Class logger.


scriptLanguage

private String scriptLanguage
The scripting language.


script

private String script
The script to execute.


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

ScriptedAttributeDefinition

public ScriptedAttributeDefinition(String language)
Constructor.

Parameters:
language - the scripting language that will be used
Method Detail

getScriptLanguage

public String getScriptLanguage()
Gets the scripting language used.

Returns:
scripting language used

getScript

public String getScript()
Gets the script that will be executed.

Returns:
script that will be executed

setScript

public void setScript(String newScript)
Sets the script that will be executed.

Parameters:
newScript - script that will be executed

initialize

public void initialize()
Initializes this attribute definition.


validate

public void validate()
              throws AttributeResolutionException
Validate the internal state of this plug-in. This process may not rely on information from any dependency.

Throws:
AttributeResolutionException - if the plug-in has an invalid internal state

doResolve

protected BaseAttribute<?> doResolve(ShibbolethResolutionContext resolutionContext)
                              throws AttributeResolutionException
Creates and populates the values for the resolved attribute. Implementations should *not* set, or otherwise manage, the attribute encoders for the resolved attribute.

Specified by:
doResolve in class BaseAttributeDefinition
Parameters:
resolutionContext - current attribute resolution context
Returns:
resolved attribute
Throws:
AttributeResolutionException - thrown if there is a problem resolving and creating the attribute

compileScript

protected void compileScript()
Compiles the script if the scripting engine supports it.


getScriptContext

protected ScriptContext getScriptContext(ShibbolethResolutionContext resolutionContext)
                                  throws AttributeResolutionException
Creates the script execution context from the resolution context.

Parameters:
resolutionContext - current resolution context
Returns:
constructed script context
Throws:
AttributeResolutionException - thrown if dependent data connectors or attribute definitions can not be resolved


Copyright © 1999-2012. All Rights Reserved.