FileDocCategorySizeDatePackage
GetORBPropertiesFileAction.javaAPI DocJava SE 6 API2439Tue Jun 10 00:26:26 BST 2008javax.rmi.CORBA

GetORBPropertiesFileAction

public class GetORBPropertiesFileAction extends Object implements PrivilegedAction

Fields Summary
private boolean
debug
Constructors Summary
public GetORBPropertiesFileAction()


       
    
Methods Summary
private voidgetPropertiesFromFile(java.util.Properties props, java.lang.String fileName)

        try {
	    File file = new File( fileName ) ;
	    if (!file.exists())
		return ;

            FileInputStream in = new FileInputStream( file ) ;
	    
	    try {
		props.load( in ) ;
	    } finally {
		in.close() ;
	    }
        } catch (Exception exc) {
            if (debug)
                System.out.println( "ORB properties file " + fileName + 
		    " not found: " + exc) ;
        }
    
private java.lang.StringgetSystemProperty(java.lang.String name)

	// This will not throw a SecurityException because this
	// class was loaded from rt.jar using the bootstrap classloader.
        String propValue = (String) AccessController.doPrivileged(
	    new PrivilegedAction() {
		public java.lang.Object run() {
	            return System.getProperty(name);
	        }
            }
	);

	return propValue;
    
public java.lang.Objectrun()

        Properties defaults = new Properties() ;

	String javaHome = getSystemProperty( "java.home" ) ;
	String fileName = javaHome + File.separator + "lib" + File.separator +
	    "orb.properties" ;

	getPropertiesFromFile( defaults, fileName ) ;

	Properties results = new Properties( defaults ) ;

        String userHome = getSystemProperty( "user.home" ) ;
        fileName = userHome + File.separator + "orb.properties" ;

	getPropertiesFromFile( results, fileName ) ;
	return results ;