com.ca.jcs.processor.script
Class ScriptPoolFactory

java.lang.Object
  extended by com.ca.jcs.processor.script.ScriptPoolFactory
All Implemented Interfaces:
PoolableObjectFactory

public class ScriptPoolFactory
extends Object
implements PoolableObjectFactory

Acts as the factory creating scripting engine instances based on the requested language, script and whether the script is going to be executed in its entirety or instead have functions defined within it called.

Note that this class ensures that any JavaScript EngineFactory added on the classpath is used in preference to the Rhino 1.6R2 JavaScript implementation bundled with JDK 6, because the bundled implementation:

  1. doesn't allowing unwrapping of exceptions thrown by a script and
  2. doesn't support compilation.


Nested Class Summary
static interface ScriptPoolFactory.ExceptionUnwrapper
          Provide for plug-ins that know how to unwrap exceptions (e.g.
 
Field Summary
static String EXCEPTION_UNWRAPPER_KEY
           
 
Constructor Summary
ScriptPoolFactory(String scriptLang, String script, boolean invokeFuncs)
           
 
Method Summary
 void activateObject(Object scriptEngine)
           
 void destroyObject(Object engineOrCScript)
           
 Object makeObject()
           
 void passivateObject(Object scriptEngine)
           
 boolean validateObject(Object scriptEngine)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXCEPTION_UNWRAPPER_KEY

public static final String EXCEPTION_UNWRAPPER_KEY
See Also:
Constant Field Values
Constructor Detail

ScriptPoolFactory

public ScriptPoolFactory(String scriptLang,
                         String script,
                         boolean invokeFuncs)
Method Detail

makeObject

public Object makeObject()
                  throws Exception
Specified by:
makeObject in interface PoolableObjectFactory
Throws:
Exception

destroyObject

public void destroyObject(Object engineOrCScript)
                   throws Exception
Specified by:
destroyObject in interface PoolableObjectFactory
Throws:
Exception

activateObject

public void activateObject(Object scriptEngine)
                    throws Exception
Specified by:
activateObject in interface PoolableObjectFactory
Throws:
Exception

passivateObject

public void passivateObject(Object scriptEngine)
                     throws Exception
Specified by:
passivateObject in interface PoolableObjectFactory
Throws:
Exception

validateObject

public boolean validateObject(Object scriptEngine)
Specified by:
validateObject in interface PoolableObjectFactory


Created 2011-07-14 13:27 EST