private void readConfiguration ( String fileName , IChemObjectBuilder builder ) { logger . info ( "Reading config file from " , fileName ) ; InputStream ins ; { //try to see if this is a resource ins = this . getClass ( ) . getClassLoader ( ) . getResourceAsStream ( fileName ) ; if ( ins == null ) { // try to see if this configFile is an actual file File file = new File ( fileName ) ; if ( file . exists ( ) ) { logger . debug ( "configFile is a File" ) ; // what's next? try { ins = new FileInputStream ( file ) ; } catch ( Exception exception ) { logger . error ( exception . getMessage ( ) ) ; logger . debug ( exception ) ; } } else { logger . error ( "no stream and no file" ) ; } } } String format = XML_EXTENSION ; if ( fileName . endsWith ( TXT_EXTENSION ) ) { format = TXT_EXTENSION ; } else if ( fileName . endsWith ( XML_EXTENSION ) ) { format = XML_EXTENSION ; } else if ( fileName . endsWith ( OWL_EXTENSION ) ) { format = OWL_EXTENSION ; } readConfiguration ( ins , format , builder ) ; }
Read the configuration from a text file .