private static Configuration readConfigFile ( String name , String dir , Configuration . Schema ... schemas ) throws IOException { DirectoryRoot root = new DirectoryRoot ( dir , BOOT_REGISTRY ) ; Path . Entry < ConfigFile > config = root . get ( Trie . fromString ( name ) , ConfigFile . ContentType ) ; if ( config == null ) { return Configuration . EMPTY ; } try { // Read the configuration file ConfigFile cf = config . read ( ) ; // Construct configuration according to given schema return cf . toConfiguration ( Configuration . toCombinedSchema ( schemas ) ) ; } catch ( SyntacticException e ) { e . outputSourceError ( System . out , false ) ; System . exit ( - 1 ) ; return null ; } }
Attempt to read a configuration file from a given root .