BEA Logo BEA WebLogic Enterprise Release 5.0

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

 

   WLE Doc Home   |   CORBA Programming & Related Topics   |   Previous   |   Next   |   Contents   |   Index

InterceptorSimp Sample Interceptors

This chapter discusses the following topics:

Before trying out the steps described in this chapter, make sure you have completed all the steps described in PersonQuery Sample Application.

Note: The WLE software provides C++ versions of both the client and target InterceptorSimp sample interceptors. However, only the target-side InterceptorSimp sample interceptor is provided in Java; there is no Java version of the client-side InterceptorSimp sample interceptor.

How the PersonQuery Sample Interceptors Work

The InterceptorSimp sample interceptor shows how the operation in a request passed to an interceptor can be accessed via a RequestContext object. When InterceptorSimp intercepts a request, the interceptor does the following:

Assuming a successful call to the interceptor, the client invocation is passed onto the target object and serviced in the usual way. Thus the InterceptorSimp interceptor samples show the following:

The InterceptorSimp sample interceptor also shows two different interceptors being defined and registered, but implemented in a single source file. In this example, the client and target interceptors are registered separately, with the client interceptor initialized first.

Registering and Running the PersonQuery 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 InterceptorSimp interceptor. This section describes how to register the C++ and Java versions of the InterceptorSimp 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.

Registering and Running the C++ Interceptors

To register and run the C++ InterceptorSimp client and server interceptors:

  1. Change directory to the InterceptorSimp sample directory, where workdirectory represents the name of the directory into which you copied the interceptor sample applications in PersonQuery Sample Application:

    Windows NT:

    > cd <workdirectory>\cxx\simple_cxx

    UNIX:

    $ cd <workdirectory>/cxx/simple_cxx

  2. Register the interceptor:

    Windows NT:

    > nmake -f makefile.nt config

    UNIX:

    $ make -f makefile.mk config

  3. Boot the server and run the client:

    Windows NT:

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

    UNIX:

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

  4. Perform any number of invocations using the PersonQuery client application, using the command syntax described in PersonQuery Sample Application.

  5. Stop the PersonQuery application:

    > tmshutdown -y

Registering and Running the Java Interceptors

To register the Java InterceptorSimp server interceptor:

  1. Change directory to the one into which you copied the Java interceptor sample applications in PersonQuery Sample Application:

    Windows NT:

    > cd <workdirectory>\java

    UNIX:

    $ cd <workdirectory>/java

  2. Register the interceptor:

    Windows NT:

    > .\registerAll.cmd

    UNIX:

    $ chmod u+x registerAll.ksh
    $ ./registerAll.ksh

  3. Boot the server and run the C++ client:

    Windows NT:

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

    UNIX:

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

  4. Perform any number of invocations using the PersonQuery client application, using the command syntax described in PersonQuery Sample Application.

  5. Stop the PersonQuery application:

    > tmshutdown -y

Examining the Output of the Interceptors

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 output from the C++ simple client interceptor is in files named with the following syntax:

InterceptorSimpClientxxxx.out

In the preceding syntax line, xxxx represents the process ID of the executable within which the interceptor ran. For example, there are three InterceptorSimpClient xxx .out files; one each for the following:

The content of each file varies according to how the ORB interacted with the executable. For example, target interceptors run on servers and client interceptors run on clients, so the InterceptorSimpClient log files typically have very little output from the Simple target interceptor, but it has more output from the client interceptor.

For Java:

The Java InterceptorSimp sample interceptor, which is implemented on the target side only, sends its output to the ULOG file, as in the following example:

134040.ICEAXE!JavaServer.221: main: InterceptorSimple0,
InterceptorSimple.target_invoke
134040.ICEAXE!JavaServer.221: main: Request Id = 6
134040.ICEAXE!JavaServer.221: main: Response flags = RESPONSE EXPECTED
134040.ICEAXE!JavaServer.221: main: Interface Id =
IDL:beasys.com/PersonQuery:1.0
134040.ICEAXE!JavaServer.221: main: Operation = findPersonBySS
134040.ICEAXE!JavaServer.221: main: KeyAddr address disposition, size = 84
134040.ICEAXE!JavaServer.221: main: KeyAddr address disposition object key =
01424541080101010c000000706572736f6e517565727900020000001f00000049444c3a6265
617379732e636f6d2f506572736f6e51756572793a312e3000000c000000506572736f6e5175
6572790000000000

Unregistering the Interceptors

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

  1. Shut down all running WLE applications by entering the following command:

    > tmshutdown -y

  2. Unregister the interceptors as described in the language-specific sections that follow.

Unregistering the C++ Interceptors

To unregister the C++ InterceptorSimp client and server interceptors:

  1. Change directory to the InterceptorSimp sample directory, where workdirectory represents the name of the directory into which you copied the interceptor sample applications in PersonQuery Sample Application:

    Windows NT:

    > cd <workdirectory >\cxx\simple_cxx

    UNIX:

    $ cd <workdirectory >/cxx/simple_cxx

  2. Unregister the interceptors:

    Windows NT:

    > nmake -f makefile.nt unconfig

    UNIX:

    $ make -f makefile.mk unconfig

Unregistering the Java Interceptors

To unregister the Java InterceptorSimp server interceptor:

  1. Change directory to the one into which you copied the Java interceptor sample applications in PersonQuery Sample Application:

    Windows NT:

    > cd <workdirectory >\java

    UNIX:

    $ cd <workdirectory >/java

  2. Unregister the interceptor:

    Windows NT:

    > .\unregisterAll.cmd

    UNIX:

    $ chmod u+x unregisterAll.ksh
    $ ./unregisterAll.ksh