private void findConfigFiles() {
    // Find the materialized_JSON configuration file.
    if (configFileName == null) {
      String jsonConfigFileString = conf.getConfigFile().replace(
                                         CoronaConf.DEFAULT_CONFIG_FILE,
                                         Configuration.MATERIALIZEDJSON);
      File jsonConfigFile = new File(jsonConfigFileString);
      String jsonConfigFileName = null;
      if (jsonConfigFile.exists()) {
        jsonConfigFileName = jsonConfigFileString;
      } else {
          URL u = classLoader.getResource(jsonConfigFileString);
          jsonConfigFileName = (u != null) ? u.getPath() : null;
      }
      // Check that the materialized_JSON contains the resources
      // of corona.xml
      if (jsonConfigFileName != null) {
        try {
          jsonConfigFile = new File(jsonConfigFileName);
          InputStream in = new BufferedInputStream(new FileInputStream(
        		                                           jsonConfigFile));
          JSONObject json = conf.instantiateJsonObject(in);
          if (json.has(conf.xmlToThrift(CoronaConf.DEFAULT_CONFIG_FILE))) {
            configFileName = jsonConfigFileName;
            LOG.info("Attempt to find config file " + jsonConfigFileString +
                     " as a file and in class loader returned " + configFileName);
          }
        } catch (IOException e) {
            LOG.warn("IOException: " + "while parsing corona JSON configuration");
        } catch (JSONException e) {
            LOG.warn("JSONException: " + "while parsing corona JSON configuration");
        }
      }
    }
    if (configFileName == null) {
      // Parsing the JSON configuration failed.  Look for
      // the xml configuration.
      String configFileString = conf.getConfigFile();
      File configFile = new File(configFileString);
      if (configFile.exists()) {
        configFileName = configFileString;
      } else {
        URL u = classLoader.getResource(configFileString);
        configFileName = (u != null) ? u.getPath() : null;
      }
      LOG.info("Attempt to find config file " + configFileString +
          " as a file and in class loader returned " + configFileName);
    }
    if (poolsConfigFileName == null) {
      String poolsConfigFileString = conf.getPoolsConfigFile();
      File poolsConfigFile = new File(poolsConfigFileString);
      if (poolsConfigFile.exists()) {
        poolsConfigFileName = poolsConfigFileString;
      } else {
        URL u = classLoader.getResource(poolsConfigFileString);
        poolsConfigFileName = (u != null) ? u.getPath() : null;
      }
      LOG.info("Attempt to find pools config file " + poolsConfigFileString +
          " as a file and in class loader returned " + poolsConfigFileName);
    }
  }
private void findConfigFiles ( ) { if ( configFileName == null ) { String jsonConfigFileString = conf . getConfigFile ( ) . replace ( CoronaConf . DEFAULT_CONFIG_FILE , Configuration . MATERIALIZEDJSON ) ; File jsonConfigFile = new File ( jsonConfigFileString ) ; String jsonConfigFileName = null ; if ( jsonConfigFile . exists ( ) ) { jsonConfigFileName = jsonConfigFileString ; } else { URL u = classLoader . getResource ( jsonConfigFileString ) ; jsonConfigFileName = ( u != null ) ? u . getPath ( ) : null ; } if ( jsonConfigFileName != null ) { try { jsonConfigFile = new File ( jsonConfigFileName ) ; InputStream in = new BufferedInputStream ( new FileInputStream ( jsonConfigFile ) ) ; JSONObject json = conf . instantiateJsonObject ( in ) ; if ( json . has ( conf . xmlToThrift ( CoronaConf . DEFAULT_CONFIG_FILE ) ) ) { configFileName = jsonConfigFileName ; LOG . info ( "Attempt to find config file " + jsonConfigFileString + " as a file and in class loader returned " + configFileName ) ; } } catch ( IOException e ) { LOG . warn ( "IOException: " + "while parsing corona JSON configuration" ) ; } catch ( JSONException e ) { LOG . warn ( "JSONException: " + "while parsing corona JSON configuration" ) ; } } } if ( configFileName == null ) { String configFileString = conf . getConfigFile ( ) ; File configFile = new File ( configFileString ) ; if ( configFile . exists ( ) ) { configFileName = configFileString ; } else { URL u = classLoader . getResource ( configFileString ) ; configFileName = ( u != null ) ? u . getPath ( ) : null ; } LOG . info ( "Attempt to find config file " + configFileString + " as a file and in class loader returned " + configFileName ) ; } if ( poolsConfigFileName == null ) { String poolsConfigFileString = conf . getPoolsConfigFile ( ) ; File poolsConfigFile = new File ( poolsConfigFileString ) ; if ( poolsConfigFile . exists ( ) ) { poolsConfigFileName = poolsConfigFileString ; } else { URL u = classLoader . getResource ( poolsConfigFileString ) ; poolsConfigFileName = ( u != null ) ? u . getPath ( ) : null ; } LOG . info ( "Attempt to find pools config file " + poolsConfigFileString + " as a file and in class loader returned " + poolsConfigFileName ) ; } }
Find the configuration files as set file names or in the classpath.