Package javax.script

Examples of javax.script.ScriptEngineManager


    public static void runJSR223Script(final Component parent, final ClientModel model, final File file,
            final String ext, final Writer out) {
        try {
            parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

            ScriptEngineManager mgr = new ScriptEngineManager();
            ScriptEngine engine = mgr.getEngineByExtension(ext);
            engine.getContext().setWriter(out);
            engine.getContext().setErrorWriter(out);
            engine.put("session", model.getClientSession().getSession());
            engine.put("binding", model.getClientSession().getSession().getBinding());
            engine.put("out", new PrintWriter(out));
View Full Code Here


            this.context = context;
        }

        @Override
        public void execute() {
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine engine = manager.getEngineByExtension("js");
            u.p("engine = " + engine);
            engine.put("ctx",context);
            try {
                u.p("js = " + engine.eval(new InputStreamReader(new FileInputStream(file))));
            } catch (Exception e) {
View Full Code Here

/**
* @version $Revision: 563665 $
*/
public class Jsr223Test extends TestCase {
    public void testLanguageNames() throws Exception {
        ScriptEngineManager manager = new ScriptEngineManager();
        for (ScriptEngineFactory factory : manager.getEngineFactories()) {
            System.out.println("Factory: " + factory.getNames() + " " + factory.getEngineName());
        }
    }
View Full Code Here

    protected boolean matches(E exchange, Object scriptValue) {
        return ObjectConverter.toBoolean(scriptValue);
    }

    protected ScriptEngine createScriptEngine() {
        ScriptEngineManager manager = new ScriptEngineManager();
        return manager.getEngineByName(scriptEngineName);
    }
View Full Code Here

        }
        return new String[]{name};
    }

    protected static ScriptEngineFactory lookupScriptEngineFactory(String language) {
        ScriptEngineManager manager = new ScriptEngineManager();
        for (ScriptEngineFactory factory : manager.getEngineFactories()) {
            // some script names has alias
            String[] names = getScriptNames(language);
            for (String name : names) {
                if (factory.getLanguageName().equals(name)) {
                    return factory;
View Full Code Here

        }
        return null;
    }

    protected static ScriptEngine createScriptEngine(String language) {
        ScriptEngineManager manager = new ScriptEngineManager();
        ScriptEngine engine = null;

        // some script names has alias
        String[] names = getScriptNames(language);
        for (String name : names) {
            try {
                engine = manager.getEngineByName(name);
                if (engine != null) {
                    break;
                }
            } catch (NoClassDefFoundError ex) {
                LOG.error("Cannot load the scriptEngine for " + name + ", the exception is " + ex
View Full Code Here

       
        @Override
        public void run() {
          System.out.println("thread ID: " + Thread.currentThread().getId());
          try {
              ScriptEngineManager factory = new ScriptEngineManager();
             
              ScriptEngine engine = factory.getEngineByName("Renjin");  
             
              engine.put("x", args);
              engine.eval("y <- mean(x)");
              Object result = engine.get("y");
             
View Full Code Here

public class Benchmarks {
 
 
  public static void main(String[] args) throws IOException, ScriptException {
 
    ScriptEngineManager factory = new ScriptEngineManager();
    ScriptEngine engine = factory.getEngineByName("Renjin");

    engine.put("benchmarkArgs", new StringArrayVector(args));

    engine.eval(new InputStreamReader(new FileInputStream("src/main/R/runner.R")));
  }
View Full Code Here

  private Invocable invocableEngine;

  @Before
  public void setUp() {
    // create a script engine manager
    ScriptEngineManager factory = new ScriptEngineManager();
 
    engine = factory.getEngineByName("Renjin");  
    invocableEngine = (Invocable)engine;
  }
View Full Code Here

  private ScriptEngine engine;

  @Before
  public void setUp() {
    // create a script engine manager
    ScriptEngineManager factory = new ScriptEngineManager();
 
    engine = factory.getEngineByName("Renjin");   
  }
View Full Code Here

TOP

Related Classes of javax.script.ScriptEngineManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.