Examples of GroovyShell


Examples of groovy.lang.GroovyShell

                Run r = ((AbstractProject) job).getBuildByNumber(Integer.parseInt(b));
                binding.setProperty("currentBuild", r);
            }
        }

        GroovyShell groovy = new GroovyShell(Jenkins.getInstance().getPluginManager().uberClassLoader, binding);
        groovy.run(loadScript(),"RemoteClass",remaining.toArray(new String[remaining.size()]));
        return 0;
    }
View Full Code Here

Examples of groovy.lang.GroovyShell

            binding.setVariable(e.getKey(),e.getValue());

        binding.setVariable("index",toModuloIndex(axes));
        binding.setVariable("uniqueId",toIndex(axes));

        GroovyShell shell = new GroovyShell(binding);

        Object result = shell.evaluate("use("+BooleanCategory.class.getName().replace('$','.')+") {"+expression+"}");
        return TRUE.equals(result);
    }
View Full Code Here

Examples of groovy.lang.GroovyShell

            cc.addCompilationCustomizers(new ImportCustomizer().addStarImports(
                    "jenkins",
                    "jenkins.model",
                    "hudson",
                    "hudson.model"));
            GroovyShell shell = new GroovyShell(cl,new Binding(),cc);

            StringWriter out = new StringWriter();
            PrintWriter pw = new PrintWriter(out);
            shell.setVariable("out", pw);
            try {
                Object output = shell.evaluate(script);
                if(output!=null)
                pw.println("Result: "+output);
            } catch (Throwable t) {
                t.printStackTrace(pw);
            }
View Full Code Here

Examples of groovy.lang.GroovyShell

        LOGGER.info("Executing "+initScript);
        execute(new GroovyCodeSource(initScript));
    }

    private static void execute(GroovyCodeSource initScript) throws IOException {
        GroovyShell shell = new GroovyShell(Jenkins.getInstance().getPluginManager().uberClassLoader);
        shell.evaluate(initScript);
    }
View Full Code Here

Examples of groovy.lang.GroovyShell

       
        Map<String, Object> bindings = new HashMap<String, Object>();
        bindings.put(BINDING_CONFIGURATION_DATA, configurationData);
        bindings.put(BINDING_CONFIGURATION_DATA_BUILDER, new ConfigurationDataBuilder(configurationData));
        Binding binding = new Binding(bindings);
        GroovyShell shell = new GroovyShell(binding);

        executeScripts(shell, scriptDir, PATTERN_DEPENDENCIES_FILE);
    }
View Full Code Here

Examples of groovy.lang.GroovyShell

        Map<String, Object> bindings = new HashMap<String, Object>();
        bindings.put(BINDING_CONFIGURATION_DATA, configurationData);
        bindings.put(BINDING_GBEAN_DATAS, gbeanDatas);
        bindings.put(BINDING_GBEAN_DATAS_BUILDER, new GBeanDataBuilder(configurationData, gbeanDatas));
        Binding binding = new Binding(bindings);
        GroovyShell shell = new GroovyShell(classLoader, binding);

        executeScripts(shell, scriptDir, PATTERN_GBEANS_FILE);

        return gbeanDatas;
    }
View Full Code Here

Examples of groovy.lang.GroovyShell

            synchronized (this) {
                if (object == null) {
                    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 object;
View Full Code Here

Examples of groovy.lang.GroovyShell

    public Object getFreshObject(WebuiRequestContext context) throws Exception {
        try {
            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 object;
        } catch (Exception e) {
            log.error("A  problem in the groovy script : " + value, e);
            throw e;
View Full Code Here

Examples of groovy.lang.GroovyShell

            synchronized (this) {
                if (object == null) {
                    ResourceResolver resolver = context.getResourceResolver(value);
                    InputStream is = resolver.getInputStream(value);
                    Binding binding = new Binding();
                    GroovyShell shell = new GroovyShell(prepareClassLoader(), binding);
                    object = shell.evaluate(is);
                    is.close();
                }
            }
        }
        return object;
View Full Code Here

Examples of groovy.lang.GroovyShell

    public Object getFreshObject(WebuiRequestContext context) throws Exception {
        try {
            ResourceResolver resolver = context.getResourceResolver(value);
            InputStream is = resolver.getInputStream(value);
            Binding binding = new Binding();
            GroovyShell shell = new GroovyShell(prepareClassLoader(), binding);
            object = shell.evaluate(is);
            is.close();
            return object;
        } catch (Exception e) {
            log.error("A  problem in the groovy script : " + value, e);
            throw e;
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.