Package groovy.lang

Examples of groovy.lang.GroovyShell.evaluate()


    public boolean trigger(AbstractBuild<?, ?> build, TaskListener listener) {
        boolean result = false;
        GroovyShell engine = createEngine(build, listener);
        if (engine != null && !StringUtils.isEmpty(triggerScript)) {
            try {
                Object res = engine.evaluate(triggerScript);
                if (res != null) {
                    result = (Boolean)res;
                }
            } finally {
               
View Full Code Here


            if (sandbox != null) {
                sandbox.register();
            }

            try {
                Object output = shell.evaluate(script);
                if (output != null) {
                    pw.println("Result: " + output);
                    cancel = ((Boolean) shell.getVariable("cancel")).booleanValue();
                    debug(context.getListener().getLogger(), "Pre-send script set cancel to %b", cancel);
                }
View Full Code Here

        binding.setVariable(ActionPlaceholders.EXECUTION_VARIABLE, scheduleExecutionId);

        GroovyShell shell = new GroovyShell(binding);

        try {
            Object value = shell.evaluate(definition.getScript());
            return produceSuccessResult(value);
        } catch (Exception e) {
            LOGGER.debug("Fail to execute groovy script", e);
            return produceExceptionalResult(e);
        }
View Full Code Here

            Debug.logVerbose("Evaluating -- " + expression, module);
            Debug.logVerbose("Using Context -- " + context, module);
        }
        try {
            GroovyShell shell = new GroovyShell(getBinding(context));
            o = shell.evaluate(StringUtil.convertOperatorSubstitutions(expression));
            if (Debug.verboseOn()) {
                Debug.logVerbose("Evaluated to -- " + o, module);
            }
            // read back the context info
            Binding binding = shell.getContext();
View Full Code Here

    long end = System.currentTimeMillis() - start;
    System.out.println("Parsowenie " + end);

    start = System.currentTimeMillis();
    for (int i = 0; i < 1000; i++) {
      Object value = shell.evaluate("x = 123; return foo * 10");
    }
    end = System.currentTimeMillis() - start;
    System.out.println("Evolution " + end);

    // assert value.equals(new Integer(20));
View Full Code Here

         ResourceResolver resolver = context.getResourceResolver(value);
         InputStream is = resolver.getInputStream(value);
         //TODO if is == null throw an exception saying the it's impossible to find the file
         Binding binding = new Binding();
         GroovyShell shell = new GroovyShell(Thread.currentThread().getContextClassLoader(), binding);
         object = shell.evaluate(is);
         is.close();
         return (T)object;
      }
      catch (Exception ex)
      {
View Full Code Here

      {
         ResourceResolver resolver = context.getResourceResolver(value);
         InputStream is = resolver.getInputStream(value);
         Binding binding = new Binding();
         GroovyShell shell = new GroovyShell(Thread.currentThread().getContextClassLoader(), binding);
         object = shell.evaluate(is);
         is.close();
         return (T)object;
      }
      catch (Exception ex)
      {
View Full Code Here

            Debug.logVerbose("Evaluating -- " + expression, module);
            Debug.logVerbose("Using Context -- " + context, module);
        }
        try {
            GroovyShell shell = new GroovyShell(getBinding(context));
            o = shell.evaluate(StringUtil.convertOperatorSubstitutions(expression));
            if (Debug.verboseOn()) {
                Debug.logVerbose("Evaluated to -- " + o, module);
            }
            // read back the context info
            Binding binding = shell.getContext();
View Full Code Here

            GroovyShell interpreter = new GroovyShell( loader, binding, config );

            try
            {
                return interpreter.evaluate( script );
            }
            catch ( ThreadDeath e )
            {
                throw e;
            }
View Full Code Here

    Binding b = new Binding();
    b.setVariable("beans", beans);

    GroovyShell shell = classLoader != null ? new GroovyShell(classLoader,b) : new GroovyShell(b);
        for (Resource resource : resources) {
            shell.evaluate(resource.getInputStream());
        }
  }

    public void registerBeans(StaticApplicationContext ctx) {
        finalizeDeferredProperties();
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.