Package bsh

Examples of bsh.Interpreter.eval()


        Object inputValue = inputMap.get(inputName);
        if (inputValue!=null) {
          interpreter.set(inputName, inputValue);
        }
      }
      interpreter.eval(expression);
      iter = outputNames.iterator();
      while (iter.hasNext()) {
        String outputName = (String) iter.next();
        Object outputValue = interpreter.get(outputName);
        outputMap.put(outputName, outputValue);
View Full Code Here


              String object = null;
              ObjectMapper mapper = new ObjectMapper();
              try {
      object = (String) mapper.getObjectFromMessage(message, mpb.getPattern());
      Interpreter inter = new Interpreter();
      inter.eval(BEANSHELL_VARIABLE + " = " + object + mpb.getConditional());
      Boolean b = (Boolean)inter.get(BEANSHELL_VARIABLE);
      if (b.booleanValue()) {
          mvelMonitor.addEvent(message, mpb);
      }
              } catch (ObjectMappingException e1) {
View Full Code Here

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

                    Object retVal = bsh.eval(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(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

            // use the same Interpreter (ie with the same context setup) for all evals
            Interpreter bsh = this.getBshInterpreter(context);
            Iterator altTargetIter = this.altTargets.iterator();
            while (altTargetIter.hasNext()) {
                AltTarget altTarget = (AltTarget) altTargetIter.next();
                Object retVal = bsh.eval(altTarget.useWhen);
                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

        String styles = "";
        try {
            // use the same Interpreter (ie with the same context setup) for all evals
            Interpreter bsh = this.getBshInterpreter(context);
            for (AltRowStyle altRowStyle : this.altRowStyles) {
                Object retVal = bsh.eval(altRowStyle.useWhen);
                // retVal should be a Boolean, if not something weird is up...
                if (retVal instanceof Boolean) {
                    Boolean boolVal = (Boolean) retVal;
                    if (boolVal.booleanValue()) {
                        styles += altRowStyle.style;
View Full Code Here

            try {
                i.set("sdi", sdi);

                // this is the deployment descriptor file that we are currently examining;
                // this is what will be returned if the MBean was configured in this file.
                String file = i.eval("sdi.watch").toString();

                if (file.startsWith("file:/")) {
                    file = file.substring(5);
                }
View Full Code Here

                }

                // get the collection of MBeans that were deployed from the current deployment and
                // see if our MBean object name is among them
                i.set(testScriptObjectNameVariable, ourObjectName);
                Boolean b = (Boolean) i.eval(testScriptContainsOurObjectName);
                if (b) {
                    retDescriptorFile = new File(file); // found it! this is the file where the MBean was configured/deployed
                    break;
                }
            } catch (EvalError evalError) {
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

            Debug.logVerbose("Using Context -- " + context, module);

        try {
            Interpreter bsh = makeInterpreter(context);
            // evaluate the expression
            o = bsh.eval(expression);
            if (Debug.verboseOn())
                Debug.logVerbose("Evaluated to -- " + o, module);

            // read back the context info
            NameSpace ns = bsh.getNameSpace();
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.