Articles     Forum     Examples     Download     Open Source

 

PocoCapsule/C++ CORBA example: POA Server

Copyright(c) 2006, 2007 by Pocomatic Software LLC. All rights reserved.

Portable Object Adapter (POA) is the portable programming model for CORBA server applications. A POA instance encapsulates and scopes server policy settings of all its objects. These policies determine service qualities, properties and behaviors. The PocoCapsule/CORBA supports POA server application deployment with all OMG standardized POA policies. Non-OMG policies introduced by ORB vendors can also be added easily. Among a handful of OMG standardized POA policies, the most important policy is the request-processing policy. This policy determines the scenario that a POA server resolves target object servants on processing received requests.

The CORBA server application in this example covers all possible POA request-processing policy settings by the following four POAs:

Object references from this server are exported as corbaloc URLs, with URIs declared in the deployment descriptor.

The core CORBA server application deployment model of PocoCapsule/CORBA is almost explicitly mapped from the OMG POA programming model. This does not imply PocoCapsule/CORBA could not be comparable or more abstract than CCM. In fact, with PocoCapsule/C++'s DSM feature, users can easily define customized CORBA server application deployment models that abstract out the POA concept largely, if this abstraction is desirable. An example of this user defined CORBA server deployment model can be found in the ${POCOCAPSULE_DIR}/examples/corba/dsm-server directory.

Source Files

Greeting.idl: The IDL definition of the server's remote interface.

server.C: A simple container, used to deploy the server application.

client.C: A client application.

GreetingImpl.h and GreetingImpl.C: These files implement following plain old C++ CORBA artifacts:

setup.xml: This is the server's deployment descriptor. It describes following server structure:

Building this example

To build this example, the environment variable POCOCAPSULE_DIR should point to the PocoCapsule/C++ installed directory. Also, this example assumes an underneath ORB (e.g. VisiBroker/C++, TAO, etc.) is installed and its runtime and development environment (such as POCOCAPSULE_DIR, VBROKER_DIR or TAO_ROOT, etc. env variable) are set according to its product specification. Then, this example can be built by simply invoking gmake/make on linux/unix or nmake on windows.

Running this example

· Before starting the server, make sure the LD_LIBRARY_PATH (on linux and solaris) or the PATH (on windows) environment variable is set correctly to include the ${POCOCAPSULE_DIR}/lib directory and the ${VBROKREDIR}/lib (if VisiBroker is used) or the ${TAO_ROOT}/lib directory (if TAO is used).

· Start the server as:

prompt> server 

By default setting, on successful startup, server will print out all declared corbaloc URLs (namely, <object> elements, with specified uri attribute). In this server, object elements are declared with their uri attribute equal to “my-server-use-...”, the print out will be, for instance:

Server is ready, with URLs:
corbaloc::192.168.2.3:2809/my-server-use-aom-only
corbaloc::192.168.2.3:2809/my-server-use-default-servant
corbaloc::192.168.2.3:2809/my-server-use-servant-locator
corbaloc::192.168.2.3:2809/my-server-use-servant-activator

Here, the URI values “my-server-use-...” are declared in the beans descriptor setup.xml file.

· Start client: The server's corbaloc URLs should be used as the first command line argument when starting the client. For instance:

prompt> client corbaloc::192.168.2.3:2809/my-server-use-aom-only
....
prompt> client corbaloc::192.168.2.3:2809/my-server-use-default-servant
....
prompt> client corbaloc::192.168.2.3:2809/my-server-use-servant-locator
....
prompt> client corbaloc::192.168.2.3:2809/my-server-use-servant-activator
....

On success, the client sends multiple greeting messages to the server, and the server replies one to client on receiving each of them. Both sides will print out the greeting messages they received.

Back to the root page