Package org.dellroad.jct.ssh
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
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.apache.sshd.server.channel.ChannelSession
protected Charset
protected org.apache.sshd.server.Environment
protected OutputStream
protected org.apache.sshd.server.ExitCallback
protected final Exec
protected InputStream
protected Locale
protected final org.slf4j.Logger
protected OutputStream
protected ExecSession
-
Constructor Summary
ConstructorsConstructorDescriptionJctExecCommand
(Exec exec, org.apache.sshd.server.channel.ChannelSession channel, String command) -
Method Summary
Modifier and TypeMethodDescriptionprotected ExecSession
Create aConsoleSession
that will implement this command.protected Thread
createSessionThread
(Runnable action) void
destroy
(org.apache.sshd.server.channel.ChannelSession channel) protected int
protected String
getThreadName
(org.apache.sshd.server.channel.ChannelSession channel, org.apache.sshd.server.Environment env) 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.void
void
setExitCallback
(org.apache.sshd.server.ExitCallback exitCallback) void
void
final void
start
(org.apache.sshd.server.channel.ChannelSession channel, org.apache.sshd.server.Environment env)
-
Field Details
-
log
protected final org.slf4j.Logger log -
factory
-
channel
protected final org.apache.sshd.server.channel.ChannelSession channel -
in
-
out
-
err
-
exitCallback
protected org.apache.sshd.server.ExitCallback exitCallback -
env
protected org.apache.sshd.server.Environment env -
charset
-
locale
-
session
-
-
Constructor Details
-
JctExecCommand
-
-
Method Details
-
createSession
Create aConsoleSession
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 channelsignal
- the signal received
-
setInputStream
- Specified by:
setInputStream
in interfaceorg.apache.sshd.server.command.CommandDirectInputStreamAware
-
setOutputStream
- Specified by:
setOutputStream
in interfaceorg.apache.sshd.server.command.CommandDirectOutputStreamAware
-
setErrorStream
- Specified by:
setErrorStream
in interfaceorg.apache.sshd.server.command.CommandDirectErrorStreamAware
-
setExitCallback
public void setExitCallback(org.apache.sshd.server.ExitCallback exitCallback) - Specified by:
setExitCallback
in interfaceorg.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 interfaceorg.apache.sshd.server.command.CommandLifecycle
- Throws:
IOException
-
destroy
- Specified by:
destroy
in interfaceorg.apache.sshd.server.command.CommandLifecycle
- Throws:
Exception
-
executeSession
- Throws:
InterruptedException
-
createSessionThread
-
getThreadName
protected String getThreadName(org.apache.sshd.server.channel.ChannelSession channel, org.apache.sshd.server.Environment env)
-