You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2005/03/15 14:33:45 UTC
cvs commit: ws-axis/java/src/org/apache/axis/encoding TypeMapping.java TypeMappingImpl.java TypeMappingRegistry.java
dims 2005/03/15 05:33:45
Modified: java/src/org/apache/axis/encoding/ser
BeanDeserializerFactory.java
BeanSerializerFactory.java
SimpleDeserializerFactory.java
java/src/org/apache/axis/description ServiceDesc.java
java/src/org/apache/axis/encoding TypeMapping.java
TypeMappingImpl.java TypeMappingRegistry.java
Log:
Fix for AXIS-1875 : Serializable JavaServiceDesc et. all
from David Blevins
URL: http://issues.apache.org/jira/browse/AXIS-1875
Revision Changes Path
1.10 +10 -2 ws-axis/java/src/org/apache/axis/encoding/ser/BeanDeserializerFactory.java
Index: BeanDeserializerFactory.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/ser/BeanDeserializerFactory.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- BeanDeserializerFactory.java 13 Oct 2004 03:21:01 -0000 1.9
+++ BeanDeserializerFactory.java 15 Mar 2005 13:33:45 -0000 1.10
@@ -25,6 +25,7 @@
import javax.xml.namespace.QName;
import java.util.HashMap;
import java.util.Map;
+import java.io.IOException;
/**
* DeserializerFactory for Bean
@@ -35,8 +36,8 @@
public class BeanDeserializerFactory extends BaseDeserializerFactory {
/** Type metadata about this class for XML deserialization */
- protected TypeDesc typeDesc = null;
- protected Map propertyMap = null;
+ protected transient TypeDesc typeDesc = null;
+ protected transient Map propertyMap = null;
public BeanDeserializerFactory(Class javaType, QName xmlType) {
super(BeanDeserializer.class, xmlType, javaType);
@@ -87,4 +88,11 @@
return new BeanDeserializer(javaType, xmlType, typeDesc, propertyMap);
}
+
+
+ private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ typeDesc = TypeDesc.getTypeDescForClass(javaType);
+ propertyMap = getProperties(javaType, typeDesc);
+ }
}
1.11 +16 -3 ws-axis/java/src/org/apache/axis/encoding/ser/BeanSerializerFactory.java
Index: BeanSerializerFactory.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/ser/BeanSerializerFactory.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- BeanSerializerFactory.java 25 Feb 2004 14:02:37 -0000 1.10
+++ BeanSerializerFactory.java 15 Mar 2005 13:33:45 -0000 1.11
@@ -16,6 +16,8 @@
package org.apache.axis.encoding.ser;
+import java.io.IOException;
+
import org.apache.axis.description.TypeDesc;
import org.apache.axis.encoding.Serializer;
import org.apache.axis.utils.BeanPropertyDescriptor;
@@ -32,17 +34,22 @@
*/
public class BeanSerializerFactory extends BaseSerializerFactory {
- protected TypeDesc typeDesc = null;
- protected BeanPropertyDescriptor[] propertyDescriptor = null;
+ protected transient TypeDesc typeDesc = null;
+ protected transient BeanPropertyDescriptor[] propertyDescriptor = null;
public BeanSerializerFactory(Class javaType, QName xmlType) {
super(BeanSerializer.class, xmlType, javaType);
+ init(javaType);
+
+ }
+
+ private void init(Class javaType) {
// Sometimes an Enumeration class is registered as a Bean.
// If this is the case, silently switch to the EnumSerializer
if (JavaUtils.isEnumClass(javaType)) {
serClass = EnumSerializer.class;
}
-
+
typeDesc = TypeDesc.getTypeDescForClass(javaType);
if (typeDesc != null) {
@@ -73,4 +80,10 @@
return new BeanSerializer(javaType, xmlType, typeDesc,
propertyDescriptor);
}
+
+ private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ init(javaType);
+ }
+
}
1.17 +20 -10 ws-axis/java/src/org/apache/axis/encoding/ser/SimpleDeserializerFactory.java
Index: SimpleDeserializerFactory.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/ser/SimpleDeserializerFactory.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- SimpleDeserializerFactory.java 8 Mar 2005 15:50:27 -0000 1.16
+++ SimpleDeserializerFactory.java 15 Mar 2005 13:33:45 -0000 1.17
@@ -22,6 +22,7 @@
import javax.xml.namespace.QName;
import javax.xml.rpc.JAXRPCException;
import java.lang.reflect.Constructor;
+import java.io.IOException;
/**
* A deserializer for any simple type with a (String) constructor. Note:
@@ -40,7 +41,7 @@
private static final Class[] STRING_CLASS =
new Class [] {String.class};
- private Constructor constructor = null;
+ private transient Constructor constructor = null;
private boolean isBasicType = false;
/**
* Note that the factory is constructed with the QName and xmlType. This is important
@@ -49,19 +50,23 @@
public SimpleDeserializerFactory(Class javaType, QName xmlType) {
super(SimpleDeserializer.class, xmlType, javaType);
this.isBasicType = isBasic(javaType);
+ initConstructor(javaType);
+ }
+
+ private void initConstructor(Class javaType) {
if (!this.isBasicType) {
// discover the constructor for non basic types
try {
if (QName.class.isAssignableFrom(javaType)) {
- constructor =
+ constructor =
javaType.getDeclaredConstructor(STRING_STRING_CLASS);
} else {
- constructor =
+ constructor =
javaType.getDeclaredConstructor(STRING_CLASS);
}
- } catch (java.lang.NoSuchMethodException e) {
+ } catch (NoSuchMethodException e) {
try {
- constructor =
+ constructor =
javaType.getDeclaredConstructor(new Class[]{});
BeanPropertyDescriptor[] pds = BeanUtils.getPd(javaType);
if(pds != null) {
@@ -70,13 +75,13 @@
}
}
throw new IllegalArgumentException(e.toString());
- } catch (java.lang.NoSuchMethodException ex) {
+ } catch (NoSuchMethodException ex) {
throw new IllegalArgumentException(ex.toString());
- }
- }
+ }
+ }
}
}
-
+
/*
* Any builtin type that has a constructor that takes a String is a basic
* type.
@@ -142,5 +147,10 @@
return deser;
}
}
-
+
+ private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ initConstructor(javaType);
+ }
+
}
1.88 +2 -1 ws-axis/java/src/org/apache/axis/description/ServiceDesc.java
Index: ServiceDesc.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/description/ServiceDesc.java,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -r1.87 -r1.88
--- ServiceDesc.java 8 Feb 2005 18:44:37 -0000 1.87
+++ ServiceDesc.java 15 Mar 2005 13:33:45 -0000 1.88
@@ -23,8 +23,9 @@
import javax.xml.namespace.QName;
import java.util.ArrayList;
import java.util.List;
+import java.io.Serializable;
-public interface ServiceDesc {
+public interface ServiceDesc extends Serializable {
/**
* What kind of service is this?
* @return
1.17 +2 -1 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.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- TypeMapping.java 24 Feb 2005 21:59:55 -0000 1.16
+++ TypeMapping.java 15 Mar 2005 13:33:45 -0000 1.17
@@ -17,6 +17,7 @@
package org.apache.axis.encoding;
+import java.io.Serializable;
import javax.xml.namespace.QName;
import javax.xml.rpc.JAXRPCException;
import javax.xml.rpc.encoding.DeserializerFactory;
@@ -28,7 +29,7 @@
* This interface describes the AXIS TypeMapping.
*/
public interface TypeMapping
- extends javax.xml.rpc.encoding.TypeMapping {
+ extends javax.xml.rpc.encoding.TypeMapping, Serializable {
/**
* Gets the SerializerFactory registered for the specified pair
1.60 +3 -2 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.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- TypeMappingImpl.java 1 Mar 2005 00:13:36 -0000 1.59
+++ TypeMappingImpl.java 15 Mar 2005 13:33:45 -0000 1.60
@@ -38,6 +38,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.io.Serializable;
/**
* <p>
@@ -67,7 +68,7 @@
*
* @author Rich Scheuerle (scheu@us.ibm.com)
*/
-public class TypeMappingImpl
+public class TypeMappingImpl implements Serializable
{
protected static Log log =
LogFactory.getLog(TypeMappingImpl.class.getName());
@@ -80,7 +81,7 @@
*/
public static boolean dotnet_soapenc_bugfix = false;
- public static class Pair {
+ public static class Pair implements Serializable {
public Class javaType;
public QName xmlType;
public Pair(Class javaType, QName xmlType) {
1.55 +3 -1 ws-axis/java/src/org/apache/axis/encoding/TypeMappingRegistry.java
Index: TypeMappingRegistry.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/TypeMappingRegistry.java,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- TypeMappingRegistry.java 25 Feb 2004 14:02:36 -0000 1.54
+++ TypeMappingRegistry.java 15 Mar 2005 13:33:45 -0000 1.55
@@ -17,11 +17,13 @@
package org.apache.axis.encoding;
+import java.io.Serializable;
+
/**
* This interface describes the AXIS TypeMappingRegistry.
*/
public interface TypeMappingRegistry
- extends javax.xml.rpc.encoding.TypeMappingRegistry {
+ extends javax.xml.rpc.encoding.TypeMappingRegistry, Serializable {
/**
* delegate
*