This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.rmi.CORBA
class Util

java.lang.Object extended by javax.rmi.CORBA.Util

public class Util
extends Object

Provides utility methods that can be used by stubs and ties to perform common operations.


Method Summary
static Object
copyObject(Object obj, ORB orb)

          Copies or connects an object.
static Object[]
copyObjects(Object[] obj, ORB orb)

          Copies or connects an array of objects.
static ValueHandler

          Returns a singleton instance of a class that implements the javax.rmi.CORBA.ValueHandler interface.
static String

          Returns the codebase, if any, for the given class.
static Tie
getTie(Remote target)

          Returns the tie (if any) for a given target object.
static boolean
isLocal(Stub stub)

          The isLocal method has the same semantics as the ObjectImpl._is_local method, except that it can throw a RemoteException.
static Class
loadClass(String className, String remoteCodebase, ClassLoader loader)

          Returns a class instance for the specified class.
static RemoteException

          Maps a SystemException to a RemoteException.
static Object

          Reads a java.lang.Object as a CORBA any.
static void
registerTarget(Tie tie, Remote target)

          Registers a target for a tie.
static void

          Removes the associated tie from an internal table and calls javax.rmi.CORBA.Tie.deactivate to deactivate the object.
static RemoteException

          Wraps an exception thrown by an implementation method.
static void

          Writes a java.lang.Object as either a value or a CORBA Object.
static void

          Writes any java.lang.Object as a CORBA any.
static void

          Writes a java.lang.Object as a CORBA Object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

copyObject

public static Object copyObject(Object obj,
                                ORB orb)
                         throws RemoteException
Copies or connects an object. Used by local stubs to copy an actual parameter, result object, or exception.

Parameters:
obj - the object to copy.
orb - the ORB.
Returns:
the copy or connected object.
Throws:
RemoteException - if the object could not be copied or connected.

copyObjects

public static Object[] copyObjects(Object[] obj,
                                   ORB orb)
                            throws RemoteException
Copies or connects an array of objects. Used by local stubs to copy any number of actual parameters, preserving sharing across parameters as necessary to support RMI semantics.

Parameters:
obj - the objects to copy or connect.
orb - the ORB.
Returns:
the copied or connected objects.
Throws:
RemoteException - if any object could not be copied or connected.

createValueHandler

public static ValueHandler createValueHandler()
Returns a singleton instance of a class that implements the {@link ValueHandler} interface.

Returns:
a class which implements the ValueHandler interface.

getCodebase

public static String getCodebase(Class clz)
Returns the codebase, if any, for the given class.

Parameters:
clz - the class to get a codebase for.
Returns:
a space-separated list of URLs, or null.

getTie

public static Tie getTie(Remote target)
Returns the tie (if any) for a given target object.

Parameters:
target
Returns:
the tie or null if no tie is registered for the given target.

isLocal

public static boolean isLocal(Stub stub)
                       throws RemoteException
The isLocal method has the same semantics as the ObjectImpl._is_local method, except that it can throw a RemoteException. The _is_local() method is provided so that stubs may determine if a particular object is implemented by a local servant and hence local invocation APIs may be used.

Parameters:
stub - the stub to test.
Returns:
The _is_local() method returns true if the servant incarnating the object is located in the same process as the stub and they both share the same ORB instance. The _is_local() method returns false otherwise. The default behavior of _is_local() is to return false.
Throws:
RemoteException - The Java to IDL specification does not specify the conditions that cause a RemoteException to be thrown.

loadClass

public static Class loadClass(String className,
                              String remoteCodebase,
                              ClassLoader loader)
                       throws ClassNotFoundException
Returns a class instance for the specified class.

The spec for this method is the "Java to IDL language mapping", ptc/00-01-06.

In Java SE Platform, this method works as follows:


mapSystemException

public static RemoteException mapSystemException(SystemException ex)
Maps a SystemException to a RemoteException.

Parameters:
ex - the SystemException to map.
Returns:
the mapped exception.

readAny

public static Object readAny(InputStream in)
Reads a java.lang.Object as a CORBA any.

Parameters:
in - the stream from which to read the any.
Returns:
the object read from the stream.

registerTarget

public static void registerTarget(Tie tie,
                                  Remote target)
Registers a target for a tie. Adds the tie to an internal table and calls {@link Tie#setTarget} on the tie object.

Parameters:
tie - the tie to register.
target - the target for the tie.

unexportObject

public static void unexportObject(Remote target)
                           throws NoSuchObjectException
Removes the associated tie from an internal table and calls {@link Tie#deactivate} to deactivate the object.

Parameters:
target - the object to unexport.
Throws:
NoSuchObjectException

wrapException

public static RemoteException wrapException(Throwable orig)
Wraps an exception thrown by an implementation method. It returns the corresponding client-side exception.

Parameters:
orig - the exception to wrap.
Returns:
the wrapped exception.

writeAbstractObject

public static void writeAbstractObject(OutputStream out,
                                       Object obj)
Writes a java.lang.Object as either a value or a CORBA Object. If obj is a value object or a stub object, it is written to out.write_abstract_interface(java.lang.Object). If obj is an exported RMI-IIOP server object, the tie is found and wired to obj, then written to out.write_abstract_interface(java.lang.Object).

Parameters:
out - the stream in which to write the object.
obj - the object to write.

writeAny

public static void writeAny(OutputStream out,
                            Object obj)
Writes any java.lang.Object as a CORBA any.

Parameters:
out - the stream in which to write the any.
obj - the object to write as an any.

writeRemoteObject

public static void writeRemoteObject(OutputStream out,
                                     Object obj)
Writes a java.lang.Object as a CORBA Object. If obj is an exported RMI-IIOP server object, the tie is found and wired to obj, then written to out.write_Object(org.omg.CORBA.Object). If obj is a CORBA Object, it is written to out.write_Object(org.omg.CORBA.Object).

Parameters:
out - the stream in which to write the object.
obj - the object to write.


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.