0N/A/*
157N/A * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
157N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
157N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
157N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
157N/A * or visit www.oracle.com if you need additional information or have any
157N/A * questions.
0N/A */
0N/A
0N/A/*
0N/A * (C) Copyright IBM Corp. 1993 - 1997 - All Rights Reserved
0N/A *
0N/A * The original version of this source code and documentation is
0N/A * copyrighted and owned by IBM, Inc. These materials are provided under
0N/A * terms of a License Agreement between IBM and Sun. This technology is
0N/A * protected by multiple US and International patents. This notice and
0N/A * attribution to IBM may not be removed.
0N/A *
0N/A */
0N/A
0N/A
0N/Apackage javax.rmi.CORBA;
0N/A
0N/Aimport java.io.IOException;
0N/Aimport java.io.File;
0N/Aimport java.io.FileInputStream;
0N/A
0N/Aimport java.security.AccessController;
0N/Aimport java.security.PrivilegedAction;
0N/Aimport sun.security.action.GetPropertyAction;
0N/Aimport java.util.Properties;
0N/A
0N/Aclass GetORBPropertiesFileAction implements PrivilegedAction {
0N/A private boolean debug = false ;
0N/A
0N/A public GetORBPropertiesFileAction () {
0N/A }
0N/A
0N/A private String getSystemProperty(final String name) {
0N/A // This will not throw a SecurityException because this
0N/A // class was loaded from rt.jar using the bootstrap classloader.
0N/A String propValue = (String) AccessController.doPrivileged(
0N/A new PrivilegedAction() {
0N/A public java.lang.Object run() {
0N/A return System.getProperty(name);
0N/A }
0N/A }
0N/A );
0N/A
0N/A return propValue;
0N/A }
0N/A
0N/A private void getPropertiesFromFile( Properties props, String fileName )
0N/A {
0N/A try {
0N/A File file = new File( fileName ) ;
0N/A if (!file.exists())
0N/A return ;
0N/A
0N/A FileInputStream in = new FileInputStream( file ) ;
0N/A
0N/A try {
0N/A props.load( in ) ;
0N/A } finally {
0N/A in.close() ;
0N/A }
0N/A } catch (Exception exc) {
0N/A if (debug)
0N/A System.out.println( "ORB properties file " + fileName +
0N/A " not found: " + exc) ;
0N/A }
0N/A }
0N/A
0N/A public Object run()
0N/A {
0N/A Properties defaults = new Properties() ;
0N/A
0N/A String javaHome = getSystemProperty( "java.home" ) ;
0N/A String fileName = javaHome + File.separator + "lib" + File.separator +
0N/A "orb.properties" ;
0N/A
0N/A getPropertiesFromFile( defaults, fileName ) ;
0N/A
0N/A Properties results = new Properties( defaults ) ;
0N/A
0N/A String userHome = getSystemProperty( "user.home" ) ;
0N/A fileName = userHome + File.separator + "orb.properties" ;
0N/A
0N/A getPropertiesFromFile( results, fileName ) ;
0N/A return results ;
0N/A }
0N/A}