The code for the example application is provided in the bank_agent_java.html file. You can find this file in:IDL is the language that an implementer uses to specify the operations that an object will provide and how they should be invoked. In this example, we define, in IDL, the Account interface with a balance() method and the AccountManager interface with an open() method.With the interface specification described in step 1, use the idl2java or idl2cpp compilers to generate the client-side stubs and the server-side classes for the implementation of the remote objects.To complete the implementation of the client program, initialize the VisiBroker ORB, bind to the Account and the AccountManager objects, invoke the methods on these objects, and print out the balance.To complete the implementation of the server object code, we must derive from the AccountPOA and AccountManagerPOA classes, provide implementations of the interfaces' methods, and implement the server's main routine.You then use the idl2java compiler to generate stub routines and servant code compliant with the IDL specification. The stub routines are used by your client program to invoke operations on an object. You use the servant code, along with code you write, to create a server that implements the object.The sample below shows the contents of the Bank.idl file for the bank_agent example. The Account interface provides a single method for obtaining the current balance. The AccountManager interface creates an account for the user if one does not already exist.module Bank{
interface Account {
float balance();
};
interface AccountManager {
Account open(in string name);
};
};The interface specification you create in IDL is used by VisiBroker's idl2java compiler to generate Java classes for the client program, and skeleton code for the object implementation.Because the Bank.idl file requires no special handling, you can compile the file with the following command.Because Java allows only one public interface or class per file, compiling the IDL file will generate several .java files. These files are stored in a generated sub-directory called Bank, which is the module name specified in the IDL and is the package to which the generated files belong. The following is a list of .java files generated:
public final class AccountManagerHelper {
...
public static Bank.AccountManager bind(org.omg.CORBA.ORB orb) {
return bind(orb, null, null, null);
...
}
}Several other methods are provided that allow your client program to manipulate an AccountManager object reference.Many of these methods and member functions are not used in the example client application, but they are described in detail in the VisiBroker Programmer's Reference.Just as with the client, many of the classes used in implementing the bank server are contained in the Bank package generated by the idl2java compiler. The Server.java file is a server implementation included for the purposes of illustrating this example. Normally you, the programmer, would create this file.The examples directory of your VisiBroker release contains a vbmake.bat for this example and other VisiBroker examples.Assuming VisiBroker is installed in C:\vbroker, type the following to compile the example:If you encounter problems while running vbmake, check that your path environment variable points to the bin directory where you installed the VisiBroker software.Assuming VisiBroker is installed in /usr/local, type the following to compile the example:In this example, make is the standard UNIX facility. If you do not have it in your PATH, see your system administrator.Start your Account server by typing: