コード例 #1
0
ファイル: NarClassLoaders.java プロジェクト: RajiMenon/nifi
  /**
   * Loads the details for the specified NAR. The details will be extracted from the manifest file.
   *
   * @param narDirectory the nar directory
   * @return details about the NAR
   * @throws IOException ioe
   */
  private static NarDetails getNarDetails(final File narDirectory) throws IOException {
    final NarDetails narDetails = new NarDetails();
    narDetails.setNarWorkingDirectory(narDirectory);

    final File manifestFile = new File(narDirectory, "META-INF/MANIFEST.MF");
    try (final FileInputStream fis = new FileInputStream(manifestFile)) {
      final Manifest manifest = new Manifest(fis);
      final Attributes attributes = manifest.getMainAttributes();

      // get the nar details
      narDetails.setNarId(attributes.getValue("Nar-Id"));
      narDetails.setNarDependencyId(attributes.getValue("Nar-Dependency-Id"));
    }

    return narDetails;
  }