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 ch...@apache.org on 2005/03/10 03:59:29 UTC
svn commit: r156732 [1/2] - in
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM: lib/
src/java/org/apache/axis/impl/llom/
src/java/org/apache/axis/impl/llom/builder/
src/java/org/apache/axis/impl/llom/factory/
src/java/org/apache/axis/impl/llom/mtom/
src/java/org/apache/axis/impl/llom/serialize/
src/java/org/apache/axis/impl/llom/traverse/ src/java/org/apache/axis/om/
src/test-resources/ src/test/org/apache/axis/mtom/
Author: chinthaka
Date: Wed Mar 9 18:59:17 2005
New Revision: 156732
URL: http://svn.apache.org/viewcvs?view=rev&rev=156732
Log:
Applying Thilina's patch on MTOM implementation.
Added:
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/lib/junit.jar (with props)
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test/org/apache/axis/mtom/MTOMTest.java
Removed:
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test/org/apache/axis/mtom/MTOMFileTest.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test/org/apache/axis/mtom/MTOMOMSerializeTester.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test/org/apache/axis/mtom/MtomTesterWhitemesaFile1.java
Modified:
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMAttributeImpl.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMElementImpl.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNamedNodeImpl.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMStAXWrapper.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPBodyImpl.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPEnvelopeImpl.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPFaultImpl.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPHeaderBlockImpl.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPHeaderImpl.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/builder/StAXBuilder.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/builder/StAXOMBuilder.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/factory/OMLinkedListImplFactory.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/ByteArrayDataSource.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MIMEBodyPartInputStream.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MIMEInputStream.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MIMEParser.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MTOMBuilder.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MTOMXMLStreamWriter.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/OMBlob.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/serialize/SimpleOMSerializer.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/serialize/StreamingOMSerializer.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/serialize/XMLSerilazer.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/traverse/OMChildrenIterator.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/traverse/OMChildrenQNameIterator.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMElement.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPFault.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/StreamingWrapper.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test-resources/OMSerializeMTOMBaseOut.txt
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test-resources/OMSerializeMTOMOut.txt
Added: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/lib/junit.jar
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/lib/junit.jar?view=auto&rev=156732
==============================================================================
Binary file - no diff available.
Propchange: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/lib/junit.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMAttributeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMAttributeImpl.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMAttributeImpl.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMAttributeImpl.java Wed Mar 9 18:59:17 2005
@@ -1,11 +1,12 @@
package org.apache.axis.impl.llom;
-import org.apache.axis.om.OMAttribute;
-import org.apache.axis.om.OMNamespace;
-
-import javax.xml.namespace.QName;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.om.OMAttribute;
+import org.apache.axis.om.OMNamespace;
/**
* Copyright 2001-2004 The Apache Software Foundation.
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMElementImpl.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMElementImpl.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMElementImpl.java Wed Mar 9 18:59:17 2005
@@ -1,14 +1,22 @@
package org.apache.axis.impl.llom;
-import org.apache.axis.impl.llom.traverse.OMChildrenIterator;
-import org.apache.axis.impl.llom.traverse.OMChildrenQNameIterator;
-import org.apache.axis.om.*;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamReader;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.ListIterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axis.impl.llom.traverse.OMChildrenIterator;
+import org.apache.axis.impl.llom.traverse.OMChildrenQNameIterator;
+import org.apache.axis.om.OMAttribute;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMException;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMNode;
+import org.apache.axis.om.OMText;
+import org.apache.axis.om.OMXMLParserWrapper;
/**
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNamedNodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNamedNodeImpl.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNamedNodeImpl.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNamedNodeImpl.java Wed Mar 9 18:59:17 2005
@@ -1,11 +1,11 @@
package org.apache.axis.impl.llom;
+import javax.xml.namespace.QName;
+
import org.apache.axis.om.OMElement;
import org.apache.axis.om.OMException;
import org.apache.axis.om.OMNamedNode;
import org.apache.axis.om.OMNamespace;
-
-import javax.xml.namespace.QName;
/**
* Copyright 2001-2004 The Apache Software Foundation.
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMStAXWrapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMStAXWrapper.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMStAXWrapper.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMStAXWrapper.java Wed Mar 9 18:59:17 2005
@@ -1,7 +1,7 @@
package org.apache.axis.impl.llom;
-import org.apache.axis.impl.llom.exception.OMStreamingException;
-import org.apache.axis.om.*;
+import java.util.Iterator;
+import java.util.Stack;
import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
@@ -9,8 +9,15 @@
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
-import java.util.Iterator;
-import java.util.Stack;
+
+import org.apache.axis.impl.llom.exception.OMStreamingException;
+import org.apache.axis.om.OMAttribute;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMNamedNode;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMNode;
+import org.apache.axis.om.OMText;
+import org.apache.axis.om.OMXMLParserWrapper;
/**
* Copyright 2001-2004 The Apache Software Foundation.
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPBodyImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPBodyImpl.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPBodyImpl.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPBodyImpl.java Wed Mar 9 18:59:17 2005
@@ -1,9 +1,17 @@
package org.apache.axis.impl.llom;
-import org.apache.axis.om.*;
+import java.util.Iterator;
import javax.xml.namespace.QName;
-import java.util.Iterator;
+
+import org.apache.axis.om.OMConstants;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMException;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.SOAPBody;
+import org.apache.axis.om.SOAPEnvelope;
+import org.apache.axis.om.SOAPFault;
/**
* Copyright 2001-2004 The Apache Software Foundation.
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPEnvelopeImpl.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPEnvelopeImpl.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPEnvelopeImpl.java Wed Mar 9 18:59:17 2005
@@ -1,9 +1,17 @@
package org.apache.axis.impl.llom;
-import org.apache.axis.om.*;
+import java.util.Iterator;
import javax.xml.namespace.QName;
-import java.util.Iterator;
+
+import org.apache.axis.om.OMConstants;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMException;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.SOAPBody;
+import org.apache.axis.om.SOAPEnvelope;
+import org.apache.axis.om.SOAPHeader;
/**
* Copyright 2001-2004 The Apache Software Foundation.
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPFaultImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPFaultImpl.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPFaultImpl.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPFaultImpl.java Wed Mar 9 18:59:17 2005
@@ -1,10 +1,17 @@
package org.apache.axis.impl.llom;
-import org.apache.axis.engine.AxisFault;
-import org.apache.axis.om.*;
+import java.util.Locale;
import javax.xml.namespace.QName;
-import java.util.Locale;
+
+import org.apache.axis.engine.AxisFault;
+import org.apache.axis.om.OMConstants;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMException;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.SOAPFault;
/**
* Copyright 2001-2004 The Apache Software Foundation.
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPHeaderBlockImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPHeaderBlockImpl.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPHeaderBlockImpl.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPHeaderBlockImpl.java Wed Mar 9 18:59:17 2005
@@ -1,8 +1,13 @@
package org.apache.axis.impl.llom;
-import org.apache.axis.om.*;
-
import javax.xml.namespace.QName;
+
+import org.apache.axis.om.OMAttribute;
+import org.apache.axis.om.OMConstants;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.SOAPHeaderBlock;
/**
* Copyright 2001-2004 The Apache Software Foundation.
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPHeaderImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPHeaderImpl.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPHeaderImpl.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPHeaderImpl.java Wed Mar 9 18:59:17 2005
@@ -1,8 +1,15 @@
package org.apache.axis.impl.llom;
-import org.apache.axis.om.*;
-
import java.util.Iterator;
+
+import org.apache.axis.om.OMConstants;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMException;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.SOAPEnvelope;
+import org.apache.axis.om.SOAPHeader;
+import org.apache.axis.om.SOAPHeaderBlock;
/**
* Copyright 2001-2004 The Apache Software Foundation.
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/builder/StAXBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/builder/StAXBuilder.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/builder/StAXBuilder.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/builder/StAXBuilder.java Wed Mar 9 18:59:17 2005
@@ -1,14 +1,20 @@
package org.apache.axis.impl.llom.builder;
+import java.io.InputStream;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
import org.apache.axis.impl.llom.OMElementImpl;
import org.apache.axis.impl.llom.OMNodeImpl;
import org.apache.axis.impl.llom.OMTextImpl;
import org.apache.axis.impl.llom.mtom.MTOMBuilder;
-import org.apache.axis.om.*;
-
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamReader;
-import java.io.InputStream;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMException;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMNode;
+import org.apache.axis.om.OMXMLParserWrapper;
/**
* Copyright 2001-2004 The Apache Software Foundation.
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/builder/StAXOMBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/builder/StAXOMBuilder.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/builder/StAXOMBuilder.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/builder/StAXOMBuilder.java Wed Mar 9 18:59:17 2005
@@ -1,12 +1,20 @@
package org.apache.axis.impl.llom.builder;
+import java.io.InputStream;
+
+import javax.xml.stream.XMLStreamConstants;
+
import org.apache.axis.impl.llom.OMDocument;
import org.apache.axis.impl.llom.OMElementImpl;
import org.apache.axis.impl.llom.mtom.OMBlob;
-import org.apache.axis.om.*;
-
-import javax.xml.stream.XMLStreamConstants;
-import java.io.InputStream;
+import org.apache.axis.om.OMAttribute;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMException;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMNode;
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.SOAPEnvelope;
/**
* Copyright 2001-2004 The Apache Software Foundation.
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/factory/OMLinkedListImplFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/factory/OMLinkedListImplFactory.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/factory/OMLinkedListImplFactory.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/factory/OMLinkedListImplFactory.java Wed Mar 9 18:59:17 2005
@@ -1,7 +1,31 @@
package org.apache.axis.impl.llom.factory;
-import org.apache.axis.impl.llom.*;
-import org.apache.axis.om.*;
+import org.apache.axis.impl.llom.OMAttributeImpl;
+import org.apache.axis.impl.llom.OMElementImpl;
+import org.apache.axis.impl.llom.OMNamedNodeImpl;
+import org.apache.axis.impl.llom.OMNamespaceImpl;
+import org.apache.axis.impl.llom.OMNodeImpl;
+import org.apache.axis.impl.llom.OMTextImpl;
+import org.apache.axis.impl.llom.SOAPBodyImpl;
+import org.apache.axis.impl.llom.SOAPEnvelopeImpl;
+import org.apache.axis.impl.llom.SOAPFaultImpl;
+import org.apache.axis.impl.llom.SOAPHeaderBlockImpl;
+import org.apache.axis.impl.llom.SOAPHeaderImpl;
+import org.apache.axis.om.OMAttribute;
+import org.apache.axis.om.OMConstants;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMException;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMNamedNode;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMNode;
+import org.apache.axis.om.OMText;
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.SOAPBody;
+import org.apache.axis.om.SOAPEnvelope;
+import org.apache.axis.om.SOAPFault;
+import org.apache.axis.om.SOAPHeader;
+import org.apache.axis.om.SOAPHeaderBlock;
/**
* Copyright 2001-2004 The Apache Software Foundation.
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/ByteArrayDataSource.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/ByteArrayDataSource.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/ByteArrayDataSource.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/ByteArrayDataSource.java Wed Mar 9 18:59:17 2005
@@ -1,11 +1,12 @@
package org.apache.axis.impl.llom.mtom;
-import javax.activation.DataSource;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import javax.activation.DataSource;
+
/**
* Copyright 2001-2004 The Apache Software Foundation.
* <p/>
@@ -28,34 +29,34 @@
*/
public class ByteArrayDataSource implements DataSource {
- private byte[] data;
+ private byte[] data;
- private String type;
+ private String type;
- public ByteArrayDataSource(byte[] data, String type) {
- super();
- this.data = data;
- this.type = type;
- }
-
- public String getContentType() {
- if (type == null)
- return "application/octet-stream";
- else
- return type;
- }
-
- public InputStream getInputStream() throws IOException {
- return new ByteArrayInputStream(data);
- }
-
- public String getName() {
-
- return "ByteArrayDataSource";
- }
-
- public OutputStream getOutputStream() throws IOException {
- throw new IOException("Not Supported");
- }
+ public ByteArrayDataSource(byte[] data, String type) {
+ super();
+ this.data = data;
+ this.type = type;
+ }
+
+ public String getContentType() {
+ if (type == null)
+ return "application/octet-stream";
+ else
+ return type;
+ }
+
+ public InputStream getInputStream() throws IOException {
+ return new ByteArrayInputStream(data);
+ }
+
+ public String getName() {
+
+ return "ByteArrayDataSource";
+ }
+
+ public OutputStream getOutputStream() throws IOException {
+ throw new IOException("Not Supported");
+ }
}
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MIMEBodyPartInputStream.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MIMEBodyPartInputStream.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MIMEBodyPartInputStream.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MIMEBodyPartInputStream.java Wed Mar 9 18:59:17 2005
@@ -26,58 +26,58 @@
public class MIMEBodyPartInputStream extends InputStream {
- MIMEInputStream inStream;
+ MIMEInputStream inStream;
- String boundry;
+ String boundry;
- boolean done = false;
+ boolean done = false;
- boolean began = false;
+ boolean began = false;
- public MIMEBodyPartInputStream(MIMEInputStream inStream, String boundry) {
- super();
- this.inStream = inStream;
- this.boundry = boundry;
-
- }
-
- public int read() throws IOException {
-
- if (done) {
- return -1;
- } else {
- int value = 0;
- String line = "";
-
- value = inStream.read();
-
- while (value == 13 & !began) {
- value = inStream.read();
- value = inStream.read();
- }
- began = true;
-
- char readChar = (char) value;
- if (readChar == '-') {
- inStream.mark();
- char readNextChar = ' ';
-
- readNextChar = (char) inStream.read();
-
- if (readNextChar == '-') {
- line = inStream.read(boundry.length());
- if (line.equals(boundry)) {
- done = true;
- return -1;
-
- } else {
- inStream.reset();
- }
- } else {
- inStream.reset();
- }
- }
- return value;
- }
- }
+ public MIMEBodyPartInputStream(MIMEInputStream inStream, String boundry) {
+ super();
+ this.inStream = inStream;
+ this.boundry = boundry;
+
+ }
+
+ public int read() throws IOException {
+
+ if (done) {
+ return -1;
+ } else {
+ int value = 0;
+ String line = "";
+
+ value = inStream.read();
+
+ while (value == 13 & !began) {
+ value = inStream.read();
+ value = inStream.read();
+ }
+ began = true;
+
+ char readChar = (char) value;
+ if (readChar == '-') {
+ inStream.mark();
+ char readNextChar = ' ';
+
+ readNextChar = (char) inStream.read();
+
+ if (readNextChar == '-') {
+ line = inStream.read(boundry.length());
+ if (line.equals(boundry)) {
+ done = true;
+ return -1;
+
+ } else {
+ inStream.reset();
+ }
+ } else {
+ inStream.reset();
+ }
+ }
+ return value;
+ }
+ }
}
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MIMEInputStream.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MIMEInputStream.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MIMEInputStream.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MIMEInputStream.java Wed Mar 9 18:59:17 2005
@@ -27,95 +27,95 @@
public class MIMEInputStream extends InputStream {
- InputStream inStream;
+ InputStream inStream;
- LinkedList buffer;
+ LinkedList buffer;
- boolean mark = false;
+ boolean mark = false;
- boolean reset = false;
+ boolean reset = false;
- int point = 0;
-
- public MIMEInputStream(InputStream inStream) {
- super();
- this.inStream = inStream;
- buffer = new LinkedList();
- }
-
- public int read() throws IOException {
- int temp = readMain();
- return temp;
- }
-
- public String readLine() throws IOException {
- String line = "";
- char character = ' ';
- do {
- try {
- character = (char) readMain();
- line += character;
- } catch (IOException e) {
- e.printStackTrace();
- }
- } while (character != '\n');
-
- return line;
- }
-
- public String read(int length) throws IOException {
- String line = "";
- char character = ' ';
- for (int i = 0; i < length; i++) {
- character = (char) readMain();
- line += character;
- }
- return line;
- }
-
- public int readMain() throws IOException {
- int temp;
- if (mark & reset) {
- Integer byteOb = (Integer) buffer.get(point);
- temp = byteOb.intValue();
- if (buffer.get(point).equals(buffer.getLast())) {
- reset = false;
- point = 0;
- } else {
- point++;
- }
- } else if (mark) {
- temp = inStream.read();
- buffer.add(new Integer(temp));
- } else if (reset) {
- if (buffer.isEmpty()) {
- reset = false;
- temp = inStream.read();
- } else {
- Integer byteOb = (Integer) buffer.getFirst();
- temp = byteOb.intValue();
- buffer.removeFirst();
- }
- } else {
- temp = inStream.read();
- }
- return temp;
- }
-
- public void mark() {
- if (!reset) {
- buffer.clear();
- }
- mark = true;
- }
-
- public void reset() throws IOException {
- if (mark) {
- reset = true;
- mark = false;
- point = 0;
- } else {
- throw new IOException("not marked");
- }
- }
+ int point = 0;
+
+ public MIMEInputStream(InputStream inStream) {
+ super();
+ this.inStream = inStream;
+ buffer = new LinkedList();
+ }
+
+ public int read() throws IOException {
+ int temp = readMain();
+ return temp;
+ }
+
+ public String readLine() throws IOException {
+ String line = "";
+ char character = ' ';
+ do {
+ try {
+ character = (char) readMain();
+ line += character;
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ } while (character != '\n');
+
+ return line;
+ }
+
+ public String read(int length) throws IOException {
+ String line = "";
+ char character = ' ';
+ for (int i = 0; i < length; i++) {
+ character = (char) readMain();
+ line += character;
+ }
+ return line;
+ }
+
+ public int readMain() throws IOException {
+ int temp;
+ if (mark & reset) {
+ Integer byteOb = (Integer) buffer.get(point);
+ temp = byteOb.intValue();
+ if (buffer.get(point).equals(buffer.getLast())) {
+ reset = false;
+ point = 0;
+ } else {
+ point++;
+ }
+ } else if (mark) {
+ temp = inStream.read();
+ buffer.add(new Integer(temp));
+ } else if (reset) {
+ if (buffer.isEmpty()) {
+ reset = false;
+ temp = inStream.read();
+ } else {
+ Integer byteOb = (Integer) buffer.getFirst();
+ temp = byteOb.intValue();
+ buffer.removeFirst();
+ }
+ } else {
+ temp = inStream.read();
+ }
+ return temp;
+ }
+
+ public void mark() {
+ if (!reset) {
+ buffer.clear();
+ }
+ mark = true;
+ }
+
+ public void reset() throws IOException {
+ if (mark) {
+ reset = true;
+ mark = false;
+ point = 0;
+ } else {
+ throw new IOException("not marked");
+ }
+ }
}
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MIMEParser.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MIMEParser.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MIMEParser.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MIMEParser.java Wed Mar 9 18:59:17 2005
@@ -1,14 +1,14 @@
package org.apache.axis.impl.llom.mtom;
+import java.io.InputStream;
+import java.util.Properties;
+
import javax.activation.DataHandler;
import javax.mail.MessagingException;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import javax.mail.internet.MimePartDataSource;
-import java.io.InputStream;
-import java.util.Properties;
-
/**
* Copyright 2001-2004 The Apache Software Foundation.
@@ -32,145 +32,101 @@
*/
public class MIMEParser {
- int partIndex = 0;
- MIMEInputStream in;
+ int partIndex = 0;
+
+ MIMEInputStream in;
- String mimeVersion;
+ String mimeVersion;
- String contentType;
+ String contentType;
- boolean messageMime;
+ boolean messageMime;
- String boundry;
-
- boolean complete = false;
-
- String start;
- MimeMessage message;
-
- public MIMEParser(InputStream inStream) {
-
- Properties props = new Properties();
- javax.mail.Session session = javax.mail.Session.getInstance(props, null);
- try {
- message = new MimeMessage(session, inStream);
- messageMime = true;
- //in = new MIMEInputStream(inStream);
- } catch (MessagingException e) {
- messageMime = false;
- }
- }
-
- public boolean mimeMessage() {
- return messageMime;
-/* String line = null;
- char readChar = ' ';
- boolean found = false;
- int startIndex, finishIndex, valueFinishIndex;
-
- //Start processing the Mime Header
+ String boundry;
+
+ boolean complete = false;
+
+ String start;
+
+ MimeMessage message;
+
+ public MIMEParser(InputStream inStream) {
+
+ Properties props = new Properties();
+ javax.mail.Session session = javax.mail.Session
+ .getInstance(props, null);
try {
- in.readLine();
- line = in.readLine();
- } catch (Exception e) {
- System.out.println(e);
+ message = new MimeMessage(session, inStream);
+ messageMime = true;
+ //in = new MIMEInputStream(inStream);
+ } catch (MessagingException e) {
+ messageMime = false;
}
-
- line = line.trim();
- String[] versionArray = line.split(":");
-
- //Extracts and stores MIME version information
- if (versionArray[0].equalsIgnoreCase("MIME-Version")) {
- mimeVersion = versionArray[1];
-
- /*
- * extract the Mime boundry
- */
-/* do {
- try {
- line = in.readLine();
- } catch (Exception e) {
- System.out.println(e);
- }
-
- //extracting the mime boundry string
- startIndex = line.indexOf("boundary=");
- } while (startIndex == -1);
-
- finishIndex = (startIndex + ("boundary=").length());
- valueFinishIndex = line.indexOf(";", finishIndex);
-
- if (valueFinishIndex > 0) {
- boundry = line.substring(finishIndex, valueFinishIndex);
- } else {
- boundry = line.substring(finishIndex);
- }
- boundry = boundry.replace('"', ' ');
- boundry = boundry.trim();
-
- /*
- * Move the input stream to the begining of the MIME root part
- */
-/* do {
- try {
- in.mark(boundry.length() + 5);
- readChar = (char) in.read();
- } catch (Exception e) {
- System.out.println(e);
- }
- if (readChar == '-') {
- char readNextChar = ' ';
- try {
- readNextChar = (char) in.read();
- } catch (IOException e3) {
- e3.printStackTrace();
- }
-
- if (readNextChar == '-') {
- char[] cBuf = new char[boundry.length()];
-
- try {
- line = in.read(boundry.length());
- } catch (IOException e1) {
- e1.printStackTrace();
- }
-
- if (line.equals(boundry)) {
- found = true;
- } else {
- try {
- in.reset();
- } catch (IOException e2) {
- e2.printStackTrace();
- }
- }
- }
- }
- } while (!found);
- return true;
- } else {
- return false;
- }*/
- }
-
- public MimeBodyPart getPart() throws Exception {
- MimeBodyPart part = null;
- /*
- if (!complete) {
-
- MIMEBodyPartInputStream partStream = new MIMEBodyPartInputStream(
- in, boundry);
- part = new MimeBodyPart(partStream);
- if (part.getSize() == 0 | part.getSize() < 0) {
- complete = true;
- return null;
- }
- }*/
- DataHandler dh = message.getDataHandler();
- MimeMultipart multiPart = new MimeMultipart((MimePartDataSource) dh.getDataSource());
- part = (MimeBodyPart) multiPart.getBodyPart(partIndex);
-
- partIndex++;
- return part;
- }
+ }
+
+ public boolean mimeMessage() {
+ return messageMime;
+ /*
+ * String line = null; char readChar = ' '; boolean found = false; int
+ * startIndex, finishIndex, valueFinishIndex;
+ *
+ * //Start processing the Mime Header try { in.readLine(); line =
+ * in.readLine(); } catch (Exception e) { System.out.println(e); }
+ *
+ * line = line.trim(); String[] versionArray = line.split(":");
+ *
+ * //Extracts and stores MIME version information if
+ * (versionArray[0].equalsIgnoreCase("MIME-Version")) { mimeVersion =
+ * versionArray[1];
+ * /* extract the Mime boundry
+ */
+ /*
+ * do { try { line = in.readLine(); } catch (Exception e) {
+ * System.out.println(e); }
+ *
+ * //extracting the mime boundry string startIndex =
+ * line.indexOf("boundary="); } while (startIndex == -1);
+ *
+ * finishIndex = (startIndex + ("boundary=").length()); valueFinishIndex =
+ * line.indexOf(";", finishIndex);
+ *
+ * if (valueFinishIndex > 0) { boundry = line.substring(finishIndex,
+ * valueFinishIndex); } else { boundry = line.substring(finishIndex); }
+ * boundry = boundry.replace('"', ' '); boundry = boundry.trim();
+ * /* Move the input stream to the begining of the MIME root part
+ */
+ /*
+ * do { try { in.mark(boundry.length() + 5); readChar = (char)
+ * in.read(); } catch (Exception e) { System.out.println(e); } if
+ * (readChar == '-') { char readNextChar = ' '; try { readNextChar =
+ * (char) in.read(); } catch (IOException e3) { e3.printStackTrace(); }
+ *
+ * if (readNextChar == '-') { char[] cBuf = new char[boundry.length()];
+ *
+ * try { line = in.read(boundry.length()); } catch (IOException e1) {
+ * e1.printStackTrace(); }
+ *
+ * if (line.equals(boundry)) { found = true; } else { try { in.reset(); }
+ * catch (IOException e2) { e2.printStackTrace(); } } } } } while
+ * (!found); return true; } else { return false; }
+ */
+ }
+
+ public MimeBodyPart getPart() throws Exception {
+ MimeBodyPart part = null;
+ /*
+ * if (!complete) {
+ *
+ * MIMEBodyPartInputStream partStream = new MIMEBodyPartInputStream( in,
+ * boundry); part = new MimeBodyPart(partStream); if (part.getSize() ==
+ * 0 | part.getSize() < 0) { complete = true; return null; } }
+ */
+ DataHandler dh = message.getDataHandler();
+ MimeMultipart multiPart = new MimeMultipart((MimePartDataSource) dh
+ .getDataSource());
+ part = (MimeBodyPart) multiPart.getBodyPart(partIndex);
+
+ partIndex++;
+ return part;
+ }
}
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MTOMBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MTOMBuilder.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MTOMBuilder.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MTOMBuilder.java Wed Mar 9 18:59:17 2005
@@ -1,12 +1,13 @@
package org.apache.axis.impl.llom.mtom;
+import java.io.InputStream;
+import java.util.LinkedList;
+import java.util.ListIterator;
+
import javax.activation.DataHandler;
import javax.mail.internet.MimeBodyPart;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
-import java.io.InputStream;
-import java.util.LinkedList;
-import java.util.ListIterator;
/**
* Copyright 2001-2004 The Apache Software Foundation.
@@ -29,86 +30,88 @@
* @author Thilina Gunarathne thil747@yahoo.com
*/
public class MTOMBuilder {
- LinkedList parts;
+ LinkedList parts;
- InputStream inStream;
+ InputStream inStream;
- MIMEParser parser;
+ MIMEParser parser;
- public MTOMBuilder(InputStream inStream) {
- this.inStream = inStream;
- this.parser = new MIMEParser(inStream);
- parts = new LinkedList();
- }
-
- public/* Serializable */DataHandler getDataHandler(String cid)
- throws Exception {
- /*
- * First checks whether the part is already parsed by checking the parts
- * linked list. If it is not parsed yet then call the getnextPart() till
- * we find the required part.
- */
- MimeBodyPart part;
-
- boolean found = false;
- ListIterator partsIterator = parts.listIterator();
- while (partsIterator.hasNext()) {
- part = (MimeBodyPart) partsIterator.next();
- if (cid.equals(part.getContentID())) {
- found = true;
- DataHandler dh = part.getDataHandler();
- return dh;
- }
- }
- while (!found) {
- part = this.getNextPart();
-
- if (part == null) {
- break;
- }
- String partCid = part.getContentID();
- String cida = "<" + cid + ">";
- if (cida.equals(partCid)) {
- found = true;
- DataHandler dh = part.getDataHandler();
- return dh;
- }
- }
- return null;
- }
-
- public XMLStreamReader getParser() throws Exception {
-
- if (parser.mimeMessage()) {
- MimeBodyPart root = getRoot();
- return XMLInputFactory.newInstance().createXMLStreamReader(root.getInputStream());
- } else {
- return XMLInputFactory.newInstance()
- .createXMLStreamReader(inStream);
- }
- }
-
- public MimeBodyPart getRoot() throws Exception {
- MimeBodyPart root;
- if (parts.isEmpty()) {
- root = parser.getPart();
- parts.add(root);
- } else {
- root = (MimeBodyPart) parts.getFirst();
- }
- System.out.println("MIME root parsed. NO of parts parsed :" + parts.size());
- return root;
- }
-
- public MimeBodyPart getNextPart() throws Exception {
- MimeBodyPart nextPart;
- nextPart = parser.getPart();
- if (nextPart != null) {
- parts.add(nextPart);
- System.out.println("Next part parsed. NO of parts parsed :" + parts.size());
- return nextPart;
- } else
- return null;
- }
+ public MTOMBuilder(InputStream inStream) {
+ this.inStream = inStream;
+ this.parser = new MIMEParser(inStream);
+ parts = new LinkedList();
+ }
+
+ public DataHandler getDataHandler(String cid) throws Exception {
+ /*
+ * First checks whether the part is already parsed by checking the parts
+ * linked list. If it is not parsed yet then call the getnextPart() till
+ * we find the required part.
+ */
+ MimeBodyPart part;
+
+ boolean found = false;
+ ListIterator partsIterator = parts.listIterator();
+ while (partsIterator.hasNext()) {
+ part = (MimeBodyPart) partsIterator.next();
+ if (cid.equals(part.getContentID())) {
+ found = true;
+ DataHandler dh = part.getDataHandler();
+ return dh;
+ }
+ }
+ while (!found) {
+ part = this.getNextPart();
+
+ if (part == null) {
+ break;
+ }
+ String partCid = part.getContentID();
+ String cida = "<" + cid + ">";
+ if (cida.equals(partCid)) {
+ found = true;
+ DataHandler dh = part.getDataHandler();
+ return dh;
+ }
+ }
+ return null;
+ }
+
+ public XMLStreamReader getParser() throws Exception {
+
+ if (parser.mimeMessage()) {
+ MimeBodyPart root = getRoot();
+ return XMLInputFactory.newInstance().createXMLStreamReader(
+ root.getInputStream());
+ } else {
+ return XMLInputFactory.newInstance()
+ .createXMLStreamReader(inStream);
+ }
+ }
+
+ public MimeBodyPart getRoot() throws Exception {
+ MimeBodyPart root;
+ if (parts.isEmpty()) {
+ root = parser.getPart();
+ parts.add(root);
+ } else {
+ root = (MimeBodyPart) parts.getFirst();
+ }
+ System.out.println("MIME root parsed. NO of parts parsed :"
+ + parts.size());
+ return root;
+ }
+
+ public MimeBodyPart getNextPart() throws Exception {
+ MimeBodyPart nextPart;
+ nextPart = parser.getPart();
+ if (nextPart != null) {
+ parts.add(nextPart);
+ System.out.println("Next part parsed. NO of parts parsed :"
+ + parts.size());
+ return nextPart;
+ } else
+ return null;
+ }
}
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MTOMXMLStreamWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MTOMXMLStreamWriter.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MTOMXMLStreamWriter.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MTOMXMLStreamWriter.java Wed Mar 9 18:59:17 2005
@@ -1,5 +1,14 @@
package org.apache.axis.impl.llom.mtom;
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Properties;
+import java.util.Random;
+import java.util.*;
+
import javax.activation.DataHandler;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMultipart;
@@ -8,13 +17,6 @@
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.Properties;
-import java.util.Random;
/**
* Copyright 2001-2004 The Apache Software Foundation.
@@ -38,399 +40,413 @@
*/
public class MTOMXMLStreamWriter implements XMLStreamWriter {
- OutputStream outStream;
+ OutputStream outStream;
- BufferedOutputStream soapStream;
+ BufferedOutputStream soapStream;
- XMLStreamWriter writer;
+ XMLStreamWriter writer;
- Random rnd;
+ Random rnd;
+ HashMap partMap;
- LinkedList partList;
-
- ByteArrayOutputStream byteStream;
- public static String[] filter = new String[]{"Message-ID"};
-
- public MTOMXMLStreamWriter(OutputStream out) throws XMLStreamException,
- FactoryConfigurationError {
- super();
- this.outStream = out;
-
- byteStream = new ByteArrayOutputStream();
- //soapStream = new BufferedOutputStream(byteStream);
- writer = XMLOutputFactory.newInstance().createXMLStreamWriter(byteStream);
- rnd = new Random();
- partList = new LinkedList();
- }
-
- public String createPart(OMBlob blob) {
- String cid = "http://example.org/my.hsh" + (rnd.nextInt());
- AttachmentPart part = new AttachmentPart(cid, blob);
- partList.add(part);
- return cid;
- }
-
- public MimeBodyPart createMimePart(String cid, OMBlob blob) throws Exception {
- MimeBodyPart mb = new MimeBodyPart();
- mb.setDataHandler(blob.getDataHandler());
- mb.addHeader("Content-Transfer-Encoding", "binary");
- mb.addHeader("Content-ID", "<" + cid + ">");
- return mb;
-
- }
-
- public void complete() throws Exception {
- DataHandler dh = new DataHandler(byteStream.toString(), "text/xml");
- MimeBodyPart mb = new MimeBodyPart();
- mb.setDataHandler(dh);
- mb.addHeader("Content-Type", "application/xop+xml");
- mb.addHeader("Content-Transfer-Encoding", "8bit");
- String cid = "<http://example.org/my.hsh>";
- mb.addHeader("Content-ID", cid);
-
- //MimeMessage message = new MimeMessage(Session.getDefaultInstance(new java.util.Properties()));
-
- Properties props = new Properties();
- javax.mail.Session session = javax.mail.Session.getInstance(props, null);
- javax.mail.internet.MimeMessage message = new javax.mail.internet.MimeMessage(session);
- MimeMultipart mes = new MimeMultipart("Related");
- mes.addBodyPart(mb);
- Iterator partIterator = partList.iterator();
- while (partIterator.hasNext()) {
- AttachmentPart part = (AttachmentPart) partIterator.next();
- mes.addBodyPart(createMimePart(part.getCid(), part.getBlob()));
- }
- mes.writeTo(System.out);
- System.out.println("----------------------------");
- message.setContent(mes);
- message.removeHeader("Message-Id");
- message.writeTo(System.out);
- message.writeTo(outStream, filter);
- }
-
- public void writeStartElement(String localName) throws XMLStreamException {
- writer.writeStartElement(localName);
- }
-
- public void writeStartElement(String namespaceURI, String localName)
- throws XMLStreamException {
- writer.writeStartElement(namespaceURI, localName);
-
- }
-
- public void writeStartElement(String prefix, String localName,
- String namespaceURI) throws XMLStreamException {
- writer.writeStartElement(prefix, localName, namespaceURI);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#writeEmptyElement(java.lang.String,
- * java.lang.String)
- */
- public void writeEmptyElement(String namespaceURI, String localName)
- throws XMLStreamException {
- writer.writeEmptyElement(namespaceURI, localName);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#writeEmptyElement(java.lang.String,
- * java.lang.String, java.lang.String)
- */
- public void writeEmptyElement(String prefix, String localName,
- String namespaceURI) throws XMLStreamException {
- writer.writeEmptyElement(prefix, localName, namespaceURI);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#writeEmptyElement(java.lang.String)
- */
- public void writeEmptyElement(String localName) throws XMLStreamException {
- writer.writeEmptyElement(localName);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#writeEndElement()
- */
- public void writeEndElement() throws XMLStreamException {
- writer.writeEndElement();
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#writeEndDocument()
- */
- public void writeEndDocument() throws XMLStreamException {
- writer.writeEndDocument();
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#close()
- */
- public void close() throws XMLStreamException {
- writer.close();
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#flush()
- */
- public void flush() throws XMLStreamException {
- writer.flush();
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#writeAttribute(java.lang.String,
- * java.lang.String)
- */
- public void writeAttribute(String localName, String value)
- throws XMLStreamException {
- writer.writeAttribute(localName, value);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#writeAttribute(java.lang.String,
- * java.lang.String, java.lang.String, java.lang.String)
- */
- public void writeAttribute(String prefix, String namespaceURI,
- String localName, String value) throws XMLStreamException {
- writer.writeAttribute(prefix, namespaceURI, localName, value);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#writeAttribute(java.lang.String,
- * java.lang.String, java.lang.String)
- */
- public void writeAttribute(String namespaceURI, String localName,
- String value) throws XMLStreamException {
- writer.writeAttribute(namespaceURI, localName, value);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#writeNamespace(java.lang.String,
- * java.lang.String)
- */
- public void writeNamespace(String prefix, String namespaceURI)
- throws XMLStreamException {
- writer.writeNamespace(prefix, namespaceURI);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#writeDefaultNamespace(java.lang.String)
- */
- public void writeDefaultNamespace(String namespaceURI)
- throws XMLStreamException {
- writer.writeDefaultNamespace(namespaceURI);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#writeComment(java.lang.String)
- */
- public void writeComment(String data) throws XMLStreamException {
- writer.writeComment(data);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#writeProcessingInstruction(java.lang.String)
- */
- public void writeProcessingInstruction(String target)
- throws XMLStreamException {
- writer.writeProcessingInstruction(target);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#writeProcessingInstruction(java.lang.String,
- * java.lang.String)
- */
- public void writeProcessingInstruction(String target, String data)
- throws XMLStreamException {
- writer.writeProcessingInstruction(target, data);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#writeCData(java.lang.String)
- */
- public void writeCData(String data) throws XMLStreamException {
- writer.writeCData(data);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#writeDTD(java.lang.String)
- */
- public void writeDTD(String dtd) throws XMLStreamException {
- writer.writeDTD(dtd);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#writeEntityRef(java.lang.String)
- */
- public void writeEntityRef(String name) throws XMLStreamException {
- writer.writeEntityRef(name);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#writeStartDocument()
- */
- public void writeStartDocument() throws XMLStreamException {
- writer.writeStartDocument();
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#writeStartDocument(java.lang.String)
- */
- public void writeStartDocument(String version) throws XMLStreamException {
- writer.writeStartDocument(version);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#writeStartDocument(java.lang.String,
- * java.lang.String)
- */
- public void writeStartDocument(String encoding, String version)
- throws XMLStreamException {
- writer.writeStartDocument(encoding, version);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#writeCharacters(java.lang.String)
- */
- public void writeCharacters(String text) throws XMLStreamException {
- writer.writeCharacters(text);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#writeCharacters(char[], int, int)
- */
- public void writeCharacters(char[] text, int start, int len)
- throws XMLStreamException {
- writer.writeCharacters(text, start, len);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#getPrefix(java.lang.String)
- */
- public String getPrefix(String uri) throws XMLStreamException {
-
- return writer.getPrefix(uri);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#setPrefix(java.lang.String,
- * java.lang.String)
- */
- public void setPrefix(String prefix, String uri) throws XMLStreamException {
- writer.setPrefix(prefix, uri);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#setDefaultNamespace(java.lang.String)
- */
- public void setDefaultNamespace(String uri) throws XMLStreamException {
- writer.setDefaultNamespace(uri);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#setNamespaceContext(javax.xml.namespace.NamespaceContext)
- */
- public void setNamespaceContext(NamespaceContext context)
- throws XMLStreamException {
- writer.setNamespaceContext(context);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#getNamespaceContext()
- */
- public NamespaceContext getNamespaceContext() {
-
- return writer.getNamespaceContext();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.stream.XMLStreamWriter#getProperty(java.lang.String)
- */
- public Object getProperty(String name) throws IllegalArgumentException {
+ LinkedList partList;
+
+ ByteArrayOutputStream byteStream;
+
+ public static String[] filter = new String[] { "Message-ID" };
+
+ public MTOMXMLStreamWriter(OutputStream out) throws XMLStreamException,
+ FactoryConfigurationError {
+ super();
+ this.outStream = out;
+
+ byteStream = new ByteArrayOutputStream();
+
+ writer = XMLOutputFactory.newInstance().createXMLStreamWriter(
+ byteStream);
+ partMap = new HashMap();
+ rnd = new Random();
+
+ }
+
+ public String createPart(OMBlob blob) {
+ String cid = "http://example.org/my.hsh" + (rnd.nextInt());
+
+ partMap.put(cid,blob);
+
+ return cid;
+ }
+
+ public MimeBodyPart createMimePart(String cid, OMBlob blob)
+ throws Exception {
+ MimeBodyPart mb = new MimeBodyPart();
+ mb.setDataHandler(blob.getDataHandler());
+ mb.addHeader("Content-Transfer-Encoding", "binary");
+ mb.addHeader("Content-ID", "<" + cid + ">");
+ return mb;
+
+ }
+
+ public void complete() throws Exception {
+ DataHandler dh = new DataHandler(byteStream.toString(), "text/xml");
+ MimeBodyPart mb = new MimeBodyPart();
+ mb.setDataHandler(dh);
+ mb.addHeader("Content-Type", "application/xop+xml");
+ mb.addHeader("Content-Transfer-Encoding", "8bit");
+ String cid = "<http://example.org/my.hsh>";
+ mb.addHeader("Content-ID", cid);
+
+ //MimeMessage message = new MimeMessage(Session.getDefaultInstance(new
+ // java.util.Properties()));
+
+ Properties props = new Properties();
+ javax.mail.Session session = javax.mail.Session
+ .getInstance(props, null);
+ javax.mail.internet.MimeMessage message = new javax.mail.internet.MimeMessage(
+ session);
+ MimeMultipart mes = new MimeMultipart("Related");
+ mes.addBodyPart(mb);
+ Set keys = partMap.keySet();
+
+
+ Iterator keyIterator = keys.iterator();
+ while (keyIterator.hasNext()) {
+ String key = (String) keyIterator.next();
+ OMBlob blob = (OMBlob) partMap.get(key);
+
+ mes.addBodyPart(createMimePart(key, blob));
+ }
+ mes.writeTo(System.out);
+ System.out.println("----------------------------");
+ message.setContent(mes);
+ message.removeHeader("Message-Id");
+ message.writeTo(System.out);
+ message.writeTo(outStream, filter);
+ }
+
+ public void writeStartElement(String localName) throws XMLStreamException {
+ writer.writeStartElement(localName);
+ }
+
+ public void writeStartElement(String namespaceURI, String localName)
+ throws XMLStreamException {
+ writer.writeStartElement(namespaceURI, localName);
+
+ }
+
+ public void writeStartElement(String prefix, String localName,
+ String namespaceURI) throws XMLStreamException {
+ writer.writeStartElement(prefix, localName, namespaceURI);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#writeEmptyElement(java.lang.String,
+ * java.lang.String)
+ */
+ public void writeEmptyElement(String namespaceURI, String localName)
+ throws XMLStreamException {
+ writer.writeEmptyElement(namespaceURI, localName);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#writeEmptyElement(java.lang.String,
+ * java.lang.String, java.lang.String)
+ */
+ public void writeEmptyElement(String prefix, String localName,
+ String namespaceURI) throws XMLStreamException {
+ writer.writeEmptyElement(prefix, localName, namespaceURI);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#writeEmptyElement(java.lang.String)
+ */
+ public void writeEmptyElement(String localName) throws XMLStreamException {
+ writer.writeEmptyElement(localName);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#writeEndElement()
+ */
+ public void writeEndElement() throws XMLStreamException {
+ writer.writeEndElement();
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#writeEndDocument()
+ */
+ public void writeEndDocument() throws XMLStreamException {
+ writer.writeEndDocument();
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#close()
+ */
+ public void close() throws XMLStreamException {
+ writer.close();
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#flush()
+ */
+ public void flush() throws XMLStreamException {
+ writer.flush();
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#writeAttribute(java.lang.String,
+ * java.lang.String)
+ */
+ public void writeAttribute(String localName, String value)
+ throws XMLStreamException {
+ writer.writeAttribute(localName, value);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#writeAttribute(java.lang.String,
+ * java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void writeAttribute(String prefix, String namespaceURI,
+ String localName, String value) throws XMLStreamException {
+ writer.writeAttribute(prefix, namespaceURI, localName, value);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#writeAttribute(java.lang.String,
+ * java.lang.String, java.lang.String)
+ */
+ public void writeAttribute(String namespaceURI, String localName,
+ String value) throws XMLStreamException {
+ writer.writeAttribute(namespaceURI, localName, value);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#writeNamespace(java.lang.String,
+ * java.lang.String)
+ */
+ public void writeNamespace(String prefix, String namespaceURI)
+ throws XMLStreamException {
+ writer.writeNamespace(prefix, namespaceURI);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#writeDefaultNamespace(java.lang.String)
+ */
+ public void writeDefaultNamespace(String namespaceURI)
+ throws XMLStreamException {
+ writer.writeDefaultNamespace(namespaceURI);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#writeComment(java.lang.String)
+ */
+ public void writeComment(String data) throws XMLStreamException {
+ writer.writeComment(data);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#writeProcessingInstruction(java.lang.String)
+ */
+ public void writeProcessingInstruction(String target)
+ throws XMLStreamException {
+ writer.writeProcessingInstruction(target);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#writeProcessingInstruction(java.lang.String,
+ * java.lang.String)
+ */
+ public void writeProcessingInstruction(String target, String data)
+ throws XMLStreamException {
+ writer.writeProcessingInstruction(target, data);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#writeCData(java.lang.String)
+ */
+ public void writeCData(String data) throws XMLStreamException {
+ writer.writeCData(data);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#writeDTD(java.lang.String)
+ */
+ public void writeDTD(String dtd) throws XMLStreamException {
+ writer.writeDTD(dtd);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#writeEntityRef(java.lang.String)
+ */
+ public void writeEntityRef(String name) throws XMLStreamException {
+ writer.writeEntityRef(name);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#writeStartDocument()
+ */
+ public void writeStartDocument() throws XMLStreamException {
+ writer.writeStartDocument();
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#writeStartDocument(java.lang.String)
+ */
+ public void writeStartDocument(String version) throws XMLStreamException {
+ writer.writeStartDocument(version);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#writeStartDocument(java.lang.String,
+ * java.lang.String)
+ */
+ public void writeStartDocument(String encoding, String version)
+ throws XMLStreamException {
+ writer.writeStartDocument(encoding, version);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#writeCharacters(java.lang.String)
+ */
+ public void writeCharacters(String text) throws XMLStreamException {
+ writer.writeCharacters(text);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#writeCharacters(char[], int, int)
+ */
+ public void writeCharacters(char[] text, int start, int len)
+ throws XMLStreamException {
+ writer.writeCharacters(text, start, len);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#getPrefix(java.lang.String)
+ */
+ public String getPrefix(String uri) throws XMLStreamException {
+
+ return writer.getPrefix(uri);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#setPrefix(java.lang.String,
+ * java.lang.String)
+ */
+ public void setPrefix(String prefix, String uri) throws XMLStreamException {
+ writer.setPrefix(prefix, uri);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#setDefaultNamespace(java.lang.String)
+ */
+ public void setDefaultNamespace(String uri) throws XMLStreamException {
+ writer.setDefaultNamespace(uri);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#setNamespaceContext(javax.xml.namespace.NamespaceContext)
+ */
+ public void setNamespaceContext(NamespaceContext context)
+ throws XMLStreamException {
+ writer.setNamespaceContext(context);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#getNamespaceContext()
+ */
+ public NamespaceContext getNamespaceContext() {
+
+ return writer.getNamespaceContext();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.stream.XMLStreamWriter#getProperty(java.lang.String)
+ */
+ public Object getProperty(String name) throws IllegalArgumentException {
- return writer.getProperty(name);
- }
+ return writer.getProperty(name);
+ }
}
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/OMBlob.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/OMBlob.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/OMBlob.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/OMBlob.java Wed Mar 9 18:59:17 2005
@@ -1,18 +1,12 @@
package org.apache.axis.impl.llom.mtom;
+import javax.activation.DataHandler;
+
import org.apache.axis.impl.llom.OMNodeImpl;
-import org.apache.axis.impl.llom.exception.MTOMException;
import org.apache.axis.om.OMElement;
import org.apache.axis.om.OMException;
import org.apache.axis.om.OMNode;
-import javax.activation.DataHandler;
-import java.io.*;
-
-//import javax.xml.transform.stream.StreamSource;
-//import javax.xml.soap.SOAPException;
-//import javax.xml.transform.stream.StreamSource;
-
/**
* Copyright 2001-2004 The Apache Software Foundation.
* <p/>
@@ -36,180 +30,95 @@
public class OMBlob extends OMNodeImpl {
- String cid = null;
+ private String cid = null;
- Object binaryObject = null;
+ private MTOMBuilder builder;
- MTOMBuilder mimeParser;
+ private DataHandler DH = null;
- DataHandler DH = null;
+ // boolean MTOMable = true;
- boolean MTOMable = true;
-
- public OMBlob(Object object, boolean MTOMable) {
- this.MTOMable = MTOMable;
- this.binaryObject = object;
- }
-
- public OMBlob(String cid, OMElement parent, MTOMBuilder mimeParser) {
- super(parent);
- this.cid = cid;
- this.mimeParser = mimeParser;
- }
-
- public void setMTOMable(boolean MTOMable) {
- this.MTOMable = MTOMable;
- }
-
- public boolean isMTOMable() {
- return MTOMable;
- }
-
- public/*Serializable*/Object getObject() throws Exception {
- if ((binaryObject == null) & (cid != null)) {
- if (DH == null) {
- getDataHandler();
- }
- //
- /*
-
-
- javax.activation.DataSource ds = datahandler.getDataSource();
- InputStream is = null;
- try {
- is = ds.getInputStream();;
- } catch (java.io.IOException io) {
- log.error(Messages.getMessage("javaIOException00"), io);
- throw new SOAPException(io);
- }
- if (ds.getContentType().equals("text/plain")) {
- try {
- byte[] bytes = new byte[is.available()];
- IOUtils.readFully(is, bytes);
- return new String(bytes);
- } catch (java.io.IOException io) {
- log.error(Messages.getMessage("javaIOException00"), io);
- throw new SOAPException(io);
- }
- } else if (ds.getContentType().equals("text/xml")) {
- return new StreamSource(is);
- } else if (ds.getContentType().equals("image/gif") ||
- ds.getContentType().equals("image/jpeg")) {
- try {
- return ImageIOFactory.getImageIO().loadImage(is);
- } catch (Exception ex) {
- log.error(Messages.getMessage("javaIOException00"), ex);
- throw new SOAPException(ex);
- }
- }
- return is;
- //
- */
- Object in = DH.getContent();
- if (in instanceof InputStream) {
- ObjectInputStream ois = new ObjectInputStream((InputStream) in);
- binaryObject = ois.readObject();
- } else
- binaryObject = in;
- return binaryObject;
- } else if ((binaryObject == null) & (cid == null)) {
- throw new MTOMException("OMBlob not initialised Properly");
- }
- return binaryObject;
- }
-
- public java.io.OutputStream getStream() throws Exception {
- ObjectOutputStream outStream;
- ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
- if ((binaryObject == null) & (cid != null)) {
- binaryObject = getObject();
- } else if ((binaryObject == null) & (cid == null)) {
- throw new MTOMException("OMBlob not initialised Properly");
- }
- try {
-
- outStream = new ObjectOutputStream(byteStream);
- outStream.writeObject(binaryObject);
- } catch (IOException e) {
- e.printStackTrace();
- }
- return byteStream;
- }
-
- public String getValue() throws OMException {
- throw new OMException("Blob returns objects only");
- }
-
- public DataHandler getDataHandler() throws Exception {
- if ((DH == null) & (binaryObject == null)) {
- DH = mimeParser.getDataHandler(cid);
- } else if (DH == null) {
- ByteArrayOutputStream out = (ByteArrayOutputStream) getStream();
- ByteArrayDataSource bads = new ByteArrayDataSource(out
- .toByteArray(), null);
- DH = new DataHandler(bads);
- }
-/*
- ManagedMemoryDataSource source = null;
- setMimeHeader(HTTPConstants.HEADER_CONTENT_TYPE, contentType);
- if (object instanceof String) {
- try {
- String s = (String) object;
- java.io.ByteArrayInputStream bais =
- new java.io.ByteArrayInputStream(s.getBytes());
- source = new ManagedMemoryDataSource(bais,
- ManagedMemoryDataSource.MAX_MEMORY_DISK_CACHED,
- contentType, true);
- extractFilename(source);
- datahandler = new DataHandler(source);
- contentObject = object;
- return;
- } catch (java.io.IOException io) {
- log.error(Messages.getMessage("javaIOException00"), io);
- throw new java.lang.IllegalArgumentException(
- Messages.getMessage("illegalArgumentException00"));
- }
- } else if (object instanceof java.io.InputStream) {
- try {
- source = new ManagedMemoryDataSource((java.io.InputStream) object,
- ManagedMemoryDataSource.MAX_MEMORY_DISK_CACHED,
- contentType, true);
- extractFilename(source);
- datahandler = new DataHandler(source);
- contentObject = null; // the stream has been consumed
- return;
- } catch (java.io.IOException io) {
- log.error(Messages.getMessage("javaIOException00"), io);
- throw new java.lang.IllegalArgumentException(Messages.getMessage
- ("illegalArgumentException00"));
- }
- } else if (object instanceof StreamSource) {
- try {
- source = new ManagedMemoryDataSource(((StreamSource)object).getInputStream(),
- ManagedMemoryDataSource.MAX_MEMORY_DISK_CACHED,
- contentType, true);
- extractFilename(source);
- datahandler = new DataHandler(source);
- contentObject = null; // the stream has been consumed
- return;
- } catch (java.io.IOException io) {
- log.error(Messages.getMessage("javaIOException00"), io);
- throw new java.lang.IllegalArgumentException(Messages.getMessage
- ("illegalArgumentException00"));
- }
- } else {
- throw new java.lang.IllegalArgumentException(
- Messages.getMessage("illegalArgumentException00"));
- }
- */
- return DH;
- }
+ public OMBlob(DataHandler DH) {
+ this.DH = DH;
+ // this.MTOMable = MTOMable;
+ }
+
+ public OMBlob(String cid, OMElement parent, MTOMBuilder mimeParser) {
+ super(parent);
+ this.cid = cid;
+ this.builder = mimeParser;
+ }
+
+ public java.io.OutputStream getStream() throws Exception {
+ if (DH == null) {
+ getDataHandler();
+ }
+ return DH.getOutputStream();
+ }
+
+ public String getValue() throws OMException {
+ throw new OMException(
+ "Blob contains Binary data. Returns Stream or Datahandler only");
+ }
+
+ public DataHandler getDataHandler() throws Exception {
+ if (DH == null) {
+ DH = builder.getDataHandler(cid);
+ }
+ return DH;
+ }
+
+ public short getType() throws OMException {
+ return OMNode.BLOB_NODE;
+ }
+
+ public boolean isComplete() {
+ return done;
+ }
+ // Decided to let user select whether to optimise or not only when he
+ // creates OMBlob
+ /*
+ * public void setMTOMable(boolean MTOMable) { this.MTOMable = MTOMable; }
+ *
+ * public boolean isMTOMable() { return MTOMable; }
+ */
+
+ // decided to provide only the Datahandler
+ /* public/*Serializable *//*
+ * Object getObject() throws Exception { if
+ * ((binaryObject == null) & (cid != null)) { if
+ * (DH == null) { getDataHandler(); } // /*
+ *
+ *
+ * javax.activation.DataSource ds =
+ * datahandler.getDataSource(); InputStream is =
+ * null; try { is = ds.getInputStream();; } catch
+ * (java.io.IOException io) {
+ * log.error(Messages.getMessage("javaIOException00"),
+ * io); throw new SOAPException(io); } if
+ * (ds.getContentType().equals("text/plain")) { try {
+ * byte[] bytes = new byte[is.available()];
+ * IOUtils.readFully(is, bytes); return new
+ * String(bytes); } catch (java.io.IOException io) {
+ * log.error(Messages.getMessage("javaIOException00"),
+ * io); throw new SOAPException(io); } } else if
+ * (ds.getContentType().equals("text/xml")) {
+ * return new StreamSource(is); } else if
+ * (ds.getContentType().equals("image/gif") ||
+ * ds.getContentType().equals("image/jpeg")) { try {
+ * return
+ * ImageIOFactory.getImageIO().loadImage(is); }
+ * catch (Exception ex) {
+ * log.error(Messages.getMessage("javaIOException00"),
+ * ex); throw new SOAPException(ex); } } return is; //
+ */
+ /*
+ * Object in = DH.getContent(); if (in instanceof InputStream) {
+ * ObjectInputStream ois = new ObjectInputStream((InputStream) in);
+ * binaryObject = ois.readObject(); } else binaryObject = in; return
+ * binaryObject; } else if ((binaryObject == null) & (cid == null)) { throw
+ * new MTOMException("OMBlob not initialised Properly"); } return
+ * binaryObject; }
+ */
- public short getType() throws OMException {
- return OMNode.BLOB_NODE;
- }
-
- public boolean isComplete() {
- return done;
- }
}
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/serialize/SimpleOMSerializer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/serialize/SimpleOMSerializer.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/serialize/SimpleOMSerializer.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/serialize/SimpleOMSerializer.java Wed Mar 9 18:59:17 2005
@@ -1,17 +1,22 @@
package org.apache.axis.impl.llom.serialize;
+import java.io.ByteArrayOutputStream;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
import org.apache.axis.encoding.Base64;
import org.apache.axis.impl.llom.OMAttributeImpl;
import org.apache.axis.impl.llom.OMNamespaceImpl;
import org.apache.axis.impl.llom.mtom.MTOMXMLStreamWriter;
import org.apache.axis.impl.llom.mtom.OMBlob;
-import org.apache.axis.om.*;
-
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-import java.io.ByteArrayOutputStream;
-import java.util.Iterator;
-import java.util.Vector;
+import org.apache.axis.om.OMAttribute;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMNode;
+import org.apache.axis.om.OMText;
/**
* Copyright 2001-2004 The Apache Software Foundation.
@@ -124,7 +129,7 @@
protected void serializeBlob(OMBlob blob, XMLStreamWriter xmlWriter)
throws XMLStreamException {
- if (xmlWriter instanceof MTOMXMLStreamWriter & blob.isMTOMable()) {
+ if (xmlWriter instanceof MTOMXMLStreamWriter) {
MTOMXMLStreamWriter writer = (MTOMXMLStreamWriter) xmlWriter;
OMNamespace ns = new OMNamespaceImpl("http://www.w3.org/2004/08/xop/Include", "xop");
String prefix = null;
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/serialize/StreamingOMSerializer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/serialize/StreamingOMSerializer.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/serialize/StreamingOMSerializer.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/serialize/StreamingOMSerializer.java Wed Mar 9 18:59:17 2005
@@ -1,10 +1,11 @@
package org.apache.axis.impl.llom.serialize;
+import java.util.Vector;
+
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
-import java.util.Vector;
/**
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/serialize/XMLSerilazer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/serialize/XMLSerilazer.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/serialize/XMLSerilazer.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/serialize/XMLSerilazer.java Wed Mar 9 18:59:17 2005
@@ -1,9 +1,9 @@
package org.apache.axis.impl.llom.serialize;
+import javax.xml.stream.XMLStreamReader;
+
import org.apache.axis.om.OMElement;
import org.apache.axis.om.StreamingWrapper;
-
-import javax.xml.stream.XMLStreamReader;
/**
* Copyright 2001-2004 The Apache Software Foundation.
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/traverse/OMChildrenIterator.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/traverse/OMChildrenIterator.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/traverse/OMChildrenIterator.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/traverse/OMChildrenIterator.java Wed Mar 9 18:59:17 2005
@@ -1,9 +1,9 @@
package org.apache.axis.impl.llom.traverse;
+import java.util.Iterator;
+
import org.apache.axis.om.OMException;
import org.apache.axis.om.OMNode;
-
-import java.util.Iterator;
/**
* Copyright 2001-2004 The Apache Software Foundation.
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/traverse/OMChildrenQNameIterator.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/traverse/OMChildrenQNameIterator.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/traverse/OMChildrenQNameIterator.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/traverse/OMChildrenQNameIterator.java Wed Mar 9 18:59:17 2005
@@ -1,9 +1,9 @@
package org.apache.axis.impl.llom.traverse;
+import javax.xml.namespace.QName;
+
import org.apache.axis.impl.llom.OMNamedNodeImpl;
import org.apache.axis.om.OMNode;
-
-import javax.xml.namespace.QName;
/**
* Copyright 2001-2004 The Apache Software Foundation.
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMElement.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMElement.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMElement.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMElement.java Wed Mar 9 18:59:17 2005
@@ -1,9 +1,10 @@
package org.apache.axis.om;
+import java.util.Iterator;
+
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamReader;
-import java.util.Iterator;
/**
* Copyright 2001-2004 The Apache Software Foundation.
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPFault.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPFault.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPFault.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPFault.java Wed Mar 9 18:59:17 2005
@@ -15,8 +15,9 @@
package org.apache.axis.om;
-import javax.xml.namespace.QName;
import java.util.Locale;
+
+import javax.xml.namespace.QName;
/**
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/StreamingWrapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/StreamingWrapper.java?view=diff&r1=156731&r2=156732
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/StreamingWrapper.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/StreamingWrapper.java Wed Mar 9 18:59:17 2005
@@ -1,8 +1,8 @@
package org.apache.axis.om;
-import org.apache.axis.impl.llom.exception.OMStreamingException;
-
import javax.xml.namespace.QName;
+
+import org.apache.axis.impl.llom.exception.OMStreamingException;
/**