org.objectweb.david.libs.helpers
Class RMIUtilDelegate

java.lang.Object
  |
  +--org.objectweb.david.libs.helpers.RMIUtilDelegate
All Implemented Interfaces:
Constants, UtilDelegate

public class RMIUtilDelegate
extends Object
implements UtilDelegate, Constants

Delegate class for javax.rmi.CORBA.Util.

This class is parameterized using elements of the bootstrap context:


Fields inherited from interface org.objectweb.david.libs.binding.orbs.Constants
corba_object_id, corba_prefix, TC_any, TC_boolean, TC_char, TC_double, TC_float, TC_long, TC_longdouble, TC_longlong, TC_null, TC_Object, TC_octet, TC_Principal, TC_short, TC_string, tc_table, TC_TypeCode, TC_ulong, TC_ulonglong, TC_ushort, TC_void, TC_wchar, TC_wstring
 
Constructor Summary
RMIUtilDelegate()
          Constructs a new RMIUtilDelegate.
 
Method Summary
 Object copyObject(Object obj, ORB orb)
          This method is used by local stubs to copy an actual parameter, result object or exception.
 Object[] copyObjects(Object[] obj_array, ORB orb)
          This method do the same as above on multiple objects,preserving sharing among these objects.
 ValueHandler createValueHandler()
          This method returns a singleton instance of a class that implements the ValueHandler interface.
 String getCodebase(Class classe)
          This method returns the codebase for the Class object classe as a space-separated list of URLs.
 Tie getTie(Remote target)
          This method returns the Tie object for an implementation object target, or null if no Tie is registered for the target object.
 boolean isLocal(Stub s)
          This method has the same semantics as the ObjectImpl._is_local() method, except that it can throw a RemoteException.
 Class loadClass(String name, String code_base, ClassLoader context)
          This method loads a java class of the provided name, using additional information passed in the code_base and context parameters.
 RemoteException mapSystemException(SystemException ex)
          This method maps a CORBA system exception to a RemoteException
 Object readAny(InputStream in)
          This method reads a GIOP any from the input stream inand unmarshals it as a java object.
 void registerTarget(Tie tie, Remote target)
          This method is needed to support unexportObject, because it takes a target implementation object as its parameter, it is necessary for the Util class to maintain a table mapping target objects back to their associated Ties.
 void unexportObject(Remote target)
          This method deactivates an implementation object and remove its associated Tie from the table maintained by the Util class.
 RemoteException wrapException(Throwable obj)
          The wrapException method wraps an exception thrown by an implementation method.
 void writeAbstractObject(OutputStream out, Object obj)
          This method is another similar utility method for used by stubs.
 void writeAny(OutputStream out, Object object)
          This method writes the java object object to the output stream out in the form of a CORBA any.
 void writeRemoteObject(OutputStream out, Object obj)
          This method is an utility method for use by stubs when writing an RMI/IDL object reference to an output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RMIUtilDelegate

public RMIUtilDelegate()
Constructs a new RMIUtilDelegate.
Method Detail

mapSystemException

public RemoteException mapSystemException(SystemException ex)
This method maps a CORBA system exception to a RemoteException
Specified by:
mapSystemException in interface UtilDelegate
Parameters:
ex - a CORBA system exception.
Returns:
an RMI RemoteException.

writeAny

public void writeAny(OutputStream out,
                     Object object)
This method writes the java object object to the output stream out in the form of a CORBA any.
Specified by:
writeAny in interface UtilDelegate
Parameters:
out - a CORBA output stream;
object - a java object.

readAny

public Object readAny(InputStream in)
This method reads a GIOP any from the input stream inand unmarshals it as a java object.
Specified by:
readAny in interface UtilDelegate
Parameters:
in - a CORBA input stream.
Returns:
a java object.

writeRemoteObject

public void writeRemoteObject(OutputStream out,
                              Object obj)
This method is an utility method for use by stubs when writing an RMI/IDL object reference to an output stream.
Specified by:
writeRemoteObject in interface UtilDelegate
Parameters:
out - a CORBA output stream;
obj - an RMI/IDL object reference.

writeAbstractObject

public void writeAbstractObject(OutputStream out,
                                Object obj)
This method is another similar utility method for used by stubs.
Specified by:
writeAbstractObject in interface UtilDelegate
Parameters:
out - a CORBA output stream;
obj - an RMI/IDL abstract object.

registerTarget

public void registerTarget(Tie tie,
                           Remote target)
This method is needed to support unexportObject, because it takes a target implementation object as its parameter, it is necessary for the Util class to maintain a table mapping target objects back to their associated Ties.
Specified by:
registerTarget in interface UtilDelegate
Parameters:
tie - an RMI/IDL skeleton.
target - an RMI/IDL server implementation.

unexportObject

public void unexportObject(Remote target)
This method deactivates an implementation object and remove its associated Tie from the table maintained by the Util class.
Specified by:
unexportObject in interface UtilDelegate
Parameters:
target - an RMI/IDL server implementation.

getTie

public Tie getTie(Remote target)
This method returns the Tie object for an implementation object target, or null if no Tie is registered for the target object.
Specified by:
getTie in interface UtilDelegate
Parameters:
target - an RMI/IDL server implementation.
Returns:
the associated Tie.

createValueHandler

public ValueHandler createValueHandler()
This method returns a singleton instance of a class that implements the ValueHandler interface.
Specified by:
createValueHandler in interface UtilDelegate
Returns:
an implementation of the ValueHandler interface.

wrapException

public RemoteException wrapException(Throwable obj)
The wrapException method wraps an exception thrown by an implementation method. It returns the corresponding client-side exception.
Specified by:
wrapException in interface UtilDelegate
Parameters:
obj - an exception thrown by an implementation method.
Returns:
the corresponding client-side exception.

copyObject

public Object copyObject(Object obj,
                         ORB orb)
                  throws RemoteException
This method is used by local stubs to copy an actual parameter, result object or exception.
Specified by:
copyObject in interface UtilDelegate
Parameters:
obj - a parameter;
orb - a CORBA ORB;
Returns:
a copy of obj.
Throws:
RemoteException - if something goes wrong.

copyObjects

public Object[] copyObjects(Object[] obj_array,
                            ORB orb)
                     throws RemoteException
This method do the same as above on multiple objects,preserving sharing among these objects.
Specified by:
copyObjects in interface UtilDelegate
Parameters:
obj_array - an array of Java objects.
orb - a CORBA ORB.
Returns:
a copy of obj_array.
Throws:
RemoteException - if something goes wrong.

isLocal

public boolean isLocal(Stub s)
                throws RemoteException
This method has the same semantics as the ObjectImpl._is_local() method, except that it can throw a RemoteException.
Specified by:
isLocal in interface UtilDelegate
Parameters:
s - a stub;
Returns:
true if the implementation of the target object may be accessed locally, false otherwise.
Throws:
RemoteException - if something goes wrong.

getCodebase

public String getCodebase(Class classe)
This method returns the codebase for the Class object classe as a space-separated list of URLs.
Specified by:
getCodebase in interface UtilDelegate
Parameters:
classe - a Class object.
Returns:
a String representing its codebase.

loadClass

public Class loadClass(String name,
                       String code_base,
                       ClassLoader context)
                throws ClassNotFoundException
This method loads a java class of the provided name, using additional information passed in the code_base and context parameters.
Specified by:
loadClass in interface UtilDelegate
Parameters:
name - the name of the class to load;
code_base - a code base indication;
context - a class loader indication;
Returns:
the loaded Class.
Throws:
ClassNotFoundException - if the class could not be found.