Package bsh

Examples of bsh.Interpreter.eval()


    Interpreter oInterpreter = new Interpreter();

    oInterpreter.set ("DomainNm", sDomainNm);
    oInterpreter.set ("DefaultConnection", oConn);

    oInterpreter.eval(getResourceAsString("scripts/domain_drop.js", sEncoding));

    Object obj = oInterpreter.get("ErrorCode");

    Integer oCodError = (Integer) oInterpreter.get("ErrorCode");
View Full Code Here


    oInterpreter.set ("DefaultConnection", oConn);
    oInterpreter.set ("AlternativeConnection", oConn);

    if (DebugFile.trace) DebugFile.writeln("Interpreter.eval(getResourceAsString(scripts/domain_create.js,"+sEncoding);

    oInterpreter.eval(getResourceAsString("scripts/domain_create.js", sEncoding));

    Object obj = oInterpreter.get("ErrorCode");

    Integer oCodError = (Integer) oInterpreter.get("ErrorCode");
View Full Code Here

    Interpreter oInterpreter = new Interpreter();
    try {
      oInterpreter.set ("UserId", sUserId);
      oInterpreter.set ("DefaultConnection", new JDCConnection(oConn,null));
      if (DebugFile.trace) DebugFile.writeln("Interpreter.eval(getResourceAsString(scripts/user_categories_create.js,"+sEncoding);
      oInterpreter.eval(getResourceAsString("scripts/user_categories_create.js", sEncoding));
      Object obj = oInterpreter.get("ErrorCode");
      oCodError = (Integer) oInterpreter.get("ErrorCode");
      if (oCodError.intValue()==0) {
        sErrMsg = (String) oInterpreter.get("ErrorMessage");
        sRetVal = (String) oInterpreter.get("ReturnValue");
View Full Code Here

  if (null!=sScriptCode) {
      Interpreter oInterpreter = new Interpreter();

      oInterpreter.set ("Parameters", oParameters);
      oInterpreter.set ("EnvironmentProperties", oEnvironment);
      oInterpreter.eval(sScriptCode);

      Object obj = oInterpreter.get("ErrorCode");

      Integer oCodError = (Integer) oInterpreter.get("ErrorCode");
View Full Code Here

    */
   protected void loadScript (InputStream stream) throws Exception
   {
      Interpreter interpreter = new Interpreter ();
      interpreter.setClassLoader(Thread.currentThread().getContextClassLoader());
      interpreter.eval (new java.io.InputStreamReader (stream));

      scriptService = (ScriptService)interpreter.getInterface(ScriptService.class);

      // We now load the script preferences
      //
View Full Code Here

        } else {
          prereq = sb.toString();
        }
      }
      prereq = prereq.replaceAll("@", ".equals(\"");
      Object result = i.eval(prereq);
      String a = result.toString();
      boolean retVal = Boolean.valueOf(a).booleanValue();
      if (Tracing.isDebugEnabled(PrerequisiteManager.class)){
        Tracing.logDebug("eval: " + prereq + " result was: " + retVal,PrerequisiteManager.class);
      }
View Full Code Here

                    if (bsh == null) {
                        bsh = BshUtil.makeInterpreter(context);
                        context.put("bshInterpreter", bsh);
                    }

                    Object retVal = bsh.eval(StringUtil.convertOperatorSubstitutions(useWhen));

                    // retVal should be a Boolean, if not something weird is up...
                    if (retVal instanceof Boolean) {
                        Boolean boolVal = (Boolean) retVal;
                        shouldUse = boolVal.booleanValue();
View Full Code Here

        if (UtilValidate.isEmpty(useWhenStr)) {
            return true;
        } else {
            try {
                Interpreter bsh = this.modelForm.getBshInterpreter(context);
                Object retVal = bsh.eval(StringUtil.convertOperatorSubstitutions(useWhenStr));
                boolean condTrue = false;
                // retVal should be a Boolean, if not something weird is up...
                if (retVal instanceof Boolean) {
                    Boolean boolVal = (Boolean) retVal;
                    condTrue = boolVal.booleanValue();
View Full Code Here

      Map<String, String> groups = new HashMap<String, String>();
      for (String group : tm.getGroups()) {
        groups.put(group, group);
      }
      setContext(interpreter, tm.getMethod(), groups, tm);
      Object evalResult = interpreter.eval(m_expression);
      result = ((Boolean) evalResult).booleanValue();
    }
    catch (EvalError evalError) {
      Utils.log("bsh.Interpreter", 2, "Cannot evaluate expression:" + m_expression + ":" + evalError.getMessage());
    }
View Full Code Here

        try
        {
            getLog().info( "Executing in java version: " + System.getProperty( "java.version" ) );
           
            Object result = terp.eval( script );

            getLog().info( "Result of script evaluation was: " + result + "\nLoaded from: " + result.getClass().getClassLoader() );
        }
        catch ( EvalError e )
        {
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.