Examples of JexlContext


Examples of org.apache.commons.jexl.JexlContext

    if (notification instanceof CallflowNotification)
    {
      try
      {
        CallflowNotification notif = (CallflowNotification) notification;
        JexlContext jc = JexlHelper.createContext();
        Expression msgExpression = null;
        msgExpression = ExpressionFactory.createExpression("log." + _filter);

        jc.getVars().put("log", notif.getMessageInfo());
        jc.getVars().put("message", notif.getMessageInfo().getMessage());

        return ((Boolean) msgExpression.evaluate(jc));
      }
      catch (Exception e)
      {
View Full Code Here

Examples of org.apache.commons.jexl.JexlContext

    if (_messages == null)
      return null;
   
    synchronized (this)
    {
      JexlContext jc = JexlHelper.createContext();
      Expression msgExpression = null;
      if (msgFilter != null && !msgFilter.trim().equals(""))
      {
        Log.debug("Get messages with filter: " + msgFilter);
        msgExpression = ExpressionFactory.createExpression("log." + msgFilter);
      }
   
      List<MessageInfo> result = new ArrayList<MessageInfo>();
      ListIterator<MessageInfo> it = iterate(false);
     
      int i = 0;
      while (it.hasPrevious() && i < maxMessages)
      {
        MessageInfo info = it.previous();
        jc.getVars().put("log", info);
        jc.getVars().put("message", info.getMessage());
     
        if (msgExpression == null || ((Boolean) msgExpression.evaluate(jc)).booleanValue())
        {
          result.add(0, info);
          i++;
View Full Code Here

Examples of org.apache.commons.jexl.JexlContext

    if (_messages == null)
      return null;
   
    synchronized (this)
    {
      JexlContext jc = JexlHelper.createContext();
      Expression msgExpression = null;
      if (msgFilter != null && !msgFilter.trim().equals(""))
      {
        Log.debug("Get messages with filter: " + msgFilter);
        msgExpression = ExpressionFactory.createExpression("log." + msgFilter);
      }
   
      List<MessageInfo> result = new ArrayList<MessageInfo>();
      ListIterator<MessageInfo> it = iterate(false);
     
      int i = 0;
      while (it.hasPrevious() && i < maxMessages)
      {
        MessageInfo info = it.previous();
        jc.getVars().put("log", info);
        jc.getVars().put("message", info.getMessage());
     
        if (msgExpression == null || ((Boolean) msgExpression.evaluate(jc)).booleanValue())
        {
          result.add(0, info);
          i++;
View Full Code Here

Examples of org.apache.commons.jexl.JexlContext

        JMeterVariables vars = jmctx.getVariables();

        try
        {
            Script script = ScriptFactory.createScript(exp);
            JexlContext jc = JexlHelper.createContext();
            @SuppressWarnings("unchecked")
            final Map<String, Object> jexlVars = jc.getVars();
            jexlVars.put("log", log); //$NON-NLS-1$
            jexlVars.put("ctx", jmctx); //$NON-NLS-1$
            jexlVars.put("vars", vars); //$NON-NLS-1$
            jexlVars.put("props", JMeterUtils.getJMeterProperties()); //$NON-NLS-1$
            // Previously mis-spelt as theadName
View Full Code Here

Examples of org.apache.commons.jexl.JexlContext

            public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
                if (method.getAnnotation(Callback.class) != null) {
                    try {
                        Expression e = ExpressionFactory.createExpression(
                                method.getAnnotation(Callback.class).condition());
                        JexlContext jc = JexlHelper.createContext();
                        jc.getVars().put("this", obj);
                        Object r = e.evaluate(jc);
                        if (!(r instanceof Boolean)) {
                            throw new RuntimeException("Expression did not returned a boolean value but: " + r);
                        }
                        Boolean oldVal = req.getCallbacks().get(method);
View Full Code Here

Examples of org.apache.commons.jexl.JexlContext

        log.debug("Evaluating expression: {}", expression);
       
        Expression expr = ExpressionFactory.createExpression(expression);

        JexlContext ctx = JexlHelper.createContext();
        ctx.setVars(vars);

        Object result = expr.evaluate(ctx);
        log.debug("Result: {}", result);

        return result;
View Full Code Here

Examples of org.apache.commons.jexl.JexlContext

        }

        public Object evaluate(JellyContext context) {
            try {
                CURRENT_CONTEXT.set(context);
                JexlContext jexlContext = new JellyJexlContext( context );
                return expression.evaluate(jexlContext);
            } catch (AcegiSecurityException e) {
                // let the security exception pass through
                throw e;
            } catch (Exception e) {
View Full Code Here

Examples of org.apache.commons.jexl.JexlContext

            return null;
        }
       
        Expression e = ExpressionFactory.createExpression(expression);

        JexlContext jc = JexlHelper.createContext();
        jc.setVars(vars);

        return e.evaluate(jc);
    }
View Full Code Here

Examples of org.apache.commons.jexl.JexlContext

        try {
            // Create expression
            Expression exp = ExpressionFactory.createExpression(expression);

            // Create a context and add data
            JexlContext jc = JexlHelper.createContext();
            if (null != contextData && contextData.size() > 0) {
                for (Map.Entry<String, Object> entry : contextData.entrySet()) {
                    jc.getVars().put(entry.getKey(), entry.getValue());
                }
            }

            // Now evaluate the expression, getting the result
            result = exp.evaluate(jc);
View Full Code Here

Examples of org.apache.commons.jexl.JexlContext

        JMeterVariables vars = jmctx.getVariables();

        try
        {
            Expression e = ExpressionFactory.createExpression(exp);
            JexlContext jc = JexlHelper.createContext();
            final Map jexlVars = jc.getVars();
            jexlVars.put("ctx", jmctx); //$NON-NLS-1$               
            jexlVars.put("vars", vars); //$NON-NLS-1$
            jexlVars.put("props", JMeterUtils.getJMeterProperties()); //$NON-NLS-1$
            jexlVars.put("theadName", Thread.currentThread().getName()); //$NON-NLS-1$
            jexlVars.put("sampler", currentSampler); //$NON-NLS-1$ (may be null)
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.