Class CurrentService
- java.lang.Object
-
- org.apache.sshd.common.session.helpers.CurrentService
-
- Direct Known Subclasses:
ClientSessionImpl.Services
public class CurrentService extends java.lang.ObjectHolds the current SSH service for aSession.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringcurrentNameprivate ServicecurrentServiceprotected SessionsessionThe session thisCurrentServicebelongs to.
-
Constructor Summary
Constructors Modifier Constructor Description protectedCurrentService(Session session)Creates a newCurrentServiceinstance belonging to the givenSession.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetName()Retrieves the name of the current service.ServicegetService()Retrieves the current service.booleanprocess(int cmd, Buffer buffer)Processes a service request.voidset(Service service, java.lang.String name, boolean start)Sets the current service and its name, and optionally starts the service.voidstart()Starts the current service.
-
-
-
Field Detail
-
session
protected final Session session
The session thisCurrentServicebelongs to.
-
currentName
private java.lang.String currentName
-
currentService
private Service currentService
-
-
Constructor Detail
-
CurrentService
protected CurrentService(Session session)
Creates a newCurrentServiceinstance belonging to the givenSession.- Parameters:
session-Sessionthe instance belongs to
-
-
Method Detail
-
getName
public java.lang.String getName()
Retrieves the name of the current service.- Returns:
- the name, or
nullif none is set
-
getService
public Service getService()
Retrieves the current service.- Returns:
- the current service, or
nullif none is set
-
set
public void set(Service service, java.lang.String name, boolean start)
Sets the current service and its name, and optionally starts the service.- Parameters:
service-Serviceto setname- Name of the service (the name of theServiceFactorythat created it)start- whether to start the service
-
start
public void start()
Starts the current service.
-
process
public boolean process(int cmd, Buffer buffer) throws java.lang.ExceptionProcesses a service request.- Parameters:
cmd- the commandbuffer- the data received with the command- Returns:
trueif a current service is set,falseif no current service exists- Throws:
java.lang.Exception- when the current service fails
-
-