tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r787381 - /tuscany/java/sca/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionScanner.java
Date Mon, 22 Jun 2009 20:22:27 GMT
Author: rfeng
Date: Mon Jun 22 20:22:27 2009
New Revision: 787381

URL: http://svn.apache.org/viewvc?rev=787381&view=rev
Log:
Exclude .svn files 
Not scan internal jars if it is not on the Bundle-Classpath header

Modified:
    tuscany/java/sca/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionScanner.java

Modified: tuscany/java/sca/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionScanner.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionScanner.java?rev=787381&r1=787380&r2=787381&view=diff
==============================================================================
--- tuscany/java/sca/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionScanner.java
(original)
+++ tuscany/java/sca/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionScanner.java
Mon Jun 22 20:22:27 2009
@@ -37,6 +37,7 @@
 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 @@
         }
 
         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()));
                 }
 



Mime
View raw message