1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-15 22:05:00 -05:00

* use non-jdk rhino in ExpressionFormat

* add rhino to lib and include it in builds
This commit is contained in:
Reinhard Pointner 2009-04-11 23:27:10 +00:00
parent cc6b4959e7
commit 82bd7fa3b1
5 changed files with 27 additions and 25 deletions

View File

@ -53,46 +53,50 @@
<!-- include libs --> <!-- include libs -->
<zipfileset src="${dir.lib}/xercesImpl.jar"> <zipfileset src="${dir.lib}/xercesImpl.jar">
<include name="**/*.class" /> <include name="org/apache/**" />
<include name="**/*.properties" /> <include name="org/w3c/dom/html/**" />
</zipfileset> </zipfileset>
<zipfileset src="${dir.lib}/nekohtml.jar"> <zipfileset src="${dir.lib}/nekohtml.jar">
<include name="**/*.class" /> <include name="org/cyberneko/html/**" />
<include name="**/*.properties" />
</zipfileset> </zipfileset>
<zipfileset src="${dir.lib}/simmetrics.jar"> <zipfileset src="${dir.lib}/simmetrics.jar">
<include name="**/*.class" /> <include name="uk/ac/shef/wit/simmetrics/**" />
</zipfileset> </zipfileset>
<zipfileset src="${dir.lib}/glazedlists.jar"> <zipfileset src="${dir.lib}/glazedlists.jar">
<include name="**/*.class" /> <include name="ca/odell/glazedlists/**" />
</zipfileset> </zipfileset>
<zipfileset src="${dir.lib}/miglayout.jar"> <zipfileset src="${dir.lib}/miglayout.jar">
<include name="**/*.class" /> <include name="net/miginfocom/**" />
<include name="**/*.properties" />
</zipfileset> </zipfileset>
<zipfileset src="${dir.lib}/xmlrpc-client.jar"> <zipfileset src="${dir.lib}/xmlrpc-client.jar">
<include name="**/*.class" /> <include name="redstone/xmlrpc/**" />
<include name="**/*.properties" />
</zipfileset> </zipfileset>
<zipfileset src="${dir.lib}/args4j.jar"> <zipfileset src="${dir.lib}/args4j.jar">
<include name="**/*.class" /> <include name="org/kohsuke/args4j/**" />
<include name="**/*.properties" />
</zipfileset> </zipfileset>
<zipfileset src="${dir.lib}/ehcache.jar"> <zipfileset src="${dir.lib}/ehcache.jar">
<include name="**/*.class" /> <include name="net/sf/ehcache/**" />
</zipfileset> </zipfileset>
<zipfileset src="${dir.lib}/jna.jar"> <zipfileset src="${dir.lib}/jna.jar">
<!-- include classes and native libraries --> <!-- include classes and native libraries -->
<include name="com/sun/jna/**" /> <include name="com/sun/jna/**" />
</zipfileset> </zipfileset>
<zipfileset src="${dir.lib}/js-engine.jar">
<include name="com/sun/phobos/script/**" />
</zipfileset>
<zipfileset src="${dir.lib}/js.jar">
<include name="org/mozilla/**" />
</zipfileset>
</jar> </jar>
</target> </target>
@ -106,10 +110,6 @@
<classpath> <classpath>
<fileset dir="${dir.lib}" includes="*.jar" /> <fileset dir="${dir.lib}" includes="*.jar" />
</classpath> </classpath>
<bootclasspath>
<!-- specify bootclasspath explicitly so we can compile code that depends on sun.* classes -->
<fileset dir="${java.home}/lib" includes="*.jar" />
</bootclasspath>
</javac> </javac>
<!-- copy resources --> <!-- copy resources -->

BIN
lib/js-engine.jar Normal file

Binary file not shown.

BIN
lib/js.jar Normal file

Binary file not shown.

View File

@ -6,7 +6,7 @@ import java.util.Comparator;
import java.util.Map; import java.util.Map;
import java.util.TreeMap; import java.util.TreeMap;
import sun.org.mozilla.javascript.internal.Scriptable; import org.mozilla.javascript.Scriptable;
class AssociativeScriptObject implements Scriptable { class AssociativeScriptObject implements Scriptable {

View File

@ -16,10 +16,11 @@ import javax.script.Compilable;
import javax.script.CompiledScript; import javax.script.CompiledScript;
import javax.script.ScriptContext; import javax.script.ScriptContext;
import javax.script.ScriptEngine; import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException; import javax.script.ScriptException;
import javax.script.SimpleScriptContext; import javax.script.SimpleScriptContext;
import com.sun.phobos.script.javascript.RhinoScriptEngine;
public class ExpressionFormat extends Format { public class ExpressionFormat extends Format {
@ -37,7 +38,8 @@ public class ExpressionFormat extends Format {
protected ScriptEngine initScriptEngine() throws ScriptException { protected ScriptEngine initScriptEngine() throws ScriptException {
ScriptEngine engine = new ScriptEngineManager().getEngineByName("JavaScript"); // don't use jdk rhino so we can use rhino specific features and classes (e.g. Scriptable)
ScriptEngine engine = new RhinoScriptEngine();
engine.eval(new InputStreamReader(ExpressionFormat.class.getResourceAsStream("ExpressionFormat.global.js"))); engine.eval(new InputStreamReader(ExpressionFormat.class.getResourceAsStream("ExpressionFormat.global.js")));