Author: rfeng
Date: Fri Apr 24 15:58:56 2009
New Revision: 768341
URL: http://svn.apache.org/viewvc?rev=768341&view=rev
Log:
Move the JAX-WS holder testing logic to interface-java-jaxws
Modified:
tuscany/branches/sca-java-1.x/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
tuscany/branches/sca-java-1.x/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java
Modified:
tuscany/branches/sca-java-1.x/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
URL:
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java?rev=768341&r1=768340&r2=768341&view=diff
==============================================================================
---
tuscany/branches/sca-java-1.x/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
(original)
+++
tuscany/branches/sca-java-1.x/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
Fri Apr 24 15:58:56 2009
@@ -22,6 +22,8 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
@@ -37,6 +39,7 @@
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
import javax.xml.namespace.QName;
+import javax.xml.ws.Holder;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
@@ -71,7 +74,6 @@
private FaultExceptionMapper faultExceptionMapper;
private XMLAdapterExtensionPoint xmlAdapterExtensionPoint;
-
public JAXWSJavaInterfaceProcessor(DataBindingExtensionPoint
dataBindingExtensionPoint,
FaultExceptionMapper
faultExceptionMapper,
XMLAdapterExtensionPoint xmlAdapters) {
@@ -138,7 +140,7 @@
boolean bare = false;
if (methodSOAPBinding != null) {
bare = methodSOAPBinding.parameterStyle() ==
SOAPBinding.ParameterStyle.BARE;
- if(bare) {
+ if (bare) {
// For BARE parameter style, the data won't be unwrapped
// The wrapper should be null
operation.setInputWrapperStyle(false);
@@ -169,6 +171,8 @@
operation.setNonBlocking(true);
}
+ List<ParameterMode> parameterModes = operation.getParameterModes();
+
// Handle BARE mapping
if (bare) {
for (int i = 0; i < method.getParameterTypes().length; i++) {
@@ -182,7 +186,7 @@
if (logical instanceof XMLType) {
((XMLType)logical).setElementName(element);
}
- operation.getParameterModes().set(i,
getParameterMode(param.mode()));
+ parameterModes.set(i, getParameterMode(param.mode()));
}
}
WebResult result = method.getAnnotation(WebResult.class);
@@ -229,8 +233,8 @@
return dt;
} catch (ClassNotFoundException e) {
GeneratedClassLoader cl = new
GeneratedClassLoader(clazz.getClassLoader());
- return new
GeneratedDataTypeImpl(xmlAdapterExtensionPoint, method, inputWrapperClassName,
inputNS, inputName, true,
- cl);
+ return new
GeneratedDataTypeImpl(xmlAdapterExtensionPoint, method, inputWrapperClassName,
+ inputNS,
inputName, true, cl);
}
}
});
@@ -269,8 +273,8 @@
return dt;
} catch (ClassNotFoundException e) {
GeneratedClassLoader cl = new
GeneratedClassLoader(clazz.getClassLoader());
- return new
GeneratedDataTypeImpl(xmlAdapterExtensionPoint, method, outputWrapperClassName,
outputNS, outputName,
- false, cl);
+ return new
GeneratedDataTypeImpl(xmlAdapterExtensionPoint, method, outputWrapperClassName,
+ outputNS,
outputName, false, cl);
}
}
});
@@ -293,7 +297,7 @@
}
inputElements.add(new ElementInfo(element, new
TypeInfo(type, false, null)));
if (param != null) {
- operation.getParameterModes().set(i,
getParameterMode(param.mode()));
+ parameterModes.set(i, getParameterMode(param.mode()));
}
}
@@ -318,8 +322,7 @@
String db = inputWrapperDT != null ?
inputWrapperDT.getDataBinding() : JAXB_DATABINDING;
- WrapperInfo inputWrapperInfo =
- new WrapperInfo(db, new ElementInfo(inputWrapper, null),
inputElements);
+ WrapperInfo inputWrapperInfo = new WrapperInfo(db, new
ElementInfo(inputWrapper, null), inputElements);
WrapperInfo outputWrapperInfo =
new WrapperInfo(db, new ElementInfo(outputWrapper, null),
outputElements);
@@ -329,7 +332,37 @@
operation.setInputWrapper(inputWrapperInfo);
operation.setOutputWrapper(outputWrapperInfo);
}
+
+ List<DataType> inputTypes = operation.getInputType().getLogical();
+ for (int i = 0, size = parameterModes.size(); i < size; i++) {
+ // Holder pattern. Physical types of Holder<T> classes are
updated to <T> to aid in transformations.
+ if (Holder.class == inputTypes.get(i).getPhysical()) {
+ Type firstActual =
getFirstActualType(inputTypes.get(i).getGenericType());
+ if (firstActual != null) {
+ inputTypes.get(i).setPhysical((Class<?>)firstActual);
+ if (parameterModes.get(i) == ParameterMode.IN) {
+ parameterModes.set(i, ParameterMode.INOUT);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Given a Class<T>, returns T, otherwise null.
+ * @param testClass
+ * @return
+ */
+ protected static Type getFirstActualType(Type genericType) {
+ if (genericType instanceof ParameterizedType) {
+ ParameterizedType pType = (ParameterizedType)genericType;
+ Type[] actualTypes = pType.getActualTypeArguments();
+ if ((actualTypes != null) && (actualTypes.length > 0)) {
+ return actualTypes[0];
+ }
}
+ return null;
}
@SuppressWarnings("unchecked")
Modified:
tuscany/branches/sca-java-1.x/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java
URL:
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java?rev=768341&r1=768340&r2=768341&view=diff
==============================================================================
---
tuscany/branches/sca-java-1.x/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java
(original)
+++
tuscany/branches/sca-java-1.x/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java
Fri Apr 24 15:58:56 2009
@@ -33,7 +33,6 @@
import java.util.Set;
import javax.xml.namespace.QName;
-import javax.xml.ws.Holder;
import org.apache.tuscany.sca.interfacedef.ConversationSequence;
import org.apache.tuscany.sca.interfacedef.DataType;
@@ -239,14 +238,7 @@
DataTypeImpl<XMLType> xmlDataType = new DataTypeImpl<XMLType>(
UNKNOWN_DATABINDING, paramType,
genericParamTypes[i],xmlParamType);
ParameterMode mode = ParameterMode.IN;
- // Holder pattern. Physical types of Holder<T> classes are
updated to <T> to aid in transformations.
- if ( Holder.class == paramType ) {
- Type firstActual = getFirstActualType( genericParamTypes[
i ] );
- if ( firstActual != null ) {
- xmlDataType.setPhysical( (Class<?>)firstActual );
- mode = ParameterMode.INOUT;
- }
- }
+
paramDataTypes.add( xmlDataType);
operation.getParameterModes().add(mode);
}
@@ -281,19 +273,4 @@
return operations;
}
- /**
- * Given a Class<T>, returns T, otherwise null.
- * @param testClass
- * @return
- */
- protected static Type getFirstActualType(Type genericType) {
- if (genericType instanceof ParameterizedType) {
- ParameterizedType pType = (ParameterizedType)genericType;
- Type[] actualTypes = pType.getActualTypeArguments();
- if ((actualTypes != null) && (actualTypes.length > 0)) {
- return actualTypes[0];
- }
- }
- return null;
- }
}