Trading Service Example: Mortgage Calculator

Description

This example includes a server process that, on initialisation, registers a service type in the Trading Service's Service Type Repository. This service type describes properties designed to advertise mortgages provided by the MortgageServer object. The example also includes a client process that queries the Trader for Mortgage objects that meet with a certain mortgage rate selected at random. Once retrieved, each Mortgage object is passed a figure of $100000 and calculates the annual and monthly repayments that the user would have to pay if he had selected that mortgage.

How to Build This Example

UNIX

These instructions are based on the Solaris gcc3.2 compiler makefiles.

  1. Ensure that the following environment variables are set:
  2. Ensure that your environment is set up for your compiler and linker. For example, for gcc3.2:

    PATH=/usr/local/gcc-3.2/bin:/usr/ccs/bin:$PATH; export PATH

    LD_LIBRARY_PATH=/usr/local/gcc-3.2/lib:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH

  3. Change to the <TAO install dir>/examples/cc directory.
  4. If you have not done so already, enter the make command to run the makefile. This will compile all of the OpenFusion examples.

Windows NT

  1. Set the environmental property TAO_ROOT=<TAO install dir>, where <TAO install dir> is the location into which you have installed TAO.
  2. A global example Microsoft Visual C++ project has been provided. This is called <TAO install dir>\examples\cc\cc.dsw. Double-click on the project file to load it into Microsoft Visual C++. When loaded, change the Common project from debug mode to release mode using the Build | Set Active Configuration menu option.
  3. Build the Common files.
  4. Build the Trading Mortgage Example files.
  5. Build the Trading Mortgage Client files.
  6. Build the Trading Mortgage Server files.

How to Run This Example

  1. UNIX: Ensure that the environment variable LD_LIBRARY_PATH includes the path to where the common files and the mortgage files were compiled:

    Change to the <TAO install dir>/examples/cc/Trading/Mortgage/server directory.

    LD_LIBRARY_PATH=<TAO install dir>/examples/cc/Common:<TAO install dir>/examples/cc/Trading/Mortgage:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH

    Windows NT: Start a DOS window. Ensure that your path contains:

    <TAO install dir>\bin;<TAO install dir>\examples\cc\bin

  2. Ensure that the OpenFusion Trading Service is running. In order to run the OpenFusion Trading Service you must first install the OpenFusion TCS - JacORB with OpenFusion CORBA Services distribution. This can be obtained from the downloads page by following the OpenFusion CORBA Products software link.

  3. Start the server:
    tradingmortgageserver -ORBInitRef TradingService=file://<OF_INSTALL_DIR>/domains/OpenFusion/localhost/TradingService/TradingSingleton/TradingSingleton.ior

    Where <OF_INSTALL_DIR> is the OpenFusion TCS - JacORB with OpenFusion CORBA Services installation directory.

    The server will respond with the prompt "Successfully exported Mortgage offers..." when it is ready to receive remote function calls.

  4. On UNIX, change to the <TAO install dir>/examples/cc/Trading/Mortgage/client directory.

  5. In a new window, ensure that all environment variables are set up as above. Start the client:
    tradingmortgageclient -ORBInitRef TradingService=file://<OF_INSTALL_DIR>/domains/OpenFusion/localhost/TradingService/TradingSingleton/TradingSingleton.ior

    This will resolve the Trading Service and query the service for mortgage offers with rate > 3.9%.

top
[top]


© PrismTech Limited 2002