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 sc...@apache.org on 2007/09/19 18:56:49 UTC
svn commit: r577367 [1/5] - in /webservices/axis2/trunk/java/modules:
jaxws/src/org/apache/axis2/jaxws/client/
jaxws/src/org/apache/axis2/jaxws/message/util/
kernel/src/org/apache/axis2/addressing/ kernel/src/org/apache/axis2/client/
kernel/src/org/apa...
Author: scheu
Date: Wed Sep 19 09:56:47 2007
New Revision: 577367
URL: http://svn.apache.org/viewvc?rev=577367&view=rev
Log:
AXIS2-3210
Contributor:Rich Scheuerle
Performance improvements for the MessageContext persistence.
Added:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/ActivateUtils.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/DebugObjectInput.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/DebugObjectOutputStream.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/ExternalizeConstants.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/MessageExternalizeUtils.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/ObjectInputStreamWithCL.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/SafeObjectInputStream.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/SafeObjectOutputStream.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/SafeSerializable.java
webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ObjectSave2Test.java
Removed:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/MessageExternalizeUtils.java
Modified:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/PropertyMigrator.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/util/MessageUtils.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReference.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/RelatesTo.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/Options.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/OperationContext.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ServiceContext.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ServiceGroupContext.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/SessionContext.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/Parameter.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/ParameterIncludeImpl.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/MetaDataEntry.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/ObjectStateUtils.java
webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextChangeTest.java
webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveATest.java
webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveBTest.java
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/PropertyMigrator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/PropertyMigrator.java?rev=577367&r1=577366&r2=577367&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/PropertyMigrator.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/PropertyMigrator.java Wed Sep 19 09:56:47 2007
@@ -25,14 +25,15 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import java.io.Serializable;
import java.util.Map;
/**
* The PropertyMigrator implements the ApplicationContextMigrator in order to perform the necessary
* manipulations of properties during a request or response flow.
*/
-public class PropertyMigrator implements ApplicationContextMigrator {
- private static final Log log = LogFactory.getLog(PropertyMigrator.class);
+public class PropertyMigrator implements ApplicationContextMigrator, Serializable {
+ private static final Log log = LogFactory.getLog(PropertyMigrator.class);
public void migratePropertiesFromMessageContext(Map<String, Object> userContext,
MessageContext messageContext) {
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/util/MessageUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/util/MessageUtils.java?rev=577367&r1=577366&r2=577367&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/util/MessageUtils.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/util/MessageUtils.java Wed Sep 19 09:56:47 2007
@@ -34,7 +34,9 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.Constants.Configuration;
+import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.handler.AttachmentsAdapter;
import org.apache.axis2.jaxws.handler.TransportHeadersAdapter;
@@ -51,13 +53,17 @@
import javax.activation.DataHandler;
import javax.xml.namespace.QName;
import javax.xml.soap.AttachmentPart;
-import javax.xml.soap.MimeHeader;
-import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPMessage;
import javax.xml.ws.WebServiceException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -312,5 +318,77 @@
}
}
}
+ }
+
+ /**
+ * This is for debug purposes only
+ * @param mc
+ */
+ private static void persistMessageContext(MessageContext mc) {
+ try {
+ ConfigurationContext cc = mc.getConfigurationContext();
+ OperationContext op = mc.getOperationContext();
+ if (cc == null && op != null) {
+ cc = op.getConfigurationContext();
+ }
+
+ File theFile = null;
+ theFile = File.createTempFile("DebugPersist", null);
+
+ // Setup an output stream to a physical file
+ FileOutputStream outStream = new FileOutputStream(theFile);
+
+ // Attach a stream capable of writing objects to the
+ // stream connected to the file
+ ObjectOutputStream outObjStream = new ObjectOutputStream(outStream);
+
+ // Try to save the message context
+ outObjStream.writeObject(mc);
+ outObjStream.flush();
+ outObjStream.close();
+ outStream.flush();
+ outStream.close();
+
+ // Now read in the persisted message
+ // Setup an input stream to the file
+ FileInputStream inStream = new FileInputStream(theFile);
+
+ // attach a stream capable of reading objects from the
+ // stream connected to the file
+ ObjectInputStream inObjStream = new ObjectInputStream(inStream);
+
+ org.apache.axis2.context.MessageContext restoredMC =
+ (org.apache.axis2.context.MessageContext) inObjStream.readObject();
+ inObjStream.close();
+ inStream.close();
+ if (cc == null && op == null) {
+ return;
+ }
+
+ if (cc != null) {
+ restoredMC.activate(cc);
+ } else {
+ restoredMC.activateWithOperationContext(op);
+ }
+ if (restoredMC.getServiceContext() == null) {
+ throw ExceptionFactory.makeWebServiceException("No Service Group!");
+ }
+ if (cc != null) {
+ mc.activate(cc);
+ } else {
+ mc.activateWithOperationContext(op);
+ }
+ if (mc.getOperationContext() == null) {
+ throw new RuntimeException("No Operation Context");
+ }
+ if (mc.getOperationContext().getServiceContext() == null) {
+ throw new RuntimeException("No Service Context");
+ }
+ return;
+ } catch (FileNotFoundException e) {
+ } catch (IOException e) {
+ } catch (ClassNotFoundException e) {
+ }
+ return;
}
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReference.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReference.java?rev=577367&r1=577366&r2=577367&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReference.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReference.java Wed Sep 19 09:56:47 2007
@@ -30,16 +30,20 @@
import org.apache.axiom.om.util.StAXUtils;
import org.apache.axiom.om.util.UUIDGenerator;
import org.apache.axis2.AxisFault;
-import org.apache.axis2.util.ObjectStateUtils;
+import org.apache.axis2.context.externalize.ExternalizeConstants;
+import org.apache.axis2.context.externalize.SafeObjectInputStream;
+import org.apache.axis2.context.externalize.SafeObjectOutputStream;
+import org.apache.axis2.context.externalize.SafeSerializable;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamReader;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.io.Externalizable;
import java.io.IOException;
-import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -51,11 +55,16 @@
* Since the models for this in Submission and Final versions are different, lets make this to comply with
* WS-A Final version. So any information found with WS-A submission will be "pumped" in to this model.
*/
-public class EndpointReference implements Serializable {
+public class EndpointReference implements Externalizable, SafeSerializable {
private static final long serialVersionUID = 5278892171162372439L;
private static final Log log = LogFactory.getLog(EndpointReference.class);
+
+ // supported revision levels, add a new level to manage compatible changes
+ private static final int REVISION_2 = 2;
+ // current revision level of this object
+ private static final int revisionID = REVISION_2;
private static final String myClassName = "EndpointReference";
@@ -84,6 +93,12 @@
private ArrayList extensibleElements;
private ArrayList attributes;
+ /**
+ * No-Arg Constructor
+ * Required for Externalizable objects
+ */
+ public EndpointReference() {}
+
/**
* @param address
@@ -561,14 +576,21 @@
* OMElements/Attributes, we need to actually serialize the OM structures
* (at least in some cases.)
*/
- private void writeObject(java.io.ObjectOutputStream out)
+ public void writeExternal(java.io.ObjectOutput o)
throws IOException {
+ SafeObjectOutputStream out = SafeObjectOutputStream.install(o);
+
+ // revision ID
+ out.writeInt(revisionID);
+
+ // Correlation ID
String logCorrelationIDString = getLogCorrelationIDString();
// String object id
- ObjectStateUtils.writeString(out, logCorrelationIDString, logCorrelationIDString
- + ".logCorrelationIDString");
+ out.writeObject(logCorrelationIDString);
+ // Write out the content as xml
+ out.writeUTF("start xml"); // write marker
OMElement om =
EndpointReferenceHelper.toOM(OMAbstractFactory.getOMFactory(),
this,
@@ -594,7 +616,8 @@
}
out.writeInt(baos.size());
- out.write(baos.toByteArray());
+ out.write(baos.toByteArray());
+ out.writeUTF("end xml"); // write marker
if (log.isDebugEnabled()) {
byte[] buffer = baos.toByteArray();
@@ -610,12 +633,23 @@
/**
* Read the EPR to the specified InputStream.
*/
- private void readObject(java.io.ObjectInputStream in)
+ public void readExternal(java.io.ObjectInput inObject)
throws IOException, ClassNotFoundException {
-
+ SafeObjectInputStream in = SafeObjectInputStream.install(inObject);
+
+ // revision ID
+ int revID = in.readInt();
+
+ // make sure the object data is in a revision level we can handle
+ if (revID != REVISION_2) {
+ throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_REVID);
+ }
+
// String object id
- logCorrelationIDString = ObjectStateUtils.readString(in, "EndpointReference.logCorrelationIDString");
+ logCorrelationIDString = (String) in.readObject();
+ // Read xml content
+ in.readUTF(); // read marker
int numBytes = in.readInt();
byte[] serBytes = new byte[numBytes];
@@ -655,6 +689,7 @@
throw ioe;
}
+ in.readUTF(); // read marker
ByteArrayInputStream bais = new ByteArrayInputStream(serBytes);
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/RelatesTo.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/RelatesTo.java?rev=577367&r1=577366&r2=577367&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/RelatesTo.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/RelatesTo.java Wed Sep 19 09:56:47 2007
@@ -20,7 +20,10 @@
package org.apache.axis2.addressing;
-import org.apache.axis2.util.ObjectStateUtils;
+import org.apache.axis2.context.externalize.ExternalizeConstants;
+import org.apache.axis2.context.externalize.SafeObjectInputStream;
+import org.apache.axis2.context.externalize.SafeObjectOutputStream;
+import org.apache.axis2.context.externalize.SafeSerializable;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -33,7 +36,7 @@
/**
* Class RelatesTo
*/
-public class RelatesTo implements Externalizable {
+public class RelatesTo implements Externalizable, SafeSerializable {
/*
* setup for logging
@@ -61,9 +64,9 @@
* Refer to the writeExternal() and readExternal() methods.
*/
// supported revision levels, add a new level to manage compatible changes
- private static final int REVISION_1 = 1;
+ private static final int REVISION_2 = 2;
// current revision level of this object
- private static final int revisionID = REVISION_1;
+ private static final int revisionID = REVISION_2;
/**
@@ -169,7 +172,8 @@
* @param out The stream to write the object contents to
* @throws IOException
*/
- public void writeExternal(ObjectOutput out) throws IOException {
+ public void writeExternal(ObjectOutput o) throws IOException {
+ SafeObjectOutputStream out = SafeObjectOutputStream.install(o);
// write out contents of this object
// NOTES: For each item, where appropriate,
@@ -195,17 +199,15 @@
//---------------------------------------------------------
// String relationshipType
- ObjectStateUtils.writeString(out, relationshipType, "RelatesTo.relationshipType");
+ out.writeObject(relationshipType);
// String value
- ObjectStateUtils.writeString(out, value, "RelatesTo.value");
+ out.writeObject(value);
//---------------------------------------------------------
// collections and lists
//---------------------------------------------------------
-
- ObjectStateUtils
- .writeArrayList(out, extensibilityAttributes, "RelatesTo.extensibilityAttributes");
+ out.writeList(extensibilityAttributes);
}
@@ -222,7 +224,8 @@
* @throws IOException
* @throws ClassNotFoundException
*/
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ public void readExternal(ObjectInput inObject) throws IOException, ClassNotFoundException {
+ SafeObjectInputStream in = SafeObjectInputStream.install(inObject);
// serialization version ID
long suid = in.readLong();
@@ -231,12 +234,12 @@
// make sure the object data is in a version we can handle
if (suid != serialVersionUID) {
- throw new ClassNotFoundException(ObjectStateUtils.UNSUPPORTED_SUID);
+ throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_SUID);
}
// make sure the object data is in a revision level we can handle
- if (revID != REVISION_1) {
- throw new ClassNotFoundException(ObjectStateUtils.UNSUPPORTED_REVID);
+ if (revID != REVISION_2) {
+ throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_REVID);
}
//---------------------------------------------------------
@@ -244,23 +247,17 @@
//---------------------------------------------------------
// String relationshipType
- relationshipType = ObjectStateUtils.readString(in, "RelatesTo.relationshipType");
+ relationshipType = (String)in.readObject();
// String value
- value = ObjectStateUtils.readString(in, "RelatesTo.value");
+ value = (String) in.readObject();
//---------------------------------------------------------
// collections and lists
//---------------------------------------------------------
// ArrayList extensibilityAttributes
- ArrayList tmpAL2 = ObjectStateUtils.readArrayList(in, "RelatesTo.extensibilityAttributes");
- if (tmpAL2 != null) {
- extensibilityAttributes = new ArrayList(tmpAL2);
- } else {
- extensibilityAttributes = null;
- }
-
+ extensibilityAttributes = in.readArrayList();
}
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/Options.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/Options.java?rev=577367&r1=577366&r2=577367&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/Options.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/Options.java Wed Sep 19 09:56:47 2007
@@ -27,17 +27,21 @@
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.addressing.RelatesTo;
import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.externalize.ExternalizeConstants;
+import org.apache.axis2.context.externalize.SafeObjectInputStream;
+import org.apache.axis2.context.externalize.SafeObjectOutputStream;
+import org.apache.axis2.context.externalize.SafeSerializable;
import org.apache.axis2.description.TransportInDescription;
import org.apache.axis2.description.TransportOutDescription;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.i18n.Messages;
import org.apache.axis2.transport.TransportListener;
import org.apache.axis2.util.MetaDataEntry;
-import org.apache.axis2.util.ObjectStateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import javax.xml.namespace.QName;
+
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
@@ -59,7 +63,7 @@
* property inheritance, so that if a property is not set in one instance it
* will check its parent for a setting.
*/
-public class Options implements Externalizable {
+public class Options implements Externalizable, SafeSerializable {
/*
* setup for logging
@@ -93,9 +97,9 @@
* Refer to the writeExternal() and readExternal() methods.
*/
// supported revision levels, add a new level to manage compatible changes
- private static final int REVISION_1 = 1;
+ private static final int REVISION_2 = 2;
// current revision level of this object
- private static final int revisionID = REVISION_1;
+ private static final int revisionID = REVISION_2;
/**
@@ -1025,7 +1029,8 @@
* @param out The stream to write the object contents to
* @throws IOException
*/
- public void writeExternal(ObjectOutput out) throws IOException {
+ public void writeExternal(ObjectOutput o) throws IOException {
+ SafeObjectOutputStream out = SafeObjectOutputStream.install(o);
String logCorrelationIDString = getLogCorrelationIDString();
// write out contents of this object
@@ -1056,147 +1061,83 @@
out.writeBoolean(manageSession);
// the following objects could be null
- ObjectStateUtils.writeObject(out, isExceptionToBeThrownOnSOAPFault,
- logCorrelationIDString + ".isExceptionToBeThrownOnSOAPFault");
- ObjectStateUtils.writeObject(out, useSeparateListener,
- logCorrelationIDString + ".useSeparateListener");
+ out.writeObject(isExceptionToBeThrownOnSOAPFault);
+ out.writeObject(useSeparateListener);
//---------------------------------------------------------
// various strings
//---------------------------------------------------------
// String soapVersionURI
- ObjectStateUtils
- .writeString(out, soapVersionURI, logCorrelationIDString + ".soapVersionURI");
+ out.writeObject(soapVersionURI);
// String action
- ObjectStateUtils.writeString(out, action, logCorrelationIDString + ".action");
+ out.writeObject(action);
// String transportInProtocol
- ObjectStateUtils.writeString(out, transportInProtocol,
- logCorrelationIDString + ".transportInProtocol");
+ out.writeObject(transportInProtocol);
// String messageId
- ObjectStateUtils.writeString(out, messageId, logCorrelationIDString + ".messageId");
+ out.writeObject(messageId);
// String object id
- ObjectStateUtils.writeString(out, logCorrelationIDString,
- logCorrelationIDString + ".logCorrelationIDString");
+ out.writeObject(logCorrelationIDString);
//---------------------------------------------------------
// various objects
//---------------------------------------------------------
-
- // put some try..catch blocks around the following objects
- // so that the writing to the output stream continues
- // even if one of the objects can't be serialized
-
- try {
- // EndpointReference faultTo
- ObjectStateUtils.writeObject(out, faultTo, logCorrelationIDString + ".faultTo");
- }
- catch (Exception e1) {
- // note that the utility class will provide the trace for the
- // exception so we won't have to
- // so just consume the exception for now
- }
-
- try {
- // EndpointReference from
- ObjectStateUtils.writeObject(out, from, logCorrelationIDString + ".from");
- }
- catch (Exception e2) {
- // note that the utility class will provide the trace for the
- // exception so we won't have to
- // so just consume the exception for now
- }
-
- try {
- // EndpointReference replyTo
- ObjectStateUtils.writeObject(out, replyTo, logCorrelationIDString + ".replyTo");
- }
- catch (Exception e3) {
- // note that the utility class will provide the trace for the
- // exception so we won't have to
- // so just consume the exception for now
- }
-
- try {
- // EndpointReference to
- ObjectStateUtils.writeObject(out, to, logCorrelationIDString + ".to");
- }
- catch (Exception e4) {
- // note that the utility class will provide the trace for the
- // exception so we won't have to
- // so just consume the exception for now
- }
+
+ // Write out the EndpointReference values
+ out.writeObject(faultTo);
+ out.writeObject(from);
+ out.writeObject(replyTo);
+ out.writeObject(to);
+
// TransportListener listener
+ metaListener = null;
if (listener != null) {
metaListener = new MetaDataEntry(listener.getClass().getName(), null);
- } else {
- metaListener = null;
}
- ObjectStateUtils.writeObject(out, metaListener, logCorrelationIDString + ".listener");
+ out.writeObject(metaListener);
// TransportInDescription transportIn
+ metaTransportIn = null;
if (transportIn != null) {
metaTransportIn = new MetaDataEntry(null, transportIn.getName().toString());
- } else {
- metaTransportIn = null;
- }
- ObjectStateUtils.writeObject(out, metaTransportIn, logCorrelationIDString + ".transportIn");
+ }
+ out.writeObject(metaTransportIn);
// TransportOutDescription transportOut
+ metaTransportOut = null;
if (transportOut != null) {
metaTransportOut = new MetaDataEntry(null, transportOut.getName().toString());
- } else {
- metaTransportOut = null;
}
- ObjectStateUtils
- .writeObject(out, metaTransportOut, logCorrelationIDString + ".transportOut");
+ out.writeObject(metaTransportOut);
//---------------------------------------------------------
// collections and lists
//---------------------------------------------------------
-
+
// List relationships, which is an array of RelatesTo objects
- ArrayList tmp = null;
-
- if (relationships != null) {
- // make sure this is an array list
- tmp = new ArrayList(relationships);
- }
-
- ObjectStateUtils.writeArrayList(out, tmp, logCorrelationIDString + ".relationships");
+ out.writeList(relationships);
+
// ArrayList referenceParameters
- ObjectStateUtils.writeArrayList(out, referenceParameters,
- logCorrelationIDString + ".referenceParameters");
+ out.writeList(referenceParameters);
//---------------------------------------------------------
// properties
//---------------------------------------------------------
// HashMap properties
- HashMap tmpHM = new HashMap(getProperties());
-
- ObjectStateUtils.writeHashMap(out, tmpHM, logCorrelationIDString + ".properties");
+ out.writeMap(properties);
//---------------------------------------------------------
// "nested"
//---------------------------------------------------------
-
- try {
- // Options parent
- ObjectStateUtils.writeObject(out, parent, logCorrelationIDString + ".parent");
- }
- catch (Exception e5) {
- // note that the utility class will provide the trace for the
- // exception so we won't have to
- // so just consume the exception for now
- }
-
+ out.writeUTF("parent");
+ out.writeObject(parent);
}
@@ -1212,7 +1153,8 @@
* @throws IOException
* @throws ClassNotFoundException
*/
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ public void readExternal(ObjectInput inObject) throws IOException, ClassNotFoundException {
+ SafeObjectInputStream in = SafeObjectInputStream.install(inObject);
// serialization version ID
long suid = in.readLong();
@@ -1221,12 +1163,12 @@
// make sure the object data is in a version we can handle
if (suid != serialVersionUID) {
- throw new ClassNotFoundException(ObjectStateUtils.UNSUPPORTED_SUID);
+ throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_SUID);
}
// make sure the object data is in a revision level we can handle
- if (revID != REVISION_1) {
- throw new ClassNotFoundException(ObjectStateUtils.UNSUPPORTED_REVID);
+ if (revID != REVISION_2) {
+ throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_REVID);
}
//---------------------------------------------------------
@@ -1236,120 +1178,89 @@
manageSession = in.readBoolean();
- // the following objects could be null
- Object tmp1 = ObjectStateUtils.readObject(in, "Options.isExceptionToBeThrownOnSOAPFault");
- if (tmp1 != null) {
- isExceptionToBeThrownOnSOAPFault = (Boolean) tmp1;
- }
-
- Object tmp2 = ObjectStateUtils.readObject(in, "Options.useSeparateListener");
- if (tmp2 != null) {
- useSeparateListener = (Boolean) tmp2;
- }
+ isExceptionToBeThrownOnSOAPFault = (Boolean) in.readObject();
+ useSeparateListener = (Boolean) in.readObject();
//---------------------------------------------------------
// various strings
//---------------------------------------------------------
// String soapVersionURI
- soapVersionURI = ObjectStateUtils.readString(in, "Options.soapVersionURI");
+ soapVersionURI = (String) in.readObject();
// String action
- action = ObjectStateUtils.readString(in, "Options.action");
+ action = (String) in.readObject();
// String transportInProtocol
- transportInProtocol = ObjectStateUtils.readString(in, "Options.transportInProtocol");
+ transportInProtocol = (String) in.readObject();
// String messageId
- messageId = ObjectStateUtils.readString(in, "Options.messageId");
+ messageId = (String) in.readObject();
// String object id
- logCorrelationIDString = ObjectStateUtils.readString(in, "Options.logCorrelationIDString");
+ logCorrelationIDString = (String) in.readObject();
// trace point
- log.trace(myClassName + ":readExternal(): reading the input stream for [" +
- logCorrelationIDString + "]");
+ if (log.isTraceEnabled()) {
+ log.trace(myClassName + ":readExternal(): reading the input stream for [" +
+ logCorrelationIDString + "]");
+ }
//---------------------------------------------------------
// various objects
//---------------------------------------------------------
// EndpointReference faultTo
- faultTo = (EndpointReference) ObjectStateUtils.readObject(in, "Options.faultTo");
+ faultTo = (EndpointReference) in.readObject();
// EndpointReference from
- from = (EndpointReference) ObjectStateUtils.readObject(in, "Options.from");
+ from = (EndpointReference) in.readObject();
// EndpointReference replyTo
- replyTo = (EndpointReference) ObjectStateUtils.readObject(in, "Options.replyTo");
+ replyTo = (EndpointReference) in.readObject();
// EndpointReference to
- to = (EndpointReference) ObjectStateUtils.readObject(in, "Options.to");
+ to = (EndpointReference) in.readObject();
// TransportListener listener
// is not usable until the meta data has been reconciled
listener = null;
- metaListener = (MetaDataEntry) ObjectStateUtils.readObject(in, "Options.metaListener");
+ metaListener = (MetaDataEntry) in.readObject();
// TransportInDescription transportIn
// is not usable until the meta data has been reconciled
transportIn = null;
- metaTransportIn =
- (MetaDataEntry) ObjectStateUtils.readObject(in, "Options.metaTransportIn");
+ metaTransportIn = (MetaDataEntry) in.readObject();
// TransportOutDescription transportOut
// is not usable until the meta data has been reconciled
transportOut = null;
- metaTransportOut =
- (MetaDataEntry) ObjectStateUtils.readObject(in, "Options.metaTransportOut");
+ metaTransportOut = (MetaDataEntry) in.readObject();
//---------------------------------------------------------
// collections and lists
//---------------------------------------------------------
// List relationships, which is an array of RelatesTo objects
- ArrayList tmpAL1 = ObjectStateUtils.readArrayList(in, "Options.relationships");
- if (tmpAL1 != null) {
- relationships = new ArrayList(tmpAL1);
- } else {
- relationships = null;
- }
+ relationships = in.readArrayList();
// ArrayList referenceParameters
- ArrayList tmpAL2 = ObjectStateUtils.readArrayList(in, "Options.referenceParameters");
- if (tmpAL2 != null) {
- referenceParameters = new ArrayList(tmpAL2);
- } else {
- referenceParameters = null;
- }
+ referenceParameters = in.readArrayList();
//---------------------------------------------------------
// properties
//---------------------------------------------------------
// HashMap properties
- HashMap tmpHM = ObjectStateUtils.readHashMap(in, "Options.properties");
-
- if (tmpHM != null) {
- properties = new HashMap(tmpHM);
- } else {
- properties = new HashMap();
- }
+ properties = in.readHashMap();
//---------------------------------------------------------
// "nested"
//---------------------------------------------------------
// Options parent
- Object tmpParent = ObjectStateUtils.readObject(in, "Options.parent");
-
- if (tmpParent != null) {
- parent = (Options) tmpParent;
- } else {
- parent = null;
- }
-
-
+ in.readUTF(); // read marker
+ parent = (Options) in.readObject();
}
/**
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java?rev=577367&r1=577366&r2=577367&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java Wed Sep 19 09:56:47 2007
@@ -30,6 +30,12 @@
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.addressing.RelatesTo;
import org.apache.axis2.client.Options;
+import org.apache.axis2.context.externalize.ActivateUtils;
+import org.apache.axis2.context.externalize.ExternalizeConstants;
+import org.apache.axis2.context.externalize.MessageExternalizeUtils;
+import org.apache.axis2.context.externalize.SafeObjectInputStream;
+import org.apache.axis2.context.externalize.SafeObjectOutputStream;
+import org.apache.axis2.context.externalize.SafeSerializable;
import org.apache.axis2.description.AxisMessage;
import org.apache.axis2.description.AxisModule;
import org.apache.axis2.description.AxisOperation;
@@ -46,9 +52,7 @@
import org.apache.axis2.engine.Phase;
import org.apache.axis2.util.JavaUtils;
import org.apache.axis2.util.LoggingControl;
-import org.apache.axis2.util.MessageExternalizeUtils;
import org.apache.axis2.util.MetaDataEntry;
-import org.apache.axis2.util.ObjectStateUtils;
import org.apache.axis2.util.SelfManagedDataHolder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -90,7 +94,8 @@
* options). You may set them at any level of context hierarchy and they will
* affect invocations related to their child elements. </p>
*/
-public class MessageContext extends AbstractContext implements Externalizable {
+public class MessageContext extends AbstractContext
+ implements Externalizable, SafeSerializable {
/*
* setup for logging
@@ -131,9 +136,9 @@
* Refer to the writeExternal() and readExternal() methods.
*/
// supported revision levels, add a new level to manage compatible changes
- private static final int REVISION_1 = 1;
+ private static final int REVISION_2 = 2;
// current revision level of this object
- private static final int revisionID = REVISION_1;
+ private static final int revisionID = REVISION_2;
/**
@@ -1829,7 +1834,7 @@
|| (executionChain == null)
|| (selfManagedDataMap.size() == 0)
|| (executionChain.size() == 0)) {
- out.writeBoolean(ObjectStateUtils.EMPTY_OBJECT);
+ out.writeBoolean(ExternalizeConstants.EMPTY_OBJECT);
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
log.trace(getLogIDString() + ":serializeSelfManagedData(): No data : END");
@@ -1845,7 +1850,7 @@
ArrayList selfManagedDataHolderList = serializeSelfManagedDataHelper(flatExecChain);
if (selfManagedDataHolderList.size() == 0) {
- out.writeBoolean(ObjectStateUtils.EMPTY_OBJECT);
+ out.writeBoolean(ExternalizeConstants.EMPTY_OBJECT);
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
log.trace(getLogIDString() + ":serializeSelfManagedData(): No data : END");
@@ -1854,7 +1859,7 @@
return;
}
- out.writeBoolean(ObjectStateUtils.ACTIVE_OBJECT);
+ out.writeBoolean(ExternalizeConstants.ACTIVE_OBJECT);
// SelfManagedData can be binary so won't be able to treat it as a
// string - need to treat it as a byte []
@@ -2069,7 +2074,8 @@
* @param out The stream to write the object contents to
* @throws IOException
*/
- public void writeExternal(ObjectOutput out) throws IOException {
+ public void writeExternal(ObjectOutput o) throws IOException {
+ SafeObjectOutputStream out = SafeObjectOutputStream.install(o);
String logCorrelationIDString = getLogIDString();
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
@@ -2107,8 +2113,7 @@
out.writeBoolean(serverSide);
out.writeLong(getLastTouchedTime());
-
- ObjectStateUtils.writeString(out, this.getLogCorrelationID(), "logCorrelationID");
+ out.writeObject(getLogCorrelationID());
//-----------------------------------------------------------------------
// Create and initialize the OMOutputFormat for Message Externalization
@@ -2164,21 +2169,13 @@
// UTF - description string
// boolean - empty flag
//---------------------------------------------------------
- String execChainDesc = logCorrelationIDString + ".executionChain";
-
- int listSize = 0;
-
- if (executionChain != null) {
- listSize = executionChain.size();
- }
-
- if (listSize > 0) {
+ out.writeUTF("executionChain");
+ if (executionChain != null && executionChain.size() > 0) {
// start writing data to the output stream
- out.writeUTF(execChainDesc);
- out.writeBoolean(ObjectStateUtils.ACTIVE_OBJECT);
+ out.writeBoolean(ExternalizeConstants.ACTIVE_OBJECT);
out.writeInt(currentHandlerIndex);
out.writeInt(currentPhaseIndex);
- out.writeInt(listSize);
+ out.writeInt(executionChain.size());
// put the metadata on each member of the list into a buffer
@@ -2221,9 +2218,7 @@
objClass + "] qname [" + qnameAsString + "]");
}
- ObjectStateUtils.writeObject(out, mdEntry, logCorrelationIDString +
- ".executionChain:entry class [" + objClass + "] qname [" + qnameAsString +
- "]");
+ out.writeObject(mdEntry);
// update the index so that the index
// now indicates the next entry that
@@ -2243,8 +2238,7 @@
MetaDataEntry lastEntry = new MetaDataEntry();
lastEntry.setClassName(MetaDataEntry.END_OF_LIST);
- ObjectStateUtils.writeObject(out, lastEntry,
- logCorrelationIDString + ".executionChain: last entry ");
+ out.writeObject(lastEntry);
nextIndex++;
// nextIndex also gives us the number of entries
@@ -2254,9 +2248,7 @@
} else {
// general case: handle "null" or "empty"
-
- out.writeUTF(execChainDesc);
- out.writeBoolean(ObjectStateUtils.EMPTY_OBJECT);
+ out.writeBoolean(ExternalizeConstants.EMPTY_OBJECT);
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
log.trace(logCorrelationIDString + ":writeExternal(): executionChain is NULL");
@@ -2286,19 +2278,12 @@
// UTF - description string
// boolean - empty flag
//---------------------------------------------------------
- String execListDesc = logCorrelationIDString + ".executedPhases";
-
- int execListSize = 0;
-
- if (executedPhases != null) {
- execListSize = executedPhases.size();
- }
-
- if (execListSize > 0) {
+ out.writeUTF("executedPhases");
+ if (executedPhases != null && executedPhases.size() > 0) {
+
// start writing data to the output stream
- out.writeUTF(execListDesc);
- out.writeBoolean(ObjectStateUtils.ACTIVE_OBJECT);
- out.writeInt(execListSize);
+ out.writeBoolean(ExternalizeConstants.ACTIVE_OBJECT);
+ out.writeInt(executedPhases.size());
// put the metadata on each member of the list into a buffer
@@ -2338,9 +2323,7 @@
objClass + "] qname [" + qnameAsString + "]");
}
- ObjectStateUtils.writeObject(out, mdEntry, logCorrelationIDString +
- ".executedPhases:entry class [" + objClass + "] qname [" +
- qnameAsString + "]");
+ out.writeObject(mdEntry);
// update the index so that the index
// now indicates the next entry that
@@ -2360,8 +2343,7 @@
MetaDataEntry lastEntry = new MetaDataEntry();
lastEntry.setClassName(MetaDataEntry.END_OF_LIST);
- ObjectStateUtils.writeObject(out, lastEntry, logCorrelationIDString +
- ".executedPhases: last entry ");
+ out.writeObject(lastEntry);
execNextIndex++;
// execNextIndex also gives us the number of entries
@@ -2371,9 +2353,7 @@
} else {
// general case: handle "null" or "empty"
-
- out.writeUTF(execListDesc);
- out.writeBoolean(ObjectStateUtils.EMPTY_OBJECT);
+ out.writeBoolean(ExternalizeConstants.EMPTY_OBJECT);
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
log.trace(
@@ -2396,38 +2376,31 @@
log.trace(logCorrelationIDString + ":writeExternal(): message ID [" + tmpID + "]");
}
- ObjectStateUtils.writeObject(out, options, logCorrelationIDString + ".options for [" +
- options.getLogCorrelationIDString() + "]");
-
+ out.writeUTF("options");
+ out.writeObject(options);
+
//---------------------------------------------------------
// operation
//---------------------------------------------------------
// axis operation
//---------------------------------------------------------
- String axisOpMarker = logCorrelationIDString + ".axisOperation";
- ObjectStateUtils.writeString(out, axisOpMarker, axisOpMarker);
-
- if (axisOperation == null) {
- out.writeBoolean(ObjectStateUtils.EMPTY_OBJECT);
- } else {
+ out.writeUTF("axisOperation");
+ metaAxisOperation = null;
+ if (axisOperation != null) {
// TODO: may need to include the meta data for the axis service that is
// the parent of the axis operation
-
- out.writeBoolean(ObjectStateUtils.ACTIVE_OBJECT);
-
// make sure the axis operation has a name associated with it
QName aoTmpQName = axisOperation.getName();
if (aoTmpQName == null) {
- aoTmpQName = new QName(ObjectStateUtils.EMPTY_MARKER);
+ aoTmpQName = new QName(ExternalizeConstants.EMPTY_MARKER);
axisOperation.setName(aoTmpQName);
}
metaAxisOperation = new MetaDataEntry(axisOperation.getClass().getName(),
axisOperation.getName().toString());
- ObjectStateUtils.writeObject(out, metaAxisOperation,
- logCorrelationIDString + ".metaAxisOperation");
}
+ out.writeObject(metaAxisOperation);
//---------------------------------------------------------
// operation context
@@ -2436,14 +2409,13 @@
// In order to avoid having multiple copies of the object graph
// being saved at different points in the serialization,
// it is important to isolate this message context object.
- String oc_desc = logCorrelationIDString + ".operationContext";
+ out.writeUTF("operationContext");
if (operationContext != null) {
operationContext.isolateMessageContext(this);
- oc_desc = oc_desc + " for [" + operationContext.getLogCorrelationIDString() + "]";
}
- // NOTE: expect this to be the parent of the message context
- ObjectStateUtils.writeObject(out, operationContext, oc_desc);
+ out.writeObject(operationContext);
+
//---------------------------------------------------------
// service
@@ -2451,30 +2423,25 @@
// axis service
//-------------------------
// this is expected to be the parent of the axis operation object
- String axisServMarker = logCorrelationIDString + ".axisService";
- ObjectStateUtils.writeString(out, axisServMarker, axisServMarker);
-
- if (axisService == null) {
- out.writeBoolean(ObjectStateUtils.EMPTY_OBJECT);
- } else {
- out.writeBoolean(ObjectStateUtils.ACTIVE_OBJECT);
- metaAxisService =
- new MetaDataEntry(axisService.getClass().getName(), axisService.getName());
- ObjectStateUtils
- .writeObject(out, metaAxisService, logCorrelationIDString + ".metaAxisService");
+ out.writeUTF("axisService");
+ metaAxisService = null;
+ if (axisService != null) {
+ metaAxisService = new MetaDataEntry(axisService.getClass().getName(),
+ axisService.getName());
}
+ out.writeObject(metaAxisService);
//-------------------------
// serviceContextID string
//-------------------------
- ObjectStateUtils
- .writeString(out, serviceContextID, logCorrelationIDString + ".serviceContextID");
+ out.writeObject(serviceContextID);
//-------------------------
// serviceContext
//-------------------------
// is this the same as the parent of the OperationContext?
boolean isParent = false;
+ out.writeUTF("serviceContext");
if (operationContext != null) {
ServiceContext opctxParent = operationContext.getServiceContext();
@@ -2487,51 +2454,40 @@
}
}
- String servCtxMarker = logCorrelationIDString + ".serviceContext";
- ObjectStateUtils.writeString(out, servCtxMarker, servCtxMarker);
-
if (serviceContext == null) {
- out.writeBoolean(ObjectStateUtils.EMPTY_OBJECT);
+ out.writeBoolean(ExternalizeConstants.EMPTY_OBJECT);
} else {
- out.writeBoolean(ObjectStateUtils.ACTIVE_OBJECT);
+ out.writeBoolean(ExternalizeConstants.ACTIVE_OBJECT);
out.writeBoolean(isParent);
// only write out the object if it is not the parent
if (!isParent) {
- ObjectStateUtils.writeObject(out, serviceContext,
- logCorrelationIDString + ".serviceContext");
+ out.writeObject(serviceContext);
}
}
//---------------------------------------------------------
// axisServiceGroup
//---------------------------------------------------------
-
- String axisServGrpMarker = logCorrelationIDString + ".axisServiceGroup";
- ObjectStateUtils.writeString(out, axisServGrpMarker, axisServGrpMarker);
-
- if (axisServiceGroup == null) {
- out.writeBoolean(ObjectStateUtils.EMPTY_OBJECT);
- } else {
- out.writeBoolean(ObjectStateUtils.ACTIVE_OBJECT);
+ out.writeUTF("axisServiceGroup");
+ metaAxisServiceGroup = null;
+ if (axisServiceGroup != null) {
metaAxisServiceGroup = new MetaDataEntry(axisServiceGroup.getClass().getName(),
axisServiceGroup.getServiceGroupName());
- ObjectStateUtils.writeObject(out, metaAxisServiceGroup,
- logCorrelationIDString + ".metaAxisServiceGroup");
}
+ out.writeObject(metaAxisServiceGroup);
//-----------------------------
// serviceGroupContextId string
//-----------------------------
- ObjectStateUtils.writeString(out, serviceGroupContextId,
- logCorrelationIDString + ".serviceGroupContextId");
+ out.writeObject(serviceGroupContextId);
//-------------------------
// serviceGroupContext
//-------------------------
-
// is this the same as the parent of the ServiceContext?
isParent = false;
+ out.writeUTF("serviceGroupContext");
if (serviceContext != null) {
ServiceGroupContext srvgrpctxParent = (ServiceGroupContext) serviceContext.getParent();
@@ -2544,44 +2500,35 @@
}
}
- String servGrpCtxMarker = logCorrelationIDString + ".serviceGroupContext";
- ObjectStateUtils.writeString(out, servGrpCtxMarker, servGrpCtxMarker);
-
if (serviceGroupContext == null) {
- out.writeBoolean(ObjectStateUtils.EMPTY_OBJECT);
+ out.writeBoolean(ExternalizeConstants.EMPTY_OBJECT);
} else {
- out.writeBoolean(ObjectStateUtils.ACTIVE_OBJECT);
+ out.writeBoolean(ExternalizeConstants.ACTIVE_OBJECT);
out.writeBoolean(isParent);
// only write out the object if it is not the parent
if (!isParent) {
- ObjectStateUtils.writeObject(out, serviceGroupContext,
- logCorrelationIDString + ".serviceGroupContext");
+ out.writeObject(serviceGroupContext);
}
}
//---------------------------------------------------------
// axis message
//---------------------------------------------------------
- String axisMsgMarker = logCorrelationIDString + ".axisMessage";
- ObjectStateUtils.writeString(out, axisMsgMarker, axisMsgMarker);
-
- if (axisMessage == null) {
- out.writeBoolean(ObjectStateUtils.EMPTY_OBJECT);
- } else {
+ out.writeUTF("axisMessage");
+ metaAxisMessage = null;
+ if (axisMessage != null) {
// This AxisMessage is expected to belong to the AxisOperation
// that has already been recorded for this MessageContext.
// If an AxisMessage associated with this Messagecontext is
// associated with a different AxisOperation, then more
// meta information would need to be saved
- out.writeBoolean(ObjectStateUtils.ACTIVE_OBJECT);
-
// make sure the axis message has a name associated with it
String amTmpName = axisMessage.getName();
if (amTmpName == null) {
- amTmpName = ObjectStateUtils.EMPTY_MARKER;
+ amTmpName = ExternalizeConstants.EMPTY_MARKER;
axisMessage.setName(amTmpName);
}
@@ -2596,9 +2543,8 @@
metaAxisMessage = new MetaDataEntry(axisMessage.getClass().getName(),
axisMessage.getName(), amTmpElemQNameString);
- ObjectStateUtils
- .writeObject(out, metaAxisMessage, logCorrelationIDString + ".metaAxisMessage");
}
+ out.writeObject(metaAxisMessage);
//---------------------------------------------------------
// configuration context
@@ -2614,8 +2560,7 @@
//---------------------------------------------------------
// session context
//---------------------------------------------------------
- ObjectStateUtils
- .writeObject(out, sessionContext, logCorrelationIDString + ".sessionContext");
+ out.writeObject(sessionContext);
//---------------------------------------------------------
// transport
@@ -2624,48 +2569,35 @@
//------------------------------
// incomingTransportName string
//------------------------------
- ObjectStateUtils.writeString(out, incomingTransportName,
- logCorrelationIDString + ".incomingTransportName");
+ out.writeObject(incomingTransportName);
// TransportInDescription transportIn
+ metaTransportIn = null;
if (transportIn != null) {
metaTransportIn = new MetaDataEntry(null, transportIn.getName());
- } else {
- metaTransportIn = null;
- }
- ObjectStateUtils.writeObject(out, metaTransportIn, logCorrelationIDString + ".transportIn");
+ }
+ out.writeObject(metaTransportIn);
// TransportOutDescription transportOut
+ metaTransportOut = null;
if (transportOut != null) {
metaTransportOut = new MetaDataEntry(null, transportOut.getName());
- } else {
- metaTransportOut = null;
}
- ObjectStateUtils
- .writeObject(out, metaTransportOut, logCorrelationIDString + ".transportOut");
+ out.writeObject(metaTransportOut);
+
//---------------------------------------------------------
// properties
//---------------------------------------------------------
- Map tmpMap = properties;
-
- HashMap tmpHashMap = null;
-
- if ((tmpMap != null) && (!tmpMap.isEmpty())) {
- tmpHashMap = new HashMap(tmpMap);
- }
-
- ObjectStateUtils.writeHashMap(out, tmpHashMap, logCorrelationIDString + ".properties");
+ // Write out the local properties on the MessageContext
+ // Don't write out the properties from other hierarchical layers.
+ out.writeUTF("properties"); // write marker
+ out.writeMap(properties);
//---------------------------------------------------------
// special data
//---------------------------------------------------------
-
- String selfManagedDataMarker = logCorrelationIDString + ".selfManagedData";
- ObjectStateUtils.writeString(out, selfManagedDataMarker, selfManagedDataMarker);
-
- // save the data, which the handlers themselves will serialize
- //ByteArrayOutputStream baos_fromSelfManagedData = serializeSelfManagedData();
+ out.writeUTF("selfManagedData");
serializeSelfManagedData(out);
//---------------------------------------------------------
@@ -2688,7 +2620,7 @@
if (attachments != null && attachments.getContentIDList().size() > 1) {
persistOptimized = true;
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled())
- log.trace(logCorrelationIDString
+ log.trace(getLogIDString()
+ ":getPersistOptimized(): attachments present; persist optimized");
}
if (!persistOptimized) {
@@ -2696,7 +2628,7 @@
if (property != null && JavaUtils.isTrueExplicitly(property)) {
persistOptimized = true;
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled())
- log.trace(logCorrelationIDString
+ log.trace(getLogIDString()
+ ":getPersistOptimized(): ENBABLE_MTOM is set; persist optimized");
}
}
@@ -2705,12 +2637,12 @@
if (property != null && JavaUtils.isTrueExplicitly(property)) {
persistOptimized = true;
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled())
- log.trace(logCorrelationIDString
+ log.trace(getLogIDString()
+ ":getPersistOptimized(): ENBABLE_SWA is set; persist optimized");
}
}
if (!persistOptimized && LoggingControl.debugLoggingAllowed && log.isTraceEnabled())
- log.trace(logCorrelationIDString
+ log.trace(getLogIDString()
+ ":getPersistOptimized(): No attachments or attachment settings; persist non-optimized");
return persistOptimized;
}
@@ -2728,7 +2660,8 @@
* @throws IOException
* @throws ClassNotFoundException
*/
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ public void readExternal(ObjectInput inObject) throws IOException, ClassNotFoundException {
+ SafeObjectInputStream in = SafeObjectInputStream.install(inObject);
// set the flag to indicate that the message context is being
// reconstituted and will need to have certain object references
// to be reconciled with the current engine setup
@@ -2752,12 +2685,12 @@
// make sure the object data is in a version we can handle
if (suid != serialVersionUID) {
- throw new ClassNotFoundException(ObjectStateUtils.UNSUPPORTED_SUID);
+ throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_SUID);
}
// make sure the object data is in a revision level we can handle
- if (revID != REVISION_1) {
- throw new ClassNotFoundException(ObjectStateUtils.UNSUPPORTED_REVID);
+ if (revID != REVISION_2) {
+ throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_REVID);
}
//---------------------------------------------------------
@@ -2781,21 +2714,20 @@
long time = in.readLong();
setLastTouchedTime(time);
-
- logCorrelationID = ObjectStateUtils.readString(in, "logCorrelationID");
- logCorrelationIDString = "[MessageContext: logID=" + logCorrelationID + "]";
+ logCorrelationID = (String) in.readObject();
// trace point
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
+ logCorrelationIDString = "[MessageContext: logID=" + getLogCorrelationID() + "]";
log.trace(myClassName + ":readExternal(): reading the input stream for " +
- logCorrelationIDString);
+ getLogIDString());
}
//---------------------------------------------------------
// Message
// Read the message and attachments
//---------------------------------------------------------
- envelope = MessageExternalizeUtils.readExternal(in, this, logCorrelationIDString);
+ envelope = MessageExternalizeUtils.readExternal(in, this, getLogIDString());
//---------------------------------------------------------
// ArrayList executionChain
@@ -2834,14 +2766,14 @@
in.readUTF();
boolean gotChain = in.readBoolean();
- if (gotChain == ObjectStateUtils.ACTIVE_OBJECT) {
+ if (gotChain == ExternalizeConstants.ACTIVE_OBJECT) {
metaHandlerIndex = in.readInt();
metaPhaseIndex = in.readInt();
int expectedNumberEntries = in.readInt();
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
- log.trace(logCorrelationIDString +
+ log.trace(getLogIDString() +
":readExternal(): execution chain: expected number of entries [" +
expectedNumberEntries + "]");
}
@@ -2857,8 +2789,7 @@
// stop when we get to the end-of-list marker
// get the object
- Object tmpObj = ObjectStateUtils
- .readObject(in, "MessageContext.metaExecutionChain MetaDataEntry");
+ Object tmpObj = in.readObject();
count++;
@@ -2883,10 +2814,12 @@
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
String tmpHasList = mdObj.isListEmpty() ? "no children" : "has children";
- log.trace(logCorrelationIDString +
+ if (log.isTraceEnabled()) {
+ log.trace(getLogIDString() +
":readExternal(): meta data class [" + tmpClassNameStr +
"] qname [" + tmpQNameAsStr + "] index [" + count + "] [" +
tmpHasList + "]");
+ }
}
}
} else {
@@ -2899,7 +2832,7 @@
int adjustedNumberEntries = in.readInt();
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
- log.trace(logCorrelationIDString +
+ log.trace(getLogIDString() +
":readExternal(): adjusted number of entries ExecutionChain [" +
adjustedNumberEntries + "] ");
}
@@ -2907,7 +2840,7 @@
if ((metaExecutionChain == null) || (metaExecutionChain.isEmpty())) {
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
- log.trace(logCorrelationIDString +
+ log.trace(getLogIDString() +
":readExternal(): meta data for Execution Chain is NULL");
}
}
@@ -2944,11 +2877,11 @@
in.readUTF();
boolean gotInExecList = in.readBoolean();
- if (gotInExecList == ObjectStateUtils.ACTIVE_OBJECT) {
+ if (gotInExecList == ExternalizeConstants.ACTIVE_OBJECT) {
int expectedNumberInExecList = in.readInt();
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
- log.trace(logCorrelationIDString +
+ log.trace(getLogIDString() +
":readExternal(): executed phases: expected number of entries [" +
expectedNumberInExecList + "]");
}
@@ -2964,8 +2897,7 @@
// stop when we get to the end-of-list marker
// get the object
- Object tmpObj = ObjectStateUtils
- .readObject(in, "MessageContext.metaExecuted MetaDataEntry");
+ Object tmpObj = in.readObject();
count++;
@@ -2993,7 +2925,7 @@
}
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
- log.trace(logCorrelationIDString +
+ log.trace(getLogIDString() +
":readExternal(): meta data class [" + tmpClassNameStr +
"] qname [" + tmpQNameAsStr + "] index [" + count + "] [" +
tmpHasList + "]");
@@ -3009,7 +2941,7 @@
int adjustedNumberInExecList = in.readInt();
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
- log.trace(logCorrelationIDString +
+ log.trace(getLogIDString() +
":readExternal(): adjusted number of entries executedPhases [" +
adjustedNumberInExecList + "] ");
}
@@ -3017,7 +2949,7 @@
if ((metaExecuted == null) || (metaExecuted.isEmpty())) {
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
- log.trace(logCorrelationIDString +
+ log.trace(getLogIDString() +
":readExternal(): meta data for executedPhases list is NULL");
}
}
@@ -3025,12 +2957,12 @@
//---------------------------------------------------------
// options
//---------------------------------------------------------
-
- options = (Options) ObjectStateUtils.readObject(in, "MessageContext.options");
+ in.readUTF(); // Read marker
+ options = (Options) in.readObject();
if (options != null) {
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
- log.trace(logCorrelationIDString + ":readExternal(): restored Options [" +
+ log.trace(getLogIDString() + ":readExternal(): restored Options [" +
options.getLogCorrelationIDString() + "]");
}
}
@@ -3041,26 +2973,17 @@
// axisOperation is not usable until the meta data has been reconciled
axisOperation = null;
-
- ObjectStateUtils.readString(in, "MessageContext.axisOperation");
-
- boolean metaAxisOperationIsActive = in.readBoolean();
-
- if (metaAxisOperationIsActive == ObjectStateUtils.ACTIVE_OBJECT) {
- metaAxisOperation = (MetaDataEntry) ObjectStateUtils
- .readObject(in, "MessageContext.metaAxisOperation");
- } else {
- metaAxisOperation = null;
- }
+ in.readUTF(); // Read Marker
+ metaAxisOperation = (MetaDataEntry) in.readObject();
// operation context is not usable until it has been activated
// NOTE: expect this to be the parent
- operationContext = (OperationContext) ObjectStateUtils
- .readObject(in, "MessageContext.operationContext");
+ in.readUTF(); // Read marker
+ operationContext = (OperationContext) in.readObject();
if (operationContext != null) {
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
- log.trace(logCorrelationIDString + ":readExternal(): restored OperationContext [" +
+ log.trace(getLogIDString() + ":readExternal(): restored OperationContext [" +
operationContext.getLogCorrelationIDString() + "]");
}
}
@@ -3071,33 +2994,22 @@
// axisService is not usable until the meta data has been reconciled
axisService = null;
-
- ObjectStateUtils.readString(in, "MessageContext.axisService");
-
- boolean metaAxisServiceIsActive = in.readBoolean();
-
- if (metaAxisServiceIsActive == ObjectStateUtils.ACTIVE_OBJECT) {
- metaAxisService = (MetaDataEntry) ObjectStateUtils
- .readObject(in, "MessageContext.metaAxisService");
- } else {
- metaAxisService = null;
- }
+ in.readUTF(); // Read marker
+ metaAxisService = (MetaDataEntry) in.readObject();
//-------------------------
// serviceContextID string
//-------------------------
-
- serviceContextID = ObjectStateUtils.readString(in, "MessageContext.serviceContextID");
-
+ serviceContextID = (String) in.readObject();
+
//-------------------------
// serviceContext
//-------------------------
-
- ObjectStateUtils.readString(in, "MessageContext.serviceContext");
+ in.readUTF(); // Read marker
boolean servCtxActive = in.readBoolean();
- if (servCtxActive == ObjectStateUtils.EMPTY_OBJECT) {
+ if (servCtxActive == ExternalizeConstants.EMPTY_OBJECT) {
// empty object
serviceContext = null;
@@ -3108,8 +3020,7 @@
// there's an object to read in if it is not the parent of the operation context
if (!isParent) {
- serviceContext = (ServiceContext) ObjectStateUtils
- .readObject(in, "MessageContext.serviceContext");
+ serviceContext = (ServiceContext) in.readObject();
} else {
// the service context is the parent of the operation context
// so get it from the operation context during activate
@@ -3123,33 +3034,22 @@
// axisServiceGroup is not usable until the meta data has been reconciled
axisServiceGroup = null;
-
- ObjectStateUtils.readString(in, "MessageContext.axisServiceGroup");
-
- boolean metaAxisServiceGrpIsActive = in.readBoolean();
-
- if (metaAxisServiceGrpIsActive == ObjectStateUtils.ACTIVE_OBJECT) {
- metaAxisServiceGroup = (MetaDataEntry) ObjectStateUtils
- .readObject(in, "MessageContext.metaAxisServiceGroup");
- } else {
- metaAxisServiceGroup = null;
- }
+ in.readUTF(); // Read marker
+ metaAxisServiceGroup = (MetaDataEntry) in.readObject();
//-----------------------------
// serviceGroupContextId string
//-----------------------------
- serviceGroupContextId =
- ObjectStateUtils.readString(in, "MessageContext.serviceGroupContextId");
+ serviceGroupContextId = (String) in.readObject();
//-----------------------------
// serviceGroupContext
//-----------------------------
-
- ObjectStateUtils.readString(in, "MessageContext.serviceGroupContext");
+ in.readUTF();
boolean servGrpCtxActive = in.readBoolean();
- if (servGrpCtxActive == ObjectStateUtils.EMPTY_OBJECT) {
+ if (servGrpCtxActive == ExternalizeConstants.EMPTY_OBJECT) {
// empty object
serviceGroupContext = null;
@@ -3160,8 +3060,7 @@
// there's an object to read in if it is not the parent of the service group context
if (!isParentSGC) {
- serviceGroupContext = (ServiceGroupContext) ObjectStateUtils
- .readObject(in, "MessageContext.serviceGroupContext");
+ serviceGroupContext = (ServiceGroupContext) in.readObject();
} else {
// the service group context is the parent of the service context
// so get it from the service context during activate
@@ -3175,19 +3074,10 @@
// axisMessage is not usable until the meta data has been reconciled
axisMessage = null;
+ in.readUTF(); // Read marker
+ metaAxisMessage = (MetaDataEntry) in.readObject();
+ reconcileAxisMessage = (metaAxisMessage != null);
- ObjectStateUtils.readString(in, "MessageContext.axisMessage");
-
- boolean metaAxisMessageIsActive = in.readBoolean();
-
- if (metaAxisMessageIsActive == ObjectStateUtils.ACTIVE_OBJECT) {
- metaAxisMessage = (MetaDataEntry) ObjectStateUtils
- .readObject(in, "MessageContext.metaAxisMessage");
- reconcileAxisMessage = true;
- } else {
- metaAxisMessage = null;
- reconcileAxisMessage = false;
- }
//---------------------------------------------------------
// configuration context
@@ -3202,9 +3092,7 @@
//---------------------------------------------------------
// session context
//---------------------------------------------------------
-
- sessionContext =
- (SessionContext) ObjectStateUtils.readObject(in, "MessageContext.sessionContext");
+ sessionContext = (SessionContext) in.readObject();
//---------------------------------------------------------
// transport
@@ -3213,41 +3101,33 @@
//------------------------------
// incomingTransportName string
//------------------------------
- incomingTransportName =
- ObjectStateUtils.readString(in, "MessageContext.incomingTransportName");
+ incomingTransportName = (String) in.readObject();
// TransportInDescription transportIn
// is not usable until the meta data has been reconciled
transportIn = null;
- metaTransportIn =
- (MetaDataEntry) ObjectStateUtils.readObject(in, "MessageContext.metaTransportIn");
+ metaTransportIn = (MetaDataEntry) in.readObject();
// TransportOutDescription transportOut
// is not usable until the meta data has been reconciled
transportOut = null;
- metaTransportOut =
- (MetaDataEntry) ObjectStateUtils.readObject(in, "MessageContext.metaTransportOut");
+ metaTransportOut = (MetaDataEntry) in.readObject();
//---------------------------------------------------------
// properties
//---------------------------------------------------------
+ in.readUTF(); // Read marker
+ properties = in.readHashMap();
- HashMap tmpHashMap = ObjectStateUtils.readHashMap(in, "MessageContext.properties");
-
- properties = new HashMap();
- if (tmpHashMap != null) {
- setProperties(tmpHashMap);
- }
//---------------------------------------------------------
// special data
//---------------------------------------------------------
-
- ObjectStateUtils.readString(in, "MessageContext.selfManagedData");
+ in.readUTF(); // Read marker
boolean gotSelfManagedData = in.readBoolean();
- if (gotSelfManagedData == ObjectStateUtils.ACTIVE_OBJECT) {
+ if (gotSelfManagedData == ExternalizeConstants.ACTIVE_OBJECT) {
selfManagedDataHandlerCount = in.readInt();
if (selfManagedDataListHolder == null) {
@@ -3267,9 +3147,9 @@
// trace point
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
- log.trace(logCorrelationIDString +
+ log.trace(getLogIDString() +
":readExternal(): message context object created for " +
- logCorrelationIDString);
+ getLogIDString());
}
}
@@ -3300,16 +3180,17 @@
// We previously saved metaAxisService; restore it
if (metaAxisService != null) {
- this.setAxisService(ObjectStateUtils.findService(axisConfig,
- metaAxisService.getClassName(),
- metaAxisService.getQNameAsString()));
+ this.setAxisService(ActivateUtils.findService(axisConfig,
+ metaAxisService.getClassName(),
+ metaAxisService.getQNameAsString()));
}
// We previously saved metaAxisServiceGroup; restore it
if (metaAxisServiceGroup != null) {
- this.setAxisServiceGroup(ObjectStateUtils.findServiceGroup(axisConfig,
- metaAxisServiceGroup.getClassName(),
- metaAxisServiceGroup.getQNameAsString()));
+ this.setAxisServiceGroup(
+ ActivateUtils.findServiceGroup(axisConfig,
+ metaAxisServiceGroup.getClassName(),
+ metaAxisServiceGroup.getQNameAsString()));
}
// We previously saved metaAxisOperation; restore it
@@ -3318,13 +3199,13 @@
if (serv != null) {
// TODO: check for the empty name
- this.setAxisOperation(ObjectStateUtils.findOperation(serv,
- metaAxisOperation.getClassName(),
- metaAxisOperation.getQName()));
+ this.setAxisOperation(ActivateUtils.findOperation(serv,
+ metaAxisOperation.getClassName(),
+ metaAxisOperation.getQName()));
} else {
- this.setAxisOperation(ObjectStateUtils.findOperation(axisConfig,
- metaAxisOperation.getClassName(),
- metaAxisOperation.getQName()));
+ this.setAxisOperation(ActivateUtils.findOperation(axisConfig,
+ metaAxisOperation.getClassName(),
+ metaAxisOperation.getQName()));
}
}
@@ -3334,9 +3215,9 @@
if (op != null) {
// TODO: check for the empty name
- this.setAxisMessage(ObjectStateUtils.findMessage(op,
- metaAxisMessage.getQNameAsString(),
- metaAxisMessage.getExtraName()));
+ this.setAxisMessage(ActivateUtils.findMessage(op,
+ metaAxisMessage.getQNameAsString(),
+ metaAxisMessage.getExtraName()));
}
}
@@ -3616,9 +3497,9 @@
if (metaAxisMessage != null) {
if (axisOp != null) {
// TODO: check for the empty name
- this.setAxisMessage(ObjectStateUtils.findMessage(axisOp,
- metaAxisMessage.getQNameAsString(),
- metaAxisMessage.getExtraName()));
+ this.setAxisMessage(ActivateUtils.findMessage(axisOp,
+ metaAxisMessage.getQNameAsString(),
+ metaAxisMessage.getExtraName()));
}
}
@@ -3784,7 +3665,7 @@
ArrayList handlerListToReturn = new ArrayList();
for (int i = 0; i < metaDataEntries.size(); i++) {
- Handler handler = (Handler) ObjectStateUtils
+ Handler handler = (Handler) ActivateUtils
.findHandler(existingHandlers, (MetaDataEntry) metaDataEntries.get(i));
if (handler != null) {
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org