You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2017/06/06 10:19:57 UTC
svn commit: r1797768 -
/sling/whiteboard/cziegeler/feature-analyser/src/main/java/org/apache/sling/feature/analyser/BundleInfo.java
Author: cziegeler
Date: Tue Jun 6 10:19:56 2017
New Revision: 1797768
URL: http://svn.apache.org/viewvc?rev=1797768&view=rev
Log:
Make manifest available
Modified:
sling/whiteboard/cziegeler/feature-analyser/src/main/java/org/apache/sling/feature/analyser/BundleInfo.java
Modified: sling/whiteboard/cziegeler/feature-analyser/src/main/java/org/apache/sling/feature/analyser/BundleInfo.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/feature-analyser/src/main/java/org/apache/sling/feature/analyser/BundleInfo.java?rev=1797768&r1=1797767&r2=1797768&view=diff
==============================================================================
--- sling/whiteboard/cziegeler/feature-analyser/src/main/java/org/apache/sling/feature/analyser/BundleInfo.java (original)
+++ sling/whiteboard/cziegeler/feature-analyser/src/main/java/org/apache/sling/feature/analyser/BundleInfo.java Tue Jun 6 10:19:56 2017
@@ -68,13 +68,17 @@ public class BundleInfo extends Artifact
/** Bundle resources */
private final List<String> bundleResources = new ArrayList<>();
+ /** Manifest */
+ private final Manifest manifest;
+
public BundleInfo(final Artifact a,
final File file,
final int startLevel) throws IOException {
super(a, file);
this.startLevel = startLevel;
- this.analyze(ManifestUtil.getManifest(file));
+ this.manifest = ManifestUtil.getManifest(file);
+ this.analyze();
}
public BundleInfo(final Artifact artifact,
@@ -85,6 +89,7 @@ public class BundleInfo extends Artifact
this.symbolicName = Constants.SYSTEM_BUNDLE_SYMBOLICNAME;
this.bundleVersion = artifact.getId().getOSGiVersion().toString();
this.exportedPackages.addAll(pcks);
+ this.manifest = null;
}
/**
@@ -123,6 +128,10 @@ public class BundleInfo extends Artifact
return Collections.unmodifiableList(this.exportedPackages);
}
+ public Manifest getManifest() {
+ return this.manifest;
+ }
+
public boolean isExportingPackage(final String packageName) {
if ( getExportedPackages() != null ) {
for(final PackageInfo i : getExportedPackages()) {
@@ -154,10 +163,10 @@ public class BundleInfo extends Artifact
return Collections.unmodifiableList(this.dynamicImportedPackages);
}
- protected void analyze(final Manifest m) throws IOException {
- final String name = m.getMainAttributes().getValue(Constants.BUNDLE_SYMBOLICNAME);
+ protected void analyze() throws IOException {
+ final String name = this.manifest.getMainAttributes().getValue(Constants.BUNDLE_SYMBOLICNAME);
if ( name != null ) {
- final String version = m.getMainAttributes().getValue(Constants.BUNDLE_VERSION);
+ final String version = this.manifest.getMainAttributes().getValue(Constants.BUNDLE_VERSION);
if ( version == null ) {
throw new IOException("Unable to get bundle version from artifact " + getArtifact().getId().toMvnId());
}
@@ -168,11 +177,11 @@ public class BundleInfo extends Artifact
this.symbolicName = newBundleName;
}
- this.exportedPackages.addAll(ManifestUtil.extractExportedPackages(m));
- this.importedPackages.addAll(ManifestUtil.extractImportedPackages(m));
- this.dynamicImportedPackages.addAll(ManifestUtil.extractDynamicImportedPackages(m));
- extractInitialContent(m);
- extractBundleResources(m);
+ this.exportedPackages.addAll(ManifestUtil.extractExportedPackages(this.manifest));
+ this.importedPackages.addAll(ManifestUtil.extractImportedPackages(this.manifest));
+ this.dynamicImportedPackages.addAll(ManifestUtil.extractDynamicImportedPackages(this.manifest));
+ extractInitialContent(this.manifest);
+ extractBundleResources(this.manifest);
} else {
throw new IOException("Unable to get bundle symbolic name from artifact " + getArtifact().getId().toMvnId());