You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2009/06/18 04:47:07 UTC

svn commit: r785877 - /geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintExtender.java

Author: gawor
Date: Thu Jun 18 02:47:07 2009
New Revision: 785877

URL: http://svn.apache.org/viewvc?rev=785877&view=rev
Log:
handle wildcards slightly better

Modified:
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintExtender.java

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintExtender.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintExtender.java?rev=785877&r1=785876&r2=785877&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintExtender.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintExtender.java Thu Jun 18 02:47:07 2009
@@ -142,16 +142,15 @@
                 } else {
                     int pos = name.lastIndexOf('/');
                     if (pos < 0) {
-                        URL url = bundle.getEntry(name);
-                        if (url != null) {
-                            urls.add(url);
-                        } else {
-                            throw new IllegalArgumentException("Unable to find bundle entry for config file " + name);
-                        }
+                        addEntry(bundle, name, urls);
                     } else {
                         String baseName = name.substring(0, pos + 1);
                         String filePattern = name.substring(pos + 1);
-                        addEntries(bundle, baseName, filePattern, urls);
+                        if (hasWildcards(filePattern)) {
+                            addEntries(bundle, baseName, filePattern, urls);
+                        } else {
+                            addEntry(bundle, name, urls);
+                        }
                     }
                 }
             }
@@ -190,6 +189,19 @@
         return compatible;
     }
     
+    private boolean hasWildcards(String path) {
+        return path.indexOf("*") >= 0; 
+    }
+    
+    private void addEntry(Bundle bundle, String path, List<URL> urls) {
+        URL url = bundle.getEntry(path);
+        if (url != null) {
+            urls.add(url);
+        } else {
+            throw new IllegalArgumentException("Unable to find bundle entry for config file " + path);
+        }
+    }
+    
     private void addEntries(Bundle bundle, String path, String filePattern, List<URL> urls) {
         Enumeration e = bundle.findEntries(path, filePattern, false);
         while (e != null && e.hasMoreElements()) {