Package net.schmizz.sshj
Class AbstractService
- java.lang.Object
-
- net.schmizz.sshj.AbstractService
-
- All Implemented Interfaces:
ErrorNotifiable,SSHPacketHandler,Service
- Direct Known Subclasses:
ConnectionImpl,UserAuthImpl
public abstract class AbstractService extends java.lang.Object implements Service
An abstract class forServicethat implements common or default functionality.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.schmizz.sshj.common.ErrorNotifiable
ErrorNotifiable.Util
-
-
Constructor Summary
Constructors Constructor Description AbstractService(java.lang.String name, Transport trans)
-
Method Summary
Modifier and Type Method Description java.lang.StringgetName()voidhandle(Message msg, SSHPacket buf)Delegate handling of some SSH packet to this object.voidnotifyError(SSHException error)Notifies this object of anerror.voidnotifyUnimplemented(long seqNum)Notifies this service that aSSH_MSG_UNIMPLEMENTEDwas received for packet with given sequence number.voidrequest()Request and install this service with the associated transport.
-
-
-
Field Detail
-
log
protected final org.slf4j.Logger log
Logger
-
name
protected final java.lang.String name
Assigned name of this service
-
trans
protected final Transport trans
Transport layer
-
-
Constructor Detail
-
AbstractService
public AbstractService(java.lang.String name, Transport trans)
-
-
Method Detail
-
getName
public java.lang.String getName()
-
handle
public void handle(Message msg, SSHPacket buf) throws SSHException
Description copied from interface:SSHPacketHandlerDelegate handling of some SSH packet to this object.- Specified by:
handlein interfaceSSHPacketHandler- Parameters:
msg- the SSHmessage identifierbuf-SSHPacketcontaining rest of the request- Throws:
SSHException- if there is a non-recoverable error
-
notifyError
public void notifyError(SSHException error)
Description copied from interface:ErrorNotifiableNotifies this object of anerror.- Specified by:
notifyErrorin interfaceErrorNotifiable
-
notifyUnimplemented
public void notifyUnimplemented(long seqNum) throws SSHExceptionDescription copied from interface:ServiceNotifies this service that aSSH_MSG_UNIMPLEMENTEDwas received for packet with given sequence number. Meant to be invoked as a callback by the transport layer.- Specified by:
notifyUnimplementedin interfaceService- Parameters:
seqNum- sequence number of the packet which the server claims is unimplemented- Throws:
SSHException- if the packet is unexpected and may represent a disruption
-
request
public void request() throws TransportExceptionDescription copied from interface:ServiceRequest and install this service with the associated transport. Implementations should aim to make this method idempotent by first checking theTransport.getService()currently active service}.- Specified by:
requestin interfaceService- Throws:
TransportException- if there is an error sending the service request
-
-