Using CORBA Request-Level Interceptors

     Previous  Next    Open TOC in new window  Open Index in new window  View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

InterceptorData Sample Interceptors

This chapter describes the following two sample interceptors that are designed to be used with the PersonQuery sample application:

This chapter explains how each interceptor works, then shows how to build and run them with the PersonQuery sample application.

 


InterceptorDataClient 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:

In addition, the data interceptor provides the InterceptorDataClientInit method to initialize the client interceptor class.

 


InterceptorDataTarget Interceptor

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:

In addition, the data interceptor provides the InterceptorDataTargetInit method to initialize the target interceptor class.

 


Implementing the InterceptorData Interceptors

Information about the code used to implement the InterceptorData interceptors is provided in Developing CORBA Request-Level Interceptors. Refer to that chapter for information about how to do the following:

  1. Starting the Implementation File on page 2-3.
  2. Initializing the Interceptor at Run Time on page 2-3.
  3. Obtaining the Interface Name from a Request on page 2-4.
  4. Identifying Operations in the Request on page 2-5.
  5. Implementing the Interceptor’s Response Operation on page 2-5.
  6. Reading Parameters Out of a Data Input Stream on page 2-6.

 


Registering and Running the InterceptorData Interceptors

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.

To register and run the InterceptorData client and server interceptors:

  1. Change directory to the InterceptorData sample directory, where workdirectory represents the name of the directory into which you copied the interceptor sample applications in Chapter , "PersonQuery Sample Application:"
  2. Windows 2003

    > cd <workdirectory>\cxx\data_cxx

    UNIX

    $ cd <workdirectory>/cxx/data_cxx
  3. Register the interceptor:
  4. Windows 2003

    > nmake -f makefile.nt config

    UNIX

    $ make -f makefile.mk config
  5. Boot the CORBA server and run the CORBA client:
  6. Windows 2003

    > cd <workdirectory>\cxx\app_cxx
    > tmboot -y
    > PersonQueryClient

    UNIX

    > cd <workdirectory>/cxx/app_cxx
    > tmboot -y
    > PersonQueryClient
  7. Perform any number of invocations using the PersonQuery client application, using the command syntax described in PersonQuery Sample Application.
  8. Stop the PersonQuery application:
  9. > tmshutdown -y

 


Examining the Interceptor Output

The InterceptorData client and target interceptors log each invocation. For each PersonQuery application session, the client interceptor creates a log file named InterceptorDataClientxxx.out, and the target interceptor creates a log file named InterceptorDataTargetxxx.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

 


Unregistering the Interceptors

After you have run the PersonQuery sample application with the InterceptorData sample interceptors, you can unregister those interceptors using the following steps:

  1. Shut down all running CORBA applications by entering the following command:
  2. > tmshutdown -y
  3. Change directory to the InterceptorData sample directory, where workdirectory represents the name of the directory into which you copied the interceptor sample applications in Chapter , "PersonQuery Sample Application:"
  4. Windows 2003

    > cd <workdirectory>\cxx\data_cxx

    UNIX

    $ cd <workdirectory>/cxx/data_cxx
  5. Unregister the interceptors:
  6. Windows 2003

    > nmake -f makefile.nt unconfig

    UNIX

    $ make -f makefile.mk unconfig

  Back to Top       Previous  Next