Top Description Fields Constructors Methods
org.apache.sshd.common.session.helpers

public Class CurrentService

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.sshd.client.session.ClientSessionImpl.Services
Imports
java.util.Objects, org.apache.sshd.common.Service, .ServiceFactory, org.apache.sshd.common.session.Session, org.apache.sshd.common.util.ValidateUtils, org.apache.sshd.common.util.buffer.Buffer

Holds the current SSH service for a Session.
Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
private String
private Service
protected final Session
session

The session this CurrentService belongs to.

Constructor Summary

AccessConstructor and Description
protected
CurrentService(Session
Session the instance belongs to
session
)

Creates a new CurrentService instance belonging to the given Session.

Method Summary

Modifier and TypeMethod and Description
public synchronized String

Returns:

the name, or null if none is set
getName
()

Retrieves the name of the current service.

public synchronized Service

Returns:

the current service, or null if none is set
getService
()

Retrieves the current service.

public boolean

Returns:

true if a current service is set, false if no current service exists
process
(int
the command
cmd
,
Buffer
the data received with the command
buffer
)

Processes a service request.

public void
set(Service
Service to set
service
,
String
Name of the service (the name of the ServiceFactory that created it)
name
,
boolean
whether to start the service
start
)

Sets the current service and its name, and optionally starts the service.

public void
start()

Starts the current service.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

currentNameback to summary
private String currentName
currentServiceback to summary
private Service currentService
sessionback to summary
protected final Session session

The session this CurrentService belongs to.

Constructor Detail

CurrentServiceback to summary
protected CurrentService(Session session)

Creates a new CurrentService instance belonging to the given Session.

Parameters
session:Session

Session the instance belongs to

Method Detail

getNameback to summary
public synchronized String getName()

Retrieves the name of the current service.

Returns:String

the name, or null if none is set

getServiceback to summary
public synchronized Service getService()

Retrieves the current service.

Returns:Service

the current service, or null if none is set

processback to summary
public boolean process(int cmd, Buffer buffer) throws Exception

Processes a service request.

Parameters
cmd:int

the command

buffer:Buffer

the data received with the command

Returns:boolean

true if a current service is set, false if no current service exists

Exceptions
Exception:
when the current service fails
setback to summary
public void set(Service service, String name, boolean start)

Sets the current service and its name, and optionally starts the service.

Parameters
service:Service

Service to set

name:String

Name of the service (the name of the ServiceFactory that created it)

start:boolean

whether to start the service

startback to summary
public void start()

Starts the current service.