Package org.crsh.shell

Examples of org.crsh.shell.Shell


        Boolean enabled = context.getProperty(WebPlugin.ENABLED);
        if (enabled != null && enabled) {
          log.fine("Using shell " + context);
          ShellFactory factory = context.getPlugin(ShellFactory.class);
          Principal user = wsSession.getUserPrincipal();
          Shell shell = factory.create(user);
          CRaSHSession session = new CRaSHSession(wsSession, shell);
          sessions.put(wsSession.getId(), session);
          log.fine("Established session " + wsSession.getId());
        } else {
          log.fine("Web plugin disabled");
View Full Code Here


  public void testFoo() throws Exception {
    Support support = new Support() {
      @Override
      protected void execute(TestPluginLifeCycle lifeCycle, Wiser wiser) throws IOException, MessagingException, ExecutionException, InterruptedException {
        Shell shell = lifeCycle.createShell();
        lifeCycle.bindClass("produce", Commands.ProduceValue.class);
        lifeCycle.bindClass("consume", Commands.ConsumeObject.class);
        Commands.list.clear();
        BaseProcessContext process = BaseProcessContext.create(shell, "produce | mail send -s the_subject -b admin@gmail.com | consume").execute();
        ShellResponse.Ok ok = assertInstance(ShellResponse.Ok.class, process.getResponse());
View Full Code Here

  @Override
  public void destroy() {
  }

  public void handle(final TermIO io, Principal user) {
    Shell shell = factory.create(user);
    ConsoleTerm term = new ConsoleTerm(io);
    Processor processor = new Processor(term, shell);
    processor.addListener(io);
    processor.addListener(shell);
    processor.run();
View Full Code Here

      Principal user = new Principal() {
        public String getName() {
          return userName;
        }
      };
      Shell shell = factory.shellFactory.create(user);
      ConsoleReader reader = new ConsoleReader(in, out, this) {
        @Override
        public void shutdown() {
          exited.set(true);
          callback.onExit(0);
View Full Code Here

    //
    if (port != null) {
      try {
        ShellFactory factory = bootstrap.getContext().getPlugin(ShellFactory.class);
        Shell shell = factory.create(null);
        RemoteClient client = new RemoteClient(port, shell);
        log.log(Level.INFO, "Callback back remote on port " + port);
        client.connect();
        client.getRunnable().run();
      }
View Full Code Here

    log.log(Level.INFO, "cmd mounts: " + cmdBuilder.toString());


    //
    CloseableList closeable = new CloseableList();
    Shell shell;
    if (pids != null && pids.size() > 0) {

      //
      if (interactive && pids.size() > 1) {
        throw new Exception("Cannot attach to more than one JVM in interactive mode");
View Full Code Here

    Principal user = new Principal() {
      public String getName() {
        return userName;
      }
    };
    Shell shell = pluginContext.getPlugin(ShellFactory.class).create(user);
    ShellProcess shellProcess = shell.createProcess(command);

    //
    SSHInlineShellProcessContext context = new SSHInlineShellProcessContext(new SSHContext(env), shellProcess, out, err);
    int exitStatus = OK;
    String exitMsg = null;
View Full Code Here

    //
    SpringBootstrap bootstrap = context.getBean(SpringBootstrap.class);

    // Test a bit
    ShellFactory factory = bootstrap.getContext().getPlugin(ShellFactory.class);
    Shell shell = factory.create(null);
    assertNotNull(shell);
    ShellProcess process = shell.createProcess("foo_cmd");
    assertNotNull(process);
    BaseProcessContext pc = BaseProcessContext.create(process).execute();
    assertTrue(pc.getResponse() instanceof ShellResponse.Ok);
    String r = pc.getOutput();
    assertEquals("bar", r);
View Full Code Here

  public String getLine() {
    return task.def.getLine();
  }

  void run() {
    Shell sh = task.factory.create(null);
    ShellProcess sp = sh.createProcess(task.def.getLine());
    task.plugin.processes.add(this);
    task.plugin.history.add(this);
    while (task.plugin.history.size() > 100) {
      task.plugin.history.remove();
    }
View Full Code Here

        };
      }
    };

    //
    Shell shell = new BaseShell(factory);
    CommandQueue commands = new CommandQueue();
    AsyncShell  asyncShell = new AsyncShell(commands, shell);

    //
    BaseProcessContext ctx = BaseProcessContext.create(asyncShell, "foo").execute();
View Full Code Here

TOP

Related Classes of org.crsh.shell.Shell

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.