arjuna logoarjuna strap line


print this page
email this page

The role of the BankServer class is mainly to initialise the ORB and the Object Adapter and to create the default Bank object responsible to create banking accounts.

Globally the BankServer has the following structure.

  • Initialise the ORB

    This done using the ORB Portability API

  • ...
    myORB = ORB.getInstance("ServerSide");
    myOA = OA.getRootOA(myORB);
    myORB.initORB(args, null);
    myOA.initOA();
    ...
    
  • Create the BankImpl object, an instance that implements the Bank interface. Two ways are provided to build such Bank object according to the fact it's the first time we create such object or not. This depends on the existence or not of the file named "
      " that should contain the Uid of the BankImpl object.
    ...
    java.io.FileInputStream file = new java.io.FileInputStream("UidBankFile");
    java.io.InputStreamReader input = new java.io.InputStreamReader(file);
    java.io.BufferedReader reader = new java.io.BufferedReader(input);
    String stringUid = reader.readLine();
    file.close();
    _bank = new BankImpl(new Uid(stringUid), myOA);
    boolean result =_bank.activate();
    ...
    
    • If the file does not exist, a new BankImpl object is created, then the Uid of the created object is stored in the file named "UidBankFile"
    ...
    _bank = new BankImpl(myOA);
    java.io.FileOutputStream file = new java.io.FileOutputStream("UidBankFile");
    java.io.PrintStream pfile=new java.io.PrintStream(file);
    pfile.println(_bank.get_uid().toString());
    file.close();
    ...
  • Store the CORBA object reference of the BankImpl object in a file in such way the client can retrieve it from that file.
Sample Application Source Code

Full source code for the BankServer class is included to provide you with a starting point for experimentation.

Copyright 2002-2005 Arjuna Technologies All Rights Reserved.
info@arjuna.com +44 191 243 0676