private static Properties load ( ) { Properties properties = new Properties ( ) ; String file = System . getProperty ( CONFIGURATION_PROPERTY ) ; try { if ( file != null ) { InputStream stream ; if ( URL_DETECTION_PATTERN . matcher ( file ) . matches ( ) ) { stream = new URL ( file ) . openStream ( ) ; } else { stream = Thread . currentThread ( ) . getContextClassLoader ( ) . getResourceAsStream ( file ) ; if ( stream == null ) { stream = new FileInputStream ( file ) ; } } load ( properties , stream ) ; } else { InputStream stream = Thread . currentThread ( ) . getContextClassLoader ( ) . getResourceAsStream ( DEFAULT_CONFIGURATION_FILE ) ; if ( stream != null ) { load ( properties , stream ) ; } } } catch ( IOException ex ) { InternalLogger . log ( Level . ERROR , "Failed loading configuration from '" + file + "'" ) ; } for ( Object key : new ArrayList < Object > ( System . getProperties ( ) . keySet ( ) ) ) { String name = ( String ) key ; if ( name . startsWith ( PROPERTIES_PREFIX ) ) { properties . put ( name . substring ( PROPERTIES_PREFIX . length ( ) ) , System . getProperty ( name ) ) ; } } for ( Entry < Object , Object > entry : properties . entrySet ( ) ) { String value = ( String ) entry . getValue ( ) ; if ( value . indexOf ( ' ' ) != - 1 ) { value = resolve ( value , EnvironmentVariableResolver . INSTANCE ) ; value = resolve ( value , SystemPropertyResolver . INSTANCE ) ; properties . put ( entry . getKey ( ) , value ) ; } } return properties ; }
Loads all configuration properties .