The TransactionService interface must be implemented by all
Java Transaction Services. It provides a procedure for initialization
of a JTS in association with an ORB.
TransactionService is not intended to be visible to the application
programmer; it is only an interface between the ORB and the JTS.
During initialization, the application programmer must provide the
ORB with a JTS implementation through the property
"com.sun.corba.se.spi.costransactions.TransactionServiceClass". The ORB
then instantiates the JTS and calls identify_ORB() on it.
The following is an example of the
initialization steps required in the application code:
// Create a properties object. The properties may also be given as
// command line arguments, applet parameters, etc.
Properties p = new Properties();
p.put("org.omg.CORBA.ORBClass", "com.sun.corba.se.impl.orb.ORBImpl");
p.put("com.sun.corba.se.spi.costransactions.ORBJTSClass",
"com.xyz.SomeTransactionService");
// This property is given to the JTS in the Properties parameter in identify_ORB().
p.put("com.xyz.CosTransactions.SomeProperty", "SomeValue");
// Get an ORB object. During initialization, the JTS is also
// instantiated, and the JTS registers its callbacks with the ORB.
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(null, p);
// Get the Current instance from the ORB
org.omg.CosTransactions.Current current = (Current)orb.resolve_initial_references("TransactionCurrent");
current.begin();
...
current.commit(...);
Note: The package name for TransactionService and the property may change. |