To understand and use the interceptor examples packaged with the BEA Tuxedo 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 topic includes the following sections:
Notes: | The BEA Tuxedo CORBA Java client and BEA Tuxedo CORBA Java client ORB were deprecated in Tuxedo 8.1 and are no longer supported. All BEA Tuxedo CORBA Java client and BEA Tuxedo CORBA Java client ORB text references, associated code samples, should only be used to help implement/run third party Java ORB libraries, and for programmer reference only. |
Note: | Technical support for third party CORBA Java ORBs should be provided by their respective vendors. BEA Tuxedo does not provide any technical support or documentation for third party CORBA Java ORBs. |
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:
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:
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]]...
Option?
is the PersonQuery command prompt.command
is one of the PersonQuery commands from Table 4-1.keyword
is one of the keywords from Table 4-1. Note the following rules on specifying keywords:Option?
name "Thomas Mann"
Option?
address "116 Einbahnstrasse, Frankfurt am Main, BRD"
Option?
hair brown eyes blue
Listing 4-1 provides the OMG IDL code for the implemented in the PersonQuery sample application.
#pragma prefix "beasys.com"
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 (
in COLOR col, out Possibles hits)
raises (DataOutOfRange);
boolean findPersonBySkinColor (
in COLOR col, out Possibles hits)
raises (DataOutOfRange);
boolean findPersonByEyeColor (
in COLOR col, out Possibles hits)
raises (DataOutOfRange);
boolean findPersonByOther (
in MARKINGS other, out Possibles hits)
raises (DataOutOfRange);
void exit();
};
interface QueryFactory
{
PersonQuery createQuery (in string name);
};
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:
> xcopy /s/i %TUXDIR%\samples\corba\interceptors_cxx <workdirectory
>\cxx
> cp -R $TUXDIR/samples/corba/interceptors_cxx <workdirectory
>/cxx
> cd <workdirectory
>\cxx
> cd <workdirectory
>/cxx
You will use the files listed and described in Table 4-2 in the PersonQuery sample application.
During the installation of the BEA Tuxedo 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.
prompt>attrib -r /s *.*
prompt>/bin/ksh
ksh prompt>chmod -R u+w *.*
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:
> setenv.cmd
> $ . ./setenv.ksh
The following command builds the PersonQuery application, creates a machine-specific UBBCONFIG
file, and loads the UBBCONFIG
file:
> nmake -f makefile.nt
$ make -f makefile.mk
Note: | For convenience, the makefile executed in this step builds the entire 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:
Option? hair brown eyes blue
result
command to see the final query result.exit
command to quit from the application.To stop the PersonQuery sample application, enter the following command:
prompt>tmshutdown -y