org.omg.PortableServer

Class Servant

Known Direct Subclasses:
BindingIteratorPOA, DynamicImplementation, ForwardedServant, 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:
POA.servant_to_reference(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, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Details

_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.

_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.

_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.

_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.

_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

_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()
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.

_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.

Servant.java -- Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.