![]() |
![]() |
|
|
To understand and use the interceptor examples packaged with the WLE software, you need to build and run the PersonQuery sample application. The PersonQuery sample application itself does not contain any interceptors; however, this application is used as the basis for the sample interceptor applications that are described in the three chapters that follow.
This chapter discusses the following topics:
Note: The WLE software provides C++ versions of both the client and server components of the PersonQuery sample application. However, only the server component of the PersonQuery sample application is provided in Java; there is no Java version of the PersonQuery client component. To build and run the Java version of the PersonQuery server application, you also need to build and run the C++ version of the PersonQuery client application.
The PersonQuery sample application implements a simple database query interface. Using the PersonQuery application, a user can get information about people in the database that match specific search criteria, such as:
How the PersonQuery Sample Application Works
The PersonQuery application contains the following components:
When the client application receives the result of the query from the server, it will report the number of items that were found. The user can then enter the command that displays the result of the latest query, or specify a new query.
The PersonQuery database in the server application contains the following information about each person in the database:
PersonQuery Database
The PersonQuery sample application implements a simple command-line interface in the client component with which the user can enter database query commands and the command to exit from the application.
The database query commands have the following syntax:
Option? command [keyword] [command [keyword]]... In this command syntax:
Client Application Command-line Interface
Option? name "Thomas Mann"
Option? address "116 Einbahnstrasse, Frankfurt am Main, BRD"
Option? hair brown eyes blue
Listing 5-1 provides the OMG IDL code for the implemented in the PersonQuery sample application:
Listing 5-1
OMG IDL code for the PersonQuery Application Interfaces
#pragma prefix "beasys.com"The OMG IDL for the PersonQuery Sample Application
interface PersonQuery
{
enum MONTHS {Empty,Jan, Feb, Mar, Apr, May, Jun, Jul, Aug,
Sep, Oct, Nov, Dec};
struct date_ {
MONTHS Month;
short Day;
short Year;
};
typedef date_ Date;
struct addr_ {
short number;
string street;
string town;
string state;
string country;
};
typedef addr_ Address;
enum MARRIAGE {not_known, single, married, divorced};
enum HOBBIES {who_cares, rocks, swim, tv, stamps, photo,
weaving};
enum SEX {cant_tell, male, female};
enum COLOR {white, black, brown, yellow, red, green, blue,
gray, violet, hazel, unknown, dontcare};
enum MARKINGS {dont_care, tattoo, scar, missing_limb,
none};
struct person_ {
string name;
Address addr;
string ss;
SEX sex;
short age;
MARRIAGE mar;
HOBBIES rec;
Date dob;
short ht;
long wt;
COLOR hair;
COLOR eye;
COLOR skin;
MARKINGS other;
};
typedef person_ Person;
typedef sequence <Person> Possibles;
union reason_ switch (short)
{
case 0: string name;
case 1: Address addr;
case 2: string ss;
case 3: SEX sex;
case 4: short age;
case 5: MARRIAGE mar;
case 6: HOBBIES rec;
case 7: Date dob;
case 8: short ht;
case 9: long wt;
case 10: COLOR hair;
case 11: COLOR eyes;
case 12: COLOR skin;
case 13: MARKINGS other;
};
typedef reason_ Reason;
exception DataOutOfRange
{
Reason why;
};
boolean findPerson (
in Person who, out Possibles hits)
raises (DataOutOfRange);
boolean findPersonByName (
in string name, out Possibles hits)
raises (DataOutOfRange);
boolean findPersonByAddress (
in Address addr, out Possibles hits)
raises (DataOutOfRange);
boolean findPersonBySS (
in string ss, out Possibles hits)
raises (DataOutOfRange);
boolean findPersonByAge (
in short age, out Possibles hits)
raises (DataOutOfRange);
boolean findPersonByMarriage (
in MARRIAGE mar, out Possibles hits)
raises (DataOutOfRange);
boolean findPersonByHobbies (
in HOBBIES rec, out Possibles hits)
raises (DataOutOfRange);
boolean findPersonBydob (
in Date dob, out Possibles hits)
raises (DataOutOfRange);
boolean findPersonByHeight (
in short ht, out Possibles hits)
raises (DataOutOfRange);
boolean findPersonByWeight (
in long wt, out Possibles hits)
raises (DataOutOfRange);
boolean findPersonByHairColor (
Regardless of whether you plan to experiment with the C++ or Java samples, you need to perform the steps described in this section. If you are planning to run the Java samples, complete the steps described in this section, then also complete the steps described in the section Building and Running the Java RLI Sample Applications.
To build and run the PersonQuery sample application:
The request-level interceptor sample application files are located in the following directory:
$TUXDIR\samples\corba\interceptors_cxx
To create a copy of these files so that you can build them and run them, do the following:
Windows NT
> xcopy /s/i %TUXDIR%\samples\corba\interceptors_cxx <workdirectory>\cxx
UNIX
> cp -R $TUXDIR/samples/corba/interceptors_cxx <workdirectory>/cxx
Windows NT
> cd <workdirectory>\cxx
UNIX
> cd <workdirectory>/cxx
You will use the files listed and described in Table 5-2 in the PersonQuery sample application.
During the installation of the WLE software, the sample application files are marked read-only. Before you can edit or build the files in the PersonQuery sample application, you need to change the protection attribute of the files you copied into your work directory, as follows. First make sure you are in the working directory into which you copied the sample application files.
Windows NT
prompt>attrib -r /s *.* UNIX
prompt>/bin/ksh Before building and running the PersonQuery sample application, you need to set the environment in which the application runs. To set the environment variables and other property settings needed to build and run the PersonQuery sample application, enter the following command:
Windows NT
> setenv.cmd UNIX:
> $ . ./setenv.ksh The following command builds the PersonQuery application, creates a machine-specific UBBCONFIG
file, and loads the UBBCONFIG
file:
Windows NT
> nmake -f makefile.nt UNIX
$ make -f makefile.mk
Note:
For convenience, the makefile executed in this step builds the entire C++ set of interceptor samples. This includes the InterceptorSimp, InterceptorSec, and InterceptorData interceptors as well. Details on implementing and building those interceptors, as well as running them with the PersonQuery sample application, are provided in the chapters that follow.
Start the PersonQuery sample application by entering the following command:
prompt> tmboot -y A typical usage scenario of the PersonQuery sample application involves the following steps:
Changing the Protection on PersonQuery Application Files
ksh prompt>chmod -R u+w *.* Setting the Environment Variables
Building the Client and Server Applications
Start the PersonQuery Client and Server Applications
Running the PersonQuery Sample Application
Option? hair brown eyes blue
To stop the PersonQuery sample application, enter the following command:
prompt>tmshutdown -y
If you want to run the Java RLI sample applications provided with the WLE software, make sure you have completed all the steps described in the section Building and Running the PersonQuery Sample Application before you complete any of the steps described in the procedure that follows. The Java RLI sample application is a server-side-only implementation, and it uses the C++ PersonQuery client application, which needs to be built so that the Java RLI sample applications can work.
To build and run the PersonQuery sample application:
The Java request-level interceptor sample application files are located in the following directory:
$TUXDIR\samples\corba\interceptors_java
To create a copy of these files so that you can build them and run them, do the following:
Windows NT
> xcopy /s/i %TUXDIR%\samples\corba\interceptors_java <workingdirectory>\java
UNIX
> cp -R $TUXDIR/samples/corba/interceptors_java <workingdirectory>/java
Windows NT
> cd <workingdirectory>\java
UNIX
> cd <workingdirectory>/java
You will use the files listed and described in Table 5-2.
During the installation of the WLE software, the sample application files are marked read-only. Before you can edit or build the files in the Java PersonQuery sample application, you need to change the protection attribute of the files you copied into your work directory, as follows. First make sure you are in the working directory containing the sample files you copied.
Windows NT
prompt>attrib -r /s *.* UNIX
prompt>/bin/ksh Before building and running the Java PersonQuery server application, you need to set the environment in which the application runs. To set the environment variables and other property settings needed to build and run the PersonQuery server application, enter the following command:
Windows NT
> setenv.cmd UNIX:
> $ . ./setenv.ksh The following command builds the Java PersonQuery server application, creates a machine-specific UBBCONFIG
file, and loads the UBBCONFIG
file:
Windows NT
> nmake -f makefile.nt UNIX
$ make -f makefile.mk
Note:
For convenience, the makefile executed in this step builds the set of Java RLI samples. This includes the Java InterceptorSimp, InterceptorSec, and InterceptorData interceptors as well as the Java PersonQuery server application. Details on implementing and building those interceptors, as well as running them with the PersonQuery client application, are provided in the chapters that follow.
Start the PersonQuery sample application by entering the following command:
prompt> tmboot -y
Note:
The Java PersonQuery server application uses the C++ PersonQuery client application.
A typical usage scenario of the PersonQuery sample application involves the following steps:
Changing the Protection on PersonQuery Application Files
ksh prompt>chmod -R u+w *.* Setting the Environment Variables
Building the Server Application
Start the PersonQuery Client and Server Applications
Running the PersonQuery Sample Application
Option? hair brown eyes blue
To stop the PersonQuery sample application, enter the following command:
prompt>tmshutdown -y
|
Copyright © 1999 BEA Systems, Inc. All rights reserved.
|