cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1562548 - in /cxf/trunk/rt/frontend/jaxrs/src/main: java/org/apache/cxf/jaxrs/blueprint/JAXRSServerFactoryBeanDefinitionParser.java resources/schemas/blueprint/jaxrs.xsd
Date Wed, 29 Jan 2014 18:59:16 GMT
Author: sergeyb
Date: Wed Jan 29 18:59:15 2014
New Revision: 1562548

URL: http://svn.apache.org/r1562548
Log:
[CXF-5528] Support for interfaces in jaxrs Blueprint endpoints, patch from Heath Kesler applied

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/blueprint/JAXRSServerFactoryBeanDefinitionParser.java
    cxf/trunk/rt/frontend/jaxrs/src/main/resources/schemas/blueprint/jaxrs.xsd

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/blueprint/JAXRSServerFactoryBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/blueprint/JAXRSServerFactoryBeanDefinitionParser.java?rev=1562548&r1=1562547&r2=1562548&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/blueprint/JAXRSServerFactoryBeanDefinitionParser.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/blueprint/JAXRSServerFactoryBeanDefinitionParser.java
Wed Jan 29 18:59:15 2014
@@ -18,6 +18,7 @@
  */
 package org.apache.cxf.jaxrs.blueprint;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.Callable;
 
@@ -31,6 +32,7 @@ import org.apache.aries.blueprint.mutabl
 import org.apache.aries.blueprint.mutable.MutablePassThroughMetadata;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.configuration.blueprint.SimpleBPBeanDefinitionParser;
+import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
 import org.apache.cxf.jaxrs.model.UserResource;
 import org.apache.cxf.jaxrs.utils.ResourceUtils;
@@ -97,6 +99,15 @@ public class JAXRSServerFactoryBeanDefin
             bean.addProperty(name, this.parseListData(ctx, bean, el));
         }  else if ("serviceFactories".equals(name)) {
             bean.addProperty("resourceProviders", this.parseListData(ctx, bean, el));
+        } else if ("resourceClasses".equals(name)) {
+            List<String> resources = getResourceClassesFromElement(el);
+            MutableCollectionMetadata list = ctx.createMetadata(MutableCollectionMetadata.class);
+            list.setCollectionClass(List.class);
+            for (String res : resources) {
+                MutableBeanMetadata objectOfClass = createObjectOfClass(ctx, res);
+                list.addValue(objectOfClass);
+            }
+            bean.addProperty("serviceBeans", list);
         } else if ("model".equals(name)) {
             List<UserResource> resources = ResourceUtils.getResourcesFromElement(el);
             MutableCollectionMetadata list = ctx.createMetadata(MutableCollectionMetadata.class);
@@ -146,4 +157,17 @@ public class JAXRSServerFactoryBeanDefin
         }
     }
 
+    private static List<String> getResourceClassesFromElement(Element modelEl) {
+        List<String> resources = new ArrayList<String>();
+        List<Element> resourceEls =
+            DOMUtils.findAllElementsByTagName(modelEl, "class");
+        for (Element e : resourceEls) {
+            resources.add(getResourceClassFromElement(e));
+        }
+        return resources;
+    }
+    
+    private static String getResourceClassFromElement(Element e) {
+        return e.getAttribute("name");
+    }
 }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/resources/schemas/blueprint/jaxrs.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/resources/schemas/blueprint/jaxrs.xsd?rev=1562548&r1=1562547&r2=1562548&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/resources/schemas/blueprint/jaxrs.xsd (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/resources/schemas/blueprint/jaxrs.xsd Wed Jan 29
18:59:15 2014
@@ -48,6 +48,7 @@
             <xsd:element name="outFaultInterceptors" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="properties" type="beans:Tmap" minOccurs="0"/>
             <xsd:element name="serviceBeans" type="xsd:anyType" minOccurs="0"/>   
        
+            <xsd:element name="resourceClasses" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="modelBeans" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="model" type="tns:model" minOccurs="0"/>
             <xsd:element name="providers" type="xsd:anyType" minOccurs="0"/>



Mime
View raw message