CORBA 2.6.1 Getting Started Guide for Java

Chapter 4. Running the Java Stack Example
Chapter 4. Running the Java Stack Example
The Stack Example Overview
Building the Stack Sample
Configuring NonStop CORBA for the Stack Example
Running the Stack Example on OSS
Once you have installed and configured your NonStop CORBA software, you can test the operation of your system by running a simple CORBA
program.
The Stack example is a simple but fully functional CORBA program that has both a client and a server implemented in C++ and Java. This
section discusses the Java version of the example. Because it contains both client and server applications, the Stack example is a perfect test
for your newly installed NonStop CORBA system.
The Stack Example Overview
The Stack example resides in the javasamples/stack subdirectory of your NonStop CORBA installation. While the intent of this topic is to test
your installation, the
README file in the Stack directory describes the workings of the program files.
The Stack example is a program that implements both a CORBA client and server in Java. It is a complete and working program that
demonstrates:
An object interface definition written in the Interface Definition Language (IDL)
A POA server that embodies the implementation of the interface defined by the interface definition
Two POA servers that embody the implementation of the interface defined by the interface definition
A client application which makes use of an instance of a stack object
In addition to these items, the Stack example can be used to demonstrate both portability and interoperability. To demonstrate portability, you
can move this sample to another platform running an implementation of CORBA. To demonstrate interoperability, you can build and run the
client application on one platform, and run it with the server application built on another platform.
Building the Stack Sample
The Stack example contains a file named Makefile, which builds both the client and the server applications. The Makefile performs the required
steps to construct the executable components.
To build the sample:
1. Log on to the system and go to the directory javasamples/stack.
2. Verify that the
etc/env.sh script has been sourced and that the environment variable JAVA_HOME points to the installation of the NonStop
Server for Java.
3. Run the
Makefile in the javasamples/stack directory.
The
Makefile:
Uses the NonStop CORBA IDL compiler to process the interface contained in stack.idl file
Builds the server executable by using the NonStop Server for Java compiler to compile its components
Builds the client executable by using the NonStop Server for Java compiler to compile its components
The NonStop CORBA IDL compiler nsdidl takes the stack.idl file as input and produces the following 12 files:
Stack.java
StackHelper.java
StackHolder.java
StackOperations.java
StackPOA.java
_StackStub.java
StackPackage/STACK_OVERFLOW.java