Author: asoldano
Date: 2015-03-12 07:36:20 -0400 (Thu, 12 Mar 2015)
New Revision: 19555
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/FeatureUtils.java
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/InterceptorUtils.java
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/jaxws-client/main/module.xml
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly900/org/jboss/ws/jaxws-client/main/module.xml
Log:
[JBWS-3879] Use MapToBeanConverter for both features and interceptors
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/FeatureUtils.java
===================================================================
---
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/FeatureUtils.java 2015-03-12
08:17:52 UTC (rev 19554)
+++
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/FeatureUtils.java 2015-03-12
11:36:20 UTC (rev 19555)
@@ -29,8 +29,6 @@
import org.apache.cxf.Bus;
import org.apache.cxf.feature.Feature;
import org.apache.cxf.interceptor.InterceptorProvider;
-import org.jboss.ws.common.utils.DelegateClassLoader;
-import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
import org.jboss.wsf.stack.cxf.client.Constants;
/**
@@ -45,18 +43,19 @@
public static void addFeatures(InterceptorProvider interceptorProvider, Bus bus,
Map<String, String> properties) {
final String features = properties.get(Constants.CXF_FEATURES_PROP);
if (features != null) {
- for (Feature f : createFeatures(features)) {
+ MapToBeanConverter converter = new MapToBeanConverter(properties);
+ for (Feature f : createFeatures(features, converter)) {
f.initialize(interceptorProvider, bus);
}
}
}
- private static List<Feature> createFeatures(String propValue) {
+ private static List<Feature> createFeatures(String propValue, MapToBeanConverter
converter) {
List<Feature> list = new ArrayList<Feature>();
- StringTokenizer st = new StringTokenizer(propValue, ", ", false );
+ StringTokenizer st = new StringTokenizer(propValue, ", ", false);
+
while (st.hasMoreTokens()) {
- String itc = st.nextToken();
- Feature feature = (Feature)newInstance(itc);
+ Feature feature = (Feature)newInstance(st.nextToken(), converter);
if (feature != null) {
list.add(feature);
}
@@ -64,14 +63,11 @@
return list;
}
- private static Object newInstance(String className)
+ private static Object newInstance(String className, MapToBeanConverter converter)
{
try
{
- ClassLoader loader = new
DelegateClassLoader(ClassLoaderProvider.getDefaultProvider()
- .getServerIntegrationClassLoader(),
SecurityActions.getContextClassLoader());
- Class<?> clazz = SecurityActions.loadClass(loader, className);
- return clazz.newInstance();
+ return className.startsWith(MapToBeanConverter.BEAN_ID_PREFIX) ?
converter.get(className) : converter.newInstance(className);
}
catch (Exception e)
{
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/InterceptorUtils.java
===================================================================
---
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/InterceptorUtils.java 2015-03-12
08:17:52 UTC (rev 19554)
+++
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/InterceptorUtils.java 2015-03-12
11:36:20 UTC (rev 19555)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2014, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2015, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -30,8 +30,6 @@
import org.apache.cxf.interceptor.Interceptor;
import org.apache.cxf.interceptor.InterceptorProvider;
-import org.jboss.ws.common.utils.DelegateClassLoader;
-import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
import org.jboss.wsf.stack.cxf.client.Constants;
/**
@@ -44,13 +42,20 @@
public class InterceptorUtils
{
public static void addInterceptors(InterceptorProvider interceptorProvider,
Map<String, String> properties) {
+ MapToBeanConverter converter = null;
final String inInterceptors = properties.get(Constants.CXF_IN_INTERCEPTORS_PROP);
if (inInterceptors != null) {
-
interceptorProvider.getInInterceptors().addAll(createInterceptors(inInterceptors));
+ if (converter == null) {
+ converter = new MapToBeanConverter(properties);
+ }
+
interceptorProvider.getInInterceptors().addAll(createInterceptors(inInterceptors,
converter));
}
final String outInterceptors =
properties.get(Constants.CXF_OUT_INTERCEPTORS_PROP);
if (outInterceptors != null) {
-
interceptorProvider.getOutInterceptors().addAll(createInterceptors(outInterceptors));
+ if (converter == null) {
+ converter = new MapToBeanConverter(properties);
+ }
+
interceptorProvider.getOutInterceptors().addAll(createInterceptors(outInterceptors,
converter));
}
}
@@ -69,12 +74,11 @@
interceptorsList.removeAll(toBeRemoved);
}
- private static List<Interceptor<?>> createInterceptors(String propValue)
{
+ private static List<Interceptor<?>> createInterceptors(String propValue,
MapToBeanConverter converter) {
List<Interceptor<?>> list = new
ArrayList<Interceptor<?>>();
StringTokenizer st = new StringTokenizer(propValue, ", ", false );
while (st.hasMoreTokens()) {
- String itc = st.nextToken();
- Interceptor<?> interceptor = (Interceptor<?>)newInstance(itc);
+ Interceptor<?> interceptor =
(Interceptor<?>)newInstance(st.nextToken(), converter);
if (interceptor != null) {
list.add(interceptor);
}
@@ -82,14 +86,11 @@
return list;
}
- private static Object newInstance(String className)
+ private static Object newInstance(String className, MapToBeanConverter converter)
{
try
{
- ClassLoader loader = new
DelegateClassLoader(ClassLoaderProvider.getDefaultProvider()
- .getServerIntegrationClassLoader(),
SecurityActions.getContextClassLoader());
- Class<?> clazz = SecurityActions.loadClass(loader, className);
- return clazz.newInstance();
+ return className.startsWith(MapToBeanConverter.BEAN_ID_PREFIX) ?
converter.get(className) : converter.newInstance(className);
}
catch (Exception e)
{
Modified:
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/jaxws-client/main/module.xml
===================================================================
---
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/jaxws-client/main/module.xml 2015-03-12
08:17:52 UTC (rev 19554)
+++
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/jaxws-client/main/module.xml 2015-03-12
11:36:20 UTC (rev 19555)
@@ -67,6 +67,7 @@
<module name="org.apache.ws.security" />
<module name="org.jboss.logging" />
<module name="org.picketbox"/>
+ <module name="org.apache.commons.beanutils"/>
<module name="org.springframework.spring"
optional="true">
<imports>
<include path="META-INF"/>
Modified:
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly900/org/jboss/ws/jaxws-client/main/module.xml
===================================================================
---
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly900/org/jboss/ws/jaxws-client/main/module.xml 2015-03-12
08:17:52 UTC (rev 19554)
+++
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly900/org/jboss/ws/jaxws-client/main/module.xml 2015-03-12
11:36:20 UTC (rev 19555)
@@ -67,6 +67,7 @@
<module name="org.apache.ws.security" />
<module name="org.jboss.logging" />
<module name="org.picketbox"/>
+ <module name="org.apache.commons.beanutils"/>
<module name="org.springframework.spring"
optional="true">
<imports>
<include path="META-INF"/>