org.objectweb.david.libs.services.CosTransactions.handler
Class TSHandler

java.lang.Object
  extended byorg.objectweb.david.libs.services.CosTransactions.handler.TSHandler
All Implemented Interfaces:
Service, org.omg.CORBA.TSIdentification
Direct Known Subclasses:
DavidTSHandler, JRMITSHandler

public abstract class TSHandler
extends java.lang.Object
implements Service, org.omg.CORBA.TSIdentification

Provides an abstract implementation of a Transaction service handler, to be used as a base class by TS implementations, following the CosTSPortability apis.


Field Summary
protected  org.omg.CosTSPortability.Receiver receiver
          A Receiver instance
protected  org.omg.CosTSPortability.Sender sender
          A Sender instance
protected  int service_id
          The transaction service id.
 
Constructor Summary
protected TSHandler()
           
protected TSHandler(int service_id, org.omg.CosTSPortability.Sender sender, org.omg.CosTSPortability.Receiver receiver)
           
protected TSHandler(org.omg.CosTSPortability.Sender sender, org.omg.CosTSPortability.Receiver receiver)
          Creates a new TSHandler instance.
 
Method Summary
protected abstract  org.omg.CosTransactions.PropagationContext decodeContext(org.omg.IOP.ServiceContext sc)
          Decodes a PropagationContext instance from a ServiceContext instance.
protected abstract  org.omg.IOP.ServiceContext encodeContext(org.omg.CosTransactions.PropagationContext ctx)
          Encodes the provided PropagationContext into a ServiceContext.
 org.omg.IOP.ServiceContext getReplyContext(int request_id, org.objectweb.jonathan.apis.kernel.Context ignored)
          Returns a reply context.
 org.omg.IOP.ServiceContext getRequestContext(int request_id, boolean response_expected, byte[] object_key, org.objectweb.jonathan.apis.kernel.Context ignored)
          Returns a request context.
 void handleReplyContext(org.omg.IOP.ServiceContext context, int request_id, org.objectweb.jonathan.apis.kernel.Context ignored)
          This method is called by the services handler to let the operations related to the target service be performed on reply arrival.
 void handleRequestContext(org.omg.IOP.ServiceContext context, int request_id, boolean response_expected, byte[] object_key, org.objectweb.jonathan.apis.kernel.Context ignored)
          This method is called by the services handler to let the operations related to the target service be performed on request arrival.
 void identify_receiver(org.omg.CosTSPortability.Receiver receiver)
           
 void identify_sender(org.omg.CosTSPortability.Sender sender)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sender

protected org.omg.CosTSPortability.Sender sender
A Sender instance


receiver

protected org.omg.CosTSPortability.Receiver receiver
A Receiver instance


service_id

protected int service_id
The transaction service id. The default value is org.omg.IOP.TransactionService.value.

Constructor Detail

TSHandler

protected TSHandler(org.omg.CosTSPortability.Sender sender,
                    org.omg.CosTSPortability.Receiver receiver)
             throws org.objectweb.jonathan.apis.kernel.JonathanException
Creates a new TSHandler instance.


TSHandler

protected TSHandler(int service_id,
                    org.omg.CosTSPortability.Sender sender,
                    org.omg.CosTSPortability.Receiver receiver)
             throws org.objectweb.jonathan.apis.kernel.JonathanException

TSHandler

protected TSHandler()
Method Detail

identify_sender

public void identify_sender(org.omg.CosTSPortability.Sender sender)
                     throws org.omg.CORBA.TSIdentificationPackage.NotAvailable,
                            org.omg.CORBA.TSIdentificationPackage.AlreadyIdentified
Specified by:
identify_sender in interface org.omg.CORBA.TSIdentification
Throws:
org.omg.CORBA.TSIdentificationPackage.NotAvailable
org.omg.CORBA.TSIdentificationPackage.AlreadyIdentified

identify_receiver

public void identify_receiver(org.omg.CosTSPortability.Receiver receiver)
                       throws org.omg.CORBA.TSIdentificationPackage.NotAvailable,
                              org.omg.CORBA.TSIdentificationPackage.AlreadyIdentified
Specified by:
identify_receiver in interface org.omg.CORBA.TSIdentification
Throws:
org.omg.CORBA.TSIdentificationPackage.NotAvailable
org.omg.CORBA.TSIdentificationPackage.AlreadyIdentified

getRequestContext

public org.omg.IOP.ServiceContext getRequestContext(int request_id,
                                                    boolean response_expected,
                                                    byte[] object_key,
                                                    org.objectweb.jonathan.apis.kernel.Context ignored)
Returns a request context.

If sender is not null, this method encodes the propagation context returned by its sending_request method, else it returns null.

Specified by:
getRequestContext in interface Service
Parameters:
request_id - the request identifier;
response_expected - unused;
object_key - unused.
ignored - the context of the request marshaller.
Returns:
a service context.

getReplyContext

public org.omg.IOP.ServiceContext getReplyContext(int request_id,
                                                  org.objectweb.jonathan.apis.kernel.Context ignored)
Returns a reply context.

If receiver is not null, this method encodes the propagation context returned by its sending_reply method, else it returns null.

Specified by:
getReplyContext in interface Service
Parameters:
request_id - the corresponding request id.
ignored - the context of the reply marshaller.
Returns:
a service context.

handleRequestContext

public void handleRequestContext(org.omg.IOP.ServiceContext context,
                                 int request_id,
                                 boolean response_expected,
                                 byte[] object_key,
                                 org.objectweb.jonathan.apis.kernel.Context ignored)
This method is called by the services handler to let the operations related to the target service be performed on request arrival.

If receiver is null, this method returns immediately. Else, it uses the decodeContext method to obtain a PropagationContext instance, and call the received_request method on it.

Specified by:
handleRequestContext in interface Service
Parameters:
context - the service context of the request;
request_id - the request identifier;
response_expected - unused;
object_key - unused.
ignored - the context of the request unmarshaller.

handleReplyContext

public void handleReplyContext(org.omg.IOP.ServiceContext context,
                               int request_id,
                               org.objectweb.jonathan.apis.kernel.Context ignored)
This method is called by the services handler to let the operations related to the target service be performed on reply arrival.

If sender is null, this method returns immediately. Else, it uses the decodeContext method to obtain a PropagationContext instance, and call the received_reply method on it.

Specified by:
handleReplyContext in interface Service
Parameters:
context - the service context of the reply;
request_id - the corresponding request identifier.
ignored - the context of the reply unmarshaller.

encodeContext

protected abstract org.omg.IOP.ServiceContext encodeContext(org.omg.CosTransactions.PropagationContext ctx)
Encodes the provided PropagationContext into a ServiceContext.

Parameters:
ctx - a PropagationContext instance.
Returns:
a ServiceContext instance.

decodeContext

protected abstract org.omg.CosTransactions.PropagationContext decodeContext(org.omg.IOP.ServiceContext sc)
Decodes a PropagationContext instance from a ServiceContext instance.

Parameters:
sc - a ServiceContext instance.
Returns:
a PropagationContext instance.