Example usage for javax.script ScriptEngine NAME

List of usage examples for javax.script ScriptEngine NAME

Introduction

In this page you can find the example usage for javax.script ScriptEngine NAME.

Prototype

String NAME

To view the source code for javax.script ScriptEngine NAME.

Click Source Link

Document

Reserved key for a named value that identifies the short name of the scripting language.

Usage

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  w w.j a v  a2 s.co  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  w  w  .j a v a2  s .  com
    }

    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");
}