@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();
        }
    }
@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;
            }
           
            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();
        }
    }
@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; } 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(); } }