Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JavaTM 2 Platform Std. Ed. v1.3.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.rmi.CORBA
Class Util

    java.lang.Object
      |
      +--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` | `createValueHandler()` Returns a singleton instance of a class that implements the `ValueHandler` interface.
`static String` | `getCodebase(Class clz)` 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)` Returns true if the stub is in the same ORB instance as is the servant.
`static Class` | `loadClass(String className, String remoteCodebase, ClassLoader loader)` Returns a class instance for the specified class.
`static RemoteException` | `mapSystemException(SystemException ex)` Maps a SystemException to a RemoteException.
`static Object` | `readAny(InputStream in)` Reads a java.lang.Object as a CORBA any.
`static void` | `registerTarget(Tie tie, Remote target)` Registers a target for a tie.
`static void` | `unexportObject(Remote target)` Removes the associated tie from an internal table and calls `Tie.deactivate()` to deactivate the object.
`static RemoteException` | `wrapException(Throwable orig)` Wraps an exception thrown by an implementation method.
`static void` | `writeAbstractObject(OutputStream out, Object obj)` Writes a java.lang.Object as either a value or a CORBA Object.
`static void` | `writeAny(OutputStream out, Object obj)` Writes any java.lang.Object as a CORBA any.
`static void` | `writeRemoteObject(OutputStream out, Object obj)` 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

### mapSystemException

    public static RemoteException mapSystemException(SystemException ex)

  Maps a SystemException to a RemoteException.
  Parameters:
    `ex` - the SystemException to map.
  Returns:
    the mapped exception.

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

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

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

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

### registerTarget

    public static void registerTarget(Tie tie,
                                      Remote target)

  Registers a target for a tie. Adds the tie to an internal table and calls `Tie.setTarget(java.rmi.Remote)` on the tie object.
  Parameters:
    `tie` - the tie to register.
    `target` - the target for the tie.

### unexportObject

    public static void unexportObject(Remote target)

  Removes the associated tie from an internal table and calls `Tie.deactivate()` to deactivate the object.
  Parameters:
    `target` - the object to unexport.

### getTie

    public static Tie getTie(Remote target)

  Returns the tie (if any) for a given target object.
  Returns:
    the tie or null if no tie is registered for the given target.

### createValueHandler

    public static ValueHandler createValueHandler()

  Returns a singleton instance of a class that implements the `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.

### loadClass

    public static Class loadClass(String className,
                                  String remoteCodebase,
                                  ClassLoader loader)
                           throws ClassNotFoundException

  Returns a class instance for the specified class.
  Parameters:
    `className` - the name of the class.
    `remoteCodebase` - a space-separated list of URLs at which the class might be found. May be null.
    `loadingContext` - a class whose ClassLoader may be used to load the class if all other methods fail.
  Returns:
    the `Class` object representing the loaded class.
  Throws:
    `ClassNotFoundException` - if class cannot be loaded.

### isLocal

    public static boolean isLocal(Stub stub)
                           throws RemoteException

  Returns true if the stub is in the same ORB instance as is the servant. This method is equivalent to `ObjectImpl._is_local()` except that it throws a RemoteException instead of a SystemException.
  Parameters:
    `stub` - the stub to test.
  Returns:
    true if local, false if not.
  Throws:
    `RemoteException` - if stub has not been connected to an ORB.

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

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

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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JavaTM 2 Platform Std. Ed. v1.3.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.