private void parseMpackDirectories() {
    try {
      for (final File dirEntry : mpackStaging.listFiles()) {
        if (dirEntry.isDirectory()) {
          String mpackName = dirEntry.getName();
          LOG.info("Reading mpack :" + mpackName);
          if (!mpackName.equals(MPACK_TAR_LOCATION)) {
            for (final File file : dirEntry.listFiles()) {
              if (file.isDirectory()) {
                String mpackVersion = file.getName();
                List resultSet = mpackDAO.findByNameVersion(mpackName, mpackVersion);

                if (resultSet.size() > 0) {
                  MpackEntity mpackEntity = (MpackEntity) resultSet.get(0);

                  // Read the mpack.json file into Mpack Object for further use.
                  String mpackJsonContents = new String((Files.readAllBytes(Paths.get(file + "/" + MPACK_METADATA))),
                          "UTF-8");
                  Gson gson = new Gson();
                  Mpack existingMpack = gson.fromJson(mpackJsonContents, Mpack.class);
                  existingMpack.setResourceId(mpackEntity.getId());
                  existingMpack.setMpackUri(mpackEntity.getMpackUri());
                  existingMpack.setRegistryId(mpackEntity.getRegistryId());
                  mpackMap.put(mpackEntity.getId(), existingMpack);
                }
              }
            }
          }
        }
      }
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
Parses mpackdirectories during boostrap/ambari-server restart
Reads from /var/lib/ambari-server/mpacks-v2/

@throws IOException
ambari-server/src/test/java/org/apache/ambari/server/mpack/MpackManagerMock.java