Package groovy.lang

Examples of groovy.lang.Binding


        if (descriptor.isSecurityEnabled()) {
            cc.addCompilationCustomizers(new SandboxTransformer());
            sandbox = new ScriptSandbox();
        }

        Binding binding = new Binding();
        for (Map.Entry<String, Object> e : variables.entrySet()) {
            binding.setVariable(e.getKey(), e.getValue());
        }

        GroovyShell shell = new GroovyShell(cl, binding, cc);
        if (sandbox != null) {
            sandbox.register();
View Full Code Here


        if (publisher.getDescriptor().isSecurityEnabled()) {
            cc.addCompilationCustomizers(new SandboxTransformer());
            sandbox = new ScriptSandbox();
        }

        Binding binding = new Binding();
        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

                debug(context.getListener().getLogger(), "Setting up sandbox for pre-send script");
                cc.addCompilationCustomizers(new SandboxTransformer());
                sandbox = new ScriptSandbox();
            }

            Binding binding = new Binding();
            binding.setVariable("build", context.getBuild());
            binding.setVariable("msg", msg);
            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);
View Full Code Here

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

        GroovyActionDefinition definition = (GroovyActionDefinition) actionDefinition;

        LOGGER.debug("Groovy action will be executed on node node [{}]", nodeAddress);

        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());
View Full Code Here

        try {
            parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

            String[] roots = new String[] { file.getParentFile().getAbsolutePath() };
            GroovyScriptEngine gse = new GroovyScriptEngine(roots, parent.getClass().getClassLoader());
            Binding binding = new Binding();
            binding.setVariable("session", model.getClientSession().getSession());
            binding.setVariable("binding", model.getClientSession().getSession().getBinding());
            binding.setVariable("out", out);
            gse.run(file.getName(), binding);
        } catch (Exception ex) {
            ClientHelper.showError(null, ex);
        } finally {
            parent.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
View Full Code Here

            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;
        }
        return o;
View Full Code Here

        Map<String, Object> vars = FastMap.newInstance();
        if (context != null) {
            vars.putAll(context);
            vars.put("context", context);
        }
        return new Binding(vars);
    }
View Full Code Here

        catch (Exception e)
        {
            throw new ApplicationRuntimeException(e);
        }

        Binding processorBinding = new Binding();
        processorBinding.setVariable("processor", builder);

        script.setBinding(processorBinding);

        script.run();
View Full Code Here

    private void runScript(Script script, ContentHandler handler)
    {
        HiveMindBuilder builder = new HiveMindBuilder(handler);

        Binding processorBinding = new Binding();
        processorBinding.setVariable("processor", builder);

        script.setBinding(processorBinding);

        script.run();
    }
View Full Code Here

TOP

Related Classes of groovy.lang.Binding

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.