cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1417992 - /cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/
Date Thu, 06 Dec 2012 16:38:24 GMT
Author: cschneider
Date: Thu Dec  6 16:38:23 2012
New Revision: 1417992

URL: http://svn.apache.org/viewvc?rev=1417992&view=rev
Log:
DOSGI-127 Move InterceptorUtils into AbstractPojoConfigurationTypeHandler as they are only
used from subclasses

Removed:
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/InterceptorUtils.java
Modified:
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java?rev=1417992&r1=1417991&r2=1417992&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java
Thu Dec  6 16:38:23 2012
@@ -21,6 +21,7 @@ package org.apache.cxf.dosgi.dsw.handler
 import java.lang.reflect.Proxy;
 import java.net.URL;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -32,11 +33,16 @@ import org.apache.cxf.databinding.DataBi
 import org.apache.cxf.dosgi.dsw.Constants;
 import org.apache.cxf.dosgi.dsw.qos.IntentManager;
 import org.apache.cxf.dosgi.dsw.qos.IntentUtils;
+import org.apache.cxf.dosgi.dsw.util.ClassUtils;
 import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
+import org.apache.cxf.endpoint.AbstractEndpointFactory;
 import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.feature.AbstractFeature;
 import org.apache.cxf.frontend.ClientFactoryBean;
 import org.apache.cxf.frontend.ClientProxyFactoryBean;
 import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.jaxb.JAXBDataBinding;
 import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
 import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
@@ -240,4 +246,63 @@ public abstract class AbstractPojoConfig
         }
     }
 
+    protected static void addWsInterceptorsFeaturesProps(
+            AbstractEndpointFactory factory, BundleContext callingContext, Map<String,
Object> sd) {
+        addInterceptors(factory, callingContext, sd, Constants.WS_IN_INTERCEPTORS_PROP_KEY);
+        addInterceptors(factory, callingContext, sd, Constants.WS_OUT_INTERCEPTORS_PROP_KEY);
+        addInterceptors(factory, callingContext, sd, Constants.WS_OUT_FAULT_INTERCEPTORS_PROP_KEY);
+        addInterceptors(factory, callingContext, sd, Constants.WS_IN_FAULT_INTERCEPTORS_PROP_KEY);
+        addFeatures(factory, callingContext, sd, Constants.WS_FEATURES_PROP_KEY);
+        addContextProperties(factory, callingContext, sd, Constants.WS_CONTEXT_PROPS_PROP_KEY);
+    }
+    
+    static void addRsInterceptorsFeaturesProps(
+            AbstractEndpointFactory factory, BundleContext callingContext, Map<String,
Object> sd) {
+        addInterceptors(factory, callingContext, sd, Constants.RS_IN_INTERCEPTORS_PROP_KEY);
+        addInterceptors(factory, callingContext, sd, Constants.RS_OUT_INTERCEPTORS_PROP_KEY);
+        addInterceptors(factory, callingContext, sd, Constants.RS_OUT_FAULT_INTERCEPTORS_PROP_KEY);
+        addInterceptors(factory, callingContext, sd, Constants.RS_IN_FAULT_INTERCEPTORS_PROP_KEY);
+        addFeatures(factory, callingContext, sd, Constants.RS_FEATURES_PROP_KEY);
+        addContextProperties(factory, callingContext, sd, Constants.RS_CONTEXT_PROPS_PROP_KEY);
+    }
+
+    private static void addInterceptors(AbstractEndpointFactory factory, BundleContext callingContext,

+            Map<String, Object> sd, String propName) {
+
+        List<Object> providers = ClassUtils.loadProviderClasses(callingContext, sd,
propName); 
+        boolean in = propName.contains("in.interceptors");
+        boolean out = propName.contains("out.interceptors");
+        boolean in_fault = propName.contains("in.fault.interceptors");
+        boolean out_fault = propName.contains("out.fault.interceptors");
+        for (int i = 0; i < providers.size(); i++) {
+            Interceptor<?> interceptor = (Interceptor<?>)providers.get(i);  
+            if (in) {
+                factory.getInInterceptors().add(interceptor);
+            } else if (out) {
+                factory.getOutInterceptors().add(interceptor);
+            } else if (in_fault) {
+                factory.getInFaultInterceptors().add(interceptor);
+            } else if (out_fault) {
+                factory.getOutFaultInterceptors().add(interceptor);
+            }
+        }
+    }
+       
+    private static void addFeatures(AbstractEndpointFactory factory, BundleContext callingContext,

+            Map<String, Object> sd, String propName) {
+
+        List<Object> providers = ClassUtils.loadProviderClasses(callingContext, sd,
propName); 
+        if (providers.size() > 0) {
+            factory.getFeatures().addAll(CastUtils.cast(providers, AbstractFeature.class));
+        }
+    }
+    
+    private static void addContextProperties(AbstractEndpointFactory factory, BundleContext
callingContext, 
+            Map<String, Object> sd, String propName) {
+        @SuppressWarnings("unchecked")
+        Map<String, Object> props = (Map<String, Object>)sd.get(propName);
+        if (props != null) {
+            factory.getProperties(true).putAll(props);
+        }
+    }
 }

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java?rev=1417992&r1=1417991&r2=1417992&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java
Thu Dec  6 16:38:23 2012
@@ -96,7 +96,7 @@ public class JaxRSPojoConfigurationTypeH
         	bean.setClassLoader(loader);
         }
         
-        InterceptorUtils.addRsInterceptorsFeaturesProps(bean, callingContext, sd.getProperties());
+        addRsInterceptorsFeaturesProps(bean, callingContext, sd.getProperties());
         
         List<UserResource> resources = JaxRSUtils.getModel(callingContext, iClass);
         if (resources != null) {
@@ -174,7 +174,7 @@ public class JaxRSPojoConfigurationTypeH
         if (providers != null && providers.size() > 0) {
             factory.setProviders(providers);
         }
-        InterceptorUtils.addRsInterceptorsFeaturesProps(factory, callingContext, sd);
+        addRsInterceptorsFeaturesProps(factory, callingContext, sd);
         String location = OsgiUtils.getProperty(sd, Constants.RS_WADL_LOCATION);
         if (location != null) {
             URL wadlURL = callingContext.getBundle().getResource(location);

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java?rev=1417992&r1=1417991&r2=1417992&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java
Thu Dec  6 16:38:23 2012
@@ -59,7 +59,7 @@ public class PojoConfigurationTypeHandle
             ClientProxyFactoryBean factory = createClientProxyFactoryBean(serviceReference,
iClass);
             factory.setServiceClass(iClass);
             factory.setAddress(address);
-            InterceptorUtils.addWsInterceptorsFeaturesProps(factory.getClientFactoryBean(),
callingContext, sd.getProperties());
+            addWsInterceptorsFeaturesProps(factory.getClientFactoryBean(), callingContext,
sd.getProperties());
             setClientWsdlProperties(factory.getClientFactoryBean(), dswContext, sd.getProperties(),
false);
 
             intentManager.applyIntents(factory.getFeatures(), factory.getClientFactoryBean(),
sd.getProperties());
@@ -88,7 +88,7 @@ public class PojoConfigurationTypeHandle
         factory.setServiceClass(iClass);
         factory.setAddress(address);
         factory.setServiceBean(serviceBean);
-        InterceptorUtils.addWsInterceptorsFeaturesProps(factory, callingContext, sd);
+        addWsInterceptorsFeaturesProps(factory, callingContext, sd);
         setWsdlProperties(factory, callingContext, sd, false);
         String[] intents = intentManager.applyIntents(factory.getFeatures(), factory, sd);
         

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java?rev=1417992&r1=1417991&r2=1417992&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java
Thu Dec  6 16:38:23 2012
@@ -136,7 +136,7 @@ public class WsdlConfigurationTypeHandle
         factory.getServiceFactory().setDataBinding(databinding);
         factory.setServiceBean(serviceBean);
 
-        InterceptorUtils.addWsInterceptorsFeaturesProps(factory, callingContext, sd);
+        addWsInterceptorsFeaturesProps(factory, callingContext, sd);
         
         setWsdlProperties(factory, callingContext, sd, true);
         



Mime
View raw message