public class DavidServicesHandler extends Object implements ServicesHandler
The services managed by this handler must be components of
a Context
provided at initialization time. The
names to use should be integers representing service identifiers.
The service components' values must be Service
instances.
The list of services managed by a DavidServicesHandler instance is initialized when the instance is created.
Constructor and Description |
---|
DavidServicesHandler(org.objectweb.jonathan.apis.kernel.Context services_context)
Builds a new DavidServicesHandler instance.
|
Modifier and Type | Method and Description |
---|---|
ServiceContext[] |
getReplyContexts(int request_id,
org.objectweb.jonathan.apis.kernel.Context message_context)
Returns a list of service contexts.
|
ServiceContext[] |
getRequestContexts(int request_id,
boolean response_expected,
byte[] object_key,
org.objectweb.jonathan.apis.kernel.Context message_context)
Returns a list of service contexts.
|
void |
handleReplyContexts(ServiceContext[] contexts,
int request_id,
org.objectweb.jonathan.apis.kernel.Context message_context)
Lets the handler manage the provided contexts.
|
void |
handleRequestContexts(ServiceContext[] contexts,
int request_id,
boolean response_expected,
byte[] object_key,
org.objectweb.jonathan.apis.kernel.Context message_context)
Lets the handler manage the provided contexts.
|
public DavidServicesHandler(org.objectweb.jonathan.apis.kernel.Context services_context) throws org.objectweb.jonathan.apis.kernel.JonathanException
services_context
- the context containing the services (as local
objects);org.objectweb.jonathan.apis.kernel.JonathanException
- if something goes wrongpublic ServiceContext[] getRequestContexts(int request_id, boolean response_expected, byte[] object_key, org.objectweb.jonathan.apis.kernel.Context message_context)
This method simply tries to get a request context from each managed service. No service order is specified.
getRequestContexts
in interface ServicesHandler
request_id
- the request id;response_expected
- indicates if a response is expected;object_key
- the target object key.message_context
- the context of the request marshaller.public ServiceContext[] getReplyContexts(int request_id, org.objectweb.jonathan.apis.kernel.Context message_context)
This method simply tries to get a reply context from each managed service. No service order is specified.
getReplyContexts
in interface ServicesHandler
request_id
- the request id.message_context
- the context of the reply marshaller.public void handleRequestContexts(ServiceContext[] contexts, int request_id, boolean response_expected, byte[] object_key, org.objectweb.jonathan.apis.kernel.Context message_context)
When a context bears the same identifier as one of the services handled
by the target handler, the context is sent
to
the service. No order is specified.
handleRequestContexts
in interface ServicesHandler
contexts
- the list of contexts contained in the request;request_id
- the request id;response_expected
- indicates whether a response is expected;object_key
- the target object key.message_context
- the context of the request unmarshaller.public void handleReplyContexts(ServiceContext[] contexts, int request_id, org.objectweb.jonathan.apis.kernel.Context message_context)
When a context bears the same identifier as one of the services handled
by the target handler, the context is sent
to
the service. No order is specified.
handleReplyContexts
in interface ServicesHandler
contexts
- the list of contexts contained in the reply;request_id
- the request id;message_context
- the context of the reply unmarshaller.