Package org.codehaus.groovy.control.customizers

Examples of org.codehaus.groovy.control.customizers.ImportCustomizer


    private GroovyShell createEngine(AbstractBuild<?, ?> build, TaskListener listener) {

        ClassLoader cl = Jenkins.getInstance().getPluginManager().uberClassLoader;
        ScriptSandbox sandbox = null;
        CompilerConfiguration cc = new CompilerConfiguration();
        cc.addCompilationCustomizers(new ImportCustomizer().addStarImports(
                "jenkins",
                "jenkins.model",
                "hudson",
                "hudson.model"));
View Full Code Here


        ClassLoader cl = Jenkins.getInstance().getPluginManager().uberClassLoader;
        ScriptSandbox sandbox = null;
        CompilerConfiguration cc = new CompilerConfiguration();
        cc.setScriptBaseClass(EmailExtScript.class.getCanonicalName());
        cc.addCompilationCustomizers(new ImportCustomizer().addStarImports(
                "jenkins",
                "jenkins.model",
                "hudson",
                "hudson.model"));
View Full Code Here

        if (StringUtils.isNotBlank(script)) {
            debug(context.getListener().getLogger(), "Executing pre-send script");
            ClassLoader cl = Jenkins.getInstance().getPluginManager().uberClassLoader;
            ScriptSandbox sandbox = null;
            CompilerConfiguration cc = new CompilerConfiguration();
            cc.addCompilationCustomizers(new ImportCustomizer().addStarImports(
                    "jenkins",
                    "jenkins.model",
                    "hudson",
                    "hudson.model"));
View Full Code Here

      return cl;
    }

    protected void newEvaluator() throws MalformedURLException
    {
      ImportCustomizer icz = new ImportCustomizer();

      if (!imports.isEmpty()) {
        for (int i = 0; i < imports.size(); i++) {
          // should trim too
          if (imports.get(i).endsWith(".*")) {
            icz.addStarImports(imports.get(i).substring(0, imports.get(i).length() - 2));
          } else {
            icz.addImports(imports.get(i));
          }
        }
      }
      CompilerConfiguration config = new CompilerConfiguration().addCompilationCustomizers(icz);
      shell = new GroovyShell(newClassLoader(), new Binding(), config);
View Full Code Here

        public String call() throws RuntimeException {
            // if we run locally, cl!=null. Otherwise the delegating classloader will be available as context classloader.
            if (cl==null)       cl = Thread.currentThread().getContextClassLoader();
            CompilerConfiguration cc = new CompilerConfiguration();
            cc.addCompilationCustomizers(new ImportCustomizer().addStarImports(
                    "jenkins",
                    "jenkins.model",
                    "hudson",
                    "hudson.model"));
            GroovyShell shell = new GroovyShell(cl,new Binding(),cc);
View Full Code Here

        staticImports.add(Order.class.getCanonicalName() + DOT_STAR);
    }

    @Override
    public CompilationCustomizer getCompilationCustomizer() {
        final ImportCustomizer ic = new ImportCustomizer();

        processImports(ic, imports);
        processStaticImports(ic, staticImports);
        processImports(ic, extraImports);
        processStaticImports(ic, extraStaticImports);
View Full Code Here

* @author Stephen Mallette (http://stephen.genoprime.com)
*/
public class NoImportCustomizerProvider implements ImportCustomizerProvider {
    @Override
    public CompilationCustomizer getCompilationCustomizer() {
        return new ImportCustomizer();
    }
View Full Code Here

        this.extraStaticImports.addAll(baseCustomizer.getExtraStaticImports());
    }

    @Override
    public CompilationCustomizer getCompilationCustomizer() {
        final ImportCustomizer ic = new ImportCustomizer();

        processImports(ic, extraImports);
        processStaticImports(ic, extraStaticImports);

        return ic;
View Full Code Here

            throw new RuntimeException(e.getMessage(), e);
        }
    }

    public static ImportCustomizer getImportCustomizer() {
        final ImportCustomizer ic = new DefaultImportCustomizerProvider().getImportCustomizer();
        for (final String imp : Imports.getImports()) {
            ic.addStarImports(imp.replace(DOT_STAR, EMPTY_STRING));
        }
        return ic;
    }
View Full Code Here

    protected final Set<String> extraImports = new HashSet<String>();
    protected final Set<String> extraStaticImports = new HashSet<String>();

    @Override
    public ImportCustomizer getImportCustomizer() {
        final ImportCustomizer ic = new ImportCustomizer();
        for (final String imp : Imports.getImports()) {
            ic.addStarImports(imp.replace(DOT_STAR, EMPTY_STRING));
        }

        ic.addImports("com.tinkerpop.gremlin.Tokens.T");
        ic.addStarImports("com.tinkerpop.gremlin.groovy");
        ic.addStaticImport(Direction.class.getName(), Direction.OUT.toString());
        ic.addStaticImport(Direction.class.getName(), Direction.IN.toString());
        ic.addStaticImport(Direction.class.getName(), Direction.BOTH.toString());
        ic.addStaticImport(TransactionalGraph.Conclusion.class.getName(), TransactionalGraph.Conclusion.SUCCESS.toString());
        ic.addStaticImport(TransactionalGraph.Conclusion.class.getName(), TransactionalGraph.Conclusion.FAILURE.toString());

        importExtras(ic);
        importExtraStatics(ic);

        return ic;
View Full Code Here

TOP

Related Classes of org.codehaus.groovy.control.customizers.ImportCustomizer

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.