Class CurrentService
- java.lang.Object
-
- org.apache.sshd.common.session.helpers.CurrentService
-
public class CurrentService extends Object
Holds the current SSH service for aSession
.- Author:
- Apache MINA SSHD Project
-
-
Field Summary
Fields Modifier and Type Field Description protected Session
session
The session thisCurrentService
belongs to.
-
Constructor Summary
Constructors Modifier Constructor Description protected
CurrentService(Session session)
Creates a newCurrentService
instance belonging to the givenSession
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getName()
Retrieves the name of the current service.Service
getService()
Retrieves the current service.boolean
process(int cmd, Buffer buffer)
Processes a service request.void
set(Service service, String name, boolean start)
Sets the current service and its name, and optionally starts the service.void
start()
Starts the current service.
-
-
-
Field Detail
-
session
protected final Session session
The session thisCurrentService
belongs to.
-
-
Constructor Detail
-
CurrentService
protected CurrentService(Session session)
Creates a newCurrentService
instance belonging to the givenSession
.- Parameters:
session
-Session
the instance belongs to
-
-
Method Detail
-
getName
public String getName()
Retrieves the name of the current service.- Returns:
- the name, or
null
if none is set
-
getService
public Service getService()
Retrieves the current service.- Returns:
- the current service, or
null
if none is set
-
set
public void set(Service service, String name, boolean start)
Sets the current service and its name, and optionally starts the service.- Parameters:
service
-Service
to setname
- Name of the service (the name of theServiceFactory
that 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 Exception
Processes a service request.- Parameters:
cmd
- the commandbuffer
- the data received with the command- Returns:
true
if a current service is set,false
if no current service exists- Throws:
Exception
- when the current service fails
-
-