Package javax.script

Examples of javax.script.ScriptEngineManager


            if (script != null) {
                return executeScript(script, functionName, scriptContext, args);
            }
        }
        String fileExtension = getFileExtension(filePath);
        ScriptEngineManager manager = new ScriptEngineManager();
        ScriptEngine engine = manager.getEngineByExtension(fileExtension);
        if (engine == null) {
            throw new IllegalArgumentException("The script type is not supported for location: " + filePath);
        }
        if (Debug.verboseOn()) {
            Debug.logVerbose("Begin processing script [" + filePath + "] using engine " + engine.getClass().getName(), module);
View Full Code Here


    protected boolean matches(Exchange exchange, Object scriptValue) {
        return ObjectConverter.toBool(scriptValue);
    }

    protected ScriptEngine createScriptEngine() {
        ScriptEngineManager manager = new ScriptEngineManager();
        try {
            engine = manager.getEngineByName(scriptEngineName);
        } catch (NoClassDefFoundError ex) {
            LOG.error("Cannot load the scriptEngine for " + scriptEngineName + ", the exception is " + ex
                      + ", please ensure correct JARs is provided on classpath.");
        }
        if (engine == null) {
View Full Code Here

    Event<Escalation> escalationSink;

    @PostConstruct
    public void initScripting() {
       
        ScriptEngineManager engineManager = new ScriptEngineManager();
        this.scriptEngine = engineManager.getEngineByName(ENGINE_NAME);
        if (this.scriptEngine == null) {
            throw new IllegalStateException("Cannot create ScriptEngine: " + ENGINE_NAME);
        }
        LOG.info("Loaded script engine: " + ENGINE_NAME);
    }
View Full Code Here

    globalScriptContext.setAttribute("scriptHelper",
        new ScriptHelper(globalScriptContext, globalScriptLanguage, resourceManager, contextKey), ScriptContext.ENGINE_SCOPE);


    final ScriptEngine maybeInvocableEngine = new ScriptEngineManager().getEngineByName(globalScriptLanguage);
    if (maybeInvocableEngine == null)
    {
      throw new ReportDataFactoryException(String.format
          ("DataFactoryScriptingSupport: Failed to locate scripting engine for language '%s'.", globalScriptLanguage));
    }
View Full Code Here

      return eval(script, defaultScriptLanguage);
    }

    public Object eval(final String script, final String scriptLanguage) throws ScriptException
    {
      final ScriptEngine scriptEngine = new ScriptEngineManager().getEngineByName(scriptLanguage);
      if (scriptEngine == null)
      {
        throw new ScriptException(String.format
            ("DataFactoryScriptingSupport: Failed to locate scripting engine for language '%s'.", scriptLanguage));
      }
View Full Code Here

      }

      this.context.setAttribute("scriptHelper",
          new ScriptHelper(this.context, scriptLanguage, resourceManager, contextKey), ScriptContext.ENGINE_SCOPE);

      this.scriptEngine = new ScriptEngineManager().getEngineByName(scriptLanguage);
      if (scriptEngine instanceof Invocable == false)
      {
        throw new ReportDataFactoryException(String.format("Query script language '%s' is not usable.", scriptLanguage));
      }
      this.invocableEngine = (Invocable) scriptEngine;
View Full Code Here

  public static ScriptEngineFactory[] getScriptEngineLanguages()
  {
    final LinkedHashSet<ScriptEngineFactory> langSet = new LinkedHashSet<ScriptEngineFactory>();
    langSet.add(null);
    final List<ScriptEngineFactory> engineFactories = new ScriptEngineManager().getEngineFactories();
    for (final ScriptEngineFactory engineFactory : engineFactories)
    {
      langSet.add(engineFactory);
    }
    return langSet.toArray(new ScriptEngineFactory[langSet.size()]);
View Full Code Here

  /**
   * Initialize the current configured engine.
   * @throws ScriptException If we are unable to import packages.
   */
  private void initializeEngine() throws ScriptException {
    ScriptEngineManager manager = new ScriptEngineManager();
    engine = manager.getEngineByName(config.getScriptEngineName());
   
    // Import useful packages
    if (engine != null) {
      engine.eval("importPackage(org.bukkit);");
      engine.eval("importPackage(com.comphenix.protocol.reflect);");
View Full Code Here

            sqlSB.append("    i += a[E[c] >> 4 & 15], i += a[E[c] & 15]; \n");
            sqlSB.append("  return i \n");
            sqlSB.append("} \n");
            String js = sqlSB.toString();
            // end
            ScriptEngineManager mgr = new ScriptEngineManager();
            ScriptEngine engine = mgr
                    .getEngineByMimeType("application/javascript");
            engine.eval(js);
            Invocable inv = (Invocable) engine;
            s = (String) inv.invokeFunction("P", uin, ptwebqq);
        } catch (Exception e) {
View Full Code Here

*/
public class AppleScriptUtil {

  public static Object executeScript(String script) throws ScriptException {
    if (_appleScriptEngine == null) {
      _scriptEngineManager = new ScriptEngineManager();

      _appleScriptEngine = _scriptEngineManager.getEngineByName(
        "AppleScriptEngine");

      if (_appleScriptEngine == null) {
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.