List of usage examples for javax.script ScriptEngineFactory getLanguageVersion
public String getLanguageVersion();
ScriptEngine
. From source file:Main.java
public static void main(String args[]) { ScriptEngineManager manager = new ScriptEngineManager(); List<ScriptEngineFactory> factories = manager.getEngineFactories(); for (ScriptEngineFactory factory : factories) { System.out.println(factory.getEngineName()); System.out.println(factory.getEngineVersion()); System.out.println(factory.getLanguageName()); System.out.println(factory.getLanguageVersion()); System.out.println(factory.getExtensions()); System.out.println(factory.getMimeTypes()); System.out.println(factory.getNames()); }/*from w ww . j av a 2 s . com*/ }
From source file:MetadataDemo.java
public static void main(String[] args) { ScriptEngineManager manager = new ScriptEngineManager(); List<ScriptEngineFactory> factories = manager.getEngineFactories(); for (ScriptEngineFactory factory : factories) { System.out.println("Full name = " + factory.getEngineName()); System.out.println("\nVersion = " + factory.getEngineVersion()); System.out.println("\nSupported language version = " + factory.getLanguageVersion()); }//from ww w.j a va 2 s .c o m }
From source file:Main.java
public static void main(String[] args) { ScriptEngineManager manager = new ScriptEngineManager(); // Get the list of all available engines List<ScriptEngineFactory> list = manager.getEngineFactories(); // Print the details of each engine for (ScriptEngineFactory f : list) { System.out.println("Engine Name:" + f.getEngineName()); System.out.println("Engine Version:" + f.getEngineVersion()); System.out.println("Language Name:" + f.getLanguageName()); System.out.println("Language Version:" + f.getLanguageVersion()); System.out.println("Engine Short Names:" + f.getNames()); System.out.println("Mime Types:" + f.getMimeTypes()); System.out.println("==="); }/*from ww w .ja v a 2 s .co m*/ }
From source file:EnumerateScriptEngines.java
public static void main(String[] args) { ScriptEngineManager manager = new ScriptEngineManager(); List<ScriptEngineFactory> factories = manager.getEngineFactories(); for (ScriptEngineFactory factory : factories) { System.out.println("Engine name (full): " + factory.getEngineName()); System.out.println("Engine version: " + factory.getEngineVersion()); System.out.println("Supported extensions:"); List<String> extensions = factory.getExtensions(); for (String extension : extensions) System.out.println(" " + extension); System.out.println("Language name: " + factory.getLanguageName()); System.out.println("Language version: " + factory.getLanguageVersion()); System.out.println("Supported MIME types:"); List<String> mimetypes = factory.getMimeTypes(); for (String mimetype : mimetypes) System.out.println(" " + mimetype); System.out.println("Supported short names:"); List<String> shortnames = factory.getNames(); for (String shortname : shortnames) System.out.println(" " + shortname); System.out.println();//w w w. ja v a 2 s.co m } }
From source file:com.galeoconsulting.leonardinius.api.LanguageUtils.java
public static String getVersionString(ScriptEngineFactory factory) { return factory.getLanguageVersion(); }
From source file:org.mycontroller.standalone.scripts.McScriptEngineUtils.java
public static List<HashMap<String, Object>> getScriptEnginesDetail() { List<HashMap<String, Object>> engines = new ArrayList<HashMap<String, Object>>(); ScriptEngineManager mgr = McScriptEngineUtils.getScriptEngineManager(); List<ScriptEngineFactory> factories = mgr.getEngineFactories(); for (ScriptEngineFactory factory : factories) { HashMap<String, Object> engine = new HashMap<String, Object>(); engine.put("engineName", factory.getEngineName()); engine.put("engineVersion", factory.getEngineVersion()); engine.put("languageName", factory.getLanguageName()); engine.put("languageVersion", factory.getLanguageVersion()); engine.put("extensions", factory.getExtensions()); engine.put("alias", factory.getNames()); engines.add(engine);/*from w w w.ja v a 2 s. c o m*/ } return engines; }
From source file:com.xafero.vee.cmd.MainApp.java
private static void printLanguages() { ScriptEngineManager mgr = new ScriptEngineManager(); for (ScriptEngineFactory factory : mgr.getEngineFactories()) System.out.println(MoreObjects.toStringHelper("").add("name", factory.getEngineName()) .add("version", factory.getEngineVersion()) .add("extensions", "[ " + Strings.join(" | ", factory.getExtensions()) + " ]") .add("mimeTypes", "[ " + Strings.join(" | ", factory.getMimeTypes()) + " ]") .add("aliases", "[ " + Strings.join(" | ", factory.getNames()) + " ]") .add("language", factory.getLanguageName() + " " + factory.getLanguageVersion()) .omitNullValues().toString().replace(", ", String.format(", %n "))); }
From source file:ca.hedlund.jiss.preprocessor.LangPreprocessor.java
private void printLangs(JissModel model, StringBuffer cmd) { final ScriptEngineManager manager = new ScriptEngineManager(JissModel.class.getClassLoader()); final List<String> cmds = new ArrayList<String>(); for (ScriptEngineFactory factory : manager.getEngineFactories()) { final String engineInfo = factory.getLanguageName() + " " + factory.getLanguageVersion() + ":" + factory.getEngineName() + " " + factory.getEngineVersion(); cmds.add(createPrintCmd(model, engineInfo)); }//from w ww.j a v a 2 s .com final ScriptEngineFactory factory = model.getScriptEngine().getFactory(); final String prog = StringEscapeUtils.unescapeJava(factory.getProgram(cmds.toArray(new String[0]))); cmd.append(prog); }
From source file:ca.hedlund.jiss.preprocessor.LangPreprocessor.java
private void printCurrentLang(JissModel model, StringBuffer cmd) { final List<String> cmds = new ArrayList<String>(); final ScriptEngineFactory factory = model.getScriptEngine().getFactory(); final String engineInfo = factory.getLanguageName() + " " + factory.getLanguageVersion() + ":" + factory.getEngineName() + " " + factory.getEngineVersion(); cmds.add(createPrintCmd(model, engineInfo)); final String prog = StringEscapeUtils.unescapeJava(factory.getProgram(cmds.toArray(new String[0]))); cmd.append(prog);//from w ww. j a va 2 s . c om }
From source file:org.springframework.data.hadoop.scripting.Jsr223ScriptEvaluator.java
protected ScriptEngine discoverEngine(ScriptSource script, Map<String, Object> arguments) { ScriptEngineManager engineManager = new ScriptEngineManager(classLoader); ScriptEngine engine = null;//from w ww . ja v a 2s . co m if (StringUtils.hasText(language)) { engine = engineManager.getEngineByName(language); } else { // make use the extension (enhanced ScriptSource interface) Assert.hasText(extension, "no language or extension specified"); engine = engineManager.getEngineByExtension(extension); } Assert.notNull(engine, "No suitable engine found for " + (StringUtils.hasText(language) ? "language " + language : "extension " + extension)); if (log.isDebugEnabled()) { ScriptEngineFactory factory = engine.getFactory(); log.debug(String.format("Using ScriptEngine %s (%s), language %s (%s)", factory.getEngineName(), factory.getEngineVersion(), factory.getLanguageName(), factory.getLanguageVersion())); } return engine; }