Example usage for javax.script ScriptEngineFactory getParameter

List of usage examples for javax.script ScriptEngineFactory getParameter

Introduction

In this page you can find the example usage for javax.script ScriptEngineFactory getParameter.

Prototype

public Object getParameter(String key);

Source Link

Document

Returns the value of an attribute whose meaning may be implementation-specific.

Usage

From source file:ThreadingBehavior.java

public static void main(String[] args) {
    ScriptEngineManager manager = new ScriptEngineManager();

    List<ScriptEngineFactory> factories = manager.getEngineFactories();
    for (ScriptEngineFactory factory : factories)
        System.out.println("Threading behavior: " + factory.getParameter("THREADING"));
}

From source file:Main.java

public static void main(String[] args) {
    ScriptEngineManager mgr = new ScriptEngineManager();
    List<ScriptEngineFactory> factories = mgr.getEngineFactories();
    for (ScriptEngineFactory factory : factories) {
        System.out.println(String.format("engineName: %s, THREADING: %s", factory.getEngineName(),
                factory.getParameter("THREADING")));
    }/*from   w  ww  .ja v a 2 s.com*/
}

From source file:com.galeoconsulting.leonardinius.api.impl.ScriptServiceImpl.java

@Override
public void defaultRegistration(ScriptEngineFactory engineFactory) {
    for (String extension : engineFactory.getExtensions()) {
        registerEngineExtension(extension, engineFactory);
    }//from  w  ww .  j av  a  2s .  c o m

    for (String mime : engineFactory.getMimeTypes()) {
        registerEngineMime(mime, engineFactory);
    }

    registerEngineLanguage(engineFactory.getLanguageName(), engineFactory);
    registerEngineLanguage((String) engineFactory.getParameter(ScriptEngine.NAME), engineFactory);

    // do not rely on the other methods
    registeredEngines.put(engineFactory, DUMMY);
}

From source file:org.trafodion.rest.script.ScriptManager.java

private ScriptManager() {
    List<ScriptEngineFactory> engines = manager.getEngineFactories();
    if (engines.isEmpty()) {
        LOG.warn("No scripting engines were found");
        return;/*from   w  ww .j a  va  2  s .c  om*/
    }

    StringBuffer sb = new StringBuffer();
    sb.append("\nThe following " + engines.size() + " scripting engine(s) were found");

    for (ScriptEngineFactory engine : engines) {
        sb.append("\nEngine name: " + engine.getEngineName() + "\nVersion: " + engine.getEngineVersion()
                + "\nLanguage: " + engine.getLanguageName());
        List<String> extensions = engine.getExtensions();
        if (extensions.size() > 0) {
            sb.append("\n\tEngine supports the following extensions:");
            for (String e : extensions) {
                sb.append("\n\t\t" + e);
            }
        }
        List<String> shortNames = engine.getNames();
        if (shortNames.size() > 0) {
            sb.append("\n\tEngine has the following short names:");
            for (String n : engine.getNames()) {
                sb.append("\n\t\t" + n);
            }
        }

        String[] params = { ScriptEngine.ENGINE, ScriptEngine.ENGINE_VERSION, ScriptEngine.LANGUAGE,
                ScriptEngine.LANGUAGE_VERSION, ScriptEngine.NAME, "THREADING" };

        sb.append("\n\tEngine has the following parameters:");
        for (String param : params) {
            sb.append("\n\t\t" + param + " = " + engine.getParameter(param));
        }
        sb.append("\n=========================");
    }
    LOG.debug(sb.toString());

    //Get -Drest.home.dir
    restHome = System.getProperty("rest.home.dir");

    //Start the scripts directory watcher
    watcherWorker = new ScriptManagerWatcher("ScriptManagerWatcher", restHome + "/bin/scripts");
}