8.7 A Closer Look at Object Adapters

In addition to the name service and naming context object, the server in Program 8.3 also uses a portable object adapter. Recall from Figure 8-6 that the adapter acts as a kind of middleman between the ORB and the servant object that actually does the work of the CORBA object. We can compare a servant object to a ghost writer that writes a book on behalf of a celebrity. The publicists, marketers, and lawyers interact with the celebrity. The celebrity gets all the credit, but the ghost writer does the actual work and writing involved. The CORBA object publishes an interface to the outside world and is the celebrity in a CORBA program. The client or producer program interacts with the interface that the CORBA object provides, however, it's the servant object playing the part of the ghost writer that actually does the real work. The servant object has its own protocol. This protocol might be different from the one presented by the CORBA object. The CORBA object might present a C++ interface to the client. The servant object might be implemented in Java, Smalltalk, Fortran and so on. The object adapter provides an interface to the servant object. It adapts the interface so that the implementation of the servant object is transparent to the ORB and the client program. A CORBA implementation will normally have support for two types of object adapters: the Basic Object Adapter (BOA) and the Portable Object Adapter (POA). The BOA was the original adapter specified by the CORBA standard. The POA was designed to replace the BOA and is considerably more flexible and most commonly used. The BOA is a barebones adapter that has minimal capabilities. However, the BOA can be used to activate object implementations based on information stored in the Implementation Repository. Table 8-4 contains some of the commonly found elements in an Implementation Repository.

The BOA uses the activation mode and the path from the Implementation Repository to start the execution of a producer or server object. Although some of the simpler examples in this chapter used the BOA, we recommend that you use the POA for any serious CORBA development. The POA:

  • Supports transparent object activation

  • Supports transient objects

  • Supports implicit activation of servant objects

  • Supports persistent objects across server boundaries

Table 8-4. Some Commonly Found Elements in an Implementation Repository

Implementation Repository Elements

Description

object name

Unique identifier for each object.

activation mode

Shared, unshared, persistent, permethod library.

path

Name and path of the binary.

list of repository IDs

 

Perhaps the most important function of the POA is to interact with servant objects. The CORBA specification defines a servant accordingly :

A servant is a programming language object or entity that implements requests on one or more objects. Servants generally exist within the context of a server process. Requests made on an object's references are mediated by the ORB and transformed into invocations on a particular servant. In the course of an object's lifetime it may be associated with multiple servants.

Every servant object will have at least one POA. However, other configurations are possible. Figure 8-9 shows the configuration possibilities between POAs and servants.

Figure 8-9. Configuration possibilities between POAs and servants.

graphics/08fig09.gif

POAs are managed in part by POA manager objects. The CORBA specification defines a POA manager accordingly.

A POA manager is an object that encapsulates the processing state of one or more POAs. Using operation on a POA manager, the developer can cause requests for the associated POAs to be queued or discarded. The developer can also use the POA manager to deactivate the POAs.

The server in Program 8.3 provides a simple example of how to use POAs and POA manager objects. A complete discussion of the POA is beyond the scope of this book. For a thorough discussion of POAs, see Advanced CORBA Programming with C++ by Michi Henning and Steve Vinoski. The MICO distribution also contains several examples of how to use some of the more advanced features of the POA.



Parallel and Distributed Programming Using C++
Parallel and Distributed Programming Using C++
ISBN: 0131013769
EAN: 2147483647
Year: 2002
Pages: 133

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net