Mapping Clients  «Prev  Next»
Lesson 5 Skeletons: Inheritance-based implementation
Objective Use inheritance-based skeletons.

Skeletons and Inheritance-based Implementation

Hooking an implementation object into a CORBA system requires hooking it up to a skeleton, which then provides a connection to the communications plumbing that is the ORB. The simplest way to hook an implementation class into a skeleton is through inheritance.
In the CORBA specification version 3.4, skeleton classes are indeed associated with the `org.omg.PortableServer.Servant` base class. In CORBA, the `Servant` class serves as the base class for user-implemented servants. Specifically, skeleton classes generated for server-side implementations of CORBA objects inherit from `org.omg.PortableServer.Servant`.However, the `DynamicImplementation` class is an older feature from earlier CORBA versions. In CORBA 3.4, `DynamicImplementation` is largely deprecated in favor of the Portable Object Adapter (POA) model, which uses the `Servant` base class directly. Thus, for CORBA version 3.4, the modern and recommended way involves extending `org.omg.PortableServer.Servant` and using POA to connect the servant to the ORB.

Corba Skeletons

Skeleton classes themselves inherit from the org.omg.PortableServer.Servant base class (via DynamicImplementation, for DSI-based skeletons). They also implement the corresponding operations interface, the methods of which must be implemented by the subclassing implementation object. The skeleton contains dispatching code and utility methods, which are inherited by implementation subclasses.
  • Compactly Stated: In a nutshell, you write inheritance-based implementations by:
    1. Making your implementation class extend the skeleton class
    2. Implementing all the methods inherited from the given operations interface

Inheritance-based skeleton hierarchy
Inheritance-based skeleton hierarchy

Let us look at a concrete example by writing an inheritance-based implementation class for the Weather Service from the previous lesson.
We will extend the POA_WeatherService skeleton and implement the methods from the WeatherServiceOperations interface shown previously:
package weather;
//Inheritance based Implementation
public class WeatherServiceImpl extends POA_WeatherService{
 public java.lang.String getReport(java.lang.String city) {
  return "Sunny with a chance of objects";
 }
}

The obvious benefit of this approach is simplicity, because an instance of the implementation is its own skeleton via inheritance.
In the next lesson, you will learn to use the alternative approach of writing delegation-based implementation classes.

SEMrush Software