bea ホーム | 製品 | dev2dev | support | askBEA |
![]() |
![]() |
|
![]() |
e-docs > Tuxedo > Tuxedo CORBA 要求レベルのインターセプタ > PersonQuery サンプル・アプリケーション |
Tuxedo CORBA 要求レベルのインターセプタ
|
PersonQuery サンプル・アプリケーション
BEA Tuxedo ソフトウェアに同梱されたインターセプタ例を理解して使用するには、PersonQuery サンプル・アプリケーションをビルドして実行する必要があります。PersonQuery サンプル・アプリケーション自体には、インターセプタは含まれていません。しかし、このアプリケーションは、以降の 3 つの章で説明するインターセプタのサンプル・アプリケーションの基本として使用されます。
ここでは、以下の内容について説明します。
PersonQuery サンプル・アプリケーションのしくみ
PersonQuery サンプル・アプリケーションは、単純なデータベース問い合せインターフェイスをインプリメントします。PersonQuery アプリケーションを使用すると、データベースから次のような特定の検索基準に一致する人物の情報を取得できます。
PersonQuery アプリケーションには、次のコンポーネントが含まれます。
クライアント・アプリケーションは、サーバからの問い合せ結果を受け取ると、見つかった項目の数を報告します。ユーザは次に、最新の問い合せ結果を表示するコマンドを入力するか、新しい問い合せを指定します。
PersonQuery データベース
サーバ・アプリケーションの PersonQuery データベースには、データベース内の各人物に関する次の情報が含まれます。
クライアント・アプリケーションのコマンド行インターフェイス
PersonQuery サンプル・アプリケーションは、ユーザがデータベース問い合せコマンド、およびアプリケーション終了コマンドを入力できるクライアント・コンポーネントの単純なコマンド行インターフェイスをインプリメントします。
データベース問い合せコマンドの構文は次のとおりです。
Option? command [keyword] [command [keyword]]...
このコマンド構文の詳細は以下のとおりです。
Option? name "Thomas Mann"
Option? address "116 Einbahnstrasse, Frankfurt am Main, BRD"
Option? hair brown eyes blue
表 4-1 PersonQuery アプリケーションのコマンドおよびキーワード
PersonQuery サンプル・アプリケーションの OMG IDL
リスト4-1 は、PersonQuery サンプル・アプリケーションでインプリメントされている OMG IDL コードを示します。
コード リスト 4-1 PersonQuery アプリケーションのインターフェイス用 OMG IDL
#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);
};
PersonQuery サンプル・アプリケーションのビルドと実行
PersonQuery サンプル・アプリケーションをビルドして実行するには、以下の手順に従います。
PersonQuery サンプル・アプリケーション用ファイルのコピー
要求レベルのインターセプタのサンプル・アプリケーション用ファイルは、次のディレクトリに格納されています。
$TUXDIR¥samples¥corba¥interceptors_cxx
これらのファイルをビルドおよび実行できるようにコピーするには、次の手順に従います。
Windows 2000
> xcopy /s/i %TUXDIR%¥samples¥corba¥interceptors_cxx <workdirectory>¥cxx
UNIX
> cp -R $TUXDIR/samples/corba/interceptors_cxx <workdirectory>/cxx
Windows 2000
> cd <workdirectory>¥cxx
UNIX
> cd <workdirectory>/cxx
PersonQuery サンプル・アプリケーションには 表 4-2 でリストおよび説明されているファイルを使用します。
表 4-2 インターセプタのサンプル・アプリケーションに含まれるファイル
PersonQuery アプリケーション・ファイルに対する保護の変更 BEA Tuxedo ソフトウェアのインストール時には、サンプル・アプリケーションは読み取り専用に設定されています。PersonQuery サンプル・アプリケーションのファイルを編集またはビルドできるようにするには、次のように作業ディレクトリにコピーしたファイルの保護属性を変更する必要があります。まず、サンプル・アプリケーションのファイルをコピーしたディレクトリにアクセスしていることを確認します。 Windows 2000 UNIX 環境変数を設定する PersonQuery サンプル・アプリケーションをビルドして実行する前に、アプリケーションが実行される環境を設定する必要があります。PersonQuery サンプル・アプリケーションのビルドと実行に必要な環境変数およびプロパティの設定を行うには、次のコマンドを入力します。 Windows 2000 UNIX: CORBA クライアントおよびサーバ・アプリケーションのビルド 次のコマンドにより、PersonQuery アプリケーションをビルドし、マシン固有の UBBCONFIG ファイルを作成し、UBBCONFIG ファイルをロードできます。 Windows 2000 UNIX 注記 便宜上、この手順で実行される makefile によってインターセプタのサンプル一式すべてをビルドします。これには、InterceptorSimp、InterceptorSec、および InterceptorData インターセプタも含まれます。これらのインターセプタのインプリメントとビルド、および PersonQuery サンプル・アプリケーションによる実行については、以降の章で説明します。 PersonQuery クライアントおよびサーバ・アプリケーションの起動 次のコマンドを入力して、PersonQuery サンプル・アプリケーションを起動します。 PersonQuery サンプル・アプリケーションの実行 PersonQuery サンプル・アプリケーションの代表的な使用方法として、次の手順に従います。
prompt>attrib -r /s *.*
prompt>/bin/ksh
ksh prompt>chmod -R u+w *.* > setenv.cmd
> $ . ./setenv.ksh
> nmake -f makefile.nt
$ make -f makefile.mk
prompt> tmboot -y
Option? hair brown eyes blue
PersonQuery サンプル・アプリケーションの停止
PersonQuery サンプル・アプリケーションを停止するには、次のコマンドを入力します。
prompt>tmshutdown -y
![]() |
![]() |
![]() |
![]() |
||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |