List of usage examples for javax.script ScriptEngineFactory getLanguageVersion
public String getLanguageVersion();
ScriptEngine
. From source file:cc.osint.graphd.script.GScriptEngine.java
public void dumpScriptEngines() throws Exception { ScriptEngineManager mgr = new ScriptEngineManager(); List<ScriptEngineFactory> factories = mgr.getEngineFactories(); for (ScriptEngineFactory factory : factories) { log.info("ScriptEngineFactory Info"); String engName = factory.getEngineName(); String engVersion = factory.getEngineVersion(); String langName = factory.getLanguageName(); String langVersion = factory.getLanguageVersion(); System.out.printf("\tScript Engine: %s (%s)\n", engName, engVersion); List<String> engNames = factory.getNames(); for (String name : engNames) { System.out.printf("\tEngine Alias: %s\n", name); }//from w w w . j a va 2s .c om System.out.printf("\tLanguage: %s (%s)\n", langName, langVersion); } }
From source file:ca.hedlund.jiss.preprocessor.InfoPreprocessor.java
@Override public boolean preprocessCommand(JissModel jissModel, String orig, StringBuffer cmd) { final String c = cmd.toString(); if (c.equals(INFO_CMD)) { // clear string cmd.setLength(0);//from w w w. j a v a2s. com final ScriptEngine se = jissModel.getScriptEngine(); final ScriptEngineFactory seFactory = se.getFactory(); final boolean incnl = !seFactory.getOutputStatement("").startsWith("println"); final String infoCmd = seFactory.getOutputStatement(INFO_TXT + (incnl ? "\\n" : "")); final String langCmd = seFactory.getOutputStatement("Language:" + seFactory.getLanguageName() + " " + seFactory.getLanguageVersion() + (incnl ? "\\n" : "")); final String engineCmd = seFactory.getOutputStatement("Engine:" + seFactory.getEngineName() + " " + seFactory.getEngineVersion() + (incnl ? "\\n" : "")); final String program = seFactory.getProgram(infoCmd, langCmd, engineCmd); cmd.append(StringEscapeUtils.unescapeJava(program)); } // we want the scripting engine to handle the replaced command return false; }
From source file:org.apache.felix.webconsole.plugins.scriptconsole.internal.ScriptEngineManager.java
private Collection<?> registerFactory(final EngineManagerState mgr, final ScriptEngineFactory factory, final Map<Object, Object> props) { log.log(LogService.LOG_INFO,//from w w w . jav a 2 s . c om String.format("Adding ScriptEngine %s, %s for language %s, %s", factory.getEngineName(), factory.getEngineVersion(), factory.getLanguageName(), factory.getLanguageVersion())); mgr.factories.add(factory); mgr.factoryProperties.put(factory, props); for (Object ext : factory.getExtensions()) { mgr.extensionAssociations.put((String) ext, factory); } return factory.getExtensions(); }
From source file:org.apache.accumulo.core.util.shell.commands.ScriptCommand.java
private void listJSREngineInfo(ScriptEngineManager mgr, Shell shellState) throws IOException { List<ScriptEngineFactory> factories = mgr.getEngineFactories(); Set<String> lines = new TreeSet<String>(); for (ScriptEngineFactory factory : factories) { lines.add("ScriptEngineFactory Info"); String engName = factory.getEngineName(); String engVersion = factory.getEngineVersion(); String langName = factory.getLanguageName(); String langVersion = factory.getLanguageVersion(); lines.add("\tScript Engine: " + engName + " (" + engVersion + ")"); List<String> engNames = factory.getNames(); for (String name : engNames) { lines.add("\tEngine Alias: " + name); }//from w w w . j a va2 s. c o m lines.add("\tLanguage: " + langName + " (" + langVersion + ")"); } shellState.printLines(lines.iterator(), true); }
From source file:com.aionemu.commons.scripting.AionScriptEngineManager.java
private AionScriptEngineManager() { ScriptEngineManager scriptEngineManager = new ScriptEngineManager(); List<ScriptEngineFactory> factories = scriptEngineManager.getEngineFactories(); if (USE_COMPILED_CACHE) { _cache = loadCompiledScriptCache(); } else {/*from ww w. j a va 2 s . c om*/ _cache = null; } log.info("Initializing Script Engine Manager"); for (ScriptEngineFactory factory : factories) { try { log.info("Script Engine: " + factory.getEngineName() + " " + factory.getEngineVersion() + " - Language: " + factory.getLanguageName() + " " + factory.getLanguageVersion()); ScriptEngine engine = factory.getScriptEngine(); for (String name : factory.getNames()) { if (_nameEngines.containsKey(name)) throw new IllegalStateException("Multiple script engines for the same name!"); _nameEngines.put(name, engine); } for (String ext : factory.getExtensions()) { if (_extEngines.containsKey(ext)) throw new IllegalStateException("Multiple script engines for the same extension!"); _extEngines.put(ext, engine); } } catch (Exception e) { log.warn("Failed initializing factory.", e); } } }
From source file:com.l2jfree.gameserver.scripting.L2ScriptEngineManager.java
private L2ScriptEngineManager() { ScriptEngineManager scriptEngineManager = new ScriptEngineManager(); List<ScriptEngineFactory> factories = scriptEngineManager.getEngineFactories(); if (USE_COMPILED_CACHE) { _cache = loadCompiledScriptCache(); } else {/*from w ww . ja va 2 s.co m*/ _cache = null; } _log.info("Initializing Script Engine Manager"); for (ScriptEngineFactory factory : factories) { try { _log.info("Script Engine: " + factory.getEngineName() + " " + factory.getEngineVersion() + " - Language: " + factory.getLanguageName() + " " + factory.getLanguageVersion()); ScriptEngine engine = factory.getScriptEngine(); for (String name : factory.getNames()) { if (_nameEngines.containsKey(name)) throw new IllegalStateException("Multiple script engines for the same name!"); _nameEngines.put(name, engine); } for (String ext : factory.getExtensions()) { if (_extEngines.containsKey(ext)) throw new IllegalStateException("Multiple script engines for the same extension!"); _extEngines.put(ext, engine); } } catch (Exception e) { _log.warn("Failed initializing factory.", e); } } preConfigure(); }
From source file:org.omegat.gui.scripting.ScriptingWindow.java
private String listScriptEngines() { StringBuilder sb = new StringBuilder(OStrings.getString("SCW_LIST_ENGINES") + "\n"); for (ScriptEngineFactory engine : ScriptRunner.MANAGER.getEngineFactories()) { sb.append(" - "); sb.append(engine.getEngineName()); sb.append(" "); sb.append(engine.getLanguageName()); sb.append(" v."); sb.append(engine.getLanguageVersion()); sb.append(" (").append(OStrings.getString("SCW_EXTENSIONS")).append(" "); boolean hasMore = false; for (String ext : engine.getExtensions()) { if (hasMore) { sb.append(", "); }/*from w w w . j a v a 2 s . c o m*/ sb.append(ext); hasMore = true; } sb.append(")"); sb.append("\n"); } return sb.toString(); }