javax.rmi.CORBA
Class Util

java.lang.Object
  |
  +--javax.rmi.CORBA.Util

public class Util
extends Object

This class provides some utility methods to manage RMI objects and mechanisms over GIOP.


Constructor Summary
Util()
           
 
Method Summary
static Object copyObject(Object obj, ORB orb)
          This method is used by local stubs to copy an actual parameter, result object or exception.
static Object[] copyObjects(Object[] obj, ORB orb)
          This method do the same as above on multiple objects,preserving sharing among these objects.
static ValueHandler createValueHandler()
          This method returns a singleton instance of a class that implements the ValueHandler interface.
static String getCodebase(Class clz)
          This method returns the codebase for the Class object clz as a space-separated list of URLs.
static 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.
static boolean isLocal(Stub s)
          This method has the same semantics as the ObjectImpl._is_local method, except that it can throw a RemoteException.
static 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.
static RemoteException mapSystemException(SystemException ex)
          This method maps a CORBA system exception to a RemoteException
static Object readAny(InputStream in)
          This method reads a GIOP any from the input stream in and unmarshals it as a java object.
static 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.
static void unexportObject(Remote target)
          This method deactivates an implementation object and remove its associated Tie from the table maintained by the Util class.
static RemoteException wrapException(Throwable obj)
          The wrapException method wraps an exception thrown by an implementation method.
static void writeAbstractObject(OutputStream out, Object obj)
          This method is another similar utility method for used by stubs.
static void writeAny(OutputStream out, Object obj)
          This method writes the java object obj to the output stream out in the form of a CORBA any.
static 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

Util

public Util()
Method Detail

mapSystemException

public static RemoteException mapSystemException(SystemException ex)
This method maps a CORBA system exception to a RemoteException
Parameters:
ex - a CORBA system exception.
Returns:
an RMI RemoteException.

writeAny

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

readAny

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

writeRemoteObject

public static 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.
Parameters:
out - a CORBA output stream;
obj - an RMI/IDL object reference.

writeAbstractObject

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

registerTarget

public static 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.
Parameters:
tie - an RMI/IDL skeleton.
target - an RMI/IDL server implementation.

unexportObject

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

getTie

public static 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.
Parameters:
target - an RMI/IDL server implementation.
Returns:
the associated Tie.

createValueHandler

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

wrapException

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

copyObject

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

copyObjects

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

isLocal

public static 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.
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 static String getCodebase(Class clz)
This method returns the codebase for the Class object clz as a space-separated list of URLs.
Parameters:
clz - a Class object.
Returns:
a String representing its codebase.

loadClass

public static 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.
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.