public class CurrentService
extends java.lang.Object
Session
.Modifier and Type | Field and Description |
---|---|
private java.lang.String |
currentName |
private Service |
currentService |
protected Session |
session
The session this
CurrentService belongs to. |
Modifier | Constructor and Description |
---|---|
protected |
CurrentService(Session session)
Creates a new
CurrentService instance belonging to the given Session . |
Modifier and Type | Method and Description |
---|---|
java.lang.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,
java.lang.String name,
boolean start)
Sets the current service and its name, and optionally starts the service.
|
void |
start()
Starts the current service.
|
protected final Session session
CurrentService
belongs to.private java.lang.String currentName
private Service currentService
protected CurrentService(Session session)
CurrentService
instance belonging to the given Session
.session
- Session
the instance belongs topublic java.lang.String getName()
null
if none is setpublic Service getService()
null
if none is setpublic void set(Service service, java.lang.String name, boolean start)
service
- Service
to setname
- Name of the service (the name of the ServiceFactory
that created it)start
- whether to start the servicepublic void start()
public boolean process(int cmd, Buffer buffer) throws java.lang.Exception
cmd
- the commandbuffer
- the data received with the commandtrue
if a current service is set, false
if no current service existsjava.lang.Exception
- when the current service fails