private void validateExtensionDirectory(File extensionRoot) throws AmbariException {
    LOG.info("Validating extension directory {} ...", extensionRoot);

    if (extensionRoot == null) {
      return;
    }

    String extensionRootAbsPath = extensionRoot.getAbsolutePath();
    if (LOG.isDebugEnabled()) {
      LOG.debug("Loading extension information, extensionRoot = {}", extensionRootAbsPath);
    }

    //For backwards compatibility extension directory may not exist
    if (extensionRoot.exists() && !extensionRoot.isDirectory()) {
      throw new AmbariException("" + Configuration.METADATA_DIR_PATH
          + " should be a directory"
          + ", extensionRoot = " + extensionRootAbsPath);
    }
  }
Validate that the specified extension root is a valid directory.

@param extensionRoot  the extension root directory to validate
@throws AmbariException if the specified extension root directory is invalid
ambari-server/src/main/java/org/apache/ambari/server/stack/StackManager.java