public ViewConfig getViewConfigFromExtractedArchive(String archivePath, boolean validate)
      throws JAXBException, IOException, SAXException {
    File configFile = new File(archivePath + File.separator + VIEW_XML);

    if (!configFile.exists()) {
      configFile = new File(archivePath + File.separator + WEB_INF_VIEW_XML);
    }

    if (validate) {
      validateConfig(new FileInputStream(configFile));
    }

    InputStream  configStream = new FileInputStream(configFile);
    try {

      JAXBContext  jaxbContext      = JAXBContext.newInstance(ViewConfig.class);
      Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();

      return (ViewConfig) jaxbUnmarshaller.unmarshal(configStream);
    } finally {
      configStream.close();
    }
  }
Get the view configuration from the extracted archive file.

@param archivePath  path to extracted archive
@param validate     indicates whether or not the view configuration should be validated

@return the associated view configuration

@throws JAXBException if xml is malformed
@throws IOException if xml can not be read
@throws SAXException if the validation fails
ambari-server/src/main/java/org/apache/ambari/server/view/ViewArchiveUtility.java