org.omg.PortableServer
Class Servant

java.lang.Object
  extended by org.omg.PortableServer.Servant
Direct Known Subclasses:
BindingIteratorPOA, DynamicImplementation, NamingContextExtPOA, NamingContextPOA, ServantActivatorPOA, ServantLocatorPOA

public abstract class Servant
extends Object

The servant is responsible for handling the method invocation on the target object. It can be one servant per object, or the same servant can support several (possibly all) objects, associated with the given POA.

Till JDK 1.3 inclusive, a typical IDL to java compiler generates an implementation base (name pattern _*ImplBase.java) that is derived from the ObjectImpl. Since JDK 1.4 the implementation base is derived from the Servant, also having a different name pattern (*POA.java). This suffix may be confusing, as the servant itself is not POA nor it is derived from it.

In both cases, the implementation base also inherits an interface, containing definitions of the application specific methods. The application programmer writes a child of the implementation base, implementing these methods for the application-specific functionality. The ObjectImpl is connected directly to the ORB. The Servant is connected to POA that can be obtained from the ORB.

If the servant is connected to more than one object, the exact object being currently served can be identified with _object_id().

The derivativ of Servant, being directly connected to serve requests, must inherit either from InvokeHandler or from DynamicImplementation).

The Servant type is a CORBA native type.

See Also:
POAOperations.servant_to_reference(Servant)

Constructor Summary
Servant()
           
 
Method Summary
abstract  String[] _all_interfaces(POA poa, byte[] object_ID)
          Get the repository ids of all interfaces, supported by the CORBA object, identified by the passed Id.
 POA _default_POA()
          Returns the root POA of the ORB instance, associated with this servant.
 Delegate _get_delegate()
          Get the delegate, where calls to some Servant methods are forwarded.
 Object _get_interface_def()
          Get the interface repository definition InterfaceDef for this Object.
 boolean _is_a(String repository_id)
          Checks if the passed servant is an instance of the given CORBA IDL type.
 boolean _non_existent()
          Determines if the server object for this reference has already been destroyed.
 byte[] _object_id()
          Return the invocation target object identifier as a byte array.
 ORB _orb()
          Returns the ORB that is directly associated with the given servant.
 POA _poa()
          Get POA that is directly associated with the given servant.
 void _set_delegate(Delegate a_delegate)
          Set the delegate for this servant.
 Object _this_object()
          Obtains the CORBA object reference that is a current invocation target for the given servant.
 Object _this_object(ORB an_orb)
          Obtains the CORBA object reference that is a current invocation target for the given servant.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Servant

public Servant()
Method Detail

_all_interfaces

public abstract String[] _all_interfaces(POA poa,
                                         byte[] object_ID)
Get the repository ids of all interfaces, supported by the CORBA object, identified by the passed Id. In the typical code the passed parameters are ignored, returning an array of repository ids, supported by the servant implementation.

Parameters:
poa - a POA of the given object.
object_ID - the object Id of the given object.
Returns:
an array, containing the repository ids.

_get_delegate

public final Delegate _get_delegate()
Get the delegate, where calls to some Servant methods are forwarded.


_get_interface_def

public Object _get_interface_def()
Get the interface repository definition InterfaceDef for this Object. By default, forwards request to the delegate.


_is_a

public boolean _is_a(String repository_id)
Checks if the passed servant is an instance of the given CORBA IDL type. By default, forwards the requet to the delegate.

Parameters:
repository_id - a repository ID, representing an IDL type for that the servant must be checked.
Returns:
true if the servant is an instance of the given type, false otherwise.

_non_existent

public boolean _non_existent()
Determines if the server object for this reference has already been destroyed. By default, forwards request to the delegate.

Returns:
true if the object has been destroyed, false otherwise.

_orb

public final ORB _orb()
Returns the ORB that is directly associated with the given servant. In this implementation, the method is overridden to return


_default_POA

public POA _default_POA()
Returns the root POA of the ORB instance, associated with this servant. It is the same POA that would be returned by resolving the initial reference "RootPOA" for that orb. By default, forwards request to the delegate.

See Also:
ORB.resolve_initial_references(java.lang.String)

_object_id

public final byte[] _object_id()
Return the invocation target object identifier as a byte array. This is typically used when the same servant serves multiple objects, and the object id can encapsulated the whole description of the object. This method returns correct values even when the same servant serves several objects in parallel threads. The ORB maintains the thread to invocation data map for all calls that are currently being processed.


_poa

public final POA _poa()
Get POA that is directly associated with the given servant. By default, forwards request to the delegate.


_set_delegate

public final void _set_delegate(Delegate a_delegate)
Set the delegate for this servant.


_this_object

public final Object _this_object(ORB an_orb)
Obtains the CORBA object reference that is a current invocation target for the given servant. This is important when the same servant serves multiple objects. If the servant is not yet connected to the passed orb, the method will try to connect it to that orb on POA, returned by the method _default_POA(). That method can be overridden to get poa where the object must be automatically connected when calling this method.

Parameters:
an_orb - the ORB with relate to that the object is requested.

_this_object

public final Object _this_object()
Obtains the CORBA object reference that is a current invocation target for the given servant. This is important when the same servant serves multiple objects. This method required the servant to be connected to a single orb, and a delegate set. This method returns correct values even when the same servant serves several objects in parallel threads. The ORB maintains the thread to invocation data map for all calls that are currently being processed.