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/04/14 21:49:23 UTC

svn commit: r764933 - in /geronimo/sandbox/blueprint: org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/ org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/context/ org.apache.felix.blueprint/src/test/java/org/apache/...

Author: gawor
Date: Tue Apr 14 19:49:22 2009
New Revision: 764933

URL: http://svn.apache.org/viewvc?rev=764933&view=rev
Log:
recognize Bundle-Blueprint header

Added:
    geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/HeaderParser.java   (with props)
    geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/test/java/org/apache/felix/blueprint/HeaderParserTest.java   (with props)
Modified:
    geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/Activator.java
    geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/ModuleContextEventSender.java
    geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/context/DefaultModuleContextEventSender.java
    geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/context/ModuleContextImpl.java
    geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/context/Parser.java
    geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/context/WaitForDependencyException.java
    geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/test/java/org/apache/felix/blueprint/ParserTest.java
    geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/test/java/org/apache/felix/blueprint/WiringTest.java
    geronimo/sandbox/blueprint/sample/pom.xml

Modified: geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/Activator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/Activator.java?rev=764933&r1=764932&r2=764933&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/Activator.java (original)
+++ geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/Activator.java Tue Apr 14 19:49:22 2009
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.apache.felix.blueprint;
 
 import java.net.URL;
@@ -8,6 +26,7 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.felix.blueprint.HeaderParser.PathElement;
 import org.apache.felix.blueprint.context.DefaultModuleContextEventSender;
 import org.apache.felix.blueprint.context.ModuleContextImpl;
 import org.apache.felix.blueprint.namespace.NamespaceHandlerRegistryImpl;
@@ -68,27 +87,39 @@
             moduleContext.destroy();
         }
     }
-
-    private void checkBundle(Bundle b) {
-        System.out.println("Checking: " + b.getSymbolicName());
+    
+    private void checkBundle(Bundle bundle) {
+        System.out.println("Checking: " + bundle.getSymbolicName());
 
         List<URL> urls = new ArrayList<URL>();
-        Enumeration e = b.findEntries("OSGI-INF/blueprint", "*.xml", true);
-        if (e != null) {
-            while (e.hasMoreElements()) {
-                URL u = (URL) e.nextElement();
-                System.out.println("found xml config:" + u);
-                urls.add(u);
+        Dictionary headers = bundle.getHeaders();
+        String blueprintHeader = (String)headers.get("Bundle-Blueprint");
+        if (blueprintHeader != null) {
+            List<PathElement> paths = HeaderParser.parseHeader(blueprintHeader);
+            for (PathElement path : paths) {
+                URL url = bundle.getEntry(path.getName());
+                if (url != null) {
+                    urls.add(url);
+                }
+            }
+        }
+        
+        if (urls.isEmpty()) {
+            Enumeration e = bundle.findEntries("OSGI-INF/blueprint", "*.xml", true);
+            if (e != null) {
+                while (e.hasMoreElements()) {
+                    URL u = (URL) e.nextElement();
+                    urls.add(u);
+                }
             }
         }
-        if (urls.size() > 0) {
-            ModuleContextImpl moduleContext = new ModuleContextImpl(b.getBundleContext(), sender, urls.toArray(new URL[urls.size()]));
-            contextMap.put(b, moduleContext);
+                
+        if (!urls.isEmpty()) {
+            System.out.println("Found config files:" + urls);
+            ModuleContextImpl moduleContext = new ModuleContextImpl(bundle.getBundleContext(), sender, urls);
+            contextMap.put(bundle, moduleContext);
             moduleContext.create();
         }
-
-        Dictionary d = b.getHeaders();
-        System.out.println(d.get("Bundle-Blueprint"));
     }
 
 

Added: geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/HeaderParser.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/HeaderParser.java?rev=764933&view=auto
==============================================================================
--- geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/HeaderParser.java (added)
+++ geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/HeaderParser.java Tue Apr 14 19:49:22 2009
@@ -0,0 +1,100 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.blueprint;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class HeaderParser  {
+   
+    public static List<PathElement> parseHeader(String header) {
+        List<PathElement> elements = new ArrayList<PathElement>();
+        String[] clauses = header.split(",");
+        for (String clause : clauses) {
+            String[] tokens = clause.split(";");
+            if (tokens.length < 1) {
+                throw new RuntimeException("Invalid header clause: " + clause);
+            }
+            PathElement elem = new PathElement(tokens[0].trim());
+            elements.add(elem);
+            for (int i = 1; i < tokens.length; i++) {
+                int pos = tokens[i].indexOf('=');
+                if (pos != -1) {
+                    if (pos > 0 && tokens[i].charAt(pos - 1) == ':') {
+                        String name = tokens[i].substring(0, pos - 1).trim();
+                        String value = tokens[i].substring(pos + 1).trim();
+                        elem.addDirective(name, value);
+                    } else {
+                        String name = tokens[i].substring(0, pos).trim();
+                        String value = tokens[i].substring(pos + 1).trim();
+                        elem.addAttribute(name, value);
+                    }
+                } else {
+                    elem = new PathElement(tokens[i].trim());
+                    elements.add(elem);
+                }
+            }
+        }
+        return elements;
+    }
+
+    public static class PathElement {
+        
+        private String path;
+        private Map<String, String> attributes;
+        private Map<String, String> directives;
+        
+        public PathElement(String path) {
+            this.path = path;
+            this.attributes = new HashMap<String, String>();
+            this.directives = new HashMap<String, String>();
+        }
+        
+        public String getName() {
+            return this.path;
+        }
+        
+        public Map<String, String> getAttributes() {
+            return attributes;
+        }
+        
+        public String getAttribute(String name) {
+            return attributes.get(name);
+        }
+        
+        public void addAttribute(String name, String value) {
+            attributes.put(name, value);
+        }
+        
+        public Map<String, String> getDirectives() {
+            return directives;
+        }
+        
+        public String getDirective(String name) {
+            return directives.get(name);
+        }
+        
+        public void addDirective(String name, String value) {
+            directives.put(name, value);
+        }        
+        
+    }
+}

Propchange: geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/HeaderParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/HeaderParser.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/HeaderParser.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/ModuleContextEventSender.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/ModuleContextEventSender.java?rev=764933&r1=764932&r2=764933&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/ModuleContextEventSender.java (original)
+++ geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/ModuleContextEventSender.java Tue Apr 14 19:49:22 2009
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.apache.felix.blueprint;
 
 import org.apache.felix.blueprint.context.ModuleContextImpl;

Modified: geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/context/DefaultModuleContextEventSender.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/context/DefaultModuleContextEventSender.java?rev=764933&r1=764932&r2=764933&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/context/DefaultModuleContextEventSender.java (original)
+++ geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/context/DefaultModuleContextEventSender.java Tue Apr 14 19:49:22 2009
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.apache.felix.blueprint.context;
 
 import java.util.Dictionary;

Modified: geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/context/ModuleContextImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/context/ModuleContextImpl.java?rev=764933&r1=764932&r2=764933&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/context/ModuleContextImpl.java (original)
+++ geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/context/ModuleContextImpl.java Tue Apr 14 19:49:22 2009
@@ -21,6 +21,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.List;
 import java.util.Set;
 import java.net.URL;
 
@@ -46,10 +47,10 @@
 
     private final BundleContext bundleContext;
     private final ModuleContextEventSender sender;
-    private final URL[] urls;
+    private final List<URL> urls;
     private ComponentDefinitionRegistryImpl componentDefinitionRegistry;
 
-    public ModuleContextImpl(BundleContext bundleContext, ModuleContextEventSender sender, URL[] urls) {
+    public ModuleContextImpl(BundleContext bundleContext, ModuleContextEventSender sender, List<URL> urls) {
         this.bundleContext = bundleContext;
         this.sender = sender;
         this.urls = urls;
@@ -64,7 +65,7 @@
             Instanciator i = new Instanciator(bundleContext.getBundle());
             Repository repository = i.createRepository(componentDefinitionRegistry);
             ObjectGraph graph = new ObjectGraph(repository);
-            graph.createAll(new ArrayList<String>(componentDefinitionRegistry.getComponentDefinitionNames()));
+            System.out.println(graph.createAll(new ArrayList<String>(componentDefinitionRegistry.getComponentDefinitionNames())));                    
             sender.sendCreated(this);
         } catch (WaitForDependencyException e) {
             sender.sendWaiting(this, null, null); // TODO: give correct args

Modified: geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/context/Parser.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/context/Parser.java?rev=764933&r1=764932&r2=764933&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/context/Parser.java (original)
+++ geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/context/Parser.java Tue Apr 14 19:49:22 2009
@@ -32,17 +32,12 @@
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 
-import org.w3c.dom.CharacterData;
-import org.w3c.dom.Comment;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.EntityReference;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Attr;
-
-import org.apache.felix.blueprint.namespace.ComponentDefinitionRegistryImpl;
 import org.apache.felix.blueprint.NamespaceHandlerRegistry;
+import org.apache.felix.blueprint.namespace.ComponentDefinitionRegistryImpl;
+import org.apache.felix.blueprint.reflect.ArrayValueImpl;
+import org.apache.felix.blueprint.reflect.BindingListenerMetadataImpl;
+import org.apache.felix.blueprint.reflect.CollectionBasedServiceReferenceComponentMetadataImpl;
+import org.apache.felix.blueprint.reflect.ComponentMetadataImpl;
 import org.apache.felix.blueprint.reflect.ComponentValueImpl;
 import org.apache.felix.blueprint.reflect.ListValueImpl;
 import org.apache.felix.blueprint.reflect.LocalComponentMetadataImpl;
@@ -57,13 +52,11 @@
 import org.apache.felix.blueprint.reflect.SetValueImpl;
 import org.apache.felix.blueprint.reflect.TypedStringValueImpl;
 import org.apache.felix.blueprint.reflect.UnaryServiceReferenceComponentMetadataImpl;
-import org.apache.felix.blueprint.reflect.BindingListenerMetadataImpl;
-import org.apache.felix.blueprint.reflect.ComponentMetadataImpl;
-import org.apache.felix.blueprint.reflect.CollectionBasedServiceReferenceComponentMetadataImpl;
-import org.apache.felix.blueprint.reflect.ArrayValueImpl;
-import org.apache.felix.blueprint.convert.ConversionServiceImpl;
 import org.osgi.service.blueprint.context.ComponentDefinitionException;
-import org.osgi.service.blueprint.convert.ConversionService;
+import org.osgi.service.blueprint.reflect.ArrayValue;
+import org.osgi.service.blueprint.reflect.BindingListenerMetadata;
+import org.osgi.service.blueprint.reflect.CollectionBasedServiceReferenceComponentMetadata;
+import org.osgi.service.blueprint.reflect.ComponentMetadata;
 import org.osgi.service.blueprint.reflect.ListValue;
 import org.osgi.service.blueprint.reflect.LocalComponentMetadata;
 import org.osgi.service.blueprint.reflect.MapValue;
@@ -74,10 +67,14 @@
 import org.osgi.service.blueprint.reflect.ServiceReferenceComponentMetadata;
 import org.osgi.service.blueprint.reflect.SetValue;
 import org.osgi.service.blueprint.reflect.Value;
-import org.osgi.service.blueprint.reflect.BindingListenerMetadata;
-import org.osgi.service.blueprint.reflect.ComponentMetadata;
-import org.osgi.service.blueprint.reflect.CollectionBasedServiceReferenceComponentMetadata;
-import org.osgi.service.blueprint.reflect.ArrayValue;
+import org.w3c.dom.Attr;
+import org.w3c.dom.CharacterData;
+import org.w3c.dom.Comment;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.EntityReference;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 import org.xml.sax.InputSource;
 
 /**
@@ -179,7 +176,6 @@
 
     private DocumentBuilderFactory documentBuilderFactory;
     private ComponentDefinitionRegistryImpl registry;
-    private ConversionService conversionService;
     private NamespaceHandlerRegistry namespaceHandlerRegistry;
     private int nameCounter;
     private String defaultTimeout;
@@ -190,7 +186,6 @@
 
     public Parser() {
         registry = new ComponentDefinitionRegistryImpl();
-        conversionService = new ConversionServiceImpl();
         // TODO: Register conversionService, bundle, bundleContext, moduleContext in the registry
     }
 
@@ -198,7 +193,7 @@
         return registry;
     }
 
-    public void parse(URL[] urls) throws Exception {
+    public void parse(List<URL> urls) throws Exception {
         List<Document> documents = new ArrayList<Document>();
         // Load documents
         for (URL url : urls) {

Modified: geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/context/WaitForDependencyException.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/context/WaitForDependencyException.java?rev=764933&r1=764932&r2=764933&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/context/WaitForDependencyException.java (original)
+++ geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/main/java/org/apache/felix/blueprint/context/WaitForDependencyException.java Tue Apr 14 19:49:22 2009
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.apache.felix.blueprint.context;
 
 /**

Added: geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/test/java/org/apache/felix/blueprint/HeaderParserTest.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/test/java/org/apache/felix/blueprint/HeaderParserTest.java?rev=764933&view=auto
==============================================================================
--- geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/test/java/org/apache/felix/blueprint/HeaderParserTest.java (added)
+++ geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/test/java/org/apache/felix/blueprint/HeaderParserTest.java Tue Apr 14 19:49:22 2009
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.blueprint;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.felix.blueprint.HeaderParser.PathElement;
+
+public class HeaderParserTest extends TestCase {
+
+    public void testSimple() throws Exception {
+        List<PathElement> paths = HeaderParser.parseHeader("/foo.xml, /foo/bar.xml");
+        assertEquals(2, paths.size());
+        assertEquals("/foo.xml", paths.get(0).getName());
+        assertEquals(0, paths.get(0).getAttributes().size());
+        assertEquals(0, paths.get(0).getDirectives().size());
+        assertEquals("/foo/bar.xml", paths.get(1).getName());
+        assertEquals(0, paths.get(1).getAttributes().size());
+        assertEquals(0, paths.get(1).getDirectives().size());
+    }
+    
+    public void testComplex() throws Exception {
+        List<PathElement> paths = HeaderParser.parseHeader("OSGI-INF/blueprint/comp1_named.xml;ignored-directive:=true,OSGI-INF/blueprint/comp2_named.xml;some-other-attribute=1");
+        assertEquals(2, paths.size());
+        assertEquals("OSGI-INF/blueprint/comp1_named.xml", paths.get(0).getName());
+        assertEquals(0, paths.get(0).getAttributes().size());
+        assertEquals(1, paths.get(0).getDirectives().size());
+        assertEquals("true", paths.get(0).getDirective("ignored-directive"));
+        assertEquals("OSGI-INF/blueprint/comp2_named.xml", paths.get(1).getName());
+        assertEquals(1, paths.get(1).getAttributes().size());
+        assertEquals("1", paths.get(1).getAttribute("some-other-attribute"));
+        assertEquals(0, paths.get(1).getDirectives().size());
+    }
+
+    public void testPaths() throws Exception {
+        List<PathElement> paths = HeaderParser.parseHeader("OSGI-INF/blueprint/comp1_named.xml;ignored-directive:=true,OSGI-INF/blueprint/comp2_named.xml;foo.xml;a=b;1:=2;c:=d;4=5");
+        assertEquals(3, paths.size());
+        assertEquals("OSGI-INF/blueprint/comp1_named.xml", paths.get(0).getName());
+        assertEquals(0, paths.get(0).getAttributes().size());
+        assertEquals(1, paths.get(0).getDirectives().size());
+        assertEquals("true", paths.get(0).getDirective("ignored-directive"));
+        assertEquals("OSGI-INF/blueprint/comp2_named.xml", paths.get(1).getName());
+        assertEquals(0, paths.get(1).getAttributes().size());
+        assertEquals(0, paths.get(1).getDirectives().size());
+        assertEquals("foo.xml", paths.get(2).getName());
+        assertEquals(2, paths.get(2).getAttributes().size());
+        assertEquals("b", paths.get(2).getAttribute("a"));
+        assertEquals("5", paths.get(2).getAttribute("4"));
+        assertEquals(2, paths.get(2).getDirectives().size());
+        assertEquals("d", paths.get(2).getDirective("c"));
+        assertEquals("2", paths.get(2).getDirective("1"));
+    }
+}

Propchange: geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/test/java/org/apache/felix/blueprint/HeaderParserTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/test/java/org/apache/felix/blueprint/HeaderParserTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/test/java/org/apache/felix/blueprint/HeaderParserTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/test/java/org/apache/felix/blueprint/ParserTest.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/test/java/org/apache/felix/blueprint/ParserTest.java?rev=764933&r1=764932&r2=764933&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/test/java/org/apache/felix/blueprint/ParserTest.java (original)
+++ geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/test/java/org/apache/felix/blueprint/ParserTest.java Tue Apr 14 19:49:22 2009
@@ -18,22 +18,23 @@
  */
 package org.apache.felix.blueprint;
 
-import java.net.URL;
-import java.util.Set;
+import java.util.Arrays;
 import java.util.List;
+import java.util.Set;
 
 import junit.framework.TestCase;
+
+import org.apache.felix.blueprint.context.Parser;
+import org.osgi.service.blueprint.namespace.ComponentDefinitionRegistry;
+import org.osgi.service.blueprint.reflect.ArrayValue;
 import org.osgi.service.blueprint.reflect.ComponentMetadata;
-import org.osgi.service.blueprint.reflect.LocalComponentMetadata;
+import org.osgi.service.blueprint.reflect.ComponentValue;
 import org.osgi.service.blueprint.reflect.ConstructorInjectionMetadata;
-import org.osgi.service.blueprint.reflect.ParameterSpecification;
-import org.osgi.service.blueprint.reflect.TypedStringValue;
+import org.osgi.service.blueprint.reflect.LocalComponentMetadata;
 import org.osgi.service.blueprint.reflect.NullValue;
+import org.osgi.service.blueprint.reflect.ParameterSpecification;
 import org.osgi.service.blueprint.reflect.ReferenceValue;
-import org.osgi.service.blueprint.reflect.ArrayValue;
-import org.osgi.service.blueprint.reflect.ComponentValue;
-import org.osgi.service.blueprint.namespace.ComponentDefinitionRegistry;
-import org.apache.felix.blueprint.context.Parser;
+import org.osgi.service.blueprint.reflect.TypedStringValue;
 
 /**
  * TODO: constructor injection
@@ -114,7 +115,7 @@
 
     public void testParse() throws Exception {
         Parser parser = new Parser();
-        parser.parse(new URL[] { getClass().getResource("/test.xml") });
+        parser.parse(Arrays.asList( getClass().getResource("/test.xml") ));
         ComponentDefinitionRegistry registry = parser.getRegistry();
         assertNotNull(registry);
 
@@ -123,7 +124,7 @@
 
     protected Parser parse(String name) throws Exception {
         Parser parser = new Parser();
-        parser.parse(new URL[] { getClass().getResource(name) });
+        parser.parse(Arrays.asList( getClass().getResource(name) ));
         return parser;
     }
 }

Modified: geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/test/java/org/apache/felix/blueprint/WiringTest.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/test/java/org/apache/felix/blueprint/WiringTest.java?rev=764933&r1=764932&r2=764933&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/test/java/org/apache/felix/blueprint/WiringTest.java (original)
+++ geronimo/sandbox/blueprint/org.apache.felix.blueprint/src/test/java/org/apache/felix/blueprint/WiringTest.java Tue Apr 14 19:49:22 2009
@@ -18,9 +18,10 @@
  */
 package org.apache.felix.blueprint;
 
-import java.net.URL;
+import java.util.Arrays;
 
 import junit.framework.TestCase;
+
 import org.apache.felix.blueprint.context.Instanciator;
 import org.apache.felix.blueprint.context.Parser;
 import org.apache.felix.blueprint.pojos.PojoA;
@@ -45,7 +46,7 @@
 
     protected Parser parse(String name) throws Exception {
         Parser parser = new Parser();
-        parser.parse(new URL[] { getClass().getResource(name) });
+        parser.parse(Arrays.asList( getClass().getResource(name) ));
         return parser;
     }
 

Modified: geronimo/sandbox/blueprint/sample/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/sample/pom.xml?rev=764933&r1=764932&r2=764933&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/sample/pom.xml (original)
+++ geronimo/sandbox/blueprint/sample/pom.xml Tue Apr 14 19:49:22 2009
@@ -39,6 +39,9 @@
                         <Bundle-Activator>
                             org.apache.geronimo.osgi.example.Activator
                         </Bundle-Activator>
+<!--
+                        <Bundle-Blueprint>/test.xml</Bundle-Blueprint>
+-->
                     </instructions>
                 </configuration>
             </plugin>