|
|
This chapter explains how each interceptor works, then shows how to build and run them with the PersonQuery sample application.
Note:
The WLE software provides C++ versions of both the client and target InterceptorData sample interceptors. However, only the target-side InterceptorData sample interceptor is provided in Java; there is no Java version of the client-side InterceptorData sample interceptor.
The InterceptorDataClient interceptor intercepts and logs each client application request and reply parameters. This interceptor also allows certain operations on the PersonQuery server application to be invoked by users of the client application who meet specific criteria. The InterceptorDataClient interceptor implements the InterceptorDataClient
interface, which inherits from the ClientRequestInterceptor
class.
The InterceptorDataClient class implements the methods as follows:
InterceptorDataClient Interceptor
This method returns the string InterceptorDataClient .
This method removes the request from the tracker object.
When invoked by the ORB, this method removes the request from the tracker object.
This method determines if the interface and operation are "of interest." If the client request is "of interest," this method parses the request parameters and outputs the parameters to the log file. If the client request is not "of interest," this method simply returns.
This method determines if the interface and operation in the request are "of interest." If the interface and operation are "of interest," this method walks through the CORBA DataInputStream parameter to obtain the reply parameters and write them to the log file. If the interface and operation in the request are not "of interest," this method simply returns.
In addition, the data interceptor provides the InterceptorDataClientInit
method to initialize the client interceptor class.
The InterceptorDataTarget interceptor intercepts and logs request and reply data parameters. This interceptor also removes sensitive data from specific reply parameters by masking the data with x
characters. The InterceptorDataTarget interceptor implements the InterceptorDataTarget
interface, which inherits from the TargetRequestInterceptor
class.
The InterceptorDataTarget
class implements the methods as follows:
InterceptorDataTarget Interceptor
This method returns the string InterceptorDataTarget .
This method simply returns.
This method removes the request from the tracker object.
This method determines if the interface and operation are "of interest." If so, this method parses the request parameters and outputs that data to the log file. If the interface and operation in the request are not "of interest," this method simply returns. If the operation in the request is exit , this method returns the status value INVOKE_NO_EXCEPTION .
This method determines if the interface and operation are "of interest." If so, this method walks through the DataInputStream parameter to obtain the response parameters and output to the log file. Sensitive data items are substituted in the log. For example, a person's social security number will not be output to the log. If the interface and operation in the request are not "of interest," this method simply returns.
In addition, the data interceptor provides the InterceptorDataTargetInit
method to initialize the target interceptor class.
Information about the code used to implement the InterceptorData interceptors is provided in Developing C++ Interceptors, and Developing Java Interceptors. Refer to those chapters for information about how to do the following:
Implementing the InterceptorData Interceptors
If you are implementing in C++... |
If you are implementing in Java... |
---|---|
When you run the makefile that builds the PersonQuery sample application in PersonQuery Sample Application, the entire set of sample interceptors are built as well, including the InterceptorData interceptors. This section describes how to register the InterceptorData interceptor so that it works with PersonQuery application at run time.
This section is presented in two parts: one for C++, and one for Java.
To register and run the C++ InterceptorData client and server interceptors:
Registering and Running the InterceptorData Interceptors
Registering and Running the C++ Interceptors
Windows NT
> cd <workdirectory>\cxx\data_cxx
UNIX
$ cd <workdirectory>/cxx/data_cxx
Windows NT
> nmake -f makefile.nt config
UNIX
$ make -f makefile.mk config
Windows NT
> cd <workdirectory>\cxx\app_cxx
> tmboot -y
> PersonQueryClient
UNIX
> cd <workdirectory>/cxx/app_cxx
> tmboot -y
> PersonQueryClient
> tmshutdown -y
To register and run the Java InterceptorData server interceptor:
Windows NT:
> cd <workdirectory>\java
UNIX:
$ cd <workdirectory>/java
Windows NT:
> .\registerAll.cmd
UNIX:
$ chmod u+x registerAll.ksh
$ ./registerAll.ksh
Windows NT:
> tmboot -y
> cd <workdirectory>\cxx\app_cxx
> PersonQueryClient
UNIX:
> tmboot -y
> cd <workdirectory>/cxx/app_cxx
> PersonQueryClient
> tmshutdown -y
Because of the way in which the sample interceptors were implemented, the location and format of the interceptor output is different between the C++ and Java interceptors.
For C++:
The C++ InterceptorData client and target interceptors log each invocation. For each PersonQuery application session, the client interceptor creates a log file named InterceptorDataClient xxx .out , and the target interceptor creates a log file named InterceptorDataTarget xxx .out . This section shows sample log file data for each interceptor.
Sample Client Interceptor Log Output
InterceptorDataClientInit called
ClientInterceptorData::id called
ClientInterceptorData::client_invoke called
ClientInterceptorData::client_response called
Request Id: 1
unable to find request for this reply (must not be one we care about)
ClientInterceptorData::client_invoke called
Request Id: 2
Interface: IDL:beasys.com/PersonQuery:1.0
Operation: findPerson
Parameters:
name: ALISTER LANCASHIRE
address: 3 PENNY LANE
LONDON GB UK
ss: 999-99-9999
sex: can't tell
age(yrs.): 85
marital status: single
hobby: stamp collecting
date-of-birth: 11/25/1913
height(in.): 32
weight(lbs.): 57
hair color: unknown
eye color: blue
skin color: white
other markings: missing limb
Sample Target Interceptor Log Output
InterceptorDataTargetInit called
TargetInterceptorData::id called
TargetInterceptorData::target_response called
Request Id: 2
ReplyStatus: GIOP::NO_EXCEPTION
Interface: IDL:beasys.com/PersonQuery:1.0
Operation: findPerson
Method Result: TRUE
Parameters:
Maximum: 8
Length: 8
Item 0
name: ALISTER LANCASHIRE
address: 3 PENNY LANE
LONDON GB UK
ss: NO PRIVILEDGE
sex: NO PRIVILEDGE
age (years): NO PRIVILEDGE
marital status: NO PRIVILEDGE
hobby: stamp collecting
date-of-birth: NO PRIVILEDGE
height (in.): 32
weight (lbs.): 57
hair color: unknown
eye color: blue
skin color: NO PRIVILEDGE
other markings: missing limb
For Java:
The Java InterceptorData target interceptor logs each invocation. For each PersonQuery application session, the interceptor sends its output to the ULOG file, as in the following example:
Sample Target Interceptor Log Output
134040.ICEAXE!JavaServer.221: main: Process operation findPersonBySS
134040.ICEAXE!JavaServer.221: main: Operation succeeded
134040.ICEAXE!JavaServer.221: main: arg_stream, Possibles count = 2
134040.ICEAXE!JavaServer.221: main: Person [0] =
Name: FRED MURTZ
Address: 436 AMHERST ST. NASHUA, NH USA
SS#: 999-99-9999
Sex: male
Age: 75
Status: married
Hobby: tv
Date of birth: Jan-1-1924
Height: 62
Weight: 115
Hair Color: black
Eye Color: hazel
Skin Color: black
Other Markings: scar
134040.ICEAXE!JavaServer.221: main: Person [1] =
Name: ALISTER LANCASHIRE
Address: 3 PENNY LANE LONDON, GB UK
SS#: 999-99-9999
Sex: cant_tell
Age: 85
Status: single
Hobby: stamps
Date of birth: Nov-25-1913
Height: 32
Weight: 57
Hair Color: unknown
Eye Color: blue
Skin Color: white
Other Markings: missing_limb
134040.ICEAXE!JavaServer.221: main: Processing operation findPersonBySS complete
After you have run the PersonQuery sample application with the InterceptorData sample interceptors, you can unregister those interceptors using the following steps:
> tmshutdown -y
To unregister the C++ InterceptorData client and server interceptors:
Windows NT:
> cd <workdirectory >\cxx\data_cxx
UNIX:
$ cd <workdirectory >/cxx/data_cxx
Windows NT:
> nmake -f makefile.nt unconfig
UNIX:
$ make -f makefile.mk unconfig
To unregister the Java InterceptorData server interceptor:
Windows NT:
> cd <workdirectory >\java
UNIX:
$ cd <workdirectory >/java
Windows NT:
> .\unregisterAll.cmd
UNIX:
$ chmod u+x unregisterAll.ksh
$ ./unregisterAll.ksh
|
Copyright © 1999 BEA Systems, Inc. All rights reserved.
|