--- old/src/java.corba/share/classes/javax/rmi/CORBA/Util.java 2018-01-30 20:26:14.000000000 -0500 +++ /dev/null 2018-01-30 20:26:14.000000000 -0500 @@ -1,405 +0,0 @@ -/* - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -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.io.SerializablePermission; -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 final javax.rmi.CORBA.UtilDelegate utilDelegate; - private static final String UtilClassKey = "javax.rmi.CORBA.UtilClass"; - - static { - utilDelegate = (javax.rmi.CORBA.UtilDelegate)createDelegate(UtilClassKey); - } - - 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} is - * an exported RMI-IIOP server object, the tie is found - * and wired to {@code obj}, then written to - * {@code out.write_Object(org.omg.CORBA.Object)}. - * If {@code obj} is a CORBA Object, it is written to - * {@code out.write_Object(org.omg.CORBA.Object)}. - * @param out the stream in which to write the object. - * @param obj the object to write. - */ - public static void writeRemoteObject(OutputStream out, - java.lang.Object obj) { - - if (utilDelegate != null) { - utilDelegate.writeRemoteObject(out, obj); - } - - } - - /** - * Writes a java.lang.Object as either a value or a CORBA Object. - * If {@code obj} is a value object or a stub object, it is written to - * {@code out.write_abstract_interface(java.lang.Object)}. - * If {@code obj} is an exported - * RMI-IIOP server object, the tie is found and wired to {@code obj}, - * then written to {@code out.write_abstract_interface(java.lang.Object)}. - * @param out the stream in which to write the object. - * @param obj the object to write. - */ - public static void writeAbstractObject(OutputStream out, - java.lang.Object obj) { - - if (utilDelegate != null) { - utilDelegate.writeAbstractObject(out, obj); - } - } - - /** - * Registers a target for a tie. Adds the tie to an internal table and calls - * {@link Tie#setTarget} on the tie object. - * @param tie the tie to register. - * @param target the target for the tie. - */ - public static void registerTarget(javax.rmi.CORBA.Tie tie, - java.rmi.Remote target) { - - if (utilDelegate != null) { - utilDelegate.registerTarget(tie, target); - } - - } - - /** - * Removes the associated tie from an internal table - * and calls {@link Tie#deactivate} - * to deactivate the object. - * @param target the object to unexport. - */ - public static void unexportObject(java.rmi.Remote target) - throws java.rmi.NoSuchObjectException - { - - if (utilDelegate != null) { - utilDelegate.unexportObject(target); - } - - } - - /** - * Returns the tie (if any) for a given target object. - * @return the tie or null if no tie is registered for the given target. - */ - public static Tie getTie (Remote target) { - - if (utilDelegate != null) { - return utilDelegate.getTie(target); - } - return null; - } - - - /** - * Returns a singleton instance of a class that implements the - * {@link ValueHandler} interface. - * @return a class which implements the ValueHandler interface. - */ - public static ValueHandler createValueHandler() { - - isCustomSerializationPermitted(); - - if (utilDelegate != null) { - return utilDelegate.createValueHandler(); - } - return null; - } - - /** - * Returns the codebase, if any, for the given class. - * @param clz the class to get a codebase for. - * @return a space-separated list of URLs, or null. - */ - public static String getCodebase(java.lang.Class clz) { - if (utilDelegate != null) { - return utilDelegate.getCodebase(clz); - } - return null; - } - - /** - * 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: - *