Package com.google.gerrit.sshd.SshScope

Examples of com.google.gerrit.sshd.SshScope.Context


  public void start(Environment env) throws IOException {
    try {
      if (caller.get() instanceof PeerDaemonUser) {
        parseCommandLine();

        final Context ctx = callingContext.subContext(newSession(), join(args));
        final Context old = sshScope.set(ctx);
        try {
          final BaseCommand cmd = dispatcher.get();
          cmd.setArguments(args.toArray(new String[args.size()]));
          provideStateTo(cmd);
          atomicCmd.set(cmd);
View Full Code Here


      this.ctx = sshScope.newContext(s, commandLine);
    }

    public void start(final Environment env) throws IOException {
      this.env = env;
      final Context ctx = this.ctx;
      task.set(startExecutor.submit(new Runnable() {
        public void run() {
          try {
            onStart();
          } catch (Exception e) {
            logger.warn("Cannot start command \"" + ctx.getCommandLine()
                + "\" for user " + ctx.getSession().getUsername(), e);
          }
        }

        @Override
        public String toString() {
          return "start (user " + ctx.getSession().getUsername() + ")";
        }
      }));
    }
View Full Code Here

      }));
    }

    private void onStart() throws IOException {
      synchronized (this) {
        final Context old = sshScope.set(ctx);
        try {
          cmd = dispatcher.get();
          cmd.setArguments(argv);
          cmd.setInputStream(in);
          cmd.setOutputStream(out);
View Full Code Here

    }

    private void onDestroy() {
      synchronized (this) {
        if (cmd != null) {
          final Context old = sshScope.set(ctx);
          try {
            cmd.destroy();
            log(BaseCommand.STATUS_CANCEL);
          } finally {
            ctx = null;
View Full Code Here

      // If this is the first time we've authenticated this
      // session, record a login event in the log and add
      // a close listener to record a logout event.
      //
      Context ctx = sshScope.newContext(sd, null);
      Context old = sshScope.set(ctx);
      try {
        sshLog.onLogin();
      } finally {
        sshScope.set(old);
      }

      session.getIoSession().getCloseFuture().addListener(
          new IoFutureListener<IoFuture>() {
            @Override
            public void operationComplete(IoFuture future) {
              final Context ctx = sshScope.newContext(sd, null);
              final Context old = sshScope.set(ctx);
              try {
                sshLog.onLogout();
              } finally {
                sshScope.set(old);
              }
View Full Code Here

    public void setSession(final ServerSession session) {
      this.context = sshScope.newContext(session.getAttribute(SshSession.KEY), "");
    }

    public void start(final Environment env) throws IOException {
      Context old = sshScope.set(context);
      String message;
      try {
        message = messageFactory.get().getMessage();
      } finally {
        sshScope.set(old);
View Full Code Here

  protected Repository repo;
  protected Project project;

  @Override
  public void start(final Environment env) {
    Context ctx = context.subContext(newSession(), context.getCommandLine());
    final Context old = sshScope.set(ctx);
    try {
      startThread(new ProjectCommandRunnable() {
        @Override
        public void executeParseCommand() throws Exception {
          parseCommandLine();
View Full Code Here

    }

    @Override
    public void cancel() {
      synchronized (this) {
        final Context old = sshScope.set(context);
        try {
          onExit(STATUS_CANCEL);
        } finally {
          sshScope.set(old);
        }
View Full Code Here

    public void run() {
      synchronized (this) {
        final Thread thisThread = Thread.currentThread();
        final String thisName = thisThread.getName();
        int rc = 0;
        final Context old = sshScope.set(context);
        try {
          context.started = System.currentTimeMillis();
          thisThread.setName("SSH " + taskName);

          if (thunk instanceof ProjectCommandRunnable) {
View Full Code Here

    async.append(event);
  }

  void onExecute(int exitValue) {
    final Context ctx = context.get();
    ctx.finished = System.currentTimeMillis();

    final String commandLine = ctx.getCommandLine();
    String cmd = QuotedString.BOURNE.quote(commandLine);
    if (cmd == commandLine) {
      cmd = "'" + commandLine + "'";
    }
View Full Code Here

TOP

Related Classes of com.google.gerrit.sshd.SshScope.Context

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.