Class JctExecCommand

java.lang.Object
org.dellroad.jct.ssh.JctExecCommand
All Implemented Interfaces:
org.apache.sshd.server.command.Command, org.apache.sshd.server.command.CommandDirectErrorStreamAware, org.apache.sshd.server.command.CommandDirectInputStreamAware, org.apache.sshd.server.command.CommandDirectOutputStreamAware, org.apache.sshd.server.command.CommandDirectStreamsAware, org.apache.sshd.server.command.CommandLifecycle

public class JctExecCommand extends Object
  • Field Details

    • log

      protected final org.slf4j.Logger log
    • factory

      protected final Exec factory
    • channel

      protected final org.apache.sshd.server.channel.ChannelSession channel
    • in

      protected InputStream in
    • out

      protected OutputStream out
    • err

      protected OutputStream err
    • exitCallback

      protected org.apache.sshd.server.ExitCallback exitCallback
    • env

      protected org.apache.sshd.server.Environment env
    • charset

      protected Charset charset
    • locale

      protected Locale locale
    • session

      protected ExecSession session
  • Constructor Details

    • JctExecCommand

      public JctExecCommand(Exec exec, org.apache.sshd.server.channel.ChannelSession channel, String command)
  • Method Details

    • createSession

      protected ExecSession createSession() throws IOException
      Create a ConsoleSession that will implement this command.
      Returns:
      newly created session
      Throws:
      IOException - if an I/O error occurs
    • handleChannelSignal

      protected void handleChannelSignal(org.apache.sshd.common.channel.Channel channel, org.apache.sshd.server.Signal signal)
      Handle an incoming signal from the SSH client terminal.

      The implementation in AbstractCommand does nothing.

      Parameters:
      channel - SSH channel
      signal - the signal received
    • setInputStream

      public void setInputStream(InputStream in)
      Specified by:
      setInputStream in interface org.apache.sshd.server.command.CommandDirectInputStreamAware
    • setOutputStream

      public void setOutputStream(OutputStream out)
      Specified by:
      setOutputStream in interface org.apache.sshd.server.command.CommandDirectOutputStreamAware
    • setErrorStream

      public void setErrorStream(OutputStream err)
      Specified by:
      setErrorStream in interface org.apache.sshd.server.command.CommandDirectErrorStreamAware
    • setExitCallback

      public void setExitCallback(org.apache.sshd.server.ExitCallback exitCallback)
      Specified by:
      setExitCallback in interface org.apache.sshd.server.command.Command
    • start

      public final void start(org.apache.sshd.server.channel.ChannelSession channel, org.apache.sshd.server.Environment env) throws IOException
      Specified by:
      start in interface org.apache.sshd.server.command.CommandLifecycle
      Throws:
      IOException
    • destroy

      public void destroy(org.apache.sshd.server.channel.ChannelSession channel) throws Exception
      Specified by:
      destroy in interface org.apache.sshd.server.command.CommandLifecycle
      Throws:
      Exception
    • executeSession

      protected int executeSession() throws InterruptedException
      Throws:
      InterruptedException
    • createSessionThread

      protected Thread createSessionThread(Runnable action)
    • getThreadName

      protected String getThreadName(org.apache.sshd.server.channel.ChannelSession channel, org.apache.sshd.server.Environment env)