Examples of invokeFunction()


Examples of javax.script.Invocable.invokeFunction()

                //File f = new File(this.getJarPath());
                InputStreamReader reader = new InputStreamReader(getClass()
                                                                 .getClassLoader()
                                                                 .getResourceAsStream("boot.js"));
                this.engine.eval(reader);
                inv.invokeFunction("__scboot", this, engine, getClass().getClassLoader());
            }

            Canary.commands().registerCommands(this, this, false);
        }catch(Exception e){
            e.printStackTrace();
View Full Code Here

Examples of javax.script.Invocable.invokeFunction()

            this.getLogman().error(NO_JAVASCRIPT_MESSAGE);
            return null;
        }
        try {
            Invocable inv = (Invocable)this.engine;
            inv.invokeFunction("__onTabComplete", result, sender, args, cmd);
        }catch (Exception e){
            sender.message(e.getMessage());
            e.printStackTrace();
        }
        return result;
View Full Code Here

Examples of javax.script.Invocable.invokeFunction()

      if (this.engine == null){
    this.getLogger().severe(NO_JAVASCRIPT_MESSAGE);
      } else {
    Invocable inv = (Invocable)this.engine;
    this.engine.eval(new InputStreamReader(this.getResource("boot.js")));
    inv.invokeFunction("__scboot", this, engine);
      }
        }catch(Exception e){
            e.printStackTrace();
            this.getLogger().severe(e.getMessage());
        }finally{
View Full Code Here

Examples of javax.script.Invocable.invokeFunction()

      this.getLogger().severe(NO_JAVASCRIPT_MESSAGE);
      return null;
  }
        try {
            Invocable inv = (Invocable)this.engine;
            inv.invokeFunction("__onTabComplete", result, sender, cmd, alias, args);
        }catch (Exception e){
            sender.sendMessage(e.getMessage());
            e.printStackTrace();
        }
        return result;
View Full Code Here

Examples of javax.script.Invocable.invokeFunction()

          args = new Object[iArgs.size()];
          int i = 0;
          for (Entry<Object, Object> arg : iArgs.entrySet())
            args[i++] = arg.getValue();
        }
        invocableEngine.invokeFunction(this.function.getName(), args);
      }
    } catch (ScriptException e) {
      throw new OCommandScriptException("Error on execution of the script", this.function.getName(), e.getColumnNumber(), e);
    } catch (NoSuchMethodException e) {
      throw new OCommandScriptException("Error on execution of the script", this.function.getName(), 0, e);
View Full Code Here

Examples of javax.script.Invocable.invokeFunction()

          args = new Object[iArgs.size()];
          int i = 0;
          for (Entry<Object, Object> arg : iArgs.entrySet())
            args[i++] = arg.getValue();
        }
        result = invocableEngine.invokeFunction(parserText, args);

      } else {
        // INVOKE THE CODE SNIPPET
        final Object[] args = iArgs == null ? null : iArgs.values().toArray();
        result = scriptEngine.eval(scriptManager.getFunctionInvoke(f, args), binding);
View Full Code Here

Examples of javax.script.Invocable.invokeFunction()

        Object b = engine.get( "test" );
        System.out.println( b );

        engine.put( "listener", new JavascriptTestEnvironment() );
        Invocable invocable = ( Invocable ) engine;
        invocable.invokeFunction( "test" );
        invocable.invokeMethod( o, "b" );
        System.out.println();
    }

View Full Code Here

Examples of javax.script.Invocable.invokeFunction()

    }
    Invocable invokableEngine = (Invocable) engine;
    String javascriptFunction = "function result() {" + javascriptFunctionBody + "}"
    engine.eval(javascriptFunction);

    return invokableEngine.invokeFunction("result" );

  }
 
}
View Full Code Here

Examples of javax.script.Invocable.invokeFunction()

      try {
        @SuppressWarnings("unused")
        Method apiMethod = null;
        Invocable invocable = (Invocable) engine;
        if (null == instance) {
          o = invocable.invokeFunction(name, args);
        } else {
          try {
            o = invocable.invokeMethod(instance, name, args);
          } catch (NoSuchMethodException nex) {
            log.debug("Method not found: " + name);
View Full Code Here

Examples of javax.script.Invocable.invokeFunction()

            log.debug("Method not found: " + name);
            try {
              // try to invoke it directly, this will work if the
              // function is in the engine context
              // ie. the script has been already evaluated
              o = invocable.invokeFunction(name, args);
            } catch (Exception ex) {
              log.debug("Function not found: " + name);
              Class[] interfaces = (Class[]) engine.get("interfaces");
              for (Class clazz : interfaces) {
                // java6 style
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.