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. package com.sun.corba.se.spi.costransactions;
  8. /** The TransactionService interface must be implemented by all
  9. Java Transaction Services. It provides a procedure for initialization
  10. of a JTS in association with an ORB.
  11. TransactionService is not intended to be visible to the application
  12. programmer; it is only an interface between the ORB and the JTS.
  13. During initialization, the application programmer must provide the
  14. ORB with a JTS implementation through the property
  15. "com.sun.corba.se.spi.costransactions.TransactionServiceClass". The ORB
  16. then instantiates the JTS and calls identify_ORB() on it.
  17. The following is an example of the
  18. initialization steps required in the application code:
  19. <p>
  20. // Create a properties object. The properties may also be given as <br>
  21. // command line arguments, applet parameters, etc. <br>
  22. Properties p = new Properties(); <br>
  23. p.put("org.omg.CORBA.ORBClass", "com.sun.corba.se.impl.orb.ORBImpl");
  24. p.put("com.sun.corba.se.spi.costransactions.ORBJTSClass",
  25. "com.xyz.SomeTransactionService");
  26. // This property is given to the JTS in the Properties parameter in identify_ORB().
  27. p.put("com.xyz.CosTransactions.SomeProperty", "SomeValue");
  28. <p>
  29. // Get an ORB object. During initialization, the JTS is also <br>
  30. // instantiated, and the JTS registers its callbacks with the ORB.<br>
  31. org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(null, p);
  32. <p>
  33. // Get the Current instance from the ORB <br>
  34. org.omg.CosTransactions.Current current = (Current)orb.resolve_initial_references("TransactionCurrent");
  35. <p>
  36. current.begin(); <br>
  37. ... <br>
  38. current.commit(...); <br>
  39. <p>
  40. Note: The package name for TransactionService and the property may change.
  41. */
  42. public interface TransactionService {
  43. /** get_current() is called by the ORB during initialization to
  44. obtain the transaction-service's implementation of the Current
  45. pseudo-object. Current is available to the application programmer
  46. thru orb.resolve_initial_references("TransactionCurrent").
  47. */
  48. public org.omg.CosTransactions.Current get_current();
  49. /** identify_ORB is called by the ORB during initialization to
  50. provide the JTS implementation with an instance of the ORB object,
  51. and a TSIdentification object. The ORB instance is necessary so
  52. that client JTS implementations running in applets do not have
  53. to store static data which may cause security flaws.
  54. The TSIdentification object is used by the JTS to register its Sender
  55. and Receiver callbacks. The Properties object allows the application
  56. to pass information to the JTS implementation.
  57. */
  58. public void identify_ORB(org.omg.CORBA.ORB orb,
  59. org.omg.CORBA.TSIdentification tsi,
  60. java.util.Properties props);
  61. }