/**
* Construct a new script executors
*
* @param engine
* the script engine to use, must not be <code>null</code>
* @param command
* the command to execute, may be <code>null</code>
* @param classLoader
* the class loader to use when executing, may be
* <code>null</code>
* @throws ScriptException
*/
public ScriptExecutor ( final ScriptEngine engine, final String command, final ClassLoader classLoader, final String sourceName ) throws Exception
{
this.engine = engine;
this.command = command;
this.commandUrl = null;
this.classLoader = classLoader;
this.sourceName = sourceName;
if ( command != null && engine instanceof Compilable && !Boolean.getBoolean ( PROP_NAME_DISABLE_COMPILE ) )
{
if ( sourceName != null )
{
engine.put ( ScriptEngine.FILENAME, sourceName );
}
Scripts.executeWithClassLoader ( classLoader, new Callable<Void> () {
@Override
public Void call () throws Exception
{
ScriptExecutor.this.compiledScript = ( (Compilable)engine ).compile ( command );
return null;
}
} );
}
}
ScriptExecutor.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:neoscada
作者:
评论列表
文章目录