Author: dkulp
Date: Mon Aug 12 16:55:08 2013
New Revision: 1513193

URL: http://svn.apache.org/r1513193
Log:
Combine the two namespace handlers into one

Removed:
    
cxf/trunk/core/src/main/java/org/apache/cxf/bus/blueprint/CXFCoreNamespaceHandler.java
    cxf/trunk/core/src/main/resources/OSGI-INF/blueprint/cxf-api.xml
    
cxf/trunk/core/src/test/java/org/apache/cxf/bus/blueprint/CXFCoreNamespaceHandlerTest.java
Modified:
    
cxf/trunk/core/src/main/java/org/apache/cxf/internal/CXFAPINamespaceHandler.java
    cxf/trunk/core/src/main/resources/OSGI-INF/blueprint/cxf-core.xml
    
cxf/trunk/core/src/test/java/org/apache/cxf/internal/CXFAPINamespaceHandlerTest.java

Modified: 
cxf/trunk/core/src/main/java/org/apache/cxf/internal/CXFAPINamespaceHandler.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/core/src/main/java/org/apache/cxf/internal/CXFAPINamespaceHandler.java?rev=1513193&r1=1513192&r2=1513193&view=diff
==============================================================================
--- 
cxf/trunk/core/src/main/java/org/apache/cxf/internal/CXFAPINamespaceHandler.java
 (original)
+++ 
cxf/trunk/core/src/main/java/org/apache/cxf/internal/CXFAPINamespaceHandler.java
 Mon Aug 12 16:55:08 2013
@@ -27,6 +27,12 @@ import org.w3c.dom.Node;
 
 import org.apache.aries.blueprint.NamespaceHandler;
 import org.apache.aries.blueprint.ParserContext;
+import org.apache.aries.blueprint.mutable.MutableBeanMetadata;
+import org.apache.cxf.bus.blueprint.BusDefinitionParser;
+import org.apache.cxf.configuration.blueprint.SimpleBPBeanDefinitionParser;
+import org.apache.cxf.feature.FastInfosetFeature;
+import org.apache.cxf.feature.LoggingFeature;
+import org.apache.cxf.workqueue.AutomaticWorkQueueImpl;
 import org.osgi.service.blueprint.reflect.ComponentMetadata;
 import org.osgi.service.blueprint.reflect.Metadata;
 
@@ -44,12 +50,41 @@ public class CXFAPINamespaceHandler impl
             return 
getClass().getClassLoader().getResource("schemas/configuration/security.xsd");
         } else if ("http://schemas.xmlsoap.org/wsdl/".equals(namespace)) {
             return 
getClass().getClassLoader().getResource("schemas/wsdl/wsdl.xsd");
+        } else if ("http://cxf.apache.org/blueprint/core".equals(namespace)) {
+            return 
getClass().getClassLoader().getResource("schemas/blueprint/core.xsd");
         }
         return null;
     }
 
 
     public Metadata parse(Element element, ParserContext context) {
+        String s = element.getLocalName();
+        if ("bus".equals(s)) {
+            //parse bus
+            return new BusDefinitionParser().parse(element, context);
+        } else if ("logging".equals(s)) {
+            //logging feature
+            return new 
SimpleBPBeanDefinitionParser(LoggingFeature.class).parse(element, context);
+        } else if ("fastinfoset".equals(s)) {
+            //fastinfosetfeature
+            return new 
SimpleBPBeanDefinitionParser(FastInfosetFeature.class).parse(element, context);
+        } else if ("workqueue".equals(s)) {
+            return new 
SimpleBPBeanDefinitionParser(AutomaticWorkQueueImpl.class) {
+                public String getId(Element element, ParserContext context) {
+                    String id = element.hasAttribute("id") ? 
element.getAttribute("id") : null;
+                    if (id == null) {
+                        id = "cxf.workqueue."; 
+                        id += element.hasAttribute("name") ? 
element.getAttribute("name") : "def";
+                    }
+                    return id;
+                }
+
+                protected void processNameAttribute(Element element, 
ParserContext ctx,
+                                                    MutableBeanMetadata bean, 
String val) {
+                    bean.addProperty("name", createValue(ctx, val));
+                }
+            } .parse(element, context);
+        }
         return null;
     }
 

Modified: cxf/trunk/core/src/main/resources/OSGI-INF/blueprint/cxf-core.xml
URL: 
http://svn.apache.org/viewvc/cxf/trunk/core/src/main/resources/OSGI-INF/blueprint/cxf-core.xml?rev=1513193&r1=1513192&r2=1513193&view=diff
==============================================================================
--- cxf/trunk/core/src/main/resources/OSGI-INF/blueprint/cxf-core.xml (original)
+++ cxf/trunk/core/src/main/resources/OSGI-INF/blueprint/cxf-core.xml Mon Aug 
12 16:55:08 2013
@@ -22,11 +22,32 @@
            
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0";
            xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd";>
 
-  <bean id="CXFCoreNamespaceHandler" 
class="org.apache.cxf.bus.blueprint.CXFCoreNamespaceHandler"/>
+  <bean id="CXFAPINamespaceHandler" 
class="org.apache.cxf.internal.CXFAPINamespaceHandler"/>
 
-  <service ref="CXFCoreNamespaceHandler" 
interface="org.apache.aries.blueprint.NamespaceHandler">
+  <service ref="CXFAPINamespaceHandler" 
interface="org.apache.aries.blueprint.NamespaceHandler">
     <service-properties>
       <entry key="osgi.service.blueprint.namespace" 
value="http://cxf.apache.org/blueprint/core"/>
     </service-properties>
+  </service>  
+  <service ref="CXFAPINamespaceHandler" 
interface="org.apache.aries.blueprint.NamespaceHandler">
+    <service-properties>
+      <entry key="osgi.service.blueprint.namespace" 
value="http://cxf.apache.org/configuration/beans"/>
+    </service-properties>
+  </service>
+  <service ref="CXFAPINamespaceHandler" 
interface="org.apache.aries.blueprint.NamespaceHandler">
+    <service-properties>
+      <entry key="osgi.service.blueprint.namespace" 
value="http://cxf.apache.org/configuration/parameterized-types"/>
+    </service-properties>
   </service>
+  <service ref="CXFAPINamespaceHandler" 
interface="org.apache.aries.blueprint.NamespaceHandler">
+    <service-properties>
+      <entry key="osgi.service.blueprint.namespace" 
value="http://cxf.apache.org/configuration/security"/>
+    </service-properties>
+  </service>
+  <!-- additional namespaces that are referenced by cxf configuration schemas 
-->
+  <service ref="CXFAPINamespaceHandler" 
interface="org.apache.aries.blueprint.NamespaceHandler">
+    <service-properties>
+      <entry key="osgi.service.blueprint.namespace" 
value="http://schemas.xmlsoap.org/wsdl/"/>
+    </service-properties>
+  </service>  
 </blueprint>
\ No newline at end of file

Modified: 
cxf/trunk/core/src/test/java/org/apache/cxf/internal/CXFAPINamespaceHandlerTest.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/core/src/test/java/org/apache/cxf/internal/CXFAPINamespaceHandlerTest.java?rev=1513193&r1=1513192&r2=1513193&view=diff
==============================================================================
--- 
cxf/trunk/core/src/test/java/org/apache/cxf/internal/CXFAPINamespaceHandlerTest.java
 (original)
+++ 
cxf/trunk/core/src/test/java/org/apache/cxf/internal/CXFAPINamespaceHandlerTest.java
 Mon Aug 12 16:55:08 2013
@@ -34,6 +34,7 @@ public class CXFAPINamespaceHandlerTest 
         
assertNotNull(handler.getSchemaLocation("http://cxf.apache.org/configuration/parameterized-types";));
         
assertNotNull(handler.getSchemaLocation("http://cxf.apache.org/configuration/security";));
         
assertNotNull(handler.getSchemaLocation("http://schemas.xmlsoap.org/wsdl/";));
+        
assertNotNull(handler.getSchemaLocation("http://cxf.apache.org/blueprint/core";));
     }
 
 }


Reply via email to