Examples of GroovyScriptEngine


Examples of groovy.util.GroovyScriptEngine

            final Writer out) {
        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

Examples of groovy.util.GroovyScriptEngine

        if (_parent != null) {
            _scripts.addAll(_parent.getScripts());
            _scriptURLS.addAll(_parent.getScriptURLS());
        }
       
        _gse = new GroovyScriptEngine(_scriptURLS.toArray(new URL[0]),
                new ScriptClassLoader(Thread.currentThread()
                        .getContextClassLoader()));
       
        _properties = new Properties();
       
View Full Code Here

Examples of groovy.util.GroovyScriptEngine

     * Hook method to setup the GroovyScriptEngine to use.<br/>
     * Subclasses may override this method to provide a custom
     * engine.
     */
    protected GroovyScriptEngine createGroovyScriptEngine(){
        return new GroovyScriptEngine(this);
    }
View Full Code Here

Examples of groovy.util.GroovyScriptEngine

    try {
      // set Grape root
      File grapeRoot = gitblit.getGrapesFolder();
      grapeRoot.mkdirs();
      System.setProperty("grape.root", grapeRoot.getAbsolutePath());
      this.gse = new GroovyScriptEngine(groovyDir.getAbsolutePath());
    } catch (IOException e) {
    }

    // set advanced ref permissions
    setAllowCreates(user.canCreateRef(repository));
View Full Code Here

Examples of groovy.util.GroovyScriptEngine

        catExtDigester.addObjectCreate("extension/script", "com.tonbeller.jpivot.mondrian.script.ScriptColumn");
        catExtDigester.addSetProperties("extension/script");
        catExtDigester.addSetNext("extension/script", "addScript");
        catExtDigester.parse(catExtIs);
        URL scriptsBaseURL = Thread.currentThread().getContextClassLoader().getResource(scriptRootUrl);
        scriptEngine = new GroovyScriptEngine(new URL[] {scriptsBaseURL});
      }
      con = getConnection();
      Statement s = con.createStatement();
      s.setMaxRows(maxResults);
      ResultSet rs = s.executeQuery(sql);
View Full Code Here

Examples of groovy.util.GroovyScriptEngine

      catExtDigester.addSetProperties("extension/script");
      catExtDigester.addSetNext("extension/script", "addScript");
      catExtDigester.parse(catExtIs);

      URL scriptsBaseURL = Thread.currentThread().getContextClassLoader().getResource(scriptRootUrl);
      scriptEngine = new GroovyScriptEngine(new URL[] {scriptsBaseURL});
     
      con = getConnection();
      Statement s = con.createStatement();
      s.setMaxRows(maxResults);
      ResultSet rs = s.executeQuery(sql);
View Full Code Here

Examples of groovy.util.GroovyScriptEngine

    try {
      // set Grape root
      File grapeRoot = gitblit.getGrapesFolder();
      grapeRoot.mkdirs();
      System.setProperty("grape.root", grapeRoot.getAbsolutePath());
      this.gse = new GroovyScriptEngine(groovyDir.getAbsolutePath());
    } catch (IOException e) {
    }

    // set advanced ref permissions
    setAllowCreates(user.canCreateRef(repository));
View Full Code Here

Examples of groovy.util.GroovyScriptEngine

    UserModel user = new UserModel("mock");

    String gitblitUrl = GitBlitSuite.url;

    File groovyDir = repositories().getHooksFolder();
    GroovyScriptEngine gse = new GroovyScriptEngine(groovyDir.getAbsolutePath());

    Binding binding = new Binding();
    binding.setVariable("gitblit", gitblit);
    binding.setVariable("repository", repository);
    binding.setVariable("user", user);
    binding.setVariable("commands", commands);
    binding.setVariable("url", gitblitUrl);
    binding.setVariable("logger", logger);
    binding.setVariable("clientLogger", clientLogger);

    Object result = gse.run(script, binding);
    if (result instanceof Boolean) {
      if (!((Boolean) result)) {
        throw new GitBlitException(MessageFormat.format(
            "Groovy script {0} has failed!  Hook scripts aborted.", script));
      }
View Full Code Here

Examples of groovy.util.GroovyScriptEngine

        ClassLoader curLoader = Thread.currentThread().getContextClassLoader();

        URL combinedRoots[] = getResourceRoots(extContext, curLoader);
           
        if (0 < combinedRoots.length) {
            GroovyScriptEngine engine =
                    new GroovyScriptEngine(combinedRoots, curLoader);
            loader = new MojarraGroovyClassLoader(engine);
            if (LOGGER.isLoggable(Level.INFO)) {
                LOGGER.log(Level.INFO,
                        "Groovy support enabled.");
            }
View Full Code Here

Examples of groovy.util.GroovyScriptEngine

        String pathPrefix = getScriptRootPath(config);
       
        try
        {
            this.gse = new GroovyScriptEngine(new String[]{pathPrefix});
        }
        catch(IOException ex) { throw new RuntimeException(ex); }
       
        //gse.getConfig().setMinimumRecompilationInterval(0);
       
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.