VISIGENIC "BANK" EXAMPLES
INTRODUCTION
Revised: 12/12/97
These examples are the same as the "Bank" examples that Visigenic
provides with its product, except that they have been converted to use
the Internet Service Broker's web naming functionality. There are
three independent examples. Each example implements the same basic
CORBA client and server written in Java, but using a different technology:
|
Example
|
Client
|
Server
|
| bank |
Static stubs |
Server inherits from skeleton |
| bank_using_tie |
Static stubs |
Server called through "tie" delegation |
| dynamic_bank |
Dynamic invocation |
Dynamic skeletons |
This example contains batch files used to build the example
which are specific to Windows NT, however it can be run with the existing
class files on any platform. In addition, the examples can easily
be manually built on other platforms. (Just execute the Java compiles
manually instead of using the batch files)
TABLE OF CONTENTS
BANK EXAMPLE
DESIGN
The Visigenic "Bank" example code actually contains three independent examples.
Each example implements the same set of objects but using a different set
of technologies. Each example is contained in its own sub-directory:
-
bank: Clients use static stubs. Server implementations
inherit from IDL-generated skeletons
-
bank_using_tie: Clients use static stubs.
Server implementations are called from skeletons through delegation
-
dynamic_bank: Clients use Dynamic Invocation
Interface. Server implementations use Dynamic Skeleton Interface.
SCENARIO
The bank example simulates a banking system where a CORBA server object
represents a bank account. A CORBA client can invoke a method on
a bank account object for a specific customer to retrieve and display that
customer's account balance. It uses two CORBA objects: an Account,
an AccountManager, and a client that uses these components to get and display
the account balance for the given customer. The AccountManager is
an example of a factory object. A factory object is an object
whose purpose is to create and return instances of other objects.
In this case, the client uses the AccountManager to obtain a reference
to the specific Account object for a given customer. If this is the
first time the AccountManager has seen this customer, it creates a new
Account object for that customer and returns that object's reference.
If an Account object had previously been created for that customer, the
AccountManager returns a reference to the already-existing Account.
CORBA OBJECTS
Account
AccountManager
Command-Line Client
Client Applet
RUNNING THE
BANK EXAMPLES
Each of the three bank example is kept in a separate subdirectory.
To run any of the examples, execute the following steps from within the
directory for the example you wish to execute.
PRE-REQUISITES
The Bank examples come pre-compiled, so you don't need to build them
in order to run them. However, you must have the following:
-
Windows NT
-
Enterprise Server must be upgraded to at least Enterprise
Server 3.0f (or 3.01) with the WAI-Patch
#P85416.
-
CORBA must be enabled on the Enterprise Server.
-
Click here for information on Enabling
CORBA on the Enterprise Server.
-
A standalone Java VM supporting the JDK1.1 installed. (Ex: JDK1.1.X
from JavaSoft, or Symantec's Visual Cafe for Java 1.1)
-
The Java VM is used by idl2java to process the IDL file
-
Your CLASSPATH should include the following directories (in this order)
-
<JDK 1.1 Libraries> (Location dependent on your vendor.)
-
<Enterprise Server Install Directory>\wai\java\nisb.zip
-
<Enterprise Server Install Directory>\wai\java\wai.zip
-
Your PATH should include the directory for your Java VM (So that
you can just type "java" to run it)
-
The example directories should exist within the document tree of your web
server. This will allow you to easily run the client applet without
having to copy it under your document tree at a later time.
STARTING THE
SERVER
Before you can run a client which accesses a bank account object, you
must first start the server which implements that object:
-
Bring-up a DOS-box and verify that your PATH and CLASSPATH are correctly
set
-
Navigate to the example directory for the example you want to run
-
Execute the following command:
RUNNING
THE COMMAND-LINE
CLIENT
RUNNING THE
CLIENT APPLET (LOCATED
IN "BANK" EXAMPLE)
-
Install the java classes from the demo directory to your web server.
This may be accomplished by copy the files to the docs directory within
Enterprise Server. A typical installation will have the directory
as C:\Netscape\SuiteSpot\docs.
-
Access ClientApplet.html page through the web server ("http://<host>/<path>/ClientApplet.html").
Because of applet security, this example does not work when the web page
is accessed from a file.
BUILDING
THE BANK EXAMPLES
PRE-REQUISITES
To build the bank examples, you will need to have the following:
-
Enterprise Server 3.0
-
A standalone Java VM supporting the JDK1.1. (Ex: JDK1.1.X from JavaSoft,
or Symantec's Visual Cafe for Java 1.1)
-
Your CLASSPATH should include the following directories (in this order)
-
<JDK 1.1 Libraries> (Location dependent on your vendor.)
-
<Enterprise Server Install Directory>\wai\java\nisb.zip
-
<Enterprise Server Install Directory>\wai\java\wai.zip
-
Your PATH should include:
-
The directory for your Java VM (So that you can just type "java"
to run it)
-
The directory for your Java compiler (javac)
FILE AND
DIRECTORY STRUCTURE
The station monitor example has the following directory structure:
-
<root dir>: Batch files to build example. Readme.
-
bank: Sub-directory for example that uses static client
stubs and servers that inherit from their skeletons
-
bank_using_tie: Sub-directory for example that uses static
client stubs and servers that are called through delegation from "tie"
classes
-
Docs: Other useful documents
-
dynamic_bank: Sub-directory for example that uses dynamic
invocation for the client and server. (DII & DSI)
BUILDING
Each example contains three DOS batch files to help you build the sample
code. The root directory has batch files by the same names that can
be used to build all examples at one time.
-
makeidl.bat: Calls the idl2java IDL
compiler to generate CORBA object stubs and skeletons
-
make.bat: Calls the Java compiler to compile
the source files
-
makeclean.bat: Removes the class files and generated
source files
Once you have your environment set-up according to the above pre-requisites,
do the following to build the example code:
-
Open a DOS box and verify your PATH and CLASSPATH variables are correctly
set
-
Navigate to the example code root directory
-
Type "makeidl" to call the IDL compiler
-
Type "make" to compile all the source
REFERENCE
FURTHER
INFORMATION ON THE
BANK EXAMPLE
-
For more information on the bank example, you can view Visigenic's on-line
documentation in either frames
or no-frames
format. It is important to remember, however, that the Visigenic
examples use Visigenic's "bind" naming service, whereas the Netscape examples
you have here use web naming.
DOCUMENTATION
-
Netscape
ISB for Java Programmer's Guide - provides information on how to develop
and program distributed object-based applications in Java for Windows and
UNIX platforms using the Netscape Internet Service Broker. Last updated
8/4/97.
-
Netscape
ISB for Java Reference Guide - provides reference information on the
commands, utilities and interfaces included with the Netscape Internet
Service Broker for Java under Windows and UNIX operating systems. Preliminary,
last updated 5/97.