diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-22 20:22:27 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-22 20:22:27 +0000 |
commit | 899d38e814ea6546636c98e0cf2809dced1151bb (patch) | |
tree | e63b0d424c03914f8a1aa6fb2514b68b0ca5badb | |
parent | acb4c0f43ac6e93dcdde461738be8f05c80b4121 (diff) |
Exclude .svn files
Not scan internal jars if it is not on the Bundle-Classpath header
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@787381 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | java/sca/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionScanner.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/java/sca/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionScanner.java b/java/sca/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionScanner.java index 3d20d968a3..a8bec24dab 100644 --- a/java/sca/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionScanner.java +++ b/java/sca/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionScanner.java @@ -37,6 +37,7 @@ import org.apache.tuscany.sca.contribution.processor.ContributionException; import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
import org.apache.tuscany.sca.contribution.scanner.ContributionScanner;
import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
/**
* Bundle Contribution package processor.
@@ -123,19 +124,30 @@ public class OSGiBundleContributionScanner implements ContributionScanner { }
List<String> artifacts = new ArrayList<String>();
+ Set<String> bundleClassPath = new HashSet<String>();
+ String cp = (String)bundle.getHeaders().get(Constants.BUNDLE_CLASSPATH);
+ if (cp != null) {
+ String[] paths = cp.split(",");
+ for (String path : paths) {
+ bundleClassPath.add(path.trim());
+ }
+ }
try {
Enumeration<?> entries = bundle.findEntries("/", "*", true);
while (entries.hasMoreElements()) {
URL entry = (URL)entries.nextElement();
String entryName = entry.getPath();
+ if (entryName.contains("/.svn/")) {
+ // Ignore .svn files
+ continue;
+ }
if (entryName.startsWith("/")) {
entryName = entryName.substring(1);
}
artifacts.add(entryName);
- // FIXME: We probably should honor Bundle-ClassPath headers to deal with inner jars
- if (entryName.endsWith(".jar")) {
+ if (entryName.endsWith(".jar") && bundleClassPath.contains(entryName)) {
artifacts.addAll(getJarArtifacts(entry, entry.openStream()));
}
|