Class Util
java.lang.Object
com.sun.corba.se.impl.javax.rmi.CORBA.Util
- All Implemented Interfaces:
UtilDelegate
Provides utility methods that can be used by stubs and ties to
perform common operations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcleanUpTie(Tie cachedTie) copyObject(Object obj, ORB orb) Copies or connects an object.Object[]copyObjects(Object[] obj, ORB orb) Copies or connects an array of objects.Returns a singleton instance of a class that implements theValueHandlerinterface.getCodebase(Class clz) Returns the codebase, if any, for the given class.static UtilReturns the tie (if any) for a given target object.static booleanbooleanThe isLocal method has the same semantics as the ObjectImpl.loadClass(String className, String remoteCodebase, ClassLoader loader) Returns a class instance for the specified class.Maps a SystemException to a RemoteException.readAny(InputStream in) Reads a java.lang.Object as a CORBA any.voidregisterTarget(Tie tie, Remote target) Registers a target for a tie.voidunexportObject(Remote target) Removes the associated tie from an internal table and callsTie.deactivate()to deactivate the object.voidwrapException(Throwable orig) Wraps an exception thrown by an implementation method.voidwriteAbstractObject(OutputStream out, Object obj) Writes a java.lang.Object as either a value or a CORBA Object.voidwriteAny(OutputStream out, Object obj) Writes any java.lang.Object as a CORBA any.voidwriteRemoteObject(OutputStream out, Object obj) Writes a java.lang.Object as a CORBA Object.
-
Constructor Details
-
Util
public Util()
-
-
Method Details
-
getInstance
-
isInstanceDefined
public static boolean isInstanceDefined() -
unregisterTargetsForORB
-
mapSystemException
Maps a SystemException to a RemoteException.- Specified by:
mapSystemExceptionin interfaceUtilDelegate- Parameters:
ex- the SystemException to map.- Returns:
- the mapped exception.
-
writeAny
Writes any java.lang.Object as a CORBA any.- Specified by:
writeAnyin interfaceUtilDelegate- Parameters:
out- the stream in which to write the any.obj- the object to write as an any.
-
readAny
Reads a java.lang.Object as a CORBA any.- Specified by:
readAnyin interfaceUtilDelegate- Parameters:
in- the stream from which to read the any.- Returns:
- the object read from the stream.
-
writeRemoteObject
Writes a java.lang.Object as a CORBA Object. Ifobjis an exported RMI-IIOP server object, the tie is found and wired toobj, then written toout.write_Object(org.omg.CORBA.Object). Ifobjis a CORBA Object, it is written toout.write_Object(org.omg.CORBA.Object).- Specified by:
writeRemoteObjectin interfaceUtilDelegate- Parameters:
out- the stream in which to write the object.obj- the object to write.
-
writeAbstractObject
Writes a java.lang.Object as either a value or a CORBA Object. Ifobjis a value object or a stub object, it is written toout.write_abstract_interface(java.lang.Object). Ifobjis an exported RMI-IIOP server object, the tie is found and wired toobj, then written toout.write_abstract_interface(java.lang.Object).- Specified by:
writeAbstractObjectin interfaceUtilDelegate- Parameters:
out- the stream in which to write the object.obj- the object to write.
-
registerTarget
Registers a target for a tie. Adds the tie to an internal table and callsTie.setTarget(java.rmi.Remote)on the tie object.- Specified by:
registerTargetin interfaceUtilDelegate- Parameters:
tie- the tie to register.target- the target for the tie.
-
unexportObject
Removes the associated tie from an internal table and callsTie.deactivate()to deactivate the object.- Specified by:
unexportObjectin interfaceUtilDelegate- Parameters:
target- the object to unexport.- Throws:
NoSuchObjectException
-
cleanUpTie
- Throws:
NoSuchObjectException
-
getTie
Returns the tie (if any) for a given target object.- Specified by:
getTiein interfaceUtilDelegate- Returns:
- the tie or null if no tie is registered for the given target.
-
createValueHandler
Returns a singleton instance of a class that implements theValueHandlerinterface.- Specified by:
createValueHandlerin interfaceUtilDelegate- Returns:
- a class which implements the ValueHandler interface.
-
getCodebase
Returns the codebase, if any, for the given class.- Specified by:
getCodebasein interfaceUtilDelegate- Parameters:
clz- the class to get a codebase for.- Returns:
- a space-separated list of URLs, or null.
-
loadClass
public Class loadClass(String className, String remoteCodebase, ClassLoader loader) throws ClassNotFoundException Returns a class instance for the specified class.- Specified by:
loadClassin interfaceUtilDelegate- 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
Classobject representing the loaded class. - Throws:
ClassNotFoundException- if class cannot be loaded.
-
isLocal
The isLocal method has the same semantics as the ObjectImpl._is_local method, except that it can throw a RemoteException. (no it doesn't but the spec says it should.) 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.- Specified by:
isLocalin interfaceUtilDelegate- 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 to specify the conditions that cause a RemoteException to be thrown.
-
wrapException
Wraps an exception thrown by an implementation method. It returns the corresponding client-side exception.- Specified by:
wrapExceptionin interfaceUtilDelegate- Parameters:
orig- the exception to wrap.- Returns:
- the wrapped exception.
-
copyObjects
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.- Specified by:
copyObjectsin interfaceUtilDelegate- 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
Copies or connects an object. Used by local stubs to copy an actual parameter, result object, or exception.- Specified by:
copyObjectin interfaceUtilDelegate- 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.
-