You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rs...@apache.org on 2008/05/29 09:08:38 UTC
svn commit: r661229 -
/incubator/tuscany/java/sca/itest/osgi-tuscany/tuscany-osgi-installer/src/main/java/org/apache/tuscany/sca/installer/InstallerBundleActivator.java
Author: rsivaram
Date: Thu May 29 00:08:37 2008
New Revision: 661229
URL: http://svn.apache.org/viewvc?rev=661229&view=rev
Log:
Include export versions in virtual bundles
Modified:
incubator/tuscany/java/sca/itest/osgi-tuscany/tuscany-osgi-installer/src/main/java/org/apache/tuscany/sca/installer/InstallerBundleActivator.java
Modified: incubator/tuscany/java/sca/itest/osgi-tuscany/tuscany-osgi-installer/src/main/java/org/apache/tuscany/sca/installer/InstallerBundleActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/osgi-tuscany/tuscany-osgi-installer/src/main/java/org/apache/tuscany/sca/installer/InstallerBundleActivator.java?rev=661229&r1=661228&r2=661229&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/osgi-tuscany/tuscany-osgi-installer/src/main/java/org/apache/tuscany/sca/installer/InstallerBundleActivator.java (original)
+++ incubator/tuscany/java/sca/itest/osgi-tuscany/tuscany-osgi-installer/src/main/java/org/apache/tuscany/sca/installer/InstallerBundleActivator.java Thu May 29 00:08:37 2008
@@ -125,7 +125,7 @@
createAndInstallBundle(bundleContext, bundleLocation, bundleManifestStream, jarSet);
bundleManifestStream.close();
-
+
}
Bundle osgiRuntimeBundle = null;
@@ -324,7 +324,7 @@
if (isImmutableJar)
attributes.putValue("Bundle-ClassPath", bundleName);
- String packages = getPackagesInJar(bundleName, jar);
+ HashSet<String> packages = getPackagesInJar(bundleName, jar);
String version = getJarVersion(bundleName);
attributes.remove(new Attributes.Name("Require-Bundle"));
@@ -337,8 +337,8 @@
// Existing export statements in bundles may contain versions, so they should be used as is
// SDO exports are not sufficient, and should be changed
if (attributes.getValue("Export-Package") == null || bundleName.startsWith("tuscany-sdo-impl")) {
- attributes.putValue("Export-Package", packages);
- attributes.putValue("Import-Package", packages);
+ attributes.putValue("Export-Package", packagesToString(packages, version));
+ attributes.putValue("Import-Package", packagesToString(packages, null));
}
attributes.putValue("DynamicImport-Package", "*");
@@ -352,7 +352,7 @@
}
- private String getPackagesInJar(String bundleName, JarInputStream jar) throws Exception {
+ private HashSet<String> getPackagesInJar(String bundleName, JarInputStream jar) throws Exception {
HashSet<String> packages = new HashSet<String>();
ZipEntry entry;
while ((entry = jar.getNextEntry()) != null) {
@@ -375,10 +375,20 @@
else if (bundleName.startsWith("bsf-all"))
packages.remove("org.mozilla.javascript");
+ return packages;
+ }
+
+ private String packagesToString(HashSet<String> packages, String version) {
+
StringBuilder pkgBuf = new StringBuilder();
for (String pkg : packages) {
if (pkgBuf.length() >0) pkgBuf.append(',');
pkgBuf.append(pkg);
+ if (version != null) {
+ pkgBuf.append(";version=\"");
+ pkgBuf.append(version);
+ pkgBuf.append('\"');
+ }
}
return pkgBuf.toString();
}