Top Description Fields Constructors Methods
org.apache.sshd.client.channel.exit

public abstract Class AbstractChannelExitRequestHandler<V>

extends AbstractChannelRequestHandler
implements NamedResource
Class Inheritance
All Implemented Interfaces
org.apache.sshd.common.NamedResource
Known Direct Subclasses
org.apache.sshd.client.channel.exit.ExitSignalChannelRequestHandler, org.apache.sshd.client.channel.exit.ExitStatusChannelRequestHandler
Type Parameters
<V>
Type of data being extracted from the request when processed
Imports
java.util.Objects, java.util.concurrent.atomic.AtomicReference, org.apache.sshd.common.NamedResource, org.apache.sshd.common.channel.AbstractChannelRequestHandler, .Channel, org.apache.sshd.common.util.EventNotifier, org.apache.sshd.common.util.buffer.Buffer

Provides a common base class for channel request handlers that deal with various "exit-XXX" requests. Once such a request has been successfully processed, an EventNotifier can be invoked indicating the processed event.
Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
protected final AtomicReference<V>
protected final EventNotifier<? super String>

Constructor Summary

AccessConstructor and Description
protected
AbstractChannelExitRequestHandler(AtomicReference<V>
An AtomicReference that will hold the extracted request data
holder
,
EventNotifier<? super String>
An EventNotifier to be invoked when request is successfully processed and the holder has been updated with the processed request data
notifier
)

Method Summary

Modifier and TypeMethod and Description
protected String

Returns:

The event name to be used - default: getName() value
getEvent
(Channel
The Channel through which the request was received
channel
,
String
The processed request
request
,
V
The processed value
value
)

protected void
notifyStateChanged(Channel
The Channel through which the request was received
channel
,
String
The processed request
request
,
V
The processed value
value
)

Notifies that some change has been made to the data in the holder.

public RequestHandler.Result
process(Channel
The input parameter
channel
,
String
The request string
request
,
boolean
Whether a reply is requested
wantReply
,
Buffer
The Buffer with request specific data
buffer
)

Implements org.apache.sshd.common.channel.ChannelRequestHandler.process, org.apache.sshd.common.channel.RequestHandler.process.

Process an SSH request.

protected abstract V

Returns:

The extracted data - if null then request is ignored and Unsupported is returned
processRequestValue
(Channel
The Channel through which the request was received
channel
,
String
The received request - Note: guaranteed to match the handler's name if invoked from process(Channel, String, boolean, Buffer)
request
,
Buffer
The received Buffer for extracting the data
buffer
)

Invoked by default from process(Channel, String, boolean, Buffer) when a request matching the handler's name is received

Field Detail

holderback to summary
protected final AtomicReference<V> holder
notifierback to summary
protected final EventNotifier<? super String> notifier

Constructor Detail

AbstractChannelExitRequestHandlerback to summary
protected AbstractChannelExitRequestHandler(AtomicReference<V> holder, EventNotifier<? super String> notifier)
Parameters
holder:AtomicReference<V>

An AtomicReference that will hold the extracted request data

notifier:EventNotifier<? super String>

An EventNotifier to be invoked when request is successfully processed and the holder has been updated with the processed request data

Method Detail

getEventback to summary
protected String getEvent(Channel channel, String request, V value)
Parameters
channel:Channel

The Channel through which the request was received

request:String

The processed request

value:V

The processed value

Returns:String

The event name to be used - default: getName() value

notifyStateChangedback to summary
protected void notifyStateChanged(Channel channel, String request, V value)

Notifies that some change has been made to the data in the holder. The reported event is obtained via the getEvent(Channel, String, Object) call

Parameters
channel:Channel

The Channel through which the request was received

request:String

The processed request

value:V

The processed value

processback to summary
public RequestHandler.Result process(Channel channel, String request, boolean wantReply, Buffer buffer) throws Exception

Implements org.apache.sshd.common.channel.ChannelRequestHandler.process, org.apache.sshd.common.channel.RequestHandler.process.

Doc from org.apache.sshd.common.channel.RequestHandler.process.

Process an SSH request. If an exception is thrown, the ConnectionService will send a failure message if needed and the request will be considered handled.

Parameters
channel:Channel

The input parameter

request:String

The request string

wantReply:boolean

Whether a reply is requested

buffer:Buffer

The Buffer with request specific data

Returns:RequestHandler.Result

The Result

Annotations
@Override
Exceptions
Exception:
If failed to handle the request - Note: in order to signal an unsupported request the Result#Unsupported value should be returned
processRequestValueback to summary
protected abstract V processRequestValue(Channel channel, String request, Buffer buffer) throws Exception

Invoked by default from process(Channel, String, boolean, Buffer) when a request matching the handler's name is received

Parameters
channel:Channel

The Channel through which the request was received

request:String

The received request - Note: guaranteed to match the handler's name if invoked from process(Channel, String, boolean, Buffer)

buffer:Buffer

The received Buffer for extracting the data

Returns:V

The extracted data - if null then request is ignored and Unsupported is returned

Exceptions
Exception:
If failed to process the received request buffer