javax.rmi.CORBA
Class Stub

java.lang.Object
  extended by org.omg.CORBA.portable.ObjectImpl
      extended by org.omg.CORBA_2_3.portable.ObjectImpl
          extended by javax.rmi.CORBA.Stub
All Implemented Interfaces:
Serializable, Object
Direct Known Subclasses:
_Remote_Stub

public abstract class Stub
extends ObjectImpl
implements Serializable

A Stub descendants provide access to the object on the client side. This base class implements methods, required for remote or local invocation using CORBA mechanisms. The most of the functionality is forwarded to the stub delegate. This delegate can be altered by setting the system property "javax.rmi.CORBA.StubClass" to the name of the alternative class that must implement StubDelegate. Hence Stub contains two delegates, one for Stub-related operations and another inherited from the ObjectImpl.

See Also:
Serialized Form

Constructor Summary
Stub()
           
 
Method Summary
 void connect(ORB orb)
           Finds the suitable Tie for this Stub and connects it to the given ORB.
 boolean equals(Object obj)
          The stubs are equal if they point to the same remote object.
 int hashCode()
          Returns the same hashcode for all stubs that point to the same remote object.
 String toString()
          Get the string representation of this Stub.
 
Methods inherited from class org.omg.CORBA_2_3.portable.ObjectImpl
_get_codebase
 
Methods inherited from class org.omg.CORBA.portable.ObjectImpl
_create_request, _create_request, _duplicate, _get_delegate, _get_domain_managers, _get_interface_def, _get_policy, _hash, _ids, _invoke, _is_a, _is_equivalent, _is_local, _non_existent, _orb, _release, _releaseReply, _request, _request, _servant_postinvoke, _servant_preinvoke, _set_delegate, _set_policy_override
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Stub

public Stub()
Method Detail

hashCode

public int hashCode()
Returns the same hashcode for all stubs that point to the same remote object.

Overrides:
hashCode in class Object
Returns:
the hash code for this Object
See Also:
Object.equals(Object), System.identityHashCode(Object)

equals

public boolean equals(Object obj)
The stubs are equal if they point to the same remote object.

Overrides:
equals in class ObjectImpl
Parameters:
obj - the other object to compare.
Returns:
true if the objects are equal.
See Also:
Object.hashCode()

toString

public String toString()
Get the string representation of this Stub.

Overrides:
toString in class ObjectImpl
Returns:
the CORBA IOR reference.
See Also:
Object.getClass(), Object.hashCode(), Class.getName(), Integer.toHexString(int)

connect

public void connect(ORB orb)
             throws RemoteException

Finds the suitable Tie for this Stub and connects it to the given ORB. The tie is found by the name pattern. If the found tie is derived from org.omg.CORBA.PortableServer.Servant, it is connected to the root POA, also activating it (if not already active).

This method does not allow to specify, to which POA the found Tie must be connected and requires to use the deprecated method ORB.connect(org.omg.CORBA.Object). Many useful POA features remain unaccessible. A better alternative it might be to generate a org.omg.CORBA.PortableServer.Servant - derived Tie (-poa key in rmic) and connect it to POA in one of the many ways, listed in the description of the orb.omg.PortableServer package). The obtained CORBA object can be narrowed into stub using PortableRemoteObject.narrow(java.lang.Object, java.lang.Class).

It is frequently easier to call PortableRemoteObject.connect(java.rmi.Remote, java.rmi.Remote) rather than this method.

Parameters:
orb - the ORB where the Stub must be connected.
Throws:
RemoteException - if the stub is already connected to some other ORB. If the stub is already connected to the ORB that was passed as parameter, the method returns without action.
BAD_PARAM - if the name of this stub does not match the stub name pattern, "_*_Stub" or if the Tie class, "_*Impl_Tie", does not exists or an instance of this class cannot be instantiated.