corba/src/share/classes/javax/rmi/CORBA/Stub.java
author ohair
Tue, 25 May 2010 15:52:11 -0700
changeset 5555 b2b5ed3f0d0d
parent 4 02bb8761fcce
child 21431 6f404f8e434c
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     1
/*
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
     2
 * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
02bb8761fcce Initial load
duke
parents:
diff changeset
     4
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
02bb8761fcce Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
4
02bb8761fcce Initial load
duke
parents:
diff changeset
    10
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
02bb8761fcce Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
02bb8761fcce Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
02bb8761fcce Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
02bb8761fcce Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
02bb8761fcce Initial load
duke
parents:
diff changeset
    16
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
02bb8761fcce Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
02bb8761fcce Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
02bb8761fcce Initial load
duke
parents:
diff changeset
    20
 *
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
    23
 * questions.
4
02bb8761fcce Initial load
duke
parents:
diff changeset
    24
 */
02bb8761fcce Initial load
duke
parents:
diff changeset
    25
02bb8761fcce Initial load
duke
parents:
diff changeset
    26
/*
02bb8761fcce Initial load
duke
parents:
diff changeset
    27
 * Licensed Materials - Property of IBM
02bb8761fcce Initial load
duke
parents:
diff changeset
    28
 * RMI-IIOP v1.0
02bb8761fcce Initial load
duke
parents:
diff changeset
    29
 * Copyright IBM Corp. 1998 1999  All Rights Reserved
02bb8761fcce Initial load
duke
parents:
diff changeset
    30
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
    31
 */
02bb8761fcce Initial load
duke
parents:
diff changeset
    32
02bb8761fcce Initial load
duke
parents:
diff changeset
    33
package javax.rmi.CORBA;
02bb8761fcce Initial load
duke
parents:
diff changeset
    34
02bb8761fcce Initial load
duke
parents:
diff changeset
    35
import org.omg.CORBA.ORB;
02bb8761fcce Initial load
duke
parents:
diff changeset
    36
import org.omg.CORBA.INITIALIZE;
02bb8761fcce Initial load
duke
parents:
diff changeset
    37
import org.omg.CORBA_2_3.portable.ObjectImpl;
02bb8761fcce Initial load
duke
parents:
diff changeset
    38
02bb8761fcce Initial load
duke
parents:
diff changeset
    39
import java.io.IOException;
02bb8761fcce Initial load
duke
parents:
diff changeset
    40
import java.rmi.RemoteException;
02bb8761fcce Initial load
duke
parents:
diff changeset
    41
import java.io.File;
02bb8761fcce Initial load
duke
parents:
diff changeset
    42
import java.io.FileInputStream;
02bb8761fcce Initial load
duke
parents:
diff changeset
    43
import java.net.MalformedURLException ;
02bb8761fcce Initial load
duke
parents:
diff changeset
    44
import java.security.AccessController;
02bb8761fcce Initial load
duke
parents:
diff changeset
    45
import java.security.PrivilegedAction;
02bb8761fcce Initial load
duke
parents:
diff changeset
    46
import java.util.Properties;
02bb8761fcce Initial load
duke
parents:
diff changeset
    47
import java.rmi.server.RMIClassLoader;
02bb8761fcce Initial load
duke
parents:
diff changeset
    48
02bb8761fcce Initial load
duke
parents:
diff changeset
    49
import com.sun.corba.se.impl.orbutil.GetPropertyAction;
02bb8761fcce Initial load
duke
parents:
diff changeset
    50
02bb8761fcce Initial load
duke
parents:
diff changeset
    51
02bb8761fcce Initial load
duke
parents:
diff changeset
    52
/**
02bb8761fcce Initial load
duke
parents:
diff changeset
    53
 * Base class from which all RMI-IIOP stubs must inherit.
02bb8761fcce Initial load
duke
parents:
diff changeset
    54
 */
02bb8761fcce Initial load
duke
parents:
diff changeset
    55
public abstract class Stub extends ObjectImpl
02bb8761fcce Initial load
duke
parents:
diff changeset
    56
    implements java.io.Serializable {
02bb8761fcce Initial load
duke
parents:
diff changeset
    57
02bb8761fcce Initial load
duke
parents:
diff changeset
    58
    private static final long serialVersionUID = 1087775603798577179L;
02bb8761fcce Initial load
duke
parents:
diff changeset
    59
02bb8761fcce Initial load
duke
parents:
diff changeset
    60
    // This can only be set at object construction time (no sync necessary).
02bb8761fcce Initial load
duke
parents:
diff changeset
    61
    private transient StubDelegate stubDelegate = null;
02bb8761fcce Initial load
duke
parents:
diff changeset
    62
    private static Class stubDelegateClass = null;
02bb8761fcce Initial load
duke
parents:
diff changeset
    63
    private static final String StubClassKey = "javax.rmi.CORBA.StubClass";
02bb8761fcce Initial load
duke
parents:
diff changeset
    64
    private static final String defaultStubImplName = "com.sun.corba.se.impl.javax.rmi.CORBA.StubDelegateImpl";
02bb8761fcce Initial load
duke
parents:
diff changeset
    65
02bb8761fcce Initial load
duke
parents:
diff changeset
    66
    static {
02bb8761fcce Initial load
duke
parents:
diff changeset
    67
        Object stubDelegateInstance = (Object) createDelegateIfSpecified(StubClassKey, defaultStubImplName);
02bb8761fcce Initial load
duke
parents:
diff changeset
    68
        if (stubDelegateInstance != null)
02bb8761fcce Initial load
duke
parents:
diff changeset
    69
            stubDelegateClass = stubDelegateInstance.getClass();
02bb8761fcce Initial load
duke
parents:
diff changeset
    70
02bb8761fcce Initial load
duke
parents:
diff changeset
    71
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
    72
02bb8761fcce Initial load
duke
parents:
diff changeset
    73
02bb8761fcce Initial load
duke
parents:
diff changeset
    74
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
    75
     * Returns a hash code value for the object which is the same for all stubs
02bb8761fcce Initial load
duke
parents:
diff changeset
    76
     * that represent the same remote object.
02bb8761fcce Initial load
duke
parents:
diff changeset
    77
     * @return the hash code value.
02bb8761fcce Initial load
duke
parents:
diff changeset
    78
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
    79
    public int hashCode() {
02bb8761fcce Initial load
duke
parents:
diff changeset
    80
02bb8761fcce Initial load
duke
parents:
diff changeset
    81
        if (stubDelegate == null) {
02bb8761fcce Initial load
duke
parents:
diff changeset
    82
            setDefaultDelegate();
02bb8761fcce Initial load
duke
parents:
diff changeset
    83
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
    84
02bb8761fcce Initial load
duke
parents:
diff changeset
    85
        if (stubDelegate != null) {
02bb8761fcce Initial load
duke
parents:
diff changeset
    86
            return stubDelegate.hashCode(this);
02bb8761fcce Initial load
duke
parents:
diff changeset
    87
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
    88
02bb8761fcce Initial load
duke
parents:
diff changeset
    89
        return 0;
02bb8761fcce Initial load
duke
parents:
diff changeset
    90
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
    91
02bb8761fcce Initial load
duke
parents:
diff changeset
    92
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
    93
     * Compares two stubs for equality. Returns <code>true</code> when used to compare stubs
02bb8761fcce Initial load
duke
parents:
diff changeset
    94
     * that represent the same remote object, and <code>false</code> otherwise.
02bb8761fcce Initial load
duke
parents:
diff changeset
    95
     * @param obj the reference object with which to compare.
02bb8761fcce Initial load
duke
parents:
diff changeset
    96
     * @return <code>true</code> if this object is the same as the <code>obj</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
    97
     *          argument; <code>false</code> otherwise.
02bb8761fcce Initial load
duke
parents:
diff changeset
    98
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
    99
    public boolean equals(java.lang.Object obj) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   100
02bb8761fcce Initial load
duke
parents:
diff changeset
   101
        if (stubDelegate == null) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   102
            setDefaultDelegate();
02bb8761fcce Initial load
duke
parents:
diff changeset
   103
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
   104
02bb8761fcce Initial load
duke
parents:
diff changeset
   105
        if (stubDelegate != null) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   106
            return stubDelegate.equals(this, obj);
02bb8761fcce Initial load
duke
parents:
diff changeset
   107
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
   108
02bb8761fcce Initial load
duke
parents:
diff changeset
   109
        return false;
02bb8761fcce Initial load
duke
parents:
diff changeset
   110
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   111
02bb8761fcce Initial load
duke
parents:
diff changeset
   112
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   113
     * Returns a string representation of this stub. Returns the same string
02bb8761fcce Initial load
duke
parents:
diff changeset
   114
     * for all stubs that represent the same remote object.
02bb8761fcce Initial load
duke
parents:
diff changeset
   115
     * @return a string representation of this stub.
02bb8761fcce Initial load
duke
parents:
diff changeset
   116
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
   117
    public String toString() {
02bb8761fcce Initial load
duke
parents:
diff changeset
   118
02bb8761fcce Initial load
duke
parents:
diff changeset
   119
02bb8761fcce Initial load
duke
parents:
diff changeset
   120
        if (stubDelegate == null) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   121
            setDefaultDelegate();
02bb8761fcce Initial load
duke
parents:
diff changeset
   122
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
   123
02bb8761fcce Initial load
duke
parents:
diff changeset
   124
        String ior;
02bb8761fcce Initial load
duke
parents:
diff changeset
   125
        if (stubDelegate != null) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   126
            ior = stubDelegate.toString(this);
02bb8761fcce Initial load
duke
parents:
diff changeset
   127
            if (ior == null) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   128
                return super.toString();
02bb8761fcce Initial load
duke
parents:
diff changeset
   129
            } else {
02bb8761fcce Initial load
duke
parents:
diff changeset
   130
                return ior;
02bb8761fcce Initial load
duke
parents:
diff changeset
   131
            }
02bb8761fcce Initial load
duke
parents:
diff changeset
   132
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
   133
        return super.toString();
02bb8761fcce Initial load
duke
parents:
diff changeset
   134
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   135
02bb8761fcce Initial load
duke
parents:
diff changeset
   136
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   137
     * Connects this stub to an ORB. Required after the stub is deserialized
02bb8761fcce Initial load
duke
parents:
diff changeset
   138
     * but not after it is demarshalled by an ORB stream. If an unconnected
02bb8761fcce Initial load
duke
parents:
diff changeset
   139
     * stub is passed to an ORB stream for marshalling, it is implicitly
02bb8761fcce Initial load
duke
parents:
diff changeset
   140
     * connected to that ORB. Application code should not call this method
02bb8761fcce Initial load
duke
parents:
diff changeset
   141
     * directly, but should call the portable wrapper method
02bb8761fcce Initial load
duke
parents:
diff changeset
   142
     * {@link javax.rmi.PortableRemoteObject#connect}.
02bb8761fcce Initial load
duke
parents:
diff changeset
   143
     * @param orb the ORB to connect to.
02bb8761fcce Initial load
duke
parents:
diff changeset
   144
     * @exception RemoteException if the stub is already connected to a different
02bb8761fcce Initial load
duke
parents:
diff changeset
   145
     * ORB, or if the stub does not represent an exported remote or local object.
02bb8761fcce Initial load
duke
parents:
diff changeset
   146
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
   147
    public void connect(ORB orb) throws RemoteException {
02bb8761fcce Initial load
duke
parents:
diff changeset
   148
02bb8761fcce Initial load
duke
parents:
diff changeset
   149
        if (stubDelegate == null) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   150
            setDefaultDelegate();
02bb8761fcce Initial load
duke
parents:
diff changeset
   151
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
   152
02bb8761fcce Initial load
duke
parents:
diff changeset
   153
        if (stubDelegate != null) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   154
            stubDelegate.connect(this, orb);
02bb8761fcce Initial load
duke
parents:
diff changeset
   155
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
   156
02bb8761fcce Initial load
duke
parents:
diff changeset
   157
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   158
02bb8761fcce Initial load
duke
parents:
diff changeset
   159
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   160
     * Serialization method to restore the IOR state.
02bb8761fcce Initial load
duke
parents:
diff changeset
   161
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
   162
    private void readObject(java.io.ObjectInputStream stream)
02bb8761fcce Initial load
duke
parents:
diff changeset
   163
        throws IOException, ClassNotFoundException {
02bb8761fcce Initial load
duke
parents:
diff changeset
   164
02bb8761fcce Initial load
duke
parents:
diff changeset
   165
        if (stubDelegate == null) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   166
            setDefaultDelegate();
02bb8761fcce Initial load
duke
parents:
diff changeset
   167
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
   168
02bb8761fcce Initial load
duke
parents:
diff changeset
   169
        if (stubDelegate != null) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   170
            stubDelegate.readObject(this, stream);
02bb8761fcce Initial load
duke
parents:
diff changeset
   171
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
   172
02bb8761fcce Initial load
duke
parents:
diff changeset
   173
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   174
02bb8761fcce Initial load
duke
parents:
diff changeset
   175
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   176
     * Serialization method to save the IOR state.
02bb8761fcce Initial load
duke
parents:
diff changeset
   177
     * @serialData The length of the IOR type ID (int), followed by the IOR type ID
02bb8761fcce Initial load
duke
parents:
diff changeset
   178
     * (byte array encoded using ISO8859-1), followed by the number of IOR profiles
02bb8761fcce Initial load
duke
parents:
diff changeset
   179
     * (int), followed by the IOR profiles.  Each IOR profile is written as a
02bb8761fcce Initial load
duke
parents:
diff changeset
   180
     * profile tag (int), followed by the length of the profile data (int), followed
02bb8761fcce Initial load
duke
parents:
diff changeset
   181
     * by the profile data (byte array).
02bb8761fcce Initial load
duke
parents:
diff changeset
   182
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
   183
    private void writeObject(java.io.ObjectOutputStream stream) throws IOException {
02bb8761fcce Initial load
duke
parents:
diff changeset
   184
02bb8761fcce Initial load
duke
parents:
diff changeset
   185
        if (stubDelegate == null) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   186
            setDefaultDelegate();
02bb8761fcce Initial load
duke
parents:
diff changeset
   187
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
   188
02bb8761fcce Initial load
duke
parents:
diff changeset
   189
        if (stubDelegate != null) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   190
            stubDelegate.writeObject(this, stream);
02bb8761fcce Initial load
duke
parents:
diff changeset
   191
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
   192
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   193
02bb8761fcce Initial load
duke
parents:
diff changeset
   194
    private void setDefaultDelegate() {
02bb8761fcce Initial load
duke
parents:
diff changeset
   195
        if (stubDelegateClass != null) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   196
            try {
02bb8761fcce Initial load
duke
parents:
diff changeset
   197
                 stubDelegate = (javax.rmi.CORBA.StubDelegate) stubDelegateClass.newInstance();
02bb8761fcce Initial load
duke
parents:
diff changeset
   198
            } catch (Exception ex) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   199
            // what kind of exception to throw
02bb8761fcce Initial load
duke
parents:
diff changeset
   200
            // delegate not set therefore it is null and will return default
02bb8761fcce Initial load
duke
parents:
diff changeset
   201
            // values
02bb8761fcce Initial load
duke
parents:
diff changeset
   202
            }
02bb8761fcce Initial load
duke
parents:
diff changeset
   203
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
   204
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   205
02bb8761fcce Initial load
duke
parents:
diff changeset
   206
    // Same code as in PortableRemoteObject. Can not be shared because they
02bb8761fcce Initial load
duke
parents:
diff changeset
   207
    // are in different packages and the visibility needs to be package for
02bb8761fcce Initial load
duke
parents:
diff changeset
   208
    // security reasons. If you know a better solution how to share this code
02bb8761fcce Initial load
duke
parents:
diff changeset
   209
    // then remove it from PortableRemoteObject. Also in Util.java
02bb8761fcce Initial load
duke
parents:
diff changeset
   210
    private static Object createDelegateIfSpecified(String classKey, String defaultClassName) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   211
        String className = (String)
02bb8761fcce Initial load
duke
parents:
diff changeset
   212
            AccessController.doPrivileged(new GetPropertyAction(classKey));
02bb8761fcce Initial load
duke
parents:
diff changeset
   213
        if (className == null) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   214
            Properties props = getORBPropertiesFile();
02bb8761fcce Initial load
duke
parents:
diff changeset
   215
            if (props != null) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   216
                className = props.getProperty(classKey);
02bb8761fcce Initial load
duke
parents:
diff changeset
   217
            }
02bb8761fcce Initial load
duke
parents:
diff changeset
   218
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
   219
02bb8761fcce Initial load
duke
parents:
diff changeset
   220
        if (className == null) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   221
            className = defaultClassName;
02bb8761fcce Initial load
duke
parents:
diff changeset
   222
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
   223
02bb8761fcce Initial load
duke
parents:
diff changeset
   224
        try {
02bb8761fcce Initial load
duke
parents:
diff changeset
   225
            return loadDelegateClass(className).newInstance();
02bb8761fcce Initial load
duke
parents:
diff changeset
   226
        } catch (ClassNotFoundException ex) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   227
            INITIALIZE exc = new INITIALIZE( "Cannot instantiate " + className);
02bb8761fcce Initial load
duke
parents:
diff changeset
   228
            exc.initCause( ex ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   229
            throw exc ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   230
        } catch (Exception ex) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   231
            INITIALIZE exc = new INITIALIZE( "Error while instantiating" + className);
02bb8761fcce Initial load
duke
parents:
diff changeset
   232
            exc.initCause( ex ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   233
            throw exc ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   234
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
   235
02bb8761fcce Initial load
duke
parents:
diff changeset
   236
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   237
02bb8761fcce Initial load
duke
parents:
diff changeset
   238
    private static Class loadDelegateClass( String className )  throws ClassNotFoundException
02bb8761fcce Initial load
duke
parents:
diff changeset
   239
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   240
        try {
02bb8761fcce Initial load
duke
parents:
diff changeset
   241
            ClassLoader loader = Thread.currentThread().getContextClassLoader();
02bb8761fcce Initial load
duke
parents:
diff changeset
   242
            return Class.forName(className, false, loader);
02bb8761fcce Initial load
duke
parents:
diff changeset
   243
        } catch (ClassNotFoundException e) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   244
            // ignore, then try RMIClassLoader
02bb8761fcce Initial load
duke
parents:
diff changeset
   245
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
   246
02bb8761fcce Initial load
duke
parents:
diff changeset
   247
        try {
02bb8761fcce Initial load
duke
parents:
diff changeset
   248
            return RMIClassLoader.loadClass(className);
02bb8761fcce Initial load
duke
parents:
diff changeset
   249
        } catch (MalformedURLException e) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   250
            String msg = "Could not load " + className + ": " + e.toString();
02bb8761fcce Initial load
duke
parents:
diff changeset
   251
            ClassNotFoundException exc = new ClassNotFoundException( msg ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   252
            throw exc ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   253
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
   254
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   255
02bb8761fcce Initial load
duke
parents:
diff changeset
   256
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   257
     * Load the orb.properties file.
02bb8761fcce Initial load
duke
parents:
diff changeset
   258
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
   259
    private static Properties getORBPropertiesFile () {
02bb8761fcce Initial load
duke
parents:
diff changeset
   260
        return (Properties) AccessController.doPrivileged(new GetORBPropertiesFileAction());
02bb8761fcce Initial load
duke
parents:
diff changeset
   261
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   262
02bb8761fcce Initial load
duke
parents:
diff changeset
   263
}