Examples of GroovyShell


Examples of groovy.lang.GroovyShell

        binding.setVariable("build", build);
        binding.setVariable("project", build.getParent());
        binding.setVariable("rooturl", publisher.getDescriptor().getHudsonUrl());
        binding.setVariable("out", listener.getLogger());
       
        GroovyShell shell = new GroovyShell(cl, binding, cc);

        if (sandbox != null) {
            sandbox.register();
        }
View Full Code Here

Examples of groovy.lang.GroovyShell

            binding.setVariable("logger", context.getListener().getLogger());
            binding.setVariable("cancel", cancel);
            binding.setVariable("trigger", context.getTrigger());
            binding.setVariable("triggered", ImmutableMultimap.copyOf(context.getTriggered()));

            GroovyShell shell = new GroovyShell(cl, binding, cc);
            StringWriter out = new StringWriter();
            PrintWriter pw = new PrintWriter(out);

            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);
                }
            } catch (SecurityException e) {
                context.getListener().getLogger().println("Pre-send script tried to access secured objects: " + e.getMessage());
            } catch (Throwable t) {
View Full Code Here

Examples of groovy.lang.GroovyShell

        super(engine, options);
        binding = new NullBinding();
        binding.setVariable("engine", engine);
        binding.setVariable("js", new MethodClosure(this, "executeJS"));
        binding.setVariable("options", options);
        new GroovyShell(binding).evaluate(script);
    }
View Full Code Here

Examples of groovy.lang.GroovyShell

            icz.addImports(imports.get(i));
          }
        }
      }
      CompilerConfiguration config = new CompilerConfiguration().addCompilationCustomizers(icz);
      shell = new GroovyShell(newClassLoader(), new Binding(), config);
    }
View Full Code Here

Examples of groovy.lang.GroovyShell

        Binding binding = new Binding();
        binding.setVariable(ActionPlaceholders.NODE_VARIABLE, nodeAddress);
        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

Examples of groovy.lang.GroovyShell

        if (Debug.verboseOn()) {
            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();
            context.putAll(binding.getVariables());
        } catch (CompilationFailedException e) {
            Debug.logError(e, "Groovy Evaluation error.", module);
            throw e;
        }
View Full Code Here

Examples of groovy.lang.GroovyShell

    }

    private GroovyShell getGroovyShell()
    {
        if (_groovyShell == null)
            _groovyShell = new GroovyShell(_resolver.getClassLoader());

        return _groovyShell;
    }
View Full Code Here

Examples of groovy.lang.GroovyShell

        mock.startElement("", "module", "module", attrs);
        mock.endElement("", "module", "module");

        replayControls();

        Script script = new GroovyShell().parse("processor.module(id:'basic', version:'1.0.0')");

        runScript(script, mock);
    }
View Full Code Here

Examples of groovy.lang.GroovyShell

        parser.initialize(resource, getClassResolver());

        GroovyCodeSource source = new GroovyCodeSource(resource.getResourceURL());

        Script script = new GroovyShell().parse(source);

        try
        {
            runScript(script, parser);
View Full Code Here

Examples of groovy.lang.GroovyShell

    boolean
    setup(RewriteContext hr) {
  if (interp == null) {
      try {
    binding = new Binding();
    interp = new GroovyShell(binding);
      } catch (NoClassDefFoundError e) {
    hr.request.log(Server.LOG_ERROR, hr.prefix,
      "Missing Groovy libraries" + e);
    return false;
      }
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.