Package org.apache.sshd.client.channel
Class ChannelExec
- java.lang.Object
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.nio.channels.Channel
,ClientChannel
,ClientSessionHolder
,AttributeRepository
,AttributeStore
,Channel
,ChannelListenerManager
,PtyChannelConfigurationHolder
,PtyChannelConfigurationMutator
,ChannelStreamPacketWriterResolver
,ChannelStreamPacketWriterResolverManager
,Closeable
,PacketWriter
,PropertyResolver
,SessionContextHolder
,SessionHolder<Session>
,ExecutorServiceCarrier
public class ChannelExec extends PtyCapableChannelSession
Client channel to run a remote command
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.sshd.common.channel.AbstractChannel
AbstractChannel.GracefulChannelCloseable, AbstractChannel.GracefulState
-
Nested classes/interfaces inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
AbstractCloseable.State
-
Nested classes/interfaces inherited from interface org.apache.sshd.common.AttributeRepository
AttributeRepository.AttributeKey<T>
-
Nested classes/interfaces inherited from interface org.apache.sshd.client.channel.ClientChannel
ClientChannel.Streaming
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
command
static boolean
DEFAULT_REQUEST_EXEC_REPLY
static java.lang.String
REQUEST_EXEC_REPLY
Configure whether reply for the "exec" request is required-
Fields inherited from class org.apache.sshd.client.channel.ChannelSession
DEFAULT_INPUT_STREAM_PUMP_CHUNK_SIZE, INPUT_STREAM_PUMP_CHUNK_SIZE
-
Fields inherited from class org.apache.sshd.client.channel.AbstractClientChannel
asyncErr, asyncIn, asyncOut, err, exitSignalHolder, exitStatusHolder, in, invertedErr, invertedIn, invertedOut, opened, openFailureLang, openFailureMsg, openFailureReason, openFuture, out, streaming
-
Fields inherited from class org.apache.sshd.common.channel.AbstractChannel
channelListenerProxy, channelListeners, eofReceived, eofSent, gracefulFuture, gracefulState, initialized, RESPONSE_BUFFER_GROWTH_FACTOR, service
-
Fields inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
closeFuture, futureLock, state
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Fields inherited from interface org.apache.sshd.common.channel.Channel
CHANNEL_EXEC, CHANNEL_SHELL, CHANNEL_SUBSYSTEM
-
Fields inherited from interface org.apache.sshd.common.channel.throttle.ChannelStreamPacketWriterResolver
NONE
-
Fields inherited from interface org.apache.sshd.common.Closeable
CLOSE_WAIT_TIMEOUT, DEFAULT_CLOSE_WAIT_TIMEOUT
-
Fields inherited from interface org.apache.sshd.common.PropertyResolver
EMPTY
-
Fields inherited from interface org.apache.sshd.common.channel.PtyChannelConfigurationHolder
DEFAULT_COLUMNS_COUNT, DEFAULT_HEIGHT, DEFAULT_PTY_MODES, DEFAULT_ROWS_COUNT, DEFAULT_WIDTH, DUMMY_PTY_TYPE, WINDOWS_PTY_TYPE
-
-
Constructor Summary
Constructors Constructor Description ChannelExec(java.lang.String command, PtyChannelConfigurationHolder configHolder, java.util.Map<java.lang.String,?> env)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doOpen()
void
handleFailure()
Invoked whenSSH_MSG_CHANNEL_FAILURE
receivedvoid
handleSuccess()
Invoked whenSSH_MSG_CHANNEL_SUCCESS
received-
Methods inherited from class org.apache.sshd.client.channel.PtyCapableChannelSession
doOpenPty, getPtyColumns, getPtyHeight, getPtyLines, getPtyModes, getPtyType, getPtyWidth, isAgentForwarding, isUsePty, resolvePtyType, sendWindowChange, sendWindowChange, setAgentForwarding, setEnv, setPtyColumns, setPtyHeight, setPtyLines, setPtyModes, setPtyType, setPtyWidth, setupSensibleDefaultPty, setUsePty
-
Methods inherited from class org.apache.sshd.client.channel.ChannelSession
closeImmediately0, getInnerCloseable, handleInternalRequest, handleXonXoff, pumpInputStream, securedRead
-
Methods inherited from class org.apache.sshd.client.channel.AbstractClientChannel
addChannelSignalRequestHandlers, doWriteData, doWriteExtendedData, getAsyncErr, getAsyncIn, getAsyncOut, getChannelState, getChannelType, getErr, getExitSignal, getExitStatus, getIn, getInvertedErr, getInvertedIn, getInvertedOut, getOut, getStreaming, handleOpenFailure, handleOpenSuccess, handleWindowAdjust, open, open, setErr, setIn, setOut, setStreaming, updateCurrentChannelState, waitFor
-
Methods inherited from class org.apache.sshd.common.channel.AbstractChannel
addChannelListener, addPendingRequest, addRequestHandler, attributeKeys, clearAttributes, computeAttributeIfAbsent, configureWindow, getAttribute, getAttributesCount, getChannelListenerProxy, getChannelStreamPacketWriterResolver, getExecutorService, getId, getLocalWindow, getParentPropertyResolver, getProperties, getRecipient, getRemoteWindow, getRequestHandlers, getSession, handleChannelRequest, handleClose, handleData, handleEof, handleExtendedData, handleRequest, handleUnknownChannelRequest, init, invokeChannelSignaller, isEofSent, isEofSignalled, isInitialized, notifyStateChanged, notifyStateChanged, preClose, removeAttribute, removeChannelListener, removePendingRequest, removeRequestHandler, resolveChannelStreamPacketWriterResolver, sendEof, sendResponse, sendWindowAdjust, setAttribute, setChannelStreamPacketWriterResolver, setRecipient, signalChannelClosed, signalChannelClosed, signalChannelInitialized, signalChannelInitialized, signalChannelOpenFailure, signalChannelOpenFailure, signalChannelOpenSuccess, signalChannelOpenSuccess, toString, validateIncomingDataSize, writePacket
-
Methods inherited from class org.apache.sshd.common.util.closeable.AbstractInnerCloseable
doCloseGracefully, doCloseImmediately
-
Methods inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
addCloseFutureListener, builder, close, getFutureLock, isClosed, isClosing, removeCloseFutureListener
-
Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
getSimplifiedLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.AttributeRepository
attributeKeys, getAttribute, getAttributesCount
-
Methods inherited from interface org.apache.sshd.common.AttributeStore
clearAttributes, computeAttributeIfAbsent, removeAttribute, setAttribute
-
Methods inherited from interface org.apache.sshd.common.channel.Channel
addRequestHandler, addRequestHandlers, getId, getLocalWindow, getRecipient, getRemoteWindow, getRequestHandlers, handleClose, handleData, handleEof, handleExtendedData, handleRequest, init, isEofSignalled, isInitialized, removeRequestHandler, removeRequestHandlers, resolveAttribute
-
Methods inherited from interface org.apache.sshd.common.channel.ChannelListenerManager
addChannelListener, getChannelListenerProxy, removeChannelListener
-
Methods inherited from interface org.apache.sshd.common.channel.throttle.ChannelStreamPacketWriterResolverManager
getChannelStreamPacketWriterResolver, resolveChannelStreamPacketWriter, resolveChannelStreamPacketWriterResolver, setChannelStreamPacketWriterResolver
-
Methods inherited from interface org.apache.sshd.client.channel.ClientChannel
getClientSession
-
Methods inherited from interface org.apache.sshd.common.Closeable
addCloseFutureListener, close, close, isClosed, isClosing, isOpen, removeCloseFutureListener
-
Methods inherited from interface org.apache.sshd.common.io.PacketWriter
writePacket
-
Methods inherited from interface org.apache.sshd.common.PropertyResolver
getBoolean, getBooleanProperty, getCharset, getInteger, getIntProperty, getLong, getLongProperty, getObject, getParentPropertyResolver, getProperties, getString, getStringProperty
-
Methods inherited from interface org.apache.sshd.common.session.SessionHolder
getSession, getSessionContext
-
-
-
-
Field Detail
-
REQUEST_EXEC_REPLY
public static final java.lang.String REQUEST_EXEC_REPLY
Configure whether reply for the "exec" request is required- See Also:
DEFAULT_REQUEST_EXEC_REPLY
, Constant Field Values
-
DEFAULT_REQUEST_EXEC_REPLY
public static final boolean DEFAULT_REQUEST_EXEC_REPLY
- See Also:
- Constant Field Values
-
command
private final java.lang.String command
-
-
Constructor Detail
-
ChannelExec
public ChannelExec(java.lang.String command, PtyChannelConfigurationHolder configHolder, java.util.Map<java.lang.String,?> env)
-
-
Method Detail
-
doOpen
protected void doOpen() throws java.io.IOException
- Overrides:
doOpen
in classChannelSession
- Throws:
java.io.IOException
-
handleSuccess
public void handleSuccess() throws java.io.IOException
Description copied from interface:Channel
Invoked whenSSH_MSG_CHANNEL_SUCCESS
received- Specified by:
handleSuccess
in interfaceChannel
- Overrides:
handleSuccess
in classAbstractChannel
- Throws:
java.io.IOException
- If failed to handle the message
-
handleFailure
public void handleFailure() throws java.io.IOException
Description copied from interface:Channel
Invoked whenSSH_MSG_CHANNEL_FAILURE
received- Specified by:
handleFailure
in interfaceChannel
- Overrides:
handleFailure
in classAbstractChannel
- Throws:
java.io.IOException
- If failed to handle the message
-
-