// TODO figure out what to do with build info
@Override
    public BundleDetails extract(final InputStream inputStream) throws IOException {
        try (final JarInputStream jarInputStream = new JarInputStream(inputStream)) {
            final Manifest manifest = jarInputStream.getManifest();
            if (manifest == null) {
                throw new IllegalArgumentException("NAR bundles must contain a valid MANIFEST");
            }
            final Attributes attributes = manifest.getMainAttributes();
            final String groupId = attributes.getValue(NarManifestEntry.NAR_GROUP.getManifestName());
            final String artifactId = attributes.getValue(NarManifestEntry.NAR_ID.getManifestName());
            final String version = attributes.getValue(NarManifestEntry.NAR_VERSION.getManifestName());
            final BundleCoordinate bundleCoordinate = new BundleCoordinate(groupId, artifactId, version);
            final String dependencyGroupId = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_GROUP.getManifestName());
            final String dependencyArtifactId = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_ID.getManifestName());
            final String dependencyVersion = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_VERSION.getManifestName());
            final BundleCoordinate dependencyCoordinate;
            if (dependencyArtifactId != null) {
                dependencyCoordinate = new BundleCoordinate(dependencyGroupId, dependencyArtifactId, dependencyVersion);
            } else {
                dependencyCoordinate = null;
            }
            // TODO figure out what to do with build info
            final String buildBranch = attributes.getValue(NarManifestEntry.BUILD_BRANCH.getManifestName());
            final String buildTag = attributes.getValue(NarManifestEntry.BUILD_TAG.getManifestName());
            final String buildRevision = attributes.getValue(NarManifestEntry.BUILD_REVISION.getManifestName());
            final String buildTimestamp = attributes.getValue(NarManifestEntry.BUILD_TIMESTAMP.getManifestName());
            final String buildJdk = attributes.getValue(NarManifestEntry.BUILD_JDK.getManifestName());
            final String builtBy = attributes.getValue(NarManifestEntry.BUILT_BY.getManifestName());
            final BundleDetails.Builder builder = new BundleDetails.Builder()
                    .coordinate(bundleCoordinate)
                    .dependencyCoordinate(dependencyCoordinate);
            return builder.build();
        }
    }
dependencyCoordinate = null;
}
// TODO figure out what to do with build info
final String buildBranch = attributes.getValue(NarManifestEntry.BUILD_BRANCH.getManifestName());
final String buildTag = attributes.getValue(NarManifestEntry.BUILD_TAG.getManifestName());
final BundleCoordinate bundleCoordinate = new BundleCoordinate(groupId, artifactId, version);
final String dependencyGroupId = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_GROUP.getManifestName());
final String dependencyArtifactId = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_ID.getManifestName());
final String dependencyVersion = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_VERSION.getManifestName());
final BundleCoordinate dependencyCoordinate;
if (dependencyArtifactId != null) {
dependencyCoordinate = new BundleCoordinate(dependencyGroupId, dependencyArtifactId, dependencyVersion);
} else {
dependencyCoordinate = null;
}
// TODO figure out what to do with build info
final String buildBranch = attributes.getValue(NarManifestEntry.BUILD_BRANCH.getManifestName());
final String buildTag = attributes.getValue(NarManifestEntry.BUILD_TAG.getManifestName());
final String buildRevision = attributes.getValue(NarManifestEntry.BUILD_REVISION.getManifestName());
final String buildTimestamp = attributes.getValue(NarManifestEntry.BUILD_TIMESTAMP.getManifestName());
final String buildJdk = attributes.getValue(NarManifestEntry.BUILD_JDK.getManifestName());
final String builtBy = attributes.getValue(NarManifestEntry.BUILT_BY.getManifestName());
final BundleDetails.Builder builder = new BundleDetails.Builder()
.coordinate(bundleCoordinate)
.dependencyCoordinate(dependencyCoordinate);
return builder.build();
public BundleDetails extract(final InputStream inputStream) throws IOException {
try (final JarInputStream jarInputStream = new JarInputStream(inputStream)) {
final Manifest manifest = jarInputStream.getManifest();
if (manifest == null) {
throw new IllegalArgumentException("NAR bundles must contain a valid MANIFEST");
}
final Attributes attributes = manifest.getMainAttributes();
final String groupId = attributes.getValue(NarManifestEntry.NAR_GROUP.getManifestName());
final String artifactId = attributes.getValue(NarManifestEntry.NAR_ID.getManifestName());
final String version = attributes.getValue(NarManifestEntry.NAR_VERSION.getManifestName());
final BundleCoordinate bundleCoordinate = new BundleCoordinate(groupId, artifactId, version);
final String dependencyGroupId = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_GROUP.getManifestName());
final String dependencyArtifactId = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_ID.getManifestName());
final String dependencyVersion = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_VERSION.getManifestName());
final BundleCoordinate dependencyCoordinate;
if (dependencyArtifactId != null) {
dependencyCoordinate = new BundleCoordinate(dependencyGroupId, dependencyArtifactId, dependencyVersion);
} else {
dependencyCoordinate = null;
}
// TODO figure out what to do with build info
final String buildBranch = attributes.getValue(NarManifestEntry.BUILD_BRANCH.getManifestName());
final String buildTag = attributes.getValue(NarManifestEntry.BUILD_TAG.getManifestName());
final String buildRevision = attributes.getValue(NarManifestEntry.BUILD_REVISION.getManifestName());
final String buildTimestamp = attributes.getValue(NarManifestEntry.BUILD_TIMESTAMP.getManifestName());
final String buildJdk = attributes.getValue(NarManifestEntry.BUILD_JDK.getManifestName());
final String builtBy = attributes.getValue(NarManifestEntry.BUILT_BY.getManifestName());
final BundleDetails.Builder builder = new BundleDetails.Builder()
.coordinate(bundleCoordinate)
.dependencyCoordinate(dependencyCoordinate);
return builder.build();
}
}