KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > spi > costransactions > TransactionService


1 /*
2  * @(#)TransactionService.java 1.10 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.corba.se.spi.costransactions;
9
10 /** The TransactionService interface must be implemented by all
11     Java Transaction Services. It provides a procedure for initialization
12     of a JTS in association with an ORB.
13     TransactionService is not intended to be visible to the application
14     programmer; it is only an interface between the ORB and the JTS.
15     During initialization, the application programmer must provide the
16     ORB with a JTS implementation through the property
17     "com.sun.corba.se.spi.costransactions.TransactionServiceClass". The ORB
18     then instantiates the JTS and calls identify_ORB() on it.
19     The following is an example of the
20     initialization steps required in the application code:
21     <p>
22     // Create a properties object. The properties may also be given as <br>
23     // command line arguments, applet parameters, etc. <br>
24     Properties p = new Properties(); <br>
25     p.put("org.omg.CORBA.ORBClass", "com.sun.corba.se.impl.orb.ORBImpl");
26     p.put("com.sun.corba.se.spi.costransactions.ORBJTSClass",
27                         "com.xyz.SomeTransactionService");
28     // This property is given to the JTS in the Properties parameter in identify_ORB().
29     p.put("com.xyz.CosTransactions.SomeProperty", "SomeValue");
30
31     <p>
32     // Get an ORB object. During initialization, the JTS is also <br>
33     // instantiated, and the JTS registers its callbacks with the ORB.<br>
34     org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(null, p);
35     <p>
36     // Get the Current instance from the ORB <br>
37     org.omg.CosTransactions.Current current = (Current)orb.resolve_initial_references("TransactionCurrent");
38     <p>
39     current.begin(); <br>
40     ... <br>
41     current.commit(...); <br>
42     <p>
43
44     Note: The package name for TransactionService and the property may change.
45 */

46
47 public interface TransactionService {
48
49     /** get_current() is called by the ORB during initialization to
50     obtain the transaction-service's implementation of the Current
51     pseudo-object. Current is available to the application programmer
52     thru orb.resolve_initial_references("TransactionCurrent").
53     */

54     public org.omg.CosTransactions.Current get_current();
55
56     /** identify_ORB is called by the ORB during initialization to
57         provide the JTS implementation with an instance of the ORB object,
58     and a TSIdentification object. The ORB instance is necessary so
59     that client JTS implementations running in applets do not have
60     to store static data which may cause security flaws.
61     The TSIdentification object is used by the JTS to register its Sender
62     and Receiver callbacks. The Properties object allows the application
63     to pass information to the JTS implementation.
64     */

65     public void identify_ORB(org.omg.CORBA.ORB JavaDoc orb,
66                  org.omg.CORBA.TSIdentification tsi,
67                  java.util.Properties JavaDoc props);
68 }
69
Popular Tags