public ConfigurationStore getStore ( ) throws ConfigException { if ( store != null ) { return store ; } String uriStr = getConfigUri ( ) ; if ( uriStr == null ) { getPfile ( ) ; String configPname = getConfigPname ( ) ; if ( configPname == null ) { throw new ConfigException ( "Either a uri or property name must be specified" ) ; } uriStr = pfile . getProperty ( configPname ) ; if ( uriStr == null ) { /* If configPname ends with ".confuri" we'll take the preceding segment as a possible directory */ if ( configPname . endsWith ( ".confuri" ) ) { final int lastDotpos = configPname . length ( ) - 8 ; final int pos = configPname . lastIndexOf ( ' ' , lastDotpos - 1 ) ; if ( pos > 0 ) { uriStr = configPname . substring ( pos + 1 , lastDotpos ) ; } } } if ( uriStr == null ) { throw new ConfigException ( "No property with name \"" + configPname + "\"" ) ; } } try { URI uri = new URI ( uriStr ) ; String scheme = uri . getScheme ( ) ; if ( scheme == null ) { // Possible non-absolute path String path = uri . getPath ( ) ; File f = new File ( path ) ; if ( ! f . isAbsolute ( ) && configBase != null ) { path = configBase + path ; } uri = new URI ( path ) ; scheme = uri . getScheme ( ) ; } if ( ( scheme == null ) || ( scheme . equals ( "file" ) ) ) { String path = uri . getPath ( ) ; if ( getPathSuffix ( ) != null ) { if ( ! path . endsWith ( File . separator ) ) { path += File . separator ; } path += getPathSuffix ( ) + File . separator ; } store = new ConfigurationFileStore ( path ) ; return store ; } throw new ConfigException ( "Unsupported ConfigurationStore: " + uri ) ; } catch ( URISyntaxException use ) { throw new ConfigException ( use ) ; } }
Get a ConfigurationStore based on the uri or property value .