You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by gd...@apache.org on 2005/02/12 05:41:21 UTC
cvs commit: ws-axis/java/test/holders ArrayOfBook.java
gdaniels 2005/02/11 20:41:21
Modified: java/src/org/apache/axis/client Service.java
java/src/org/apache/axis/deployment/wsdd WSDDService.java
java/src/org/apache/axis/encoding
DefaultJAXRPC11TypeMappingImpl.java
DefaultSOAPEncodingTypeMappingImpl.java
DeserializationContext.java
SerializationContext.java TypeMapping.java
TypeMappingDelegate.java TypeMappingImpl.java
TypeMappingRegistryImpl.java
java/src/org/apache/axis/encoding/ser
ArrayDeserializerFactory.java
java/src/org/apache/axis/message BodyBuilder.java
java/src/org/apache/axis/wsdl/fromJava Emitter.java
java/src/org/apache/axis/wsdl/gen NoopFactory.java
java/src/org/apache/axis/wsdl/toJava Emitter.java
java/test/holders ArrayOfBook.java
Log:
Enable beans with array fields but no indexed accessors,
and along the way clean up some potentially problem-
causing rough spots. Hopefully I didn't add more of the
same. :)
* Provide an equivalent mechanism to the one Tom and I
added to the ArraySerializer for the ArrayDeserializer,
allowing us to specify a component type to the
factory so that we can customize it at creation time.
This gets used when figuring out types using
TypeMappingImpl.getDeserializer() - if we're looking
for a deserializer for a Java array type, and
we're not in maxOccurs mode (in which case you just
let the BeanDeserializer or RPCHandler do it for you),
we return an ArrayDeserializerFactory preconfigured
with the correct component type. This allows us to
deserialize array items without xsi:types. There's
a bit of tricky code in there which checks to see
that the desired XML type isn't the component type
of the desired array type - if so, that indicates
we're using maxOccurs mode.
* Remove digging down into the component type from
DeserializationContext.getDeserializerForClass()
* Since we use SOAP_ARRAY as a marker type for arrays
even in literal mode, make sure we don't end up
inadvertently serializing it on the wire as an
xsi:type (in SerializationContext)
* Clean up what's going on when we're registering
the "default" mappings in Service/WSDDService/
Emitter. Use a common function,
TypeMappingRegistryImpl.doRegisterFromVersion(),
in order to register the correct SOAPENC default
(which is really what goes on when selecting the
typemapping switch [insert flame about how awful
the "1.X" arguments are for these things]). Avoid
weird delegation chains by forcing the defaults
in these situations.
* Comment out indexed setter/getter from ArrayOfBook
* For some reason we were forcing "isResponse" to
false in BodyBuilder when deserializing in "fast"
mode. Respect the actual message type, which lets
us get the right metadata in RPCHandler.
Passes all-tests, need to re-run TCK.
Revision Changes Path
1.105 +2 -17 ws-axis/java/src/org/apache/axis/client/Service.java
Index: Service.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/client/Service.java,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -r1.104 -r1.105
--- Service.java 21 Jan 2005 18:20:57 -0000 1.104
+++ Service.java 12 Feb 2005 04:41:20 -0000 1.105
@@ -19,9 +19,7 @@
import org.apache.axis.AxisEngine;
import org.apache.axis.EngineConfiguration;
import org.apache.axis.configuration.EngineConfigurationFactoryFinder;
-import org.apache.axis.encoding.DefaultJAXRPC11TypeMappingImpl;
-import org.apache.axis.encoding.DefaultSOAPEncodingTypeMappingImpl;
-import org.apache.axis.encoding.DefaultTypeMappingImpl;
+import org.apache.axis.encoding.TypeMappingRegistryImpl;
import org.apache.axis.utils.ClassUtils;
import org.apache.axis.utils.Messages;
import org.apache.axis.utils.WSDLUtils;
@@ -42,7 +40,6 @@
import javax.wsdl.extensions.soap.SOAPAddress;
import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceException;
-import javax.xml.rpc.encoding.TypeMapping;
import javax.xml.rpc.encoding.TypeMappingRegistry;
import javax.xml.rpc.handler.HandlerRegistry;
import java.io.InputStream;
@@ -906,18 +903,6 @@
* @param version
*/
public void setTypeMappingVersion(String version) {
- TypeMapping tm = null;
- if (version.equals("1.0")) {
- tm = DefaultSOAPEncodingTypeMappingImpl.create();
- } else if (version.equals("1.1")) {
- tm = DefaultTypeMappingImpl.getSingleton();
- } else if (version.equals("1.2")) {
- tm = DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
- } else if (version.equals("1.3")) {
- tm = DefaultJAXRPC11TypeMappingImpl.createWithDelegate();
- } else {
- throw new RuntimeException(org.apache.axis.utils.Messages.getMessage("j2wBadTypeMapping00"));
- }
- getTypeMappingRegistry().registerDefault(tm);
+ ((TypeMappingRegistryImpl)getTypeMappingRegistry()).doRegisterFromVersion(version);
}
}
1.110 +2 -17 ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java
Index: WSDDService.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -r1.109 -r1.110
--- WSDDService.java 8 Feb 2005 18:44:38 -0000 1.109
+++ WSDDService.java 12 Feb 2005 04:41:20 -0000 1.110
@@ -252,24 +252,9 @@
}
private void createTMR() {
+ tmr = new TypeMappingRegistryImpl();
String version = getParameter("typeMappingVersion");
- if(version != null) {
- TypeMapping tm = null;
- if (version.equals("1.0")) {
- tm = DefaultSOAPEncodingTypeMappingImpl.create();
- } else if (version.equals("1.1")) {
- tm = DefaultTypeMappingImpl.getSingleton();
- } else if (version.equals("1.2")) {
- tm = DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
- } else if (version.equals("1.3")) {
- tm = DefaultJAXRPC11TypeMappingImpl.createWithDelegate();
- } else {
- throw new RuntimeException(org.apache.axis.utils.Messages.getMessage("j2wBadTypeMapping00"));
- }
- tmr = new TypeMappingRegistryImpl(tm);
- } else {
- tmr = new TypeMappingRegistryImpl();
- }
+ ((TypeMappingRegistryImpl)tmr).doRegisterFromVersion(version);
}
/**
1.9 +1 -1 ws-axis/java/src/org/apache/axis/encoding/DefaultJAXRPC11TypeMappingImpl.java
Index: DefaultJAXRPC11TypeMappingImpl.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/DefaultJAXRPC11TypeMappingImpl.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DefaultJAXRPC11TypeMappingImpl.java 7 Feb 2005 14:45:28 -0000 1.8
+++ DefaultJAXRPC11TypeMappingImpl.java 12 Feb 2005 04:41:20 -0000 1.9
@@ -43,7 +43,7 @@
return tm;
}
- public static TypeMapping createWithDelegate() {
+ public static TypeMapping create() {
TypeMapping ret = new DefaultJAXRPC11TypeMappingImpl();
ret.setDelegate(DefaultJAXRPC11TypeMappingImpl.getSingleton());
return ret;
1.9 +8 -4 ws-axis/java/src/org/apache/axis/encoding/DefaultSOAPEncodingTypeMappingImpl.java
Index: DefaultSOAPEncodingTypeMappingImpl.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/DefaultSOAPEncodingTypeMappingImpl.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DefaultSOAPEncodingTypeMappingImpl.java 14 Dec 2004 20:22:27 -0000 1.8
+++ DefaultSOAPEncodingTypeMappingImpl.java 12 Feb 2005 04:41:20 -0000 1.9
@@ -30,21 +30,25 @@
* @author Rich Scheuerle (scheu@us.ibm.com)
*/
public class DefaultSOAPEncodingTypeMappingImpl extends DefaultTypeMappingImpl {
-
private static DefaultSOAPEncodingTypeMappingImpl tm = null;
/**
* Construct TypeMapping
*/
- public static TypeMapping create() {
+ public static TypeMapping getSingleton() {
if (tm == null) {
tm = new DefaultSOAPEncodingTypeMappingImpl();
}
return tm;
}
- public static TypeMapping createWithDelegate() {
+ public static TypeMapping create() {
TypeMapping ret = new DefaultSOAPEncodingTypeMappingImpl();
- ret.setDelegate(DefaultTypeMappingImpl.getSingleton());
+
+ // Removed by gdaniels 2/11/2005 - we don't seem to need this
+ // any more since delegation gets done by the TMR as necessary
+ //
+ // ret.setDelegate(DefaultTypeMappingImpl.getSingleton());
+
return ret;
}
1.63 +3 -4 ws-axis/java/src/org/apache/axis/encoding/DeserializationContext.java
Index: DeserializationContext.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/DeserializationContext.java,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -r1.62 -r1.63
--- DeserializationContext.java 21 Jan 2005 16:57:31 -0000 1.62
+++ DeserializationContext.java 12 Feb 2005 04:41:20 -0000 1.63
@@ -482,9 +482,9 @@
if (cls == null) {
return null;
}
- if (cls.isArray()) {
- cls = cls.getComponentType();
- }
+// if (cls.isArray()) {
+// cls = cls.getComponentType();
+// }
if (javax.xml.rpc.holders.Holder.class.isAssignableFrom(cls)) {
try {
cls = cls.getField("value").getType();
@@ -1234,4 +1234,3 @@
}
}
-
1.105 +6 -2 ws-axis/java/src/org/apache/axis/encoding/SerializationContext.java
Index: SerializationContext.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/SerializationContext.java,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -r1.104 -r1.105
--- SerializationContext.java 10 Feb 2005 18:14:39 -0000 1.104
+++ SerializationContext.java 12 Feb 2005 04:41:20 -0000 1.105
@@ -1393,7 +1393,11 @@
if (shouldSendType ||
(xmlType != null &&
(!xmlType.equals(actualXMLType.value)))) {
- writeXMLType = actualXMLType.value;
+ if (!isEncoded() && Constants.isSOAP_ENC(actualXMLType.value.getNamespaceURI())) {
+ // Don't write SOAP_ENC types (i.e. Array) if we're not using encoding
+ } else {
+ writeXMLType = actualXMLType.value;
+ }
}
// -----------------
@@ -1581,4 +1585,4 @@
public void setEncoding(String encoding) {
this.encoding = encoding;
}
-}
+}
\ No newline at end of file
1.15 +20 -0 ws-axis/java/src/org/apache/axis/encoding/TypeMapping.java
Index: TypeMapping.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/TypeMapping.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- TypeMapping.java 7 Feb 2005 07:54:04 -0000 1.14
+++ TypeMapping.java 12 Feb 2005 04:41:20 -0000 1.15
@@ -121,6 +121,26 @@
*/
QName getXMLType(Class javaType, QName xmlType, boolean encoded)
throws JAXRPCException;
+
+ /**
+ * Gets the DeserializerFactory registered for the specified XML data type.
+ * This version uses a particular "original" TypeMapping in order to do
+ * secondary lookups for array component types, if necessary.
+ *
+ * @param javaType - the desired Java class
+ * @param xmlType - Qualified name of the XML data type
+ * @param orig - the TypeMapping from which to do secondary lookups
+ *
+ * @return Registered DeserializerFactory
+ *
+ * @throws JAXRPCException - If there is no registered DeserializerFactory
+ * for this pair of Java type and XML data type
+ * java.lang.IllegalArgumentException -
+ * If invalid or unsupported XML/Java type is specified
+ */
+ DeserializerFactory
+ getDeserializer(Class javaType, QName xmlType, TypeMappingImpl orig)
+ throws JAXRPCException;
}
1.17 +25 -1 ws-axis/java/src/org/apache/axis/encoding/TypeMappingDelegate.java
Index: TypeMappingDelegate.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/TypeMappingDelegate.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- TypeMappingDelegate.java 7 Feb 2005 07:54:04 -0000 1.16
+++ TypeMappingDelegate.java 12 Feb 2005 04:41:20 -0000 1.17
@@ -100,7 +100,31 @@
}
return null;
}
- public javax.xml.rpc.encoding.DeserializerFactory
+
+ /**
+ * Gets the DeserializerFactory registered for the specified XML data type.
+ * This version uses a particular "original" TypeMapping in order to do
+ * secondary lookups for array component types, if necessary.
+ *
+ * @param javaType - the desired Java class
+ * @param xmlType - Qualified name of the XML data type
+ * @param orig - the TypeMapping from which to do secondary lookups
+ *
+ * @return Registered DeserializerFactory
+ *
+ * @throws JAXRPCException - If there is no registered DeserializerFactory
+ * for this pair of Java type and XML data type
+ * java.lang.IllegalArgumentException -
+ * If invalid or unsupported XML/Java type is specified
+ */
+ public javax.xml.rpc.encoding.DeserializerFactory getDeserializer(Class javaType, QName xmlType, TypeMappingImpl orig) throws JAXRPCException {
+ if (delegate != null) {
+ return delegate.getDeserializer(javaType, xmlType, orig);
+ }
+ return null;
+ }
+
+ public javax.xml.rpc.encoding.DeserializerFactory
getDeserializer(QName xmlType)
throws JAXRPCException {
if (delegate != null) {
1.56 +52 -4 ws-axis/java/src/org/apache/axis/encoding/TypeMappingImpl.java
Index: TypeMappingImpl.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/TypeMappingImpl.java,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- TypeMappingImpl.java 7 Feb 2005 07:54:04 -0000 1.55
+++ TypeMappingImpl.java 12 Feb 2005 04:41:20 -0000 1.56
@@ -19,7 +19,6 @@
import org.apache.axis.Constants;
import org.apache.axis.AxisProperties;
import org.apache.axis.MessageContext;
-import org.apache.axis.AxisEngine;
import org.apache.axis.components.logger.LogFactory;
import org.apache.axis.encoding.ser.ArrayDeserializerFactory;
import org.apache.axis.encoding.ser.ArraySerializerFactory;
@@ -142,7 +141,8 @@
* setDelegate sets the new Delegate TypeMapping
*/
public void setDelegate(TypeMapping delegate) {
- this.delegate = delegate;
+ if (delegate != this)
+ this.delegate = delegate;
}
/**
@@ -447,6 +447,28 @@
public javax.xml.rpc.encoding.DeserializerFactory
getDeserializer(Class javaType, QName xmlType)
throws JAXRPCException {
+ return getDeserializer(javaType, xmlType, this);
+ }
+
+ /**
+ * Gets the DeserializerFactory registered for the specified XML data type.
+ * This version uses a particular "original" TypeMapping in order to do
+ * secondary lookups for array component types, if necessary.
+ *
+ * @param javaType - the desired Java class
+ * @param xmlType - Qualified name of the XML data type
+ * @param orig - the TypeMapping from which to do secondary lookups
+ *
+ * @return Registered DeserializerFactory
+ *
+ * @throws JAXRPCException - If there is no registered DeserializerFactory
+ * for this pair of Java type and XML data type
+ * java.lang.IllegalArgumentException -
+ * If invalid or unsupported XML/Java type is specified
+ */
+ public javax.xml.rpc.encoding.DeserializerFactory
+ getDeserializer(Class javaType, QName xmlType, TypeMappingImpl orig)
+ throws JAXRPCException {
javax.xml.rpc.encoding.DeserializerFactory df = null;
if (javaType == null) {
@@ -463,7 +485,33 @@
df = (javax.xml.rpc.encoding.DeserializerFactory) pair2DF.get(pair);
if (df == null && delegate != null) {
- df = delegate.getDeserializer(javaType, xmlType);
+ df = delegate.getDeserializer(javaType, xmlType, orig);
+ }
+
+ if (df == null) {
+ if (javaType.isArray()) {
+ Class componentType = javaType.getComponentType();
+
+ // HACK ALERT - Don't return the ArrayDeserializer IF
+ // the xmlType matches the component type of the array,
+ // because that means we're using maxOccurs and we'll
+ // want the higher layers to get the component type
+ // deserializer... (sigh)
+ if (xmlType != null) {
+ Class actualClass = orig.getClassForQName(xmlType);
+ if (actualClass == componentType)
+ return null;
+ }
+
+ pair = (Pair) qName2Pair.get(Constants.SOAP_ARRAY);
+ df = (javax.xml.rpc.encoding.DeserializerFactory) pair2DF.get(pair);
+ if (df instanceof ArrayDeserializerFactory && javaType.isArray()) {
+ QName componentXmlType = orig.getTypeQName(componentType);
+ if (componentXmlType != null) {
+ df = new ArrayDeserializerFactory(componentXmlType);
+ }
+ }
+ }
}
return df;
}
@@ -771,4 +819,4 @@
temp.addAll(class2Pair.keySet());
return (Class[])temp.toArray(new Class[temp.size()]);
}
-}
+}
\ No newline at end of file
1.31 +52 -16 ws-axis/java/src/org/apache/axis/encoding/TypeMappingRegistryImpl.java
Index: TypeMappingRegistryImpl.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/TypeMappingRegistryImpl.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- TypeMappingRegistryImpl.java 7 Feb 2005 07:54:04 -0000 1.30
+++ TypeMappingRegistryImpl.java 12 Feb 2005 04:41:20 -0000 1.31
@@ -247,24 +247,60 @@
* if an invalid type mapping is specified or the delegate is already set
*/
public void registerDefault(javax.xml.rpc.encoding.TypeMapping mapping) {
- if (mapping == null ||
- !(mapping instanceof TypeMapping)) {
- throw new IllegalArgumentException(
- Messages.getMessage("badTypeMapping"));
- }
-
- /* Don't allow this call after the delegate() method since
- * the TMR's TypeMappings will be using the default type mapping
- * of the secondary TMR.
- */
- if (defaultDelTM.getDelegate() instanceof TypeMappingDelegate) {
- throw new IllegalArgumentException(
- Messages.getMessage("defaultTypeMappingSet"));
- }
+// if (mapping == null ||
+// !(mapping instanceof TypeMapping)) {
+// throw new IllegalArgumentException(
+// Messages.getMessage("badTypeMapping"));
+// }
+//
+// /* Don't allow this call after the delegate() method since
+// * the TMR's TypeMappings will be using the default type mapping
+// * of the secondary TMR.
+// */
+// if (defaultDelTM.getDelegate() instanceof TypeMappingDelegate) {
+// throw new IllegalArgumentException(
+// Messages.getMessage("defaultTypeMappingSet"));
+// }
+//
+// defaultDelTM.setDelegate((TypeMapping) mapping);
+ }
+
+ public void doRegisterFromVersion(String version) {
+ TypeMapping tm;
+ if (version == null || version.equals("1.0")) {
+ tm = DefaultSOAPEncodingTypeMappingImpl.getSingleton();
+ } else if (version.equals("1.1")) {
+ return;
+ } else if (version.equals("1.2")) {
+ tm = DefaultSOAPEncodingTypeMappingImpl.create();
+ } else if (version.equals("1.3")) {
+ tm = DefaultJAXRPC11TypeMappingImpl.create();
+ } else {
+ throw new RuntimeException(org.apache.axis.utils.Messages.getMessage("j2wBadTypeMapping00"));
+ }
+ registerSOAPENCDefault(tm);
+ }
+ /**
+ * Force registration of the given mapping as the SOAPENC default mapping
+ * @param mapping
+ */
+ private void registerSOAPENCDefault(TypeMapping mapping) {
+ registerForced(Constants.URI_SOAP11_ENC, mapping);
+ registerForced(Constants.URI_SOAP12_ENC, mapping);
+ }
- defaultDelTM.setDelegate((TypeMapping) mapping);
+ /**
+ * Force registration of a particular mapping for a given namespace,
+ * which will delegate back to the default.
+ *
+ * @param namespaceURI
+ * @param mapping
+ */
+ private void registerForced(String namespaceURI, TypeMapping mapping) {
+ mapTM.put(namespaceURI, new TypeMappingDelegate((TypeMapping) mapping));
+ ((TypeMapping)mapping).setDelegate(defaultDelTM.getDelegate());
}
-
+
/**
* Gets the TypeMapping for the namespace. If not found, the default
* TypeMapping is returned.
1.5 +31 -1 ws-axis/java/src/org/apache/axis/encoding/ser/ArrayDeserializerFactory.java
Index: ArrayDeserializerFactory.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/ser/ArrayDeserializerFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ArrayDeserializerFactory.java 25 Feb 2004 14:02:36 -0000 1.4
+++ ArrayDeserializerFactory.java 12 Feb 2005 04:41:21 -0000 1.5
@@ -16,6 +16,8 @@
package org.apache.axis.encoding.ser;
+import javax.xml.namespace.QName;
+
/**
* DeserializerFactory for arrays
@@ -23,7 +25,35 @@
* @author Rich Scheuerle <sc...@us.ibm.com>
*/
public class ArrayDeserializerFactory extends BaseDeserializerFactory {
+ private QName componentXmlType;
+
public ArrayDeserializerFactory() {
super(ArrayDeserializer.class);
}
-}
+
+ /**
+ * Constructor
+ * @param componentXmlType the desired component type for this deser
+ */
+ public ArrayDeserializerFactory(QName componentXmlType) {
+ super(ArrayDeserializer.class);
+ this.componentXmlType = componentXmlType;
+ }
+
+ /**
+ * getDeserializerAs() is overloaded here in order to set the default
+ * item type on the ArrayDeserializers we create.
+ *
+ * @param mechanismType
+ * @return
+ */
+ public javax.xml.rpc.encoding.Deserializer getDeserializerAs(String mechanismType) {
+ ArrayDeserializer dser = (ArrayDeserializer) super.getDeserializerAs(mechanismType);
+ dser.defaultItemType = componentXmlType;
+ return dser;
+ }
+
+ public void setComponentType(QName componentType) {
+ componentXmlType = componentType;
+ }
+}
\ No newline at end of file
1.65 +3 -1 ws-axis/java/src/org/apache/axis/message/BodyBuilder.java
Index: BodyBuilder.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/message/BodyBuilder.java,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- BodyBuilder.java 8 Feb 2005 18:44:36 -0000 1.64
+++ BodyBuilder.java 12 Feb 2005 04:41:21 -0000 1.65
@@ -24,6 +24,7 @@
import org.apache.axis.AxisFault;
import org.apache.axis.Constants;
import org.apache.axis.MessageContext;
+import org.apache.axis.Message;
import org.apache.axis.components.logger.LogFactory;
import org.apache.axis.description.OperationDesc;
import org.apache.axis.encoding.DeserializationContext;
@@ -181,7 +182,8 @@
if (msgContext != null && !msgContext.isHighFidelity() &&
(operations == null || operations.length == 1)) {
((RPCElement)element).setNeedDeser(false);
- handler = new RPCHandler((RPCElement)element, false);
+ handler = new RPCHandler((RPCElement)element,
+ Message.RESPONSE.equals(msgContext.getCurrentMessage().getMessageType()));
if (operations != null) {
((RPCHandler)handler).setOperation(operations[0]);
msgContext.setOperation(operations[0]);
1.138 +4 -3 ws-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java
Index: Emitter.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -r1.137 -r1.138
--- Emitter.java 8 Feb 2005 18:44:36 -0000 1.137
+++ Emitter.java 12 Feb 2005 04:41:21 -0000 1.138
@@ -2545,13 +2545,14 @@
public void setTypeMappingVersion(String typeMappingVersion) {
if(defaultTM == null) {
if (typeMappingVersion.equals("1.0")) {
- defaultTM=DefaultSOAPEncodingTypeMappingImpl.create();
+ defaultTM=DefaultSOAPEncodingTypeMappingImpl.getSingleton();
} else if (typeMappingVersion.equals("1.1")) {
+ // No SOAP encoding
defaultTM=DefaultTypeMappingImpl.getSingleton();
} else if (typeMappingVersion.equals("1.2")) {
- defaultTM=DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
+ defaultTM=DefaultSOAPEncodingTypeMappingImpl.create();
} else if (typeMappingVersion.equals("1.3")) {
- defaultTM=DefaultJAXRPC11TypeMappingImpl.createWithDelegate();
+ defaultTM=DefaultJAXRPC11TypeMappingImpl.create();
} else {
throw new RuntimeException(org.apache.axis.utils.Messages.getMessage("j2wBadTypeMapping00"));
}
1.11 +1 -1 ws-axis/java/src/org/apache/axis/wsdl/gen/NoopFactory.java
Index: NoopFactory.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/gen/NoopFactory.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- NoopFactory.java 14 Dec 2004 20:22:28 -0000 1.10
+++ NoopFactory.java 12 Feb 2005 04:41:21 -0000 1.11
@@ -134,7 +134,7 @@
btm = new BaseTypeMapping() {
TypeMapping defaultTM =
- DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
+ DefaultSOAPEncodingTypeMappingImpl.create();
public String getBaseName(QName qNameIn) {
1.80 +5 -4 ws-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java
Index: Emitter.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -r1.79 -r1.80
--- Emitter.java 8 Feb 2005 18:44:36 -0000 1.79
+++ Emitter.java 12 Feb 2005 04:41:21 -0000 1.80
@@ -408,7 +408,7 @@
public TypeMapping getDefaultTypeMapping() {
if (defaultTM == null) {
defaultTM =
- DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
+ DefaultSOAPEncodingTypeMappingImpl.create();
}
return defaultTM;
}
@@ -762,13 +762,14 @@
public void setTypeMappingVersion(String typeMappingVersion) {
if(defaultTM == null) {
if (typeMappingVersion.equals("1.0")) {
- defaultTM=DefaultSOAPEncodingTypeMappingImpl.create();
+ defaultTM=DefaultSOAPEncodingTypeMappingImpl.getSingleton();
} else if (typeMappingVersion.equals("1.1")) {
+ // No SOAP encoding
defaultTM=DefaultTypeMappingImpl.getSingleton();
} else if (typeMappingVersion.equals("1.2")) {
- defaultTM=DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
+ defaultTM=DefaultSOAPEncodingTypeMappingImpl.create();
} else if (typeMappingVersion.equals("1.3")) {
- defaultTM=DefaultJAXRPC11TypeMappingImpl.createWithDelegate();
+ defaultTM=DefaultJAXRPC11TypeMappingImpl.create();
} else {
throw new RuntimeException(org.apache.axis.utils.Messages.getMessage("j2wBadTypeMapping00"));
}
1.2 +7 -7 ws-axis/java/test/holders/ArrayOfBook.java
Index: ArrayOfBook.java
===================================================================
RCS file: /home/cvs/ws-axis/java/test/holders/ArrayOfBook.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ArrayOfBook.java 5 Feb 2005 21:14:00 -0000 1.1
+++ ArrayOfBook.java 12 Feb 2005 04:41:21 -0000 1.2
@@ -19,11 +19,11 @@
this.arrayOfBook = arrayOfBook;
}
- public test.holders.Book getArrayOfBook(int i) {
- return this.arrayOfBook[i];
- }
-
- public void setArrayOfBook(int i, test.holders.Book _value) {
- this.arrayOfBook[i] = _value;
- }
+// public test.holders.Book getArrayOfBook(int i) {
+// return this.arrayOfBook[i];
+// }
+//
+// public void setArrayOfBook(int i, test.holders.Book _value) {
+// this.arrayOfBook[i] = _value;
+// }
}
Re: cvs commit: ws-axis/java/test/holders ArrayOfBook.java
Posted by Davanum Srinivas <da...@gmail.com>.
Super!!!!!!!!!!!!!! Thanks.
-- dims
On Fri, 11 Feb 2005 20:41:26 -0800 (PST), gdaniels@apache.org
<gd...@apache.org> wrote:
> gdaniels 2005/02/11 20:41:21
>
> Modified: java/src/org/apache/axis/client Service.java
> java/src/org/apache/axis/deployment/wsdd WSDDService.java
> java/src/org/apache/axis/encoding
> DefaultJAXRPC11TypeMappingImpl.java
> DefaultSOAPEncodingTypeMappingImpl.java
> DeserializationContext.java
> SerializationContext.java TypeMapping.java
> TypeMappingDelegate.java TypeMappingImpl.java
> TypeMappingRegistryImpl.java
> java/src/org/apache/axis/encoding/ser
> ArrayDeserializerFactory.java
> java/src/org/apache/axis/message BodyBuilder.java
> java/src/org/apache/axis/wsdl/fromJava Emitter.java
> java/src/org/apache/axis/wsdl/gen NoopFactory.java
> java/src/org/apache/axis/wsdl/toJava Emitter.java
> java/test/holders ArrayOfBook.java
> Log:
> Enable beans with array fields but no indexed accessors,
> and along the way clean up some potentially problem-
> causing rough spots. Hopefully I didn't add more of the
> same. :)
>
> * Provide an equivalent mechanism to the one Tom and I
> added to the ArraySerializer for the ArrayDeserializer,
> allowing us to specify a component type to the
> factory so that we can customize it at creation time.
>
> This gets used when figuring out types using
> TypeMappingImpl.getDeserializer() - if we're looking
> for a deserializer for a Java array type, and
> we're not in maxOccurs mode (in which case you just
> let the BeanDeserializer or RPCHandler do it for you),
> we return an ArrayDeserializerFactory preconfigured
> with the correct component type. This allows us to
> deserialize array items without xsi:types. There's
> a bit of tricky code in there which checks to see
> that the desired XML type isn't the component type
> of the desired array type - if so, that indicates
> we're using maxOccurs mode.
>
> * Remove digging down into the component type from
> DeserializationContext.getDeserializerForClass()
>
> * Since we use SOAP_ARRAY as a marker type for arrays
> even in literal mode, make sure we don't end up
> inadvertently serializing it on the wire as an
> xsi:type (in SerializationContext)
>
> * Clean up what's going on when we're registering
> the "default" mappings in Service/WSDDService/
> Emitter. Use a common function,
> TypeMappingRegistryImpl.doRegisterFromVersion(),
> in order to register the correct SOAPENC default
> (which is really what goes on when selecting the
> typemapping switch [insert flame about how awful
> the "1.X" arguments are for these things]). Avoid
> weird delegation chains by forcing the defaults
> in these situations.
>
> * Comment out indexed setter/getter from ArrayOfBook
>
> * For some reason we were forcing "isResponse" to
> false in BodyBuilder when deserializing in "fast"
> mode. Respect the actual message type, which lets
> us get the right metadata in RPCHandler.
>
> Passes all-tests, need to re-run TCK.
>
> Revision Changes Path
> 1.105 +2 -17 ws-axis/java/src/org/apache/axis/client/Service.java
>
> Index: Service.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/client/Service.java,v
> retrieving revision 1.104
> retrieving revision 1.105
> diff -u -r1.104 -r1.105
> --- Service.java 21 Jan 2005 18:20:57 -0000 1.104
> +++ Service.java 12 Feb 2005 04:41:20 -0000 1.105
> @@ -19,9 +19,7 @@
> import org.apache.axis.AxisEngine;
> import org.apache.axis.EngineConfiguration;
> import org.apache.axis.configuration.EngineConfigurationFactoryFinder;
> -import org.apache.axis.encoding.DefaultJAXRPC11TypeMappingImpl;
> -import org.apache.axis.encoding.DefaultSOAPEncodingTypeMappingImpl;
> -import org.apache.axis.encoding.DefaultTypeMappingImpl;
> +import org.apache.axis.encoding.TypeMappingRegistryImpl;
> import org.apache.axis.utils.ClassUtils;
> import org.apache.axis.utils.Messages;
> import org.apache.axis.utils.WSDLUtils;
> @@ -42,7 +40,6 @@
> import javax.wsdl.extensions.soap.SOAPAddress;
> import javax.xml.namespace.QName;
> import javax.xml.rpc.ServiceException;
> -import javax.xml.rpc.encoding.TypeMapping;
> import javax.xml.rpc.encoding.TypeMappingRegistry;
> import javax.xml.rpc.handler.HandlerRegistry;
> import java.io.InputStream;
> @@ -906,18 +903,6 @@
> * @param version
> */
> public void setTypeMappingVersion(String version) {
> - TypeMapping tm = null;
> - if (version.equals("1.0")) {
> - tm = DefaultSOAPEncodingTypeMappingImpl.create();
> - } else if (version.equals("1.1")) {
> - tm = DefaultTypeMappingImpl.getSingleton();
> - } else if (version.equals("1.2")) {
> - tm = DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
> - } else if (version.equals("1.3")) {
> - tm = DefaultJAXRPC11TypeMappingImpl.createWithDelegate();
> - } else {
> - throw new RuntimeException(org.apache.axis.utils.Messages.getMessage("j2wBadTypeMapping00"));
> - }
> - getTypeMappingRegistry().registerDefault(tm);
> + ((TypeMappingRegistryImpl)getTypeMappingRegistry()).doRegisterFromVersion(version);
> }
> }
>
> 1.110 +2 -17 ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java
>
> Index: WSDDService.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java,v
> retrieving revision 1.109
> retrieving revision 1.110
> diff -u -r1.109 -r1.110
> --- WSDDService.java 8 Feb 2005 18:44:38 -0000 1.109
> +++ WSDDService.java 12 Feb 2005 04:41:20 -0000 1.110
> @@ -252,24 +252,9 @@
> }
>
> private void createTMR() {
> + tmr = new TypeMappingRegistryImpl();
> String version = getParameter("typeMappingVersion");
> - if(version != null) {
> - TypeMapping tm = null;
> - if (version.equals("1.0")) {
> - tm = DefaultSOAPEncodingTypeMappingImpl.create();
> - } else if (version.equals("1.1")) {
> - tm = DefaultTypeMappingImpl.getSingleton();
> - } else if (version.equals("1.2")) {
> - tm = DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
> - } else if (version.equals("1.3")) {
> - tm = DefaultJAXRPC11TypeMappingImpl.createWithDelegate();
> - } else {
> - throw new RuntimeException(org.apache.axis.utils.Messages.getMessage("j2wBadTypeMapping00"));
> - }
> - tmr = new TypeMappingRegistryImpl(tm);
> - } else {
> - tmr = new TypeMappingRegistryImpl();
> - }
> + ((TypeMappingRegistryImpl)tmr).doRegisterFromVersion(version);
> }
>
> /**
>
> 1.9 +1 -1 ws-axis/java/src/org/apache/axis/encoding/DefaultJAXRPC11TypeMappingImpl.java
>
> Index: DefaultJAXRPC11TypeMappingImpl.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/DefaultJAXRPC11TypeMappingImpl.java,v
> retrieving revision 1.8
> retrieving revision 1.9
> diff -u -r1.8 -r1.9
> --- DefaultJAXRPC11TypeMappingImpl.java 7 Feb 2005 14:45:28 -0000 1.8
> +++ DefaultJAXRPC11TypeMappingImpl.java 12 Feb 2005 04:41:20 -0000 1.9
> @@ -43,7 +43,7 @@
> return tm;
> }
>
> - public static TypeMapping createWithDelegate() {
> + public static TypeMapping create() {
> TypeMapping ret = new DefaultJAXRPC11TypeMappingImpl();
> ret.setDelegate(DefaultJAXRPC11TypeMappingImpl.getSingleton());
> return ret;
>
> 1.9 +8 -4 ws-axis/java/src/org/apache/axis/encoding/DefaultSOAPEncodingTypeMappingImpl.java
>
> Index: DefaultSOAPEncodingTypeMappingImpl.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/DefaultSOAPEncodingTypeMappingImpl.java,v
> retrieving revision 1.8
> retrieving revision 1.9
> diff -u -r1.8 -r1.9
> --- DefaultSOAPEncodingTypeMappingImpl.java 14 Dec 2004 20:22:27 -0000 1.8
> +++ DefaultSOAPEncodingTypeMappingImpl.java 12 Feb 2005 04:41:20 -0000 1.9
> @@ -30,21 +30,25 @@
> * @author Rich Scheuerle (scheu@us.ibm.com)
> */
> public class DefaultSOAPEncodingTypeMappingImpl extends DefaultTypeMappingImpl {
> -
> private static DefaultSOAPEncodingTypeMappingImpl tm = null;
> /**
> * Construct TypeMapping
> */
> - public static TypeMapping create() {
> + public static TypeMapping getSingleton() {
> if (tm == null) {
> tm = new DefaultSOAPEncodingTypeMappingImpl();
> }
> return tm;
> }
>
> - public static TypeMapping createWithDelegate() {
> + public static TypeMapping create() {
> TypeMapping ret = new DefaultSOAPEncodingTypeMappingImpl();
> - ret.setDelegate(DefaultTypeMappingImpl.getSingleton());
> +
> + // Removed by gdaniels 2/11/2005 - we don't seem to need this
> + // any more since delegation gets done by the TMR as necessary
> + //
> + // ret.setDelegate(DefaultTypeMappingImpl.getSingleton());
> +
> return ret;
> }
>
> 1.63 +3 -4 ws-axis/java/src/org/apache/axis/encoding/DeserializationContext.java
>
> Index: DeserializationContext.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/DeserializationContext.java,v
> retrieving revision 1.62
> retrieving revision 1.63
> diff -u -r1.62 -r1.63
> --- DeserializationContext.java 21 Jan 2005 16:57:31 -0000 1.62
> +++ DeserializationContext.java 12 Feb 2005 04:41:20 -0000 1.63
> @@ -482,9 +482,9 @@
> if (cls == null) {
> return null;
> }
> - if (cls.isArray()) {
> - cls = cls.getComponentType();
> - }
> +// if (cls.isArray()) {
> +// cls = cls.getComponentType();
> +// }
> if (javax.xml.rpc.holders.Holder.class.isAssignableFrom(cls)) {
> try {
> cls = cls.getField("value").getType();
> @@ -1234,4 +1234,3 @@
> }
> }
>
> -
>
> 1.105 +6 -2 ws-axis/java/src/org/apache/axis/encoding/SerializationContext.java
>
> Index: SerializationContext.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/SerializationContext.java,v
> retrieving revision 1.104
> retrieving revision 1.105
> diff -u -r1.104 -r1.105
> --- SerializationContext.java 10 Feb 2005 18:14:39 -0000 1.104
> +++ SerializationContext.java 12 Feb 2005 04:41:20 -0000 1.105
> @@ -1393,7 +1393,11 @@
> if (shouldSendType ||
> (xmlType != null &&
> (!xmlType.equals(actualXMLType.value)))) {
> - writeXMLType = actualXMLType.value;
> + if (!isEncoded() && Constants.isSOAP_ENC(actualXMLType.value.getNamespaceURI())) {
> + // Don't write SOAP_ENC types (i.e. Array) if we're not using encoding
> + } else {
> + writeXMLType = actualXMLType.value;
> + }
> }
>
> // -----------------
> @@ -1581,4 +1585,4 @@
> public void setEncoding(String encoding) {
> this.encoding = encoding;
> }
> -}
> +}
> \ No newline at end of file
>
> 1.15 +20 -0 ws-axis/java/src/org/apache/axis/encoding/TypeMapping.java
>
> Index: TypeMapping.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/TypeMapping.java,v
> retrieving revision 1.14
> retrieving revision 1.15
> diff -u -r1.14 -r1.15
> --- TypeMapping.java 7 Feb 2005 07:54:04 -0000 1.14
> +++ TypeMapping.java 12 Feb 2005 04:41:20 -0000 1.15
> @@ -121,6 +121,26 @@
> */
> QName getXMLType(Class javaType, QName xmlType, boolean encoded)
> throws JAXRPCException;
> +
> + /**
> + * Gets the DeserializerFactory registered for the specified XML data type.
> + * This version uses a particular "original" TypeMapping in order to do
> + * secondary lookups for array component types, if necessary.
> + *
> + * @param javaType - the desired Java class
> + * @param xmlType - Qualified name of the XML data type
> + * @param orig - the TypeMapping from which to do secondary lookups
> + *
> + * @return Registered DeserializerFactory
> + *
> + * @throws JAXRPCException - If there is no registered DeserializerFactory
> + * for this pair of Java type and XML data type
> + * java.lang.IllegalArgumentException -
> + * If invalid or unsupported XML/Java type is specified
> + */
> + DeserializerFactory
> + getDeserializer(Class javaType, QName xmlType, TypeMappingImpl orig)
> + throws JAXRPCException;
> }
>
> 1.17 +25 -1 ws-axis/java/src/org/apache/axis/encoding/TypeMappingDelegate.java
>
> Index: TypeMappingDelegate.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/TypeMappingDelegate.java,v
> retrieving revision 1.16
> retrieving revision 1.17
> diff -u -r1.16 -r1.17
> --- TypeMappingDelegate.java 7 Feb 2005 07:54:04 -0000 1.16
> +++ TypeMappingDelegate.java 12 Feb 2005 04:41:20 -0000 1.17
> @@ -100,7 +100,31 @@
> }
> return null;
> }
> - public javax.xml.rpc.encoding.DeserializerFactory
> +
> + /**
> + * Gets the DeserializerFactory registered for the specified XML data type.
> + * This version uses a particular "original" TypeMapping in order to do
> + * secondary lookups for array component types, if necessary.
> + *
> + * @param javaType - the desired Java class
> + * @param xmlType - Qualified name of the XML data type
> + * @param orig - the TypeMapping from which to do secondary lookups
> + *
> + * @return Registered DeserializerFactory
> + *
> + * @throws JAXRPCException - If there is no registered DeserializerFactory
> + * for this pair of Java type and XML data type
> + * java.lang.IllegalArgumentException -
> + * If invalid or unsupported XML/Java type is specified
> + */
> + public javax.xml.rpc.encoding.DeserializerFactory getDeserializer(Class javaType, QName xmlType, TypeMappingImpl orig) throws JAXRPCException {
> + if (delegate != null) {
> + return delegate.getDeserializer(javaType, xmlType, orig);
> + }
> + return null;
> + }
> +
> + public javax.xml.rpc.encoding.DeserializerFactory
> getDeserializer(QName xmlType)
> throws JAXRPCException {
> if (delegate != null) {
>
> 1.56 +52 -4 ws-axis/java/src/org/apache/axis/encoding/TypeMappingImpl.java
>
> Index: TypeMappingImpl.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/TypeMappingImpl.java,v
> retrieving revision 1.55
> retrieving revision 1.56
> diff -u -r1.55 -r1.56
> --- TypeMappingImpl.java 7 Feb 2005 07:54:04 -0000 1.55
> +++ TypeMappingImpl.java 12 Feb 2005 04:41:20 -0000 1.56
> @@ -19,7 +19,6 @@
> import org.apache.axis.Constants;
> import org.apache.axis.AxisProperties;
> import org.apache.axis.MessageContext;
> -import org.apache.axis.AxisEngine;
> import org.apache.axis.components.logger.LogFactory;
> import org.apache.axis.encoding.ser.ArrayDeserializerFactory;
> import org.apache.axis.encoding.ser.ArraySerializerFactory;
> @@ -142,7 +141,8 @@
> * setDelegate sets the new Delegate TypeMapping
> */
> public void setDelegate(TypeMapping delegate) {
> - this.delegate = delegate;
> + if (delegate != this)
> + this.delegate = delegate;
> }
>
> /**
> @@ -447,6 +447,28 @@
> public javax.xml.rpc.encoding.DeserializerFactory
> getDeserializer(Class javaType, QName xmlType)
> throws JAXRPCException {
> + return getDeserializer(javaType, xmlType, this);
> + }
> +
> + /**
> + * Gets the DeserializerFactory registered for the specified XML data type.
> + * This version uses a particular "original" TypeMapping in order to do
> + * secondary lookups for array component types, if necessary.
> + *
> + * @param javaType - the desired Java class
> + * @param xmlType - Qualified name of the XML data type
> + * @param orig - the TypeMapping from which to do secondary lookups
> + *
> + * @return Registered DeserializerFactory
> + *
> + * @throws JAXRPCException - If there is no registered DeserializerFactory
> + * for this pair of Java type and XML data type
> + * java.lang.IllegalArgumentException -
> + * If invalid or unsupported XML/Java type is specified
> + */
> + public javax.xml.rpc.encoding.DeserializerFactory
> + getDeserializer(Class javaType, QName xmlType, TypeMappingImpl orig)
> + throws JAXRPCException {
> javax.xml.rpc.encoding.DeserializerFactory df = null;
>
> if (javaType == null) {
> @@ -463,7 +485,33 @@
> df = (javax.xml.rpc.encoding.DeserializerFactory) pair2DF.get(pair);
>
> if (df == null && delegate != null) {
> - df = delegate.getDeserializer(javaType, xmlType);
> + df = delegate.getDeserializer(javaType, xmlType, orig);
> + }
> +
> + if (df == null) {
> + if (javaType.isArray()) {
> + Class componentType = javaType.getComponentType();
> +
> + // HACK ALERT - Don't return the ArrayDeserializer IF
> + // the xmlType matches the component type of the array,
> + // because that means we're using maxOccurs and we'll
> + // want the higher layers to get the component type
> + // deserializer... (sigh)
> + if (xmlType != null) {
> + Class actualClass = orig.getClassForQName(xmlType);
> + if (actualClass == componentType)
> + return null;
> + }
> +
> + pair = (Pair) qName2Pair.get(Constants.SOAP_ARRAY);
> + df = (javax.xml.rpc.encoding.DeserializerFactory) pair2DF.get(pair);
> + if (df instanceof ArrayDeserializerFactory && javaType.isArray()) {
> + QName componentXmlType = orig.getTypeQName(componentType);
> + if (componentXmlType != null) {
> + df = new ArrayDeserializerFactory(componentXmlType);
> + }
> + }
> + }
> }
> return df;
> }
> @@ -771,4 +819,4 @@
> temp.addAll(class2Pair.keySet());
> return (Class[])temp.toArray(new Class[temp.size()]);
> }
> -}
> +}
> \ No newline at end of file
>
> 1.31 +52 -16 ws-axis/java/src/org/apache/axis/encoding/TypeMappingRegistryImpl.java
>
> Index: TypeMappingRegistryImpl.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/TypeMappingRegistryImpl.java,v
> retrieving revision 1.30
> retrieving revision 1.31
> diff -u -r1.30 -r1.31
> --- TypeMappingRegistryImpl.java 7 Feb 2005 07:54:04 -0000 1.30
> +++ TypeMappingRegistryImpl.java 12 Feb 2005 04:41:20 -0000 1.31
> @@ -247,24 +247,60 @@
> * if an invalid type mapping is specified or the delegate is already set
> */
> public void registerDefault(javax.xml.rpc.encoding.TypeMapping mapping) {
> - if (mapping == null ||
> - !(mapping instanceof TypeMapping)) {
> - throw new IllegalArgumentException(
> - Messages.getMessage("badTypeMapping"));
> - }
> -
> - /* Don't allow this call after the delegate() method since
> - * the TMR's TypeMappings will be using the default type mapping
> - * of the secondary TMR.
> - */
> - if (defaultDelTM.getDelegate() instanceof TypeMappingDelegate) {
> - throw new IllegalArgumentException(
> - Messages.getMessage("defaultTypeMappingSet"));
> - }
> +// if (mapping == null ||
> +// !(mapping instanceof TypeMapping)) {
> +// throw new IllegalArgumentException(
> +// Messages.getMessage("badTypeMapping"));
> +// }
> +//
> +// /* Don't allow this call after the delegate() method since
> +// * the TMR's TypeMappings will be using the default type mapping
> +// * of the secondary TMR.
> +// */
> +// if (defaultDelTM.getDelegate() instanceof TypeMappingDelegate) {
> +// throw new IllegalArgumentException(
> +// Messages.getMessage("defaultTypeMappingSet"));
> +// }
> +//
> +// defaultDelTM.setDelegate((TypeMapping) mapping);
> + }
> +
> + public void doRegisterFromVersion(String version) {
> + TypeMapping tm;
> + if (version == null || version.equals("1.0")) {
> + tm = DefaultSOAPEncodingTypeMappingImpl.getSingleton();
> + } else if (version.equals("1.1")) {
> + return;
> + } else if (version.equals("1.2")) {
> + tm = DefaultSOAPEncodingTypeMappingImpl.create();
> + } else if (version.equals("1.3")) {
> + tm = DefaultJAXRPC11TypeMappingImpl.create();
> + } else {
> + throw new RuntimeException(org.apache.axis.utils.Messages.getMessage("j2wBadTypeMapping00"));
> + }
> + registerSOAPENCDefault(tm);
> + }
> + /**
> + * Force registration of the given mapping as the SOAPENC default mapping
> + * @param mapping
> + */
> + private void registerSOAPENCDefault(TypeMapping mapping) {
> + registerForced(Constants.URI_SOAP11_ENC, mapping);
> + registerForced(Constants.URI_SOAP12_ENC, mapping);
> + }
>
> - defaultDelTM.setDelegate((TypeMapping) mapping);
> + /**
> + * Force registration of a particular mapping for a given namespace,
> + * which will delegate back to the default.
> + *
> + * @param namespaceURI
> + * @param mapping
> + */
> + private void registerForced(String namespaceURI, TypeMapping mapping) {
> + mapTM.put(namespaceURI, new TypeMappingDelegate((TypeMapping) mapping));
> + ((TypeMapping)mapping).setDelegate(defaultDelTM.getDelegate());
> }
> -
> +
> /**
> * Gets the TypeMapping for the namespace. If not found, the default
> * TypeMapping is returned.
>
> 1.5 +31 -1 ws-axis/java/src/org/apache/axis/encoding/ser/ArrayDeserializerFactory.java
>
> Index: ArrayDeserializerFactory.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/ser/ArrayDeserializerFactory.java,v
> retrieving revision 1.4
> retrieving revision 1.5
> diff -u -r1.4 -r1.5
> --- ArrayDeserializerFactory.java 25 Feb 2004 14:02:36 -0000 1.4
> +++ ArrayDeserializerFactory.java 12 Feb 2005 04:41:21 -0000 1.5
> @@ -16,6 +16,8 @@
>
> package org.apache.axis.encoding.ser;
>
> +import javax.xml.namespace.QName;
> +
>
> /**
> * DeserializerFactory for arrays
> @@ -23,7 +25,35 @@
> * @author Rich Scheuerle <sc...@us.ibm.com>
> */
> public class ArrayDeserializerFactory extends BaseDeserializerFactory {
> + private QName componentXmlType;
> +
> public ArrayDeserializerFactory() {
> super(ArrayDeserializer.class);
> }
> -}
> +
> + /**
> + * Constructor
> + * @param componentXmlType the desired component type for this deser
> + */
> + public ArrayDeserializerFactory(QName componentXmlType) {
> + super(ArrayDeserializer.class);
> + this.componentXmlType = componentXmlType;
> + }
> +
> + /**
> + * getDeserializerAs() is overloaded here in order to set the default
> + * item type on the ArrayDeserializers we create.
> + *
> + * @param mechanismType
> + * @return
> + */
> + public javax.xml.rpc.encoding.Deserializer getDeserializerAs(String mechanismType) {
> + ArrayDeserializer dser = (ArrayDeserializer) super.getDeserializerAs(mechanismType);
> + dser.defaultItemType = componentXmlType;
> + return dser;
> + }
> +
> + public void setComponentType(QName componentType) {
> + componentXmlType = componentType;
> + }
> +}
> \ No newline at end of file
>
> 1.65 +3 -1 ws-axis/java/src/org/apache/axis/message/BodyBuilder.java
>
> Index: BodyBuilder.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/message/BodyBuilder.java,v
> retrieving revision 1.64
> retrieving revision 1.65
> diff -u -r1.64 -r1.65
> --- BodyBuilder.java 8 Feb 2005 18:44:36 -0000 1.64
> +++ BodyBuilder.java 12 Feb 2005 04:41:21 -0000 1.65
> @@ -24,6 +24,7 @@
> import org.apache.axis.AxisFault;
> import org.apache.axis.Constants;
> import org.apache.axis.MessageContext;
> +import org.apache.axis.Message;
> import org.apache.axis.components.logger.LogFactory;
> import org.apache.axis.description.OperationDesc;
> import org.apache.axis.encoding.DeserializationContext;
> @@ -181,7 +182,8 @@
> if (msgContext != null && !msgContext.isHighFidelity() &&
> (operations == null || operations.length == 1)) {
> ((RPCElement)element).setNeedDeser(false);
> - handler = new RPCHandler((RPCElement)element, false);
> + handler = new RPCHandler((RPCElement)element,
> + Message.RESPONSE.equals(msgContext.getCurrentMessage().getMessageType()));
> if (operations != null) {
> ((RPCHandler)handler).setOperation(operations[0]);
> msgContext.setOperation(operations[0]);
>
> 1.138 +4 -3 ws-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java
>
> Index: Emitter.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java,v
> retrieving revision 1.137
> retrieving revision 1.138
> diff -u -r1.137 -r1.138
> --- Emitter.java 8 Feb 2005 18:44:36 -0000 1.137
> +++ Emitter.java 12 Feb 2005 04:41:21 -0000 1.138
> @@ -2545,13 +2545,14 @@
> public void setTypeMappingVersion(String typeMappingVersion) {
> if(defaultTM == null) {
> if (typeMappingVersion.equals("1.0")) {
> - defaultTM=DefaultSOAPEncodingTypeMappingImpl.create();
> + defaultTM=DefaultSOAPEncodingTypeMappingImpl.getSingleton();
> } else if (typeMappingVersion.equals("1.1")) {
> + // No SOAP encoding
> defaultTM=DefaultTypeMappingImpl.getSingleton();
> } else if (typeMappingVersion.equals("1.2")) {
> - defaultTM=DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
> + defaultTM=DefaultSOAPEncodingTypeMappingImpl.create();
> } else if (typeMappingVersion.equals("1.3")) {
> - defaultTM=DefaultJAXRPC11TypeMappingImpl.createWithDelegate();
> + defaultTM=DefaultJAXRPC11TypeMappingImpl.create();
> } else {
> throw new RuntimeException(org.apache.axis.utils.Messages.getMessage("j2wBadTypeMapping00"));
> }
>
> 1.11 +1 -1 ws-axis/java/src/org/apache/axis/wsdl/gen/NoopFactory.java
>
> Index: NoopFactory.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/gen/NoopFactory.java,v
> retrieving revision 1.10
> retrieving revision 1.11
> diff -u -r1.10 -r1.11
> --- NoopFactory.java 14 Dec 2004 20:22:28 -0000 1.10
> +++ NoopFactory.java 12 Feb 2005 04:41:21 -0000 1.11
> @@ -134,7 +134,7 @@
> btm = new BaseTypeMapping() {
>
> TypeMapping defaultTM =
> - DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
> + DefaultSOAPEncodingTypeMappingImpl.create();
>
> public String getBaseName(QName qNameIn) {
>
> 1.80 +5 -4 ws-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java
>
> Index: Emitter.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java,v
> retrieving revision 1.79
> retrieving revision 1.80
> diff -u -r1.79 -r1.80
> --- Emitter.java 8 Feb 2005 18:44:36 -0000 1.79
> +++ Emitter.java 12 Feb 2005 04:41:21 -0000 1.80
> @@ -408,7 +408,7 @@
> public TypeMapping getDefaultTypeMapping() {
> if (defaultTM == null) {
> defaultTM =
> - DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
> + DefaultSOAPEncodingTypeMappingImpl.create();
> }
> return defaultTM;
> }
> @@ -762,13 +762,14 @@
> public void setTypeMappingVersion(String typeMappingVersion) {
> if(defaultTM == null) {
> if (typeMappingVersion.equals("1.0")) {
> - defaultTM=DefaultSOAPEncodingTypeMappingImpl.create();
> + defaultTM=DefaultSOAPEncodingTypeMappingImpl.getSingleton();
> } else if (typeMappingVersion.equals("1.1")) {
> + // No SOAP encoding
> defaultTM=DefaultTypeMappingImpl.getSingleton();
> } else if (typeMappingVersion.equals("1.2")) {
> - defaultTM=DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
> + defaultTM=DefaultSOAPEncodingTypeMappingImpl.create();
> } else if (typeMappingVersion.equals("1.3")) {
> - defaultTM=DefaultJAXRPC11TypeMappingImpl.createWithDelegate();
> + defaultTM=DefaultJAXRPC11TypeMappingImpl.create();
> } else {
> throw new RuntimeException(org.apache.axis.utils.Messages.getMessage("j2wBadTypeMapping00"));
> }
>
> 1.2 +7 -7 ws-axis/java/test/holders/ArrayOfBook.java
>
> Index: ArrayOfBook.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/test/holders/ArrayOfBook.java,v
> retrieving revision 1.1
> retrieving revision 1.2
> diff -u -r1.1 -r1.2
> --- ArrayOfBook.java 5 Feb 2005 21:14:00 -0000 1.1
> +++ ArrayOfBook.java 12 Feb 2005 04:41:21 -0000 1.2
> @@ -19,11 +19,11 @@
> this.arrayOfBook = arrayOfBook;
> }
>
> - public test.holders.Book getArrayOfBook(int i) {
> - return this.arrayOfBook[i];
> - }
> -
> - public void setArrayOfBook(int i, test.holders.Book _value) {
> - this.arrayOfBook[i] = _value;
> - }
> +// public test.holders.Book getArrayOfBook(int i) {
> +// return this.arrayOfBook[i];
> +// }
> +//
> +// public void setArrayOfBook(int i, test.holders.Book _value) {
> +// this.arrayOfBook[i] = _value;
> +// }
> }
>
>
--
Davanum Srinivas - http://webservices.apache.org/~dims/
Re: cvs commit: ws-axis/java/test/holders ArrayOfBook.java
Posted by Davanum Srinivas <da...@gmail.com>.
Super!!!!!!!!!!!!!! Thanks.
-- dims
On Fri, 11 Feb 2005 20:41:26 -0800 (PST), gdaniels@apache.org
<gd...@apache.org> wrote:
> gdaniels 2005/02/11 20:41:21
>
> Modified: java/src/org/apache/axis/client Service.java
> java/src/org/apache/axis/deployment/wsdd WSDDService.java
> java/src/org/apache/axis/encoding
> DefaultJAXRPC11TypeMappingImpl.java
> DefaultSOAPEncodingTypeMappingImpl.java
> DeserializationContext.java
> SerializationContext.java TypeMapping.java
> TypeMappingDelegate.java TypeMappingImpl.java
> TypeMappingRegistryImpl.java
> java/src/org/apache/axis/encoding/ser
> ArrayDeserializerFactory.java
> java/src/org/apache/axis/message BodyBuilder.java
> java/src/org/apache/axis/wsdl/fromJava Emitter.java
> java/src/org/apache/axis/wsdl/gen NoopFactory.java
> java/src/org/apache/axis/wsdl/toJava Emitter.java
> java/test/holders ArrayOfBook.java
> Log:
> Enable beans with array fields but no indexed accessors,
> and along the way clean up some potentially problem-
> causing rough spots. Hopefully I didn't add more of the
> same. :)
>
> * Provide an equivalent mechanism to the one Tom and I
> added to the ArraySerializer for the ArrayDeserializer,
> allowing us to specify a component type to the
> factory so that we can customize it at creation time.
>
> This gets used when figuring out types using
> TypeMappingImpl.getDeserializer() - if we're looking
> for a deserializer for a Java array type, and
> we're not in maxOccurs mode (in which case you just
> let the BeanDeserializer or RPCHandler do it for you),
> we return an ArrayDeserializerFactory preconfigured
> with the correct component type. This allows us to
> deserialize array items without xsi:types. There's
> a bit of tricky code in there which checks to see
> that the desired XML type isn't the component type
> of the desired array type - if so, that indicates
> we're using maxOccurs mode.
>
> * Remove digging down into the component type from
> DeserializationContext.getDeserializerForClass()
>
> * Since we use SOAP_ARRAY as a marker type for arrays
> even in literal mode, make sure we don't end up
> inadvertently serializing it on the wire as an
> xsi:type (in SerializationContext)
>
> * Clean up what's going on when we're registering
> the "default" mappings in Service/WSDDService/
> Emitter. Use a common function,
> TypeMappingRegistryImpl.doRegisterFromVersion(),
> in order to register the correct SOAPENC default
> (which is really what goes on when selecting the
> typemapping switch [insert flame about how awful
> the "1.X" arguments are for these things]). Avoid
> weird delegation chains by forcing the defaults
> in these situations.
>
> * Comment out indexed setter/getter from ArrayOfBook
>
> * For some reason we were forcing "isResponse" to
> false in BodyBuilder when deserializing in "fast"
> mode. Respect the actual message type, which lets
> us get the right metadata in RPCHandler.
>
> Passes all-tests, need to re-run TCK.
>
> Revision Changes Path
> 1.105 +2 -17 ws-axis/java/src/org/apache/axis/client/Service.java
>
> Index: Service.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/client/Service.java,v
> retrieving revision 1.104
> retrieving revision 1.105
> diff -u -r1.104 -r1.105
> --- Service.java 21 Jan 2005 18:20:57 -0000 1.104
> +++ Service.java 12 Feb 2005 04:41:20 -0000 1.105
> @@ -19,9 +19,7 @@
> import org.apache.axis.AxisEngine;
> import org.apache.axis.EngineConfiguration;
> import org.apache.axis.configuration.EngineConfigurationFactoryFinder;
> -import org.apache.axis.encoding.DefaultJAXRPC11TypeMappingImpl;
> -import org.apache.axis.encoding.DefaultSOAPEncodingTypeMappingImpl;
> -import org.apache.axis.encoding.DefaultTypeMappingImpl;
> +import org.apache.axis.encoding.TypeMappingRegistryImpl;
> import org.apache.axis.utils.ClassUtils;
> import org.apache.axis.utils.Messages;
> import org.apache.axis.utils.WSDLUtils;
> @@ -42,7 +40,6 @@
> import javax.wsdl.extensions.soap.SOAPAddress;
> import javax.xml.namespace.QName;
> import javax.xml.rpc.ServiceException;
> -import javax.xml.rpc.encoding.TypeMapping;
> import javax.xml.rpc.encoding.TypeMappingRegistry;
> import javax.xml.rpc.handler.HandlerRegistry;
> import java.io.InputStream;
> @@ -906,18 +903,6 @@
> * @param version
> */
> public void setTypeMappingVersion(String version) {
> - TypeMapping tm = null;
> - if (version.equals("1.0")) {
> - tm = DefaultSOAPEncodingTypeMappingImpl.create();
> - } else if (version.equals("1.1")) {
> - tm = DefaultTypeMappingImpl.getSingleton();
> - } else if (version.equals("1.2")) {
> - tm = DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
> - } else if (version.equals("1.3")) {
> - tm = DefaultJAXRPC11TypeMappingImpl.createWithDelegate();
> - } else {
> - throw new RuntimeException(org.apache.axis.utils.Messages.getMessage("j2wBadTypeMapping00"));
> - }
> - getTypeMappingRegistry().registerDefault(tm);
> + ((TypeMappingRegistryImpl)getTypeMappingRegistry()).doRegisterFromVersion(version);
> }
> }
>
> 1.110 +2 -17 ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java
>
> Index: WSDDService.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java,v
> retrieving revision 1.109
> retrieving revision 1.110
> diff -u -r1.109 -r1.110
> --- WSDDService.java 8 Feb 2005 18:44:38 -0000 1.109
> +++ WSDDService.java 12 Feb 2005 04:41:20 -0000 1.110
> @@ -252,24 +252,9 @@
> }
>
> private void createTMR() {
> + tmr = new TypeMappingRegistryImpl();
> String version = getParameter("typeMappingVersion");
> - if(version != null) {
> - TypeMapping tm = null;
> - if (version.equals("1.0")) {
> - tm = DefaultSOAPEncodingTypeMappingImpl.create();
> - } else if (version.equals("1.1")) {
> - tm = DefaultTypeMappingImpl.getSingleton();
> - } else if (version.equals("1.2")) {
> - tm = DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
> - } else if (version.equals("1.3")) {
> - tm = DefaultJAXRPC11TypeMappingImpl.createWithDelegate();
> - } else {
> - throw new RuntimeException(org.apache.axis.utils.Messages.getMessage("j2wBadTypeMapping00"));
> - }
> - tmr = new TypeMappingRegistryImpl(tm);
> - } else {
> - tmr = new TypeMappingRegistryImpl();
> - }
> + ((TypeMappingRegistryImpl)tmr).doRegisterFromVersion(version);
> }
>
> /**
>
> 1.9 +1 -1 ws-axis/java/src/org/apache/axis/encoding/DefaultJAXRPC11TypeMappingImpl.java
>
> Index: DefaultJAXRPC11TypeMappingImpl.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/DefaultJAXRPC11TypeMappingImpl.java,v
> retrieving revision 1.8
> retrieving revision 1.9
> diff -u -r1.8 -r1.9
> --- DefaultJAXRPC11TypeMappingImpl.java 7 Feb 2005 14:45:28 -0000 1.8
> +++ DefaultJAXRPC11TypeMappingImpl.java 12 Feb 2005 04:41:20 -0000 1.9
> @@ -43,7 +43,7 @@
> return tm;
> }
>
> - public static TypeMapping createWithDelegate() {
> + public static TypeMapping create() {
> TypeMapping ret = new DefaultJAXRPC11TypeMappingImpl();
> ret.setDelegate(DefaultJAXRPC11TypeMappingImpl.getSingleton());
> return ret;
>
> 1.9 +8 -4 ws-axis/java/src/org/apache/axis/encoding/DefaultSOAPEncodingTypeMappingImpl.java
>
> Index: DefaultSOAPEncodingTypeMappingImpl.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/DefaultSOAPEncodingTypeMappingImpl.java,v
> retrieving revision 1.8
> retrieving revision 1.9
> diff -u -r1.8 -r1.9
> --- DefaultSOAPEncodingTypeMappingImpl.java 14 Dec 2004 20:22:27 -0000 1.8
> +++ DefaultSOAPEncodingTypeMappingImpl.java 12 Feb 2005 04:41:20 -0000 1.9
> @@ -30,21 +30,25 @@
> * @author Rich Scheuerle (scheu@us.ibm.com)
> */
> public class DefaultSOAPEncodingTypeMappingImpl extends DefaultTypeMappingImpl {
> -
> private static DefaultSOAPEncodingTypeMappingImpl tm = null;
> /**
> * Construct TypeMapping
> */
> - public static TypeMapping create() {
> + public static TypeMapping getSingleton() {
> if (tm == null) {
> tm = new DefaultSOAPEncodingTypeMappingImpl();
> }
> return tm;
> }
>
> - public static TypeMapping createWithDelegate() {
> + public static TypeMapping create() {
> TypeMapping ret = new DefaultSOAPEncodingTypeMappingImpl();
> - ret.setDelegate(DefaultTypeMappingImpl.getSingleton());
> +
> + // Removed by gdaniels 2/11/2005 - we don't seem to need this
> + // any more since delegation gets done by the TMR as necessary
> + //
> + // ret.setDelegate(DefaultTypeMappingImpl.getSingleton());
> +
> return ret;
> }
>
> 1.63 +3 -4 ws-axis/java/src/org/apache/axis/encoding/DeserializationContext.java
>
> Index: DeserializationContext.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/DeserializationContext.java,v
> retrieving revision 1.62
> retrieving revision 1.63
> diff -u -r1.62 -r1.63
> --- DeserializationContext.java 21 Jan 2005 16:57:31 -0000 1.62
> +++ DeserializationContext.java 12 Feb 2005 04:41:20 -0000 1.63
> @@ -482,9 +482,9 @@
> if (cls == null) {
> return null;
> }
> - if (cls.isArray()) {
> - cls = cls.getComponentType();
> - }
> +// if (cls.isArray()) {
> +// cls = cls.getComponentType();
> +// }
> if (javax.xml.rpc.holders.Holder.class.isAssignableFrom(cls)) {
> try {
> cls = cls.getField("value").getType();
> @@ -1234,4 +1234,3 @@
> }
> }
>
> -
>
> 1.105 +6 -2 ws-axis/java/src/org/apache/axis/encoding/SerializationContext.java
>
> Index: SerializationContext.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/SerializationContext.java,v
> retrieving revision 1.104
> retrieving revision 1.105
> diff -u -r1.104 -r1.105
> --- SerializationContext.java 10 Feb 2005 18:14:39 -0000 1.104
> +++ SerializationContext.java 12 Feb 2005 04:41:20 -0000 1.105
> @@ -1393,7 +1393,11 @@
> if (shouldSendType ||
> (xmlType != null &&
> (!xmlType.equals(actualXMLType.value)))) {
> - writeXMLType = actualXMLType.value;
> + if (!isEncoded() && Constants.isSOAP_ENC(actualXMLType.value.getNamespaceURI())) {
> + // Don't write SOAP_ENC types (i.e. Array) if we're not using encoding
> + } else {
> + writeXMLType = actualXMLType.value;
> + }
> }
>
> // -----------------
> @@ -1581,4 +1585,4 @@
> public void setEncoding(String encoding) {
> this.encoding = encoding;
> }
> -}
> +}
> \ No newline at end of file
>
> 1.15 +20 -0 ws-axis/java/src/org/apache/axis/encoding/TypeMapping.java
>
> Index: TypeMapping.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/TypeMapping.java,v
> retrieving revision 1.14
> retrieving revision 1.15
> diff -u -r1.14 -r1.15
> --- TypeMapping.java 7 Feb 2005 07:54:04 -0000 1.14
> +++ TypeMapping.java 12 Feb 2005 04:41:20 -0000 1.15
> @@ -121,6 +121,26 @@
> */
> QName getXMLType(Class javaType, QName xmlType, boolean encoded)
> throws JAXRPCException;
> +
> + /**
> + * Gets the DeserializerFactory registered for the specified XML data type.
> + * This version uses a particular "original" TypeMapping in order to do
> + * secondary lookups for array component types, if necessary.
> + *
> + * @param javaType - the desired Java class
> + * @param xmlType - Qualified name of the XML data type
> + * @param orig - the TypeMapping from which to do secondary lookups
> + *
> + * @return Registered DeserializerFactory
> + *
> + * @throws JAXRPCException - If there is no registered DeserializerFactory
> + * for this pair of Java type and XML data type
> + * java.lang.IllegalArgumentException -
> + * If invalid or unsupported XML/Java type is specified
> + */
> + DeserializerFactory
> + getDeserializer(Class javaType, QName xmlType, TypeMappingImpl orig)
> + throws JAXRPCException;
> }
>
> 1.17 +25 -1 ws-axis/java/src/org/apache/axis/encoding/TypeMappingDelegate.java
>
> Index: TypeMappingDelegate.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/TypeMappingDelegate.java,v
> retrieving revision 1.16
> retrieving revision 1.17
> diff -u -r1.16 -r1.17
> --- TypeMappingDelegate.java 7 Feb 2005 07:54:04 -0000 1.16
> +++ TypeMappingDelegate.java 12 Feb 2005 04:41:20 -0000 1.17
> @@ -100,7 +100,31 @@
> }
> return null;
> }
> - public javax.xml.rpc.encoding.DeserializerFactory
> +
> + /**
> + * Gets the DeserializerFactory registered for the specified XML data type.
> + * This version uses a particular "original" TypeMapping in order to do
> + * secondary lookups for array component types, if necessary.
> + *
> + * @param javaType - the desired Java class
> + * @param xmlType - Qualified name of the XML data type
> + * @param orig - the TypeMapping from which to do secondary lookups
> + *
> + * @return Registered DeserializerFactory
> + *
> + * @throws JAXRPCException - If there is no registered DeserializerFactory
> + * for this pair of Java type and XML data type
> + * java.lang.IllegalArgumentException -
> + * If invalid or unsupported XML/Java type is specified
> + */
> + public javax.xml.rpc.encoding.DeserializerFactory getDeserializer(Class javaType, QName xmlType, TypeMappingImpl orig) throws JAXRPCException {
> + if (delegate != null) {
> + return delegate.getDeserializer(javaType, xmlType, orig);
> + }
> + return null;
> + }
> +
> + public javax.xml.rpc.encoding.DeserializerFactory
> getDeserializer(QName xmlType)
> throws JAXRPCException {
> if (delegate != null) {
>
> 1.56 +52 -4 ws-axis/java/src/org/apache/axis/encoding/TypeMappingImpl.java
>
> Index: TypeMappingImpl.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/TypeMappingImpl.java,v
> retrieving revision 1.55
> retrieving revision 1.56
> diff -u -r1.55 -r1.56
> --- TypeMappingImpl.java 7 Feb 2005 07:54:04 -0000 1.55
> +++ TypeMappingImpl.java 12 Feb 2005 04:41:20 -0000 1.56
> @@ -19,7 +19,6 @@
> import org.apache.axis.Constants;
> import org.apache.axis.AxisProperties;
> import org.apache.axis.MessageContext;
> -import org.apache.axis.AxisEngine;
> import org.apache.axis.components.logger.LogFactory;
> import org.apache.axis.encoding.ser.ArrayDeserializerFactory;
> import org.apache.axis.encoding.ser.ArraySerializerFactory;
> @@ -142,7 +141,8 @@
> * setDelegate sets the new Delegate TypeMapping
> */
> public void setDelegate(TypeMapping delegate) {
> - this.delegate = delegate;
> + if (delegate != this)
> + this.delegate = delegate;
> }
>
> /**
> @@ -447,6 +447,28 @@
> public javax.xml.rpc.encoding.DeserializerFactory
> getDeserializer(Class javaType, QName xmlType)
> throws JAXRPCException {
> + return getDeserializer(javaType, xmlType, this);
> + }
> +
> + /**
> + * Gets the DeserializerFactory registered for the specified XML data type.
> + * This version uses a particular "original" TypeMapping in order to do
> + * secondary lookups for array component types, if necessary.
> + *
> + * @param javaType - the desired Java class
> + * @param xmlType - Qualified name of the XML data type
> + * @param orig - the TypeMapping from which to do secondary lookups
> + *
> + * @return Registered DeserializerFactory
> + *
> + * @throws JAXRPCException - If there is no registered DeserializerFactory
> + * for this pair of Java type and XML data type
> + * java.lang.IllegalArgumentException -
> + * If invalid or unsupported XML/Java type is specified
> + */
> + public javax.xml.rpc.encoding.DeserializerFactory
> + getDeserializer(Class javaType, QName xmlType, TypeMappingImpl orig)
> + throws JAXRPCException {
> javax.xml.rpc.encoding.DeserializerFactory df = null;
>
> if (javaType == null) {
> @@ -463,7 +485,33 @@
> df = (javax.xml.rpc.encoding.DeserializerFactory) pair2DF.get(pair);
>
> if (df == null && delegate != null) {
> - df = delegate.getDeserializer(javaType, xmlType);
> + df = delegate.getDeserializer(javaType, xmlType, orig);
> + }
> +
> + if (df == null) {
> + if (javaType.isArray()) {
> + Class componentType = javaType.getComponentType();
> +
> + // HACK ALERT - Don't return the ArrayDeserializer IF
> + // the xmlType matches the component type of the array,
> + // because that means we're using maxOccurs and we'll
> + // want the higher layers to get the component type
> + // deserializer... (sigh)
> + if (xmlType != null) {
> + Class actualClass = orig.getClassForQName(xmlType);
> + if (actualClass == componentType)
> + return null;
> + }
> +
> + pair = (Pair) qName2Pair.get(Constants.SOAP_ARRAY);
> + df = (javax.xml.rpc.encoding.DeserializerFactory) pair2DF.get(pair);
> + if (df instanceof ArrayDeserializerFactory && javaType.isArray()) {
> + QName componentXmlType = orig.getTypeQName(componentType);
> + if (componentXmlType != null) {
> + df = new ArrayDeserializerFactory(componentXmlType);
> + }
> + }
> + }
> }
> return df;
> }
> @@ -771,4 +819,4 @@
> temp.addAll(class2Pair.keySet());
> return (Class[])temp.toArray(new Class[temp.size()]);
> }
> -}
> +}
> \ No newline at end of file
>
> 1.31 +52 -16 ws-axis/java/src/org/apache/axis/encoding/TypeMappingRegistryImpl.java
>
> Index: TypeMappingRegistryImpl.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/TypeMappingRegistryImpl.java,v
> retrieving revision 1.30
> retrieving revision 1.31
> diff -u -r1.30 -r1.31
> --- TypeMappingRegistryImpl.java 7 Feb 2005 07:54:04 -0000 1.30
> +++ TypeMappingRegistryImpl.java 12 Feb 2005 04:41:20 -0000 1.31
> @@ -247,24 +247,60 @@
> * if an invalid type mapping is specified or the delegate is already set
> */
> public void registerDefault(javax.xml.rpc.encoding.TypeMapping mapping) {
> - if (mapping == null ||
> - !(mapping instanceof TypeMapping)) {
> - throw new IllegalArgumentException(
> - Messages.getMessage("badTypeMapping"));
> - }
> -
> - /* Don't allow this call after the delegate() method since
> - * the TMR's TypeMappings will be using the default type mapping
> - * of the secondary TMR.
> - */
> - if (defaultDelTM.getDelegate() instanceof TypeMappingDelegate) {
> - throw new IllegalArgumentException(
> - Messages.getMessage("defaultTypeMappingSet"));
> - }
> +// if (mapping == null ||
> +// !(mapping instanceof TypeMapping)) {
> +// throw new IllegalArgumentException(
> +// Messages.getMessage("badTypeMapping"));
> +// }
> +//
> +// /* Don't allow this call after the delegate() method since
> +// * the TMR's TypeMappings will be using the default type mapping
> +// * of the secondary TMR.
> +// */
> +// if (defaultDelTM.getDelegate() instanceof TypeMappingDelegate) {
> +// throw new IllegalArgumentException(
> +// Messages.getMessage("defaultTypeMappingSet"));
> +// }
> +//
> +// defaultDelTM.setDelegate((TypeMapping) mapping);
> + }
> +
> + public void doRegisterFromVersion(String version) {
> + TypeMapping tm;
> + if (version == null || version.equals("1.0")) {
> + tm = DefaultSOAPEncodingTypeMappingImpl.getSingleton();
> + } else if (version.equals("1.1")) {
> + return;
> + } else if (version.equals("1.2")) {
> + tm = DefaultSOAPEncodingTypeMappingImpl.create();
> + } else if (version.equals("1.3")) {
> + tm = DefaultJAXRPC11TypeMappingImpl.create();
> + } else {
> + throw new RuntimeException(org.apache.axis.utils.Messages.getMessage("j2wBadTypeMapping00"));
> + }
> + registerSOAPENCDefault(tm);
> + }
> + /**
> + * Force registration of the given mapping as the SOAPENC default mapping
> + * @param mapping
> + */
> + private void registerSOAPENCDefault(TypeMapping mapping) {
> + registerForced(Constants.URI_SOAP11_ENC, mapping);
> + registerForced(Constants.URI_SOAP12_ENC, mapping);
> + }
>
> - defaultDelTM.setDelegate((TypeMapping) mapping);
> + /**
> + * Force registration of a particular mapping for a given namespace,
> + * which will delegate back to the default.
> + *
> + * @param namespaceURI
> + * @param mapping
> + */
> + private void registerForced(String namespaceURI, TypeMapping mapping) {
> + mapTM.put(namespaceURI, new TypeMappingDelegate((TypeMapping) mapping));
> + ((TypeMapping)mapping).setDelegate(defaultDelTM.getDelegate());
> }
> -
> +
> /**
> * Gets the TypeMapping for the namespace. If not found, the default
> * TypeMapping is returned.
>
> 1.5 +31 -1 ws-axis/java/src/org/apache/axis/encoding/ser/ArrayDeserializerFactory.java
>
> Index: ArrayDeserializerFactory.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/ser/ArrayDeserializerFactory.java,v
> retrieving revision 1.4
> retrieving revision 1.5
> diff -u -r1.4 -r1.5
> --- ArrayDeserializerFactory.java 25 Feb 2004 14:02:36 -0000 1.4
> +++ ArrayDeserializerFactory.java 12 Feb 2005 04:41:21 -0000 1.5
> @@ -16,6 +16,8 @@
>
> package org.apache.axis.encoding.ser;
>
> +import javax.xml.namespace.QName;
> +
>
> /**
> * DeserializerFactory for arrays
> @@ -23,7 +25,35 @@
> * @author Rich Scheuerle <sc...@us.ibm.com>
> */
> public class ArrayDeserializerFactory extends BaseDeserializerFactory {
> + private QName componentXmlType;
> +
> public ArrayDeserializerFactory() {
> super(ArrayDeserializer.class);
> }
> -}
> +
> + /**
> + * Constructor
> + * @param componentXmlType the desired component type for this deser
> + */
> + public ArrayDeserializerFactory(QName componentXmlType) {
> + super(ArrayDeserializer.class);
> + this.componentXmlType = componentXmlType;
> + }
> +
> + /**
> + * getDeserializerAs() is overloaded here in order to set the default
> + * item type on the ArrayDeserializers we create.
> + *
> + * @param mechanismType
> + * @return
> + */
> + public javax.xml.rpc.encoding.Deserializer getDeserializerAs(String mechanismType) {
> + ArrayDeserializer dser = (ArrayDeserializer) super.getDeserializerAs(mechanismType);
> + dser.defaultItemType = componentXmlType;
> + return dser;
> + }
> +
> + public void setComponentType(QName componentType) {
> + componentXmlType = componentType;
> + }
> +}
> \ No newline at end of file
>
> 1.65 +3 -1 ws-axis/java/src/org/apache/axis/message/BodyBuilder.java
>
> Index: BodyBuilder.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/message/BodyBuilder.java,v
> retrieving revision 1.64
> retrieving revision 1.65
> diff -u -r1.64 -r1.65
> --- BodyBuilder.java 8 Feb 2005 18:44:36 -0000 1.64
> +++ BodyBuilder.java 12 Feb 2005 04:41:21 -0000 1.65
> @@ -24,6 +24,7 @@
> import org.apache.axis.AxisFault;
> import org.apache.axis.Constants;
> import org.apache.axis.MessageContext;
> +import org.apache.axis.Message;
> import org.apache.axis.components.logger.LogFactory;
> import org.apache.axis.description.OperationDesc;
> import org.apache.axis.encoding.DeserializationContext;
> @@ -181,7 +182,8 @@
> if (msgContext != null && !msgContext.isHighFidelity() &&
> (operations == null || operations.length == 1)) {
> ((RPCElement)element).setNeedDeser(false);
> - handler = new RPCHandler((RPCElement)element, false);
> + handler = new RPCHandler((RPCElement)element,
> + Message.RESPONSE.equals(msgContext.getCurrentMessage().getMessageType()));
> if (operations != null) {
> ((RPCHandler)handler).setOperation(operations[0]);
> msgContext.setOperation(operations[0]);
>
> 1.138 +4 -3 ws-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java
>
> Index: Emitter.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java,v
> retrieving revision 1.137
> retrieving revision 1.138
> diff -u -r1.137 -r1.138
> --- Emitter.java 8 Feb 2005 18:44:36 -0000 1.137
> +++ Emitter.java 12 Feb 2005 04:41:21 -0000 1.138
> @@ -2545,13 +2545,14 @@
> public void setTypeMappingVersion(String typeMappingVersion) {
> if(defaultTM == null) {
> if (typeMappingVersion.equals("1.0")) {
> - defaultTM=DefaultSOAPEncodingTypeMappingImpl.create();
> + defaultTM=DefaultSOAPEncodingTypeMappingImpl.getSingleton();
> } else if (typeMappingVersion.equals("1.1")) {
> + // No SOAP encoding
> defaultTM=DefaultTypeMappingImpl.getSingleton();
> } else if (typeMappingVersion.equals("1.2")) {
> - defaultTM=DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
> + defaultTM=DefaultSOAPEncodingTypeMappingImpl.create();
> } else if (typeMappingVersion.equals("1.3")) {
> - defaultTM=DefaultJAXRPC11TypeMappingImpl.createWithDelegate();
> + defaultTM=DefaultJAXRPC11TypeMappingImpl.create();
> } else {
> throw new RuntimeException(org.apache.axis.utils.Messages.getMessage("j2wBadTypeMapping00"));
> }
>
> 1.11 +1 -1 ws-axis/java/src/org/apache/axis/wsdl/gen/NoopFactory.java
>
> Index: NoopFactory.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/gen/NoopFactory.java,v
> retrieving revision 1.10
> retrieving revision 1.11
> diff -u -r1.10 -r1.11
> --- NoopFactory.java 14 Dec 2004 20:22:28 -0000 1.10
> +++ NoopFactory.java 12 Feb 2005 04:41:21 -0000 1.11
> @@ -134,7 +134,7 @@
> btm = new BaseTypeMapping() {
>
> TypeMapping defaultTM =
> - DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
> + DefaultSOAPEncodingTypeMappingImpl.create();
>
> public String getBaseName(QName qNameIn) {
>
> 1.80 +5 -4 ws-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java
>
> Index: Emitter.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java,v
> retrieving revision 1.79
> retrieving revision 1.80
> diff -u -r1.79 -r1.80
> --- Emitter.java 8 Feb 2005 18:44:36 -0000 1.79
> +++ Emitter.java 12 Feb 2005 04:41:21 -0000 1.80
> @@ -408,7 +408,7 @@
> public TypeMapping getDefaultTypeMapping() {
> if (defaultTM == null) {
> defaultTM =
> - DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
> + DefaultSOAPEncodingTypeMappingImpl.create();
> }
> return defaultTM;
> }
> @@ -762,13 +762,14 @@
> public void setTypeMappingVersion(String typeMappingVersion) {
> if(defaultTM == null) {
> if (typeMappingVersion.equals("1.0")) {
> - defaultTM=DefaultSOAPEncodingTypeMappingImpl.create();
> + defaultTM=DefaultSOAPEncodingTypeMappingImpl.getSingleton();
> } else if (typeMappingVersion.equals("1.1")) {
> + // No SOAP encoding
> defaultTM=DefaultTypeMappingImpl.getSingleton();
> } else if (typeMappingVersion.equals("1.2")) {
> - defaultTM=DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
> + defaultTM=DefaultSOAPEncodingTypeMappingImpl.create();
> } else if (typeMappingVersion.equals("1.3")) {
> - defaultTM=DefaultJAXRPC11TypeMappingImpl.createWithDelegate();
> + defaultTM=DefaultJAXRPC11TypeMappingImpl.create();
> } else {
> throw new RuntimeException(org.apache.axis.utils.Messages.getMessage("j2wBadTypeMapping00"));
> }
>
> 1.2 +7 -7 ws-axis/java/test/holders/ArrayOfBook.java
>
> Index: ArrayOfBook.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/test/holders/ArrayOfBook.java,v
> retrieving revision 1.1
> retrieving revision 1.2
> diff -u -r1.1 -r1.2
> --- ArrayOfBook.java 5 Feb 2005 21:14:00 -0000 1.1
> +++ ArrayOfBook.java 12 Feb 2005 04:41:21 -0000 1.2
> @@ -19,11 +19,11 @@
> this.arrayOfBook = arrayOfBook;
> }
>
> - public test.holders.Book getArrayOfBook(int i) {
> - return this.arrayOfBook[i];
> - }
> -
> - public void setArrayOfBook(int i, test.holders.Book _value) {
> - this.arrayOfBook[i] = _value;
> - }
> +// public test.holders.Book getArrayOfBook(int i) {
> +// return this.arrayOfBook[i];
> +// }
> +//
> +// public void setArrayOfBook(int i, test.holders.Book _value) {
> +// this.arrayOfBook[i] = _value;
> +// }
> }
>
>
--
Davanum Srinivas - http://webservices.apache.org/~dims/