Back to Naming Service Examples Page Back

Naming Service Example: Video on Demand

Description

This example includes a server process that, on initialisation, binds a ServiceProvider (singleton) object into the root context of the OpenFusion Naming Service. A number of NamingVideoCompany objects are then created by the server for management by the ServiceProvider. When instantiated, each  NameVideoCompany object binds itself into the Naming Service under a context that describes the video feed types and video titles it has on offer. The Client process resolves a reference to the ServiceProvider and to an arbitrary NameVideoCompany, and then invokes remote function calls on the objects that describe the object properties.

This example includes the following source files:

Header files: Naming.hh, NamingClient.hh, NamingServer.hh, NamingVideoSupplier.hh, VideoCompany.hh, VideoServiceProvider.hh, and VideoSupplier.hh

Code files: Naming.cpp, NamingClient.cpp, NamingServer.cpp, NamingVideoSupplier.cpp, VideoCompany.cpp, VideoServiceProvider.cpp, and VideoSupplier.cpp

Utilities: Accessor.hh, Accessor.cpp, ObjectAdapter.hh, and ObjectAdapter.cpp,

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. Make a local copy of the <TAO install dir>/examples directory.
  4. Change to the <Local Copy>/cc directory.
  5. 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. Make a local copy of the <TAO install dir>\examples directory.
  3. Change to the <Local Copy>\cc\Common directory.
  4. A global example Microsoft Visual C++ project has been provided. This is called <Local Copy>\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 | SetActive Configuration option.
  5. Build the Common files.
  6. Build the Naming Video Example files.
  7. Build the Naming Video Client files.
  8. Build the Naming Video Server files.

How to Run This Example

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

LD_LIBRARY_PATH=<Local Copy>/cc/Common:<Local Copy>/cc/Naming/video:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH

Change to <local copy>/cc/Naming/video/server

Windows NT: Open a command prompt window and ensure that your path contains:

<TAO install dir>\lib;<Local Copy>\cc\bin

Ensure that the OpenFusion Naming Service is running. In order to run the OpenFusion Naming 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.

Start the server:

namingvideoserver -ORBInitRef NameService=file://<OF_INSTALL_DIR>/domains/OpenFusion/localhost/NameService/NameSingleton/NameSingleton.ior

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

The server will respond with the prompt "Ready..." when it is ready to receive remote function calls.

On UNIX, change to <Local copy>/cc/Naming/video/client directory.

In a new window, ensure that all environment variables are set up as above and start the client:

namingvideoclient -ORBInitRef NameService=file://<OF_INSTALL_DIR>/domains/OpenFusion/localhost/NameService/NameSingleton/NameSingleton.ior

This will resolve the Naming Service and, from a context, the service provider reference and an arbitrary video-supply company reference. The client will then make a remote function call to discover what video titles are on offer by that company.


PrismTech TOP
Top