Package org.elasticsearch.common.mvel2.integration.impl

Examples of org.elasticsearch.common.mvel2.integration.impl.MapVariableResolverFactory


        }

        vars.put( "text",
                  functionDescr.getText() );

        final String text = String.valueOf(TemplateRuntime.eval( template, null, new MapVariableResolverFactory(vars)));

        final BufferedReader reader = new BufferedReader( new StringReader( text ) );
        final String lineStartsWith = "    public static " + functionDescr.getReturnType() + " " + functionDescr.getName();
        try {
            String line;
View Full Code Here


    public static void generateMethodTemplate(final String ruleTemplate, final RuleBuildContext context, final Map vars) {
        TemplateRegistry registry = getRuleTemplateRegistry(context.getKnowledgeBuilder().getRootClassLoader());

        context.addMethod((String) TemplateRuntime.execute( registry.getNamedTemplate(ruleTemplate),
                                                            null,
                                                            new MapVariableResolverFactory(vars),
                                                            registry) );
    }
View Full Code Here

        final String invokerClassName = context.getPkg().getName() + "." + context.getRuleDescr().getClassName() + StringUtils.ucFirst( className ) + "Invoker";

        context.getInvokers().put( invokerClassName,
                                   (String) TemplateRuntime.execute( registry.getNamedTemplate( invokerTemplate ),
                                                                     null,
                                                                     new MapVariableResolverFactory( vars ),
                                                                     registry ) );

        context.getInvokerLookups().put( invokerClassName,
                                             invokerLookup );
        context.getDescrLookups().put( invokerClassName,
View Full Code Here

        context.put( "mvel",
                     mvel );

        return (String) TemplateRuntime.execute( REPORT_REGISTRY.getNamedTemplate( "drl" ),
                                                 null,
                                                 new MapVariableResolverFactory( context ),
                                                 REPORT_REGISTRY );
    }
View Full Code Here

//      return evalWithMVELExpression(MVEL.compileExpression(script, ctx));
    }else{
      if(obj instanceof Map){
        return MVEL.eval(script,(Map)obj);
      }else{
        return MVEL.eval(script,new MapVariableResolverFactory());
      }
     
//      return evalWithMVELExpression(MVEL.compileExpression(script, ctx),obj);
    }
//    if(obj==null){
View Full Code Here

//    }else{
//      return MVEL.eval(script,obj);
//    }
  }
  public static Object evalWithMVEL(String script){
    return MVEL.eval(script, new MapVariableResolverFactory());
//    evalWithMVELExpression(MVEL.compileExpression(script, ctx));
//    if(obj==null){
//      return MVEL.eval(script);
//    }else{
//      return MVEL.eval(script,obj);
View Full Code Here

  }
  public static Object evalWithMVELExpression(Object expression,Object obj){
    if(obj==null){
      return evalWithMVELExpression(expression);
    }else{
      return MVEL.executeExpression(expression, obj,new MapVariableResolverFactory());
    }
  }
View Full Code Here

    }else{
      return MVEL.executeExpression(expression, obj,new MapVariableResolverFactory());
    }
  }
  public static Object evalWithMVELExpression(Object expression){
    return MVEL.executeExpression(expression,new MapVariableResolverFactory());
  }
View Full Code Here

    }
    final boolean returnValue;
    if (this.mvelExpression == null) {
      returnValue = true;
    } else {
      final Object executionResult = MVEL.executeExpression(this.mvelExpression, item, new MapVariableResolverFactory(variables));
      returnValue = executionResult instanceof Boolean && ((Boolean)executionResult).booleanValue();
    }
    return returnValue;
  }
View Full Code Here

      if (log != null && log.isDebugEnabled()) {
        log.debug(String.format("Writing change log to %s using character encoding %s", outputFile, encoding));
      }
      final Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile), encoding));
      try {
        TemplateRuntime.execute(compiledTemplate, this, new MapVariableResolverFactory(variables), null /* no TemplateRegistry */, new TemplateOutputWriter(writer));
      } finally {
        try {
          writer.flush();
        } catch (final IOException ignore) {
          // ignore on purpose
View Full Code Here

TOP

Related Classes of org.elasticsearch.common.mvel2.integration.impl.MapVariableResolverFactory

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.