Package org.codehaus.groovy.tools.shell

Examples of org.codehaus.groovy.tools.shell.IO


        try {
            in = socket.getInputStream();
            out = new PrintStream(socket.getOutputStream());
            binding.setVariable("out", out);

            final IO io = new IO(in, out, out);
            final Groovysh gsh = new Groovysh(binding, io);
            gsh.run();
        } catch (Exception e) {
            log.error("Error running the Groovy shell.", e);
        } finally {
View Full Code Here


        // redirect "println" to the CLI
        binding.setProperty("out", new PrintWriter(stdout,true));
        binding.setProperty("hudson", Jenkins.getInstance()); // backward compatibility
        binding.setProperty("jenkins", Jenkins.getInstance());

        IO io = new IO(new BufferedInputStream(stdin),stdout,stderr);

        final ClassLoader cl = Thread.currentThread().getContextClassLoader();
        Closure registrar = new Closure(null, null) {
            private static final long serialVersionUID = 1L;
View Full Code Here

    private void log(final String level, Object msg, Throwable cause) {
        assert level != null;
        assert msg != null;
       
        if (io == null) {
            io = new IO();
        }

        // Allow the msg to be a Throwable, and handle it properly if no cause is given
        if (cause == null) {
            if (msg instanceof Throwable) {
View Full Code Here

    private void log(final String level, Object msg, Throwable cause) throws Exception {
        assert level != null;
        assert msg != null;
       
        if (io == null) {
            io = new IO();
        }

        // Allow the msg to be a Throwable, and handle it properly if no cause is given
        if (cause == null) {
            if (msg instanceof Throwable) {
View Full Code Here

        super.pluginTo(pluginAcceptor);
        try {
            pluginAcceptor.eval(SugarLoader.class.getPackage().getName() + "." + SugarLoader.class.getSimpleName());
            pluginAcceptor.eval(SugarLoader.class.getSimpleName() + ".load()");
        } catch (Exception ex) {
            final IO io = (IO) pluginAcceptor.environment().get(ConsolePluginAcceptor.ENVIRONMENT_IO);
            io.out.println("Error loading the 'tinkerpop.sugar' plugin - " + ex.getMessage());
        }
    }
View Full Code Here

            while ((line = reader.readLine()) != null) {
                pluginAcceptor.eval(line);
            }
            reader.close();
        } catch (Exception ex) {
            final IO io = (IO) pluginAcceptor.environment().get(ConsolePluginAcceptor.ENVIRONMENT_IO);
            io.out.println("Error loading the 'utilities' plugin - " + ex.getMessage());
        }
    }
View Full Code Here

    private void log(final String level, Object msg, Throwable cause) throws Exception {
        assert level != null;
        assert msg != null;
       
        if (io == null) {
            io = new IO();
        }

        // Allow the msg to be a Throwable, and handle it properly if no cause is given
        if (cause == null) {
            if (msg instanceof Throwable) {
View Full Code Here

  @Override
  public void start(final Environment env) throws IOException {
    TtyFilterOutputStream out = new TtyFilterOutputStream(this.out);
    TtyFilterOutputStream err = new TtyFilterOutputStream(this.err);

    final Groovysh shell = new Groovysh(createBinding(bindings, out, err), new IO(in, out, err));

    loadDefaultScripts(shell);

    String threadName = "GroovySh Client Thread";
    wrapper = new Thread(new Runnable() {
View Full Code Here

            //System.err.println(e.getMessage());
        }
    }

    public Console() {
        this(new IO(System.in, System.out, System.err), STANDARD_INPUT_PROMPT, STANDARD_RESULT_PROMPT);
    }
View Full Code Here

              final CompilerConfiguration conf = new CompilerConfiguration(System.getProperties());
              final GroovyShell shell = new GroovyShell(binding, conf);
              shell.run(scriptFile, args);
          }
          else {
              final Groovysh shell = new Groovysh(binding, new IO());
              shell.run();
          }
        }
        finally {
          if (applicationContext instanceof DisposableBean) {
View Full Code Here

TOP

Related Classes of org.codehaus.groovy.tools.shell.IO

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.