org.identityconnectors.common.script
Class ScriptExecutorFactory

java.lang.Object
  extended by org.identityconnectors.common.script.ScriptExecutorFactory

public abstract class ScriptExecutorFactory
extends Object

Abstraction for finding script executors to allow us to invoke scripts from java.

NOTE: This is intended purely for executing java-embedable scripting languages. That is, the execution model is assumed to be same-JVM, so scripts can have side effects on objects passed to the script. This is used internally by the connector framework in its implementation of ScriptOnConnectorApiOp and should be used by connectors should they need to have a custom implementation of ScriptOnConnectorOp. This is not intended for use by connectors that implement ScriptOnResourceOp.


Constructor Summary
ScriptExecutorFactory()
           
 
Method Summary
abstract  String getLanguageName()
          Returns the name of the language supported by this factory.
static Set<String> getSupportedLanguages()
          Returns the set of supported languages.
static ScriptExecutorFactory newInstance(String language)
          Creates a ScriptExecutorFactory for the given language
abstract  ScriptExecutor newScriptExecutor(ClassLoader loader, String script, boolean compile)
          Creates a script executor for the given script.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptExecutorFactory

public ScriptExecutorFactory()
Method Detail

getSupportedLanguages

public static Set<String> getSupportedLanguages()
Returns the set of supported languages.

Returns:
The set of supported languages.

newInstance

public static ScriptExecutorFactory newInstance(String language)
                                         throws IllegalArgumentException
Creates a ScriptExecutorFactory for the given language

Parameters:
language - The name of the language
Returns:
The script executor factory
Throws:
IllegalArgumentException - If the given language is not supported.

newScriptExecutor

public abstract ScriptExecutor newScriptExecutor(ClassLoader loader,
                                                 String script,
                                                 boolean compile)
Creates a script executor for the given script.

Parameters:
loader - The classloader that contains the java classes that the script should have access to.
script - The script text.
compile - A hint to tell the script executor whether or not to compile the given script. This need not be implemented by all script executors. If true, the caller is saying that they intend to call the script multiple times with different arguments, so compile if possible.
Returns:
A script executor.

getLanguageName

public abstract String getLanguageName()
Returns the name of the language supported by this factory.

Returns:
the name of the language.


Copyright © 2012. All Rights Reserved.