private File unpack(final File narFile) { try (final JarFile nar = new JarFile(narFile)) { final Manifest manifest = nar.getManifest(); final Attributes attributes = manifest.getMainAttributes(); final String groupId = attributes.getValue(NarManifestEntry.NAR_GROUP.getManifestName()); final String narId = attributes.getValue(NarManifestEntry.NAR_ID.getManifestName()); final String version = attributes.getValue(NarManifestEntry.NAR_VERSION.getManifestName()); if (NarClassLoaders.FRAMEWORK_NAR_ID.equals(narId)) { LOGGER.error("Found a framework NAR, will not load {}", new Object[]{narFile.getAbsolutePath()}); return null; } final BundleCoordinate coordinate = new BundleCoordinate(groupId, narId, version); final Bundle bundle = extensionManager.getBundle(coordinate); if (bundle != null) { LOGGER.warn("Found existing bundle with coordinate {}, will not load {}", new Object[]{coordinate, narFile.getAbsolutePath()}); return null; } final File unpackedExtension = NarUnpacker.unpackNar(narFile, extensionsWorkingDir); NarUnpacker.mapExtension(unpackedExtension, coordinate, docsWorkingDir, extensionMapping); return unpackedExtension; } catch (Exception e) { LOGGER.error("Error unpacking " + narFile.getAbsolutePath(), e); return null; } }
builder.workingDir(narDirectory); final String group = attributes.getValue(NarManifestEntry.NAR_GROUP.getManifestName()); final String id = attributes.getValue(NarManifestEntry.NAR_ID.getManifestName()); final String version = attributes.getValue(NarManifestEntry.NAR_VERSION.getManifestName()); builder.coordinate(new BundleCoordinate(group, id, version)); final String dependencyGroup = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_GROUP.getManifestName()); final String dependencyId = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_ID.getManifestName()); final String dependencyVersion = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_VERSION.getManifestName()); if (!StringUtils.isBlank(dependencyId)) { builder.dependencyCoordinate(new BundleCoordinate(dependencyGroup, dependencyId, dependencyVersion)); builder.buildBranch(attributes.getValue(NarManifestEntry.BUILD_BRANCH.getManifestName())); builder.buildTag(attributes.getValue(NarManifestEntry.BUILD_TAG.getManifestName())); builder.buildRevision(attributes.getValue(NarManifestEntry.BUILD_REVISION.getManifestName())); builder.buildTimestamp(attributes.getValue(NarManifestEntry.BUILD_TIMESTAMP.getManifestName())); builder.buildJdk(attributes.getValue(NarManifestEntry.BUILD_JDK.getManifestName())); builder.builtBy(attributes.getValue(NarManifestEntry.BUILT_BY.getManifestName()));
final String groupId = attributes.getValue(NarManifestEntry.NAR_GROUP.getManifestName()); final String narId = attributes.getValue(NarManifestEntry.NAR_ID.getManifestName()); final String version = attributes.getValue(NarManifestEntry.NAR_VERSION.getManifestName());
builder.workingDir(narDirectory); final String group = attributes.getValue(NarManifestEntry.NAR_GROUP.getManifestName()); final String id = attributes.getValue(NarManifestEntry.NAR_ID.getManifestName()); final String version = attributes.getValue(NarManifestEntry.NAR_VERSION.getManifestName()); builder.coordinate(new BundleCoordinate(group, id, version)); final String dependencyGroup = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_GROUP.getManifestName()); final String dependencyId = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_ID.getManifestName()); final String dependencyVersion = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_VERSION.getManifestName()); if (!StringUtils.isBlank(dependencyId)) { builder.dependencyCoordinate(new BundleCoordinate(dependencyGroup, dependencyId, dependencyVersion)); builder.buildBranch(attributes.getValue(NarManifestEntry.BUILD_BRANCH.getManifestName())); builder.buildTag(attributes.getValue(NarManifestEntry.BUILD_TAG.getManifestName())); builder.buildRevision(attributes.getValue(NarManifestEntry.BUILD_REVISION.getManifestName())); builder.buildTimestamp(attributes.getValue(NarManifestEntry.BUILD_TIMESTAMP.getManifestName())); builder.buildJdk(attributes.getValue(NarManifestEntry.BUILD_JDK.getManifestName())); builder.builtBy(attributes.getValue(NarManifestEntry.BUILT_BY.getManifestName()));
builder.workingDir(narDirectory); final String group = attributes.getValue(NarManifestEntry.NAR_GROUP.getManifestName()); final String id = attributes.getValue(NarManifestEntry.NAR_ID.getManifestName()); final String version = attributes.getValue(NarManifestEntry.NAR_VERSION.getManifestName()); builder.coordinate(new BundleCoordinate(group, id, version)); final String dependencyGroup = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_GROUP.getManifestName()); final String dependencyId = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_ID.getManifestName()); final String dependencyVersion = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_VERSION.getManifestName()); if (!StringUtils.isBlank(dependencyId)) { builder.dependencyCoordinate(new BundleCoordinate(dependencyGroup, dependencyId, dependencyVersion)); builder.buildBranch(attributes.getValue(NarManifestEntry.BUILD_BRANCH.getManifestName())); builder.buildTag(attributes.getValue(NarManifestEntry.BUILD_TAG.getManifestName())); builder.buildRevision(attributes.getValue(NarManifestEntry.BUILD_REVISION.getManifestName())); builder.buildTimestamp(attributes.getValue(NarManifestEntry.BUILD_TIMESTAMP.getManifestName())); builder.buildJdk(attributes.getValue(NarManifestEntry.BUILD_JDK.getManifestName())); builder.builtBy(attributes.getValue(NarManifestEntry.BUILT_BY.getManifestName()));