* @param args The arguments to use for this trailmap example, not used.
*/
public static void main(String[] args)
{
// Define an ORB suitable for use by the JBoss Transactions product ORB portability layer.
ORB myORB = null;
// Define an object adapter suitable for use by the JBoss Transactions product ORB portability layer.
RootOA myOA = null;
try
{
// Initialize the ORB reference using the JBoss Transactions product ORB portability layer.
myORB = ORB.getInstance("ClientSide");
// Initialize the object adapter reference using the JBoss Transactions product ORB portability layer.
myOA = OA.getRootOA(myORB);
// Initialize the ORB using the JBoss Transactions product ORB portability layer.
myORB.initORB(args, null);
// Initialize the object adapter reference using the JBoss Transactions product ORB portability layer.
myOA.initOA();
}
catch (Exception e)
{
// The ORB has not been correctly configured!
// Display as much help as possible to the user track down the configuration problem
System.err.println("Trailmap Error: ORB Initialisation failed: " + e);
e.printStackTrace();
System.exit(0);
}
// Obtain a reference to the BankImpl CORBA representation inorder to be able to use it to transactionally
// invoke banking operations as part of the JBoss Transactions product trailmap
// Define the reference to invoke
Bank bank = null;
// Obtain the reference for bank
try
{
// Read the IOR from file
java.io.FileInputStream file = new java.io.FileInputStream("ObjectId");
java.io.InputStreamReader input = new java.io.InputStreamReader(file);
java.io.BufferedReader reader = new java.io.BufferedReader(input);
// This contains the IOR
String stringTarget = reader.readLine();
// Convert the IOR into a CORBA object
org.omg.CORBA.Object obj = myORB.orb().string_to_object(stringTarget);
// Narrow the object into an object implementing <CODE>Hello</CODE>
System.out.println("Try to convert the obj ref to a Bank object !");
bank = BankHelper.narrow(obj);
}
catch (java.io.IOException ioe)