org.objectweb.jeremie.services.handler.lib

Class DavidServicesHandler

Implemented Interfaces:
ServicesHandler

public class DavidServicesHandler
extends Object
implements ServicesHandler

Default implementation of a 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 Summary

DavidServicesHandler(Context services_context)
Builds a new DavidServicesHandler instance.

Method Summary

ServiceContext[]
getReplyContexts(int request_id, Context message_context)
Returns a list of service contexts.
ServiceContext[]
getRequestContexts(int request_id, boolean response_expected, byte[] object_key, Context message_context)
Returns a list of service contexts.
void
handleReplyContexts(ServiceContext contexts, int request_id, Context message_context)
Lets the handler manage the provided contexts.
void
handleRequestContexts(ServiceContext contexts, int request_id, boolean response_expected, byte[] object_key, Context message_context)
Lets the handler manage the provided contexts.

Constructor Details

DavidServicesHandler

public DavidServicesHandler(Context services_context)
            throws JonathanException
Builds a new DavidServicesHandler instance.

Parameters:
services_context - the context containing the services (as local objects);

Method Details

getReplyContexts

public ServiceContext[] getReplyContexts(int request_id,
                                         Context message_context)
Returns a list of service contexts.

This method simply tries to get a reply context from each managed service. No service order is specified.

Specified by:
getReplyContexts in interface ServicesHandler

Parameters:
request_id - the request id.
message_context - the context of the reply marshaller.

Returns:
a list of service contexts.


getRequestContexts

public ServiceContext[] getRequestContexts(int request_id,
                                           boolean response_expected,
                                           byte[] object_key,
                                           Context message_context)
Returns a list of service contexts.

This method simply tries to get a request context from each managed service. No service order is specified.

Specified by:
getRequestContexts in interface ServicesHandler

Parameters:
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.

Returns:
a list of service contexts.


handleReplyContexts

public void handleReplyContexts(ServiceContext contexts,
                                int request_id,
                                Context message_context)
Lets the handler manage the provided contexts.

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.

Specified by:
handleReplyContexts in interface ServicesHandler

Parameters:
contexts - the list of contexts contained in the reply;
request_id - the request id;
message_context - the context of the reply unmarshaller.


handleRequestContexts

public void handleRequestContexts(ServiceContext contexts,
                                  int request_id,
                                  boolean response_expected,
                                  byte[] object_key,
                                  Context message_context)
Lets the handler manage the provided contexts.

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.

Specified by:
handleRequestContexts in interface ServicesHandler

Parameters:
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.