You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsif-dev@ws.apache.org by ow...@apache.org on 2003/02/03 18:35:45 UTC
cvs commit: xml-axis-wsif/java/src/org/apache/wsif/providers/java WSIFPort_Java.java WSIFOperation_Java.java
owenb 2003/02/03 09:35:44
Modified: java/src/org/apache/wsif/providers/java WSIFPort_Java.java
WSIFOperation_Java.java
Log:
Bugzilla fixes:
- http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16648
- http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16723
Fixed serialization issues and reduced the work done by WSIFOperatoin_Java by
only producing lists on Constructor objects if the operation represents a contructor.
Revision Changes Path
1.14 +46 -2 xml-axis-wsif/java/src/org/apache/wsif/providers/java/WSIFPort_Java.java
Index: WSIFPort_Java.java
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/java/WSIFPort_Java.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- WSIFPort_Java.java 31 Jan 2003 17:25:35 -0000 1.13
+++ WSIFPort_Java.java 3 Feb 2003 17:35:44 -0000 1.14
@@ -57,6 +57,9 @@
package org.apache.wsif.providers.java;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
@@ -107,10 +110,11 @@
transient private Method[] serviceObjectMethods;
transient private Constructor[] serviceObjectConstructors;
- private java.lang.Object fieldObjectReference; // 'physical connection'
+ transient private java.lang.Object fieldObjectReference; // 'physical connection'
+ private final boolean separatedObjectRef; // DO NOT INITIALIZE UNTIL CONSTRUCTOR
private Map fieldTypeMaps;
- protected Map operationInstances;
+ transient protected Map operationInstances;
/**
* Construct a new instance of WSIFPort_Java
@@ -123,6 +127,13 @@
throws WSIFException {
Trc.entry(this, def, port, typeMap);
+ // Flag to indicate that the service object reference is written after this object
+ // when this object is serialized to a stream. Older versions of this class may
+ // not do this and so the flag will be missing in the stream and default to false
+ // when the object is deserialized (flag must not be initialized where declared
+ // because it is final and would not default to false!)
+ separatedObjectRef = true;
+
fieldDefinition = def;
fieldPortModel = port;
@@ -513,4 +524,37 @@
return buff.toString();
}
+
+ /**
+ * Override default serialization
+ */
+ private void writeObject(ObjectOutputStream oos) throws IOException {
+ oos.defaultWriteObject();
+
+ if (fieldObjectReference != null && !(fieldObjectReference instanceof Serializable)) {
+ // Cannot serialize web service object reference and so it will have to be stored as null
+ // Any state information is therefore going to be lost
+ oos.writeObject(null);
+ } else {
+ oos.writeObject(fieldObjectReference);
+ }
+
+ }
+
+ /**
+ * Override default deserialization
+ */
+ private void readObject(ObjectInputStream ois)
+ throws ClassNotFoundException, IOException {
+ ois.defaultReadObject();
+
+ // Recover the web service object reference
+ if (separatedObjectRef) {
+ Object ref = ois.readObject();
+ fieldObjectReference = ref;
+ }
+
+ // reset the operation instances
+ operationInstances = new HashMap();
+ }
}
1.31 +32 -6 xml-axis-wsif/java/src/org/apache/wsif/providers/java/WSIFOperation_Java.java
Index: WSIFOperation_Java.java
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/java/WSIFOperation_Java.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- WSIFOperation_Java.java 31 Jan 2003 17:25:36 -0000 1.30
+++ WSIFOperation_Java.java 3 Feb 2003 17:35:44 -0000 1.31
@@ -57,6 +57,9 @@
package org.apache.wsif.providers.java;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -110,8 +113,8 @@
protected String[] fieldInParameterNames = null;
protected String[] fieldOutParameterNames = null;
protected Map fieldFaultMessageInfos = null;
- protected Method[] fieldMethods = null;
- protected Constructor[] fieldConstructors = null;
+ transient protected Method[] fieldMethods = null;
+ transient protected Constructor[] fieldConstructors = null;
protected String fieldOutputMessageName = null;
protected boolean fieldIsStatic = false;
protected boolean fieldIsConstructor = false;
@@ -160,17 +163,16 @@
if (methodType != null) {
if (methodType.equals("static")) {
fieldIsStatic = true;
+ fieldMethods = getMethods(allMethods);
} else if (methodType.equals("constructor")) {
fieldIsConstructor = true;
+ fieldConstructors = getConstructors();
} else {
// Assume instance method...
+ fieldMethods = getMethods(allMethods);
}
}
- fieldConstructors = getConstructors();
-
- fieldMethods = getMethods(allMethods);
-
if (Trc.ON)
Trc.exit(deep());
}
@@ -958,6 +960,7 @@
} catch (WSIFException e) {
Trc.exception(e);
arguments[i] = null;
+ // Check for inout parts
if (fieldOutParameterNames.length > 0) {
String outParameterName = null;
for (int j = 0; j < fieldOutParameterNames.length; j++) {
@@ -1474,4 +1477,27 @@
return buff;
}
+
+ /**
+ * Override default serialization
+ */
+ private void writeObject(ObjectOutputStream oos) throws IOException {
+ oos.defaultWriteObject();
+ }
+
+ /**
+ * Override default deserialization
+ */
+ private void readObject(ObjectInputStream ois)
+ throws ClassNotFoundException, IOException {
+ ois.defaultReadObject();
+
+ // Re-establish all the Method information
+ Method[] allMethods = fieldPort.getServiceObjectMethods();
+ if (fieldIsConstructor) {
+ fieldConstructors = getConstructors();
+ } else {
+ fieldMethods = getMethods(allMethods);
+ }
+ }
}