/*
* @(#)Util.java 1.47 06/08/25
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
/*
* Licensed Materials - Property of IBM
* RMI-IIOP v1.0
* Copyright IBM Corp. 1998 1999 All Rights Reserved
*
* US Government Users Restricted Rights - Use, duplication or
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
package javax.rmi.CORBA;
import java.rmi.RemoteException;
import org.omg.CORBA.ORB;
import org.omg.CORBA.INITIALIZE;
import org.omg.CORBA.SystemException;
import org.omg.CORBA.Any;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.ObjectImpl;
import javax.rmi.CORBA.Tie;
import java.rmi.Remote;
import java.io.File;
import java.io.FileInputStream;
import java.net.MalformedURLException ;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Properties;
import java.rmi.server.RMIClassLoader;
import com.sun.corba.se.impl.orbutil.GetPropertyAction;
/**
* Provides utility methods that can be used by stubs and ties to
* perform common operations.
*/
public class Util {
// This can only be set at static initialization time (no sync necessary).
private static javax.rmi.CORBA.UtilDelegate utilDelegate = null;
private static final String UtilClassKey = "javax.rmi.CORBA.UtilClass";
private static final String defaultUtilImplName =
"com.sun.corba.se.impl.javax.rmi.CORBA.Util";
static {
utilDelegate = (javax.rmi.CORBA.UtilDelegate)
createDelegateIfSpecified(UtilClassKey, defaultUtilImplName);
}
private Util(){}
/**
* Maps a SystemException to a RemoteException.
* @param ex the SystemException to map.
* @return the mapped exception.
*/
public static RemoteException mapSystemException(SystemException ex) {
if (utilDelegate != null) {
return utilDelegate.mapSystemException(ex);
}
return null;
}
/**
* Writes any java.lang.Object as a CORBA any.
* @param out the stream in which to write the any.
* @param obj the object to write as an any.
*/
public static void writeAny(OutputStream out, Object obj) {
if (utilDelegate != null) {
utilDelegate.writeAny(out, obj);
}
}
/**
* Reads a java.lang.Object as a CORBA any.
* @param in the stream from which to read the any.
* @return the object read from the stream.
*/
public static Object readAny(InputStream in) {
if (utilDelegate != null) {
return utilDelegate.readAny(in);
}
return null;
}
/**
* Writes a java.lang.Object as a CORBA Object. If <code>obj</code> is
* an exported RMI-IIOP server object, the tie is found
* and wired to <code>obj</code>, then written to
=1= |