cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [1/2] cxf git commit: CXF-6896: CDI integration: duplicate service / feature / provider beans are registered when Application class has singletons
Date Tue, 10 May 2016 23:55:11 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 01d06cee0 -> 61765fce3


CXF-6896: CDI integration: duplicate service / feature / provider beans are registered when
Application class has singletons


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e14d803f
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e14d803f
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e14d803f

Branch: refs/heads/master
Commit: e14d803ff84be7c59dd7c2321f1090231967d45c
Parents: 01d06ce
Author: reta <drreta@gmail.com>
Authored: Tue May 10 19:53:39 2016 -0400
Committer: reta <drreta@gmail.com>
Committed: Tue May 10 19:53:39 2016 -0400

----------------------------------------------------------------------
 .../cxf/cdi/JAXRSCdiResourceExtension.java      | 36 --------------------
 1 file changed, 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/e14d803f/integration/cdi/src/main/java/org/apache/cxf/cdi/JAXRSCdiResourceExtension.java
----------------------------------------------------------------------
diff --git a/integration/cdi/src/main/java/org/apache/cxf/cdi/JAXRSCdiResourceExtension.java
b/integration/cdi/src/main/java/org/apache/cxf/cdi/JAXRSCdiResourceExtension.java
index b5d88c6..85b63f0 100644
--- a/integration/cdi/src/main/java/org/apache/cxf/cdi/JAXRSCdiResourceExtension.java
+++ b/integration/cdi/src/main/java/org/apache/cxf/cdi/JAXRSCdiResourceExtension.java
@@ -19,10 +19,7 @@
 package org.apache.cxf.cdi;
 
 import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 import java.util.ServiceLoader;
 
 import javax.enterprise.event.Observes;
@@ -44,7 +41,6 @@ import javax.ws.rs.ext.Provider;
 import org.apache.cxf.Bus;
 import org.apache.cxf.bus.extension.ExtensionManagerBus;
 import org.apache.cxf.feature.Feature;
-import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
 import org.apache.cxf.jaxrs.utils.ResourceUtils;
 
@@ -146,44 +142,12 @@ public class JAXRSCdiResourceExtension implements Extension {
     private JAXRSServerFactoryBean createFactoryInstance(final Application application) {
         
         final JAXRSServerFactoryBean instance = ResourceUtils.createApplication(application,
false, false);
-        final Map< Class< ? >, List< Object > > classified = classifySingletons(application.getSingletons());
-        instance.setServiceBeans(classified.get(Path.class));
-        instance.setProviders(classified.get(Provider.class));
-        instance.setFeatures(CastUtils.cast(classified.get(Feature.class), Feature.class));
         instance.setBus(bus);
 
         return instance; 
     }
     
     /**
-     * JAX-RS application has defined singletons as being instances of any providers, resources
and features.
-     * In the JAXRSServerFactoryBean, those should be split around several method calls depending
on instance
-     * type. At the moment, only the Feature is CXF-specific and should be replaced by JAX-RS
Feature implementation.
-     * @param singletons application singletons
-     * @return classified singletons by instance types
-     */
-    private Map< Class< ? >, List< Object > > classifySingletons(final
Collection< Object > singletons) {
-        final Map< Class< ? >, List< Object > > classified = 
-            new HashMap< Class< ? >, List< Object > >();
-        
-        classified.put(Feature.class, new ArrayList< Object >());
-        classified.put(Provider.class, new ArrayList< Object >());
-        classified.put(Path.class, new ArrayList< Object >());
-        
-        for (final Object singleton: singletons) {
-            if (singleton instanceof Feature) {
-                classified.get(Feature.class).add(singleton);
-            } else if (singleton.getClass().isAnnotationPresent(Provider.class)) {
-                classified.get(Provider.class).add(singleton);
-            } else if (singleton.getClass().isAnnotationPresent(Path.class)) {
-                classified.get(Path.class).add(singleton);
-            }
-        }
-        
-        return classified;
-    }
-
-    /**
      * Load external providers from service loader
      * @return loaded external providers
      */


Mime
View raw message