cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1511350 - in /cxf/trunk/rt: core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java transports/http/src/main/resources/OSGI-INF/blueprint/osgiservlet.xml
Date Wed, 07 Aug 2013 15:07:48 GMT
Author: dkulp
Date: Wed Aug  7 15:07:48 2013
New Revision: 1511350

URL: http://svn.apache.org/r1511350
Log:
Update to be able to grab transports from OSGi services for blueprint... need to test spring.

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java
    cxf/trunk/rt/transports/http/src/main/resources/OSGI-INF/blueprint/osgiservlet.xml

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java?rev=1511350&r1=1511349&r2=1511350&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java
Wed Aug  7 15:07:48 2013
@@ -123,7 +123,6 @@ public class BlueprintBeanLocator implem
                 list.add(type.cast(container.getComponentInstance(s)));
             }
         }
-        list.addAll(orig.getBeansOfType(type));
         if (list.isEmpty()) {
             try {
                 ServiceReference refs[] = context.getServiceReferences(type.getName(), null);
@@ -138,6 +137,7 @@ public class BlueprintBeanLocator implem
                     + " from OSGi services and get error: " + ex);  
             }
         }
+        list.addAll(orig.getBeansOfType(type));
         
         return list;
     }
@@ -166,7 +166,27 @@ public class BlueprintBeanLocator implem
                 loaded = true;
             }
         }
-        return loaded || orig.loadBeansOfType(type, listener);
+        
+        try {
+            ServiceReference refs[] = context.getServiceReferences(type.getName(), null);
+            if (refs != null) {
+                for (ServiceReference r : refs) {
+                    Object o2 = context.getService(r);
+                    Class<? extends T> t = o2.getClass().asSubclass(type);
+                    if (listener.loadBean(t.getName(), t)) {
+                        if (listener.beanLoaded(t.getName(), type.cast(o2))) {
+                            return true;
+                        }
+                        loaded = true;
+                    }
+                }
+            }
+        } catch (Exception ex) {
+            //ignore, just don't support the OSGi services
+            LOG.info("Try to find the Bean with type:" + type 
+                + " from OSGi services and get error: " + ex);  
+        }        
+        return orig.loadBeansOfType(type, listener) || loaded;
     }
 
     public boolean hasConfiguredPropertyValue(String beanName, String propertyName, String
value) {

Modified: cxf/trunk/rt/transports/http/src/main/resources/OSGI-INF/blueprint/osgiservlet.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/resources/OSGI-INF/blueprint/osgiservlet.xml?rev=1511350&r1=1511349&r2=1511350&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/resources/OSGI-INF/blueprint/osgiservlet.xml (original)
+++ cxf/trunk/rt/transports/http/src/main/resources/OSGI-INF/blueprint/osgiservlet.xml Wed
Aug  7 15:07:48 2013
@@ -46,6 +46,9 @@ under the License.
   </cm:property-placeholder>
 
   <bean id="destinationRegistry" class="org.apache.cxf.transport.http.DestinationRegistryImpl"/>
+  <bean id="httpTransport" class="org.apache.cxf.transport.http.HTTPTransportFactory">
+    <argument ref="destinationRegistry"/>
+  </bean>
 
   <bean id="osgiServlet" class="org.apache.cxf.transport.servlet.CXFNonSpringServlet">
     <argument ref="destinationRegistry"/>
@@ -72,6 +75,10 @@ under the License.
 
   <service ref="destinationRegistry" interface="org.apache.cxf.transport.http.DestinationRegistry">
   </service>
+  <service ref="httpTransport" interface="org.apache.cxf.transport.ConduitInitiator">
+  </service>
+  <service ref="httpTransport" interface="org.apache.cxf.transport.DestinationFactory">
+  </service>
 
 </blueprint>
 



Mime
View raw message