/**
   * Attempt to find any Hadoop configuration as a direct descendant of the provided directory.
   *
   * @param baseDir Directory to look for Hadoop configurations in
   * @throws ConfigurationException
   */
  private void findHadoopConfigurations(
      FileObject baseDir, ActiveHadoopConfigurationLocator activeLocator)
      throws ConfigurationException {
    configurations = new HashMap<String, HadoopConfiguration>();
    try {
      if (!baseDir.exists()) {
        throw new ConfigurationException(
            BaseMessages.getString(
                PKG, "Error.HadoopConfigurationDirectoryDoesNotExist", baseDir.getURL()));
      }
      for (FileObject f :
          baseDir.findFiles(
              new FileSelector() {
                @Override
                public boolean includeFile(FileSelectInfo info) throws Exception {
                  return info.getDepth() == 1 && FileType.FOLDER.equals(info.getFile().getType());
                }

                @Override
                public boolean traverseDescendents(FileSelectInfo info) throws Exception {
                  return info.getDepth() == 0;
                }
              })) {
        // Only load the specified configuration (ID should match the basename, we allow
        // case-insensitivity)
        if (f.getName().getBaseName().equalsIgnoreCase(activeLocator.getActiveConfigurationId())) {
          HadoopConfiguration config = loadHadoopConfiguration(f);
          if (config != null) {
            configurations.put(config.getIdentifier(), config);
          }
        }
      }
    } catch (FileSystemException ex) {
      throw new ConfigurationException(
          BaseMessages.getString(
              PKG, "Error.UnableToLoadConfigurations", baseDir.getName().getFriendlyURI()),
          ex);
    }
  }
 @Override
 public HadoopConfiguration getActiveConfiguration() throws ConfigurationException {
   return getConfiguration(activeLocator.getActiveConfigurationId());
 }