You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2012/08/04 14:34:32 UTC
svn commit: r1369305 - in /webservices/axiom/branches/AXIOM-201: ./
modules/axiom-all/ modules/axiom-api/
modules/axiom-api/src/main/java/org/apache/axiom/om/
modules/axiom-api/src/main/java/org/apache/axiom/om/ds/
modules/axiom-api/src/main/java/org/a...
Author: veithen
Date: Sat Aug 4 12:34:29 2012
New Revision: 1369305
URL: http://svn.apache.org/viewvc?rev=1369305&view=rev
Log:
Merged latest changes from trunk.
Added:
webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/xop/XOPDecodingStreamWriter.java
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/xop/XOPDecodingStreamWriter.java
webservices/axiom/branches/AXIOM-201/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/DOMNamespaceContext.java
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/DOMNamespaceContext.java
webservices/axiom/branches/AXIOM-201/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/DOMUtils.java
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/DOMUtils.java
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/ (props changed)
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/pom.xml
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/pom.xml
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/main/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/main/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/main/java/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/main/java/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/main/java/org/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/main/java/org/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/main/java/org/apache/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/main/java/org/apache/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/main/java/org/apache/axiom/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/main/java/org/apache/axiom/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/main/java/org/apache/axiom/om/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/main/java/org/apache/axiom/om/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/main/java/org/apache/axiom/om/ds/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/main/java/org/apache/axiom/om/ds/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/main/java/org/apache/axiom/om/ds/jaxb/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/main/java/org/apache/axiom/om/ds/jaxb/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/main/java/org/apache/axiom/om/ds/jaxb/AttachmentMarshallerBase.java
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/main/java/org/apache/axiom/om/ds/jaxb/AttachmentMarshallerBase.java
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/main/java/org/apache/axiom/om/ds/jaxb/DataHandlerWriterAttachmentMarshaller.java
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/main/java/org/apache/axiom/om/ds/jaxb/DataHandlerWriterAttachmentMarshaller.java
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/main/java/org/apache/axiom/om/ds/jaxb/JAXBOMDataSource.java
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/main/java/org/apache/axiom/om/ds/jaxb/JAXBOMDataSource.java
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/main/java/org/apache/axiom/om/ds/jaxb/MTOMXMLStreamWriterAttachmentMarshaller.java
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/main/java/org/apache/axiom/om/ds/jaxb/MTOMXMLStreamWriterAttachmentMarshaller.java
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/main/java/org/apache/axiom/om/util/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/main/java/org/apache/axiom/om/util/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/main/java/org/apache/axiom/om/util/jaxb/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/main/java/org/apache/axiom/om/util/jaxb/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/main/java/org/apache/axiom/om/util/jaxb/JAXBUtils.java
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/main/java/org/apache/axiom/om/util/jaxb/JAXBUtils.java
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/main/java/org/apache/axiom/util/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/main/java/org/apache/axiom/util/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/main/java/org/apache/axiom/util/jaxb/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/main/java/org/apache/axiom/util/jaxb/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/main/java/org/apache/axiom/util/jaxb/AttachmentUnmarshallerImpl.java
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/main/java/org/apache/axiom/util/jaxb/AttachmentUnmarshallerImpl.java
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/main/java/org/apache/axiom/util/jaxb/JAXBUtils.java
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/main/java/org/apache/axiom/util/jaxb/JAXBUtils.java
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/main/java/org/apache/axiom/util/jaxb/UnmarshallerAdapter.java
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/main/java/org/apache/axiom/util/jaxb/UnmarshallerAdapter.java
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/test/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/test/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/test/java/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/test/java/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/test/java/org/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/test/java/org/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/test/java/org/apache/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/test/java/org/apache/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/test/java/org/apache/axiom/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/test/java/org/apache/axiom/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/test/java/org/apache/axiom/om/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/test/java/org/apache/axiom/om/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/test/java/org/apache/axiom/om/ds/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/test/java/org/apache/axiom/om/ds/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/test/java/org/apache/axiom/om/ds/jaxb/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/test/java/org/apache/axiom/om/ds/jaxb/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/test/java/org/apache/axiom/om/ds/jaxb/ExceptionXMLStreamWriterWrapper.java
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/test/java/org/apache/axiom/om/ds/jaxb/ExceptionXMLStreamWriterWrapper.java
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/test/java/org/apache/axiom/om/ds/jaxb/JAXBOMDataSourceTest.java
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/test/java/org/apache/axiom/om/ds/jaxb/JAXBOMDataSourceTest.java
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/test/java/org/apache/axiom/om/ds/jaxb/beans/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/test/java/org/apache/axiom/om/ds/jaxb/beans/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/test/java/org/apache/axiom/om/ds/jaxb/beans/DocumentBean.java
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/test/java/org/apache/axiom/om/ds/jaxb/beans/DocumentBean.java
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/test/java/org/apache/axiom/om/ds/jaxb/beans/MyBean.java
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/test/java/org/apache/axiom/om/ds/jaxb/beans/MyBean.java
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/test/java/org/apache/axiom/om/ds/jaxb/beans/package-info.java
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/test/java/org/apache/axiom/om/ds/jaxb/beans/package-info.java
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/test/java/org/apache/axiom/om/util/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/test/java/org/apache/axiom/om/util/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/test/java/org/apache/axiom/om/util/jaxb/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/test/java/org/apache/axiom/om/util/jaxb/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/test/java/org/apache/axiom/om/util/jaxb/JAXBUtilsTest.java
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/test/java/org/apache/axiom/om/util/jaxb/JAXBUtilsTest.java
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/test/schemas/
- copied from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/test/schemas/
webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/src/test/schemas/identity.xsd
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-jaxb/src/test/schemas/identity.xsd
webservices/axiom/branches/AXIOM-201/modules/axiom-osgi-tests/src/test/java/org/apache/axiom/test/DummyBean.java
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/src/test/java/org/apache/axiom/test/DummyBean.java
webservices/axiom/branches/AXIOM-201/modules/axiom-osgi-tests/src/test/java/org/apache/axiom/test/JAXBTest.java
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/src/test/java/org/apache/axiom/test/JAXBTest.java
webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/BuilderFactory.java
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/BuilderFactory.java
webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/body/TestGetFaultFakeFault.java
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/body/TestGetFaultFakeFault.java
webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/body/TestGetFaultWithParserNoFault.java
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/body/TestGetFaultWithParserNoFault.java
webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/body/TestHasFaultFakeFault.java
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/body/TestHasFaultFakeFault.java
webservices/axiom/branches/AXIOM-201/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/stax/Normalizer.java
- copied unchanged from r1369303, webservices/commons/trunk/modules/axiom/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/stax/Normalizer.java
Modified:
webservices/axiom/branches/AXIOM-201/ (props changed)
webservices/axiom/branches/AXIOM-201/modules/axiom-all/pom.xml
webservices/axiom/branches/AXIOM-201/modules/axiom-api/pom.xml
webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/om/OMDataSource.java
webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/om/OMSerializable.java
webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/AbstractPushOMDataSource.java
webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java
webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java
webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/AbstractXMLStreamReader.java
webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamWriterUtils.java
webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/xop/XOPEncodedStream.java
webservices/axiom/branches/AXIOM-201/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java
webservices/axiom/branches/AXIOM-201/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/DOMXMLStreamReader.java
webservices/axiom/branches/AXIOM-201/modules/axiom-dom/pom.xml
webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPBodyImpl.java
webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java
webservices/axiom/branches/AXIOM-201/modules/axiom-impl/pom.xml
webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPBodyImpl.java
webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java
webservices/axiom/branches/AXIOM-201/modules/axiom-integration/pom.xml
webservices/axiom/branches/AXIOM-201/modules/axiom-osgi-tests/pom.xml
webservices/axiom/branches/AXIOM-201/modules/axiom-parent/pom.xml
webservices/axiom/branches/AXIOM-201/modules/axiom-samples/pom.xml
webservices/axiom/branches/AXIOM-201/modules/axiom-tests/pom.xml
webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestCase.java
webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMContainerFactory.java
webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetXMLStreamReader.java
webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
webservices/axiom/branches/AXIOM-201/modules/axiom-testutils/pom.xml
webservices/axiom/branches/AXIOM-201/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/stax/XMLStreamReaderComparator.java
webservices/axiom/branches/AXIOM-201/pom.xml
Propchange: webservices/axiom/branches/AXIOM-201/
------------------------------------------------------------------------------
Merged /webservices/axiom/branches/JAXB2_DS:r1366463-1367737
Merged /webservices/commons/trunk/modules/axiom:r1366209-1369303
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-all/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-all/pom.xml?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-all/pom.xml (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-all/pom.xml Sat Aug 4 12:34:29 2012
@@ -55,6 +55,11 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>axiom-compat</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>axiom-c14n</artifactId>
<version>${project.version}</version>
</dependency>
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-api/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-api/pom.xml?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-api/pom.xml (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-api/pom.xml Sat Aug 4 12:34:29 2012
@@ -96,7 +96,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
<scope>test</scope>
</dependency>
<dependency>
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/om/OMDataSource.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/om/OMDataSource.java?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/om/OMDataSource.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/om/OMDataSource.java Sat Aug 4 12:34:29 2012
@@ -22,10 +22,18 @@
*/
package org.apache.axiom.om;
+import javax.activation.DataHandler;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
+import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider;
+import org.apache.axiom.ext.stax.datahandler.DataHandlerWriter;
+import org.apache.axiom.om.ds.AbstractPushOMDataSource;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
+import org.apache.axiom.util.stax.XMLStreamWriterUtils;
+import org.apache.axiom.util.stax.xop.XOPDecodingStreamWriter;
+
import java.io.OutputStream;
import java.io.Writer;
@@ -103,6 +111,42 @@ public interface OMDataSource {
* it MUST generate namespace declarations of the form <tt>xmlns=""</tt> in the appropriate
* locations. In addition it MAY use the namespace context information to minimize the number of
* generated namespace declarations (by reusing already bound prefixes).
+ * <li>If the implementation produces base64 binary data (that could be optimized using
+ * XOP/MTOM), then it SHOULD use
+ * {@link XMLStreamWriterUtils#writeDataHandler(XMLStreamWriter, DataHandler, String, boolean)}
+ * or
+ * {@link XMLStreamWriterUtils#writeDataHandler(XMLStreamWriter, DataHandlerProvider, String, boolean)}
+ * to write the data to the stream. If this is not possible (e.g. because the content is
+ * produced by a third party library that is not aware of these APIs), then the implementation
+ * MUST use the following approach:
+ * <ul>
+ * <li>If the {@link XMLStreamWriter} is an {@link MTOMXMLStreamWriter}, then the implementation
+ * MAY use {@link MTOMXMLStreamWriter#prepareDataHandler(DataHandler)} and generate the
+ * necessary <tt>xop:Include</tt> elements itself. In this case, the implementation MAY use
+ * {@link MTOMXMLStreamWriter#isOptimized()} to check if XOP/MTOM is enabled at all.
+ * Alternatively, instead of handling {@link MTOMXMLStreamWriter} in a special way, the
+ * implementation MAY use the approach described in the next item. This works because
+ * {@link MTOMXMLStreamWriter} exposes the {@link DataHandlerWriter} extension. However, this
+ * causes a slight overhead because the stream is first XOP decoded and then reencoded again.
+ * <li>If the {@link XMLStreamWriter} exposes the {@link DataHandlerWriter} extension, but is
+ * not an {@link MTOMXMLStreamWriter} (or is an {@link MTOMXMLStreamWriter}, but the
+ * implementation doesn't implement the approach described in the previous item), then the
+ * implementation MUST wrap the {@link XMLStreamWriter} in an {@link XOPDecodingStreamWriter}
+ * and write <tt>xop:Include</tt> elements to that wrapper, so that they can be translated into
+ * appropriate calls to the {@link DataHandlerWriter}. This requirement is important for two
+ * reasons:
+ * <ul>
+ * <li>It allows Axiom to respect the contract of the
+ * {@link OMSerializable#serialize(XMLStreamWriter, boolean)} method.
+ * <li>If the {@link OMDataSource} is push-only (see {@link AbstractPushOMDataSource}), then it
+ * enables {@link OMSourcedElement} to create {@link OMText} nodes for the binary content in an
+ * efficient way.
+ * </ul>
+ * <li>In all other cases, the implementation MUST use
+ * {@link XMLStreamWriter#writeCharacters(String)} or
+ * {@link XMLStreamWriter#writeCharacters(char[], int, int)} to write the base64 encoded data to
+ * the stream.
+ * </ul>
* </ul>
* <p>
* On the other hand, the caller of this method (typically an {@link OMSourcedElement} instance)
@@ -123,7 +167,6 @@ public interface OMDataSource {
* destination writer
* @throws XMLStreamException
*/
- // TODO: specify how optimizable base64 binary data (MTOM) is handled
void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException;
/**
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/om/OMSerializable.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/om/OMSerializable.java?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/om/OMSerializable.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/om/OMSerializable.java Sat Aug 4 12:34:29 2012
@@ -22,6 +22,8 @@ package org.apache.axiom.om;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
+import org.apache.axiom.ext.stax.datahandler.DataHandlerWriter;
+
/**
* Information item that can be serialized (written to an XML stream writer) and
* deserialized (retrieved from an XML parser) as a unit.
@@ -79,10 +81,49 @@ public interface OMSerializable extends
void serializeAndConsume(XMLStreamWriter xmlWriter) throws XMLStreamException;
/**
- * Serializes the information item.
+ * Serializes the information item to the given {@link XMLStreamWriter}.
+ * <p>
+ * The implementation of this method must satisfy the following requirements:
+ * <ul>
+ * <li>If the writer exposes the {@link DataHandlerWriter} extension, then base64 binary data
+ * MUST be written using one of the methods defined by that extension. This will occur if the
+ * information item is an {@link OMText} node for which {@link OMText#isBinary()} returns
+ * <code>true</code> or if it is an {@link OMContainer} that has such an {@link OMText} node as
+ * descendant. If the writer doesn't expose the {@link DataHandlerWriter} extension, then the
+ * implementation MUST use {@link XMLStreamWriter#writeCharacters(String)} or
+ * {@link XMLStreamWriter#writeCharacters(char[], int, int)} to write the base64 encoded data to
+ * the stream.
+ * <li>The implementation MUST ensure that the produced XML is well formed with respect to
+ * namespaces, i.e. it MUST generate the required namespace declarations using
+ * {@link XMLStreamWriter#writeNamespace(String, String)} and
+ * {@link XMLStreamWriter#writeDefaultNamespace(String)}. This requirement is always applicable,
+ * even if the method is used to serialize a subtree or if the object model is not well formed
+ * with respect to namespaces. This means that the implementation is expected to implement
+ * namespace repairing and that the implementation MUST NOT assume that the
+ * {@link XMLStreamWriter} supplied by the caller performs any kind of namespace repairing.
+ * <li>The implementation MUST take into account the pre-existing namespace context, so that the
+ * caller can use this method to serialize the information item as part of a larger document.
+ * The implementation uses {@link XMLStreamWriter#getPrefix(String)} and/or
+ * {@link XMLStreamWriter#getNamespaceContext()} to query the pre-existing namespace context.
+ * </ul>
+ * <p>
+ * On the other hand, the caller of this method must ensure that the following requirements are
+ * satisfied:
+ * <ul>
+ * <li>The namespace context information provided by {@link XMLStreamWriter#getPrefix(String)}
+ * and {@link XMLStreamWriter#getNamespaceContext()} MUST accurately reflect the actual
+ * namespace context at the location in the output document where the information item is
+ * serialized. In practice this requirement means that if the caller writes content to the
+ * {@link XMLStreamWriter} before calling this method, then it must use
+ * {@link XMLStreamWriter#setPrefix(String, String)} and
+ * {@link XMLStreamWriter#setDefaultNamespace(String)} to update the namespace context. Note
+ * that this requirement may be relaxed if the caller implements some form of namespace
+ * repairing.
+ * </ul>
*
* @param xmlWriter
- * @param cache indicates if caching should be enabled
+ * @param cache
+ * indicates if caching should be enabled
* @throws XMLStreamException
*/
void serialize(XMLStreamWriter xmlWriter, boolean cache) throws XMLStreamException;
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/AbstractPushOMDataSource.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/AbstractPushOMDataSource.java?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/AbstractPushOMDataSource.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/AbstractPushOMDataSource.java Sat Aug 4 12:34:29 2012
@@ -25,6 +25,7 @@ import javax.xml.stream.XMLStreamExcepti
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
+import org.apache.axiom.om.OMDataSource;
import org.apache.axiom.om.OMDataSourceExt;
import org.apache.axiom.om.OMOutputFormat;
import org.apache.axiom.om.util.StAXUtils;
@@ -33,6 +34,13 @@ import org.apache.axiom.om.util.StAXUtil
* Base class for {@link OMDataSourceExt} implementations that can easily serialize the content to
* an {@link XMLStreamWriter} but that are unable to produce the content as an
* {@link XMLStreamReader}.
+ * <p>
+ * {@link OMSourcedElement} will handle {@link OMDataSource} implementations extending this class
+ * differently when it comes to expansion: instead of using {@link OMDataSource#getReader()} to
+ * expand the element, it will use {@link OMDataSource#serialize(XMLStreamWriter)} (with a special
+ * {@link XMLStreamWriter} that builds the descendants of the {@link OMSourcedElement}). This means
+ * that such an {@link OMSourcedElement} will be expanded instantly, and that deferred building of
+ * the descendants is not applicable.
*/
public abstract class AbstractPushOMDataSource extends AbstractOMDataSource {
public final boolean isDestructiveRead() {
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java Sat Aug 4 12:34:29 2012
@@ -352,14 +352,22 @@ public class MTOMXMLStreamWriter impleme
}
/**
- * @deprecated
- * Serialization code should use
+ * Check if MTOM is enabled.
+ * <p>
+ * Note that serialization code should use
* {@link XMLStreamWriterUtils#writeDataHandler(XMLStreamWriter, DataHandler, String, boolean)}
- * or {@link XMLStreamWriterUtils#writeDataHandler(XMLStreamWriter, org.apache.axiom.ext.stax.datahandler.DataHandlerProvider, String, boolean)}
- * to submit any binary content and let this writer decide whether the content should be
- * written as base64 encoded character data or using <tt>xop:Include</tt>.
- * This makes optimization entirely transparent for the caller and there should be no need
- * to check if the writer is producing MTOM.
+ * or
+ * {@link XMLStreamWriterUtils#writeDataHandler(XMLStreamWriter, DataHandlerProvider, String, boolean)}
+ * to submit any binary content and let this writer decide whether the content should be written
+ * as base64 encoded character data or using <tt>xop:Include</tt>. This makes optimization
+ * entirely transparent for the caller and there should be no need to check if the writer is
+ * producing MTOM. However, in some cases this is not possible, such as when integrating with
+ * 3rd party libraries. The serialization code should then use
+ * {@link #prepareDataHandler(DataHandler)} so that it can write <tt>xop:Include</tt> elements
+ * directly to the stream. In that case, the code may use the {@link #isOptimized()} method
+ * check if MTOM is enabled at all.
+ *
+ * @return <code>true</code> if MTOM is enabled, <code>false</code> otherwise
*/
public boolean isOptimized() {
return format.isOptimized();
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java Sat Aug 4 12:34:29 2012
@@ -331,8 +331,9 @@ public class StAXSOAPModelBuilder extend
} else if ((elementLevel == 3) &&
((OMElement)parent).getLocalName().equals(SOAPConstants.BODY_LOCAL_NAME) &&
- elementName.equals(SOAPConstants.BODY_FAULT_LOCAL_NAME)) {
- // this is a headerblock
+ elementName.equals(SOAPConstants.BODY_FAULT_LOCAL_NAME) &&
+ soapFactory.getSoapVersionURI().equals(parser.getNamespaceURI())) {
+ // this is a SOAP fault
element = soapFactory.createSOAPFault((SOAPBody) parent, this);
processNamespaceData(element, false);
processAttributes(element);
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/AbstractXMLStreamReader.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/AbstractXMLStreamReader.java?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/AbstractXMLStreamReader.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/AbstractXMLStreamReader.java Sat Aug 4 12:34:29 2012
@@ -83,6 +83,28 @@ public abstract class AbstractXMLStreamR
return getEventType() == CHARACTERS;
}
+ public boolean isWhiteSpace() {
+ switch (getEventType()) {
+ case SPACE:
+ return true;
+ case CHARACTERS:
+ // XMLStreamReader Javadoc says that isWhiteSpace "returns true if the cursor
+ // points to a character data event that consists of all whitespace". This
+ // means that this method may return true for a CHARACTER event and we need
+ // to scan the text of the node.
+ String text = getText();
+ for (int i=0; i<text.length(); i++) {
+ char c = text.charAt(i);
+ if (c != ' ' && c != '\t' && c != '\r' && c != '\n') {
+ return false;
+ }
+ }
+ return true;
+ default:
+ return false;
+ }
+ }
+
public boolean hasName() {
int event = getEventType();
return event == START_ELEMENT || event == END_ELEMENT;
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamWriterUtils.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamWriterUtils.java?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamWriterUtils.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamWriterUtils.java Sat Aug 4 12:34:29 2012
@@ -76,7 +76,7 @@ public class XMLStreamWriterUtils {
/**
* Get the {@link DataHandlerWriter} extension for a given {@link XMLStreamWriter}. If the
- * writer expose the extension, a reference to the extension interface implementation is
+ * writer exposes the extension, a reference to the extension interface implementation is
* returned. If the writer doesn't expose the extension, this method returns an instance of the
* extension interface that emulates the extension (by writing the binary data as base64
* character data to the stream).
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/xop/XOPEncodedStream.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/xop/XOPEncodedStream.java?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/xop/XOPEncodedStream.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/xop/XOPEncodedStream.java Sat Aug 4 12:34:29 2012
@@ -23,7 +23,7 @@ import javax.xml.stream.XMLStreamReader;
/**
* Represents an XOP encoded stream. Since an XOP message is a MIME package with
- * an main part in XML and a set of additional (binary) parts referenced from
+ * a root part in XML and a set of additional (binary) parts referenced from
* the main part, this class encapsulates an {@link XMLStreamReader}
* representing the main part and a {@link MimePartProvider} giving access to
* the attachments. Instances of this class can be obtained from
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java Sat Aug 4 12:34:29 2012
@@ -796,25 +796,7 @@ class SwitchingWrapper extends AbstractX
if (parser != null) {
return parser.isWhiteSpace();
} else {
- switch (currentEvent) {
- case SPACE:
- return true;
- case CHARACTERS:
- // XMLStreamReader Javadoc says that isWhiteSpace "returns true if the cursor
- // points to a character data event that consists of all whitespace". This
- // means that this method may return true for a CHARACTER event and we need
- // to scan the text of the node.
- String text = getTextFromNode();
- for (int i=0; i<text.length(); i++) {
- char c = text.charAt(i);
- if (c != ' ' && c != '\t' && c != '\r' && c != '\n') {
- return false;
- }
- }
- return true;
- default:
- return false;
- }
+ return super.isWhiteSpace();
}
}
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/DOMXMLStreamReader.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/DOMXMLStreamReader.java?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/DOMXMLStreamReader.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/DOMXMLStreamReader.java Sat Aug 4 12:34:29 2012
@@ -18,7 +18,6 @@
*/
package org.apache.axiom.om.impl.common.factory;
-import javax.xml.XMLConstants;
import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
@@ -28,9 +27,11 @@ import org.apache.axiom.util.stax.Abstra
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentType;
+import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.ProcessingInstruction;
+import org.w3c.dom.Text;
class DOMXMLStreamReader extends AbstractXMLStreamReader implements DTDReader {
private final Node root;
@@ -42,14 +43,19 @@ class DOMXMLStreamReader extends Abstrac
private Attr[] attributes = new Attr[8];
private int namespaceCount;
private Attr[] namespaces = new Attr[8];
+ private NamespaceContext nsContext;
- public DOMXMLStreamReader(Node node, boolean expandEntityReferences) {
+ DOMXMLStreamReader(Node node, boolean expandEntityReferences) {
root = node;
this.node = node;
this.expandEntityReferences = expandEntityReferences;
event = START_DOCUMENT;
}
+ Node currentNode() {
+ return node;
+ }
+
public Object getProperty(String name) throws IllegalArgumentException {
if (DTDReader.PROPERTY.equals(name)) {
return this;
@@ -58,6 +64,10 @@ class DOMXMLStreamReader extends Abstrac
}
}
+ public boolean hasNext() throws XMLStreamException {
+ return event != END_DOCUMENT;
+ }
+
public int next() throws XMLStreamException {
boolean forceTraverse = false;
while (true) {
@@ -89,15 +99,13 @@ class DOMXMLStreamReader extends Abstrac
event = DTD;
break;
case Node.ELEMENT_NODE:
- if (visited) {
- event = END_ELEMENT;
- } else {
- event = START_ELEMENT;
- attributesLoaded = false;
- }
+ event = visited? END_ELEMENT : START_ELEMENT;
+ // Namespace declarations can be queried on an END_ELEMENT event; always reset the
+ // attributesLoaded flag
+ attributesLoaded = false;
break;
case Node.TEXT_NODE:
- event = CHARACTERS;
+ event = ((Text)node).isElementContentWhitespace() ? SPACE : CHARACTERS;
break;
case Node.CDATA_SECTION_NODE:
event = CDATA;
@@ -130,7 +138,11 @@ class DOMXMLStreamReader extends Abstrac
}
public String getEncoding() {
- return ((Document)node).getInputEncoding();
+ if (event == START_DOCUMENT) {
+ return ((Document)node).getInputEncoding();
+ } else {
+ throw new IllegalStateException();
+ }
}
public String getVersion() {
@@ -138,7 +150,11 @@ class DOMXMLStreamReader extends Abstrac
}
public String getCharacterEncodingScheme() {
- return ((Document)node).getXmlEncoding();
+ if (event == START_DOCUMENT) {
+ return ((Document)node).getXmlEncoding();
+ } else {
+ throw new IllegalStateException();
+ }
}
public boolean isStandalone() {
@@ -170,11 +186,33 @@ class DOMXMLStreamReader extends Abstrac
}
public String getNamespaceURI() {
- return node.getNamespaceURI();
+ switch (event) {
+ case START_ELEMENT:
+ case END_ELEMENT:
+ return node.getNamespaceURI();
+ default:
+ throw new IllegalStateException();
+ }
}
public String getPrefix() {
- return node.getPrefix();
+ switch (event) {
+ case START_ELEMENT:
+ case END_ELEMENT:
+ return node.getPrefix();
+ default:
+ throw new IllegalStateException();
+ }
+ }
+
+ public QName getName() {
+ switch (event) {
+ case START_ELEMENT:
+ case END_ELEMENT:
+ return getQName(node);
+ default:
+ throw new IllegalStateException();
+ }
}
private Attr[] grow(Attr[] array) {
@@ -190,7 +228,7 @@ class DOMXMLStreamReader extends Abstrac
NamedNodeMap attrs = node.getAttributes();
for (int i=0, l=attrs.getLength(); i<l; i++) {
Attr attr = (Attr)attrs.item(i);
- if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(attr.getNamespaceURI())) {
+ if (DOMUtils.isNSDecl(attr)) {
if (namespaceCount == namespaces.length) {
namespaces = grow(namespaces);
}
@@ -207,103 +245,177 @@ class DOMXMLStreamReader extends Abstrac
}
public int getAttributeCount() {
- loadAttributes();
- return attributeCount;
+ if (event == START_ELEMENT) {
+ loadAttributes();
+ return attributeCount;
+ } else {
+ throw new IllegalStateException();
+ }
}
+ private Attr getAttribute(int index) {
+ if (event == START_ELEMENT) {
+ loadAttributes();
+ return attributes[index];
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
public String getAttributeLocalName(int index) {
- loadAttributes();
- return attributes[index].getLocalName();
+ return getAttribute(index).getLocalName();
}
public String getAttributeNamespace(int index) {
- loadAttributes();
- return attributes[index].getNamespaceURI();
+ return getAttribute(index).getNamespaceURI();
}
public String getAttributePrefix(int index) {
- loadAttributes();
- return attributes[index].getPrefix();
+ return getAttribute(index).getPrefix();
+ }
+
+ public QName getAttributeName(int index) {
+ return getQName(getAttribute(index));
}
public String getAttributeValue(int index) {
- loadAttributes();
- return attributes[index].getValue();
+ return getAttribute(index).getValue();
}
public String getAttributeType(int index) {
- return "CDATA";
+ if (event == START_ELEMENT) {
+ return "CDATA";
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public boolean isAttributeSpecified(int index) {
+ return getAttribute(index).getSpecified();
+ }
+
+ public String getAttributeValue(String namespaceURI, String localName) {
+ return ((Element)node).getAttributeNS(namespaceURI == null || namespaceURI.length() == 0 ? null : namespaceURI, localName);
}
public int getNamespaceCount() {
- loadAttributes();
- return namespaceCount;
+ switch (event) {
+ case START_ELEMENT:
+ case END_ELEMENT:
+ loadAttributes();
+ return namespaceCount;
+ default:
+ throw new IllegalStateException();
+ }
+ }
+
+ private Attr getNamespace(int index) {
+ switch (event) {
+ case START_ELEMENT:
+ case END_ELEMENT:
+ loadAttributes();
+ return namespaces[index];
+ default:
+ throw new IllegalStateException();
+ }
}
public String getNamespacePrefix(int index) {
- loadAttributes();
- Attr attr = namespaces[index];
- String prefix = attr.getPrefix();
- return prefix == null ? null : attr.getLocalName();
+ return DOMUtils.getNSDeclPrefix(getNamespace(index));
}
public String getNamespaceURI(int index) {
- loadAttributes();
- return namespaces[index].getValue();
+ return getNamespace(index).getValue();
}
+ private String internalGetText() {
+ switch (event) {
+ case CHARACTERS:
+ case SPACE:
+ case CDATA:
+ case COMMENT:
+ return node.getNodeValue();
+ case ENTITY_REFERENCE:
+ return null;
+ default:
+ throw new IllegalStateException();
+ }
+ }
+
public String getText() {
if (event == DTD) {
return ((DocumentType)node).getInternalSubset();
} else {
- return node.getNodeValue();
+ return internalGetText();
}
}
- public String getPITarget() {
- return ((ProcessingInstruction)node).getTarget();
- }
-
- public String getPIData() {
- return ((ProcessingInstruction)node).getData();
+ public int getTextStart() {
+ // Call internalGetText to throw an IllegalStateException if appropriate
+ internalGetText();
+ return 0;
}
- public void close() throws XMLStreamException {
- // TODO
- throw new UnsupportedOperationException();
+ public int getTextLength() {
+ return internalGetText().length();
}
- public QName getAttributeName(int arg0) {
- // TODO
- throw new UnsupportedOperationException();
+ public char[] getTextCharacters() {
+ return internalGetText().toCharArray();
}
- public String getAttributeValue(String arg0, String arg1) {
- // TODO
- throw new UnsupportedOperationException();
+ public String getPITarget() {
+ if (event == PROCESSING_INSTRUCTION) {
+ return ((ProcessingInstruction)node).getTarget();
+ } else {
+ throw new IllegalStateException();
+ }
}
- public String getElementText() throws XMLStreamException {
- // TODO
- throw new UnsupportedOperationException();
+ public String getPIData() {
+ if (event == PROCESSING_INSTRUCTION) {
+ return ((ProcessingInstruction)node).getData();
+ } else {
+ throw new IllegalStateException();
+ }
}
- public QName getName() {
- // TODO
- throw new UnsupportedOperationException();
+ public NamespaceContext getNamespaceContext() {
+ if (nsContext == null) {
+ nsContext = new DOMNamespaceContext(this);
+ }
+ return nsContext;
}
- public NamespaceContext getNamespaceContext() {
- // TODO
- throw new UnsupportedOperationException();
+ public String getNamespaceURI(String prefix) {
+ Node current = node;
+ do {
+ NamedNodeMap attributes = current.getAttributes();
+ if (attributes != null) {
+ for (int i=0, l=attributes.getLength(); i<l; i++) {
+ Attr attr = (Attr)attributes.item(i);
+ if (DOMUtils.isNSDecl(attr)) {
+ String candidatePrefix = DOMUtils.getNSDeclPrefix(attr);
+ if (candidatePrefix == null) {
+ candidatePrefix = "";
+ }
+ if (candidatePrefix.equals(prefix)) {
+ return attr.getValue();
+ }
+ }
+ }
+ }
+ current = current.getParentNode();
+ } while (current != null);
+ return null;
}
- public String getNamespaceURI(String arg0) {
+ public void close() throws XMLStreamException {
// TODO
throw new UnsupportedOperationException();
}
- public char[] getTextCharacters() {
+ public String getElementText() throws XMLStreamException {
// TODO
throw new UnsupportedOperationException();
}
@@ -314,33 +426,13 @@ class DOMXMLStreamReader extends Abstrac
throw new UnsupportedOperationException();
}
- public int getTextLength() {
- // TODO
- throw new UnsupportedOperationException();
- }
-
- public int getTextStart() {
- // TODO
- throw new UnsupportedOperationException();
- }
-
- public boolean hasNext() throws XMLStreamException {
- // TODO
- throw new UnsupportedOperationException();
- }
-
- public boolean isAttributeSpecified(int arg0) {
- // TODO
- throw new UnsupportedOperationException();
- }
-
- public boolean isWhiteSpace() {
- // TODO
- throw new UnsupportedOperationException();
- }
-
public boolean standaloneSet() {
// TODO
throw new UnsupportedOperationException();
}
+
+ private static QName getQName(Node node) {
+ String prefix = node.getPrefix();
+ return new QName(node.getNamespaceURI(), node.getLocalName(), prefix == null ? "" : prefix);
+ }
}
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-dom/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-dom/pom.xml?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-dom/pom.xml (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-dom/pom.xml Sat Aug 4 12:34:29 2012
@@ -113,7 +113,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
<scope>test</scope>
</dependency>
</dependencies>
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPBodyImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPBodyImpl.java?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPBodyImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPBodyImpl.java Sat Aug 4 12:34:29 2012
@@ -26,8 +26,6 @@ import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.om.impl.dom.ParentNode;
-import org.apache.axiom.soap.SOAP11Constants;
-import org.apache.axiom.soap.SOAP12Constants;
import org.apache.axiom.soap.SOAPBody;
import org.apache.axiom.soap.SOAPConstants;
import org.apache.axiom.soap.SOAPEnvelope;
@@ -67,16 +65,7 @@ public abstract class SOAPBodyImpl exten
* <code>SOAPBody</code> object; <code>false</code> otherwise
*/
public boolean hasFault() {
- OMElement element = getFirstElement();
- if (element != null
- && SOAPConstants.SOAPFAULT_LOCAL_NAME.equals(element.getLocalName())) {
- OMNamespace ns = element.getNamespace();
- return ns != null &&
- (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns.getNamespaceURI()) ||
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns.getNamespaceURI()));
- } else {
- return false;
- }
+ return getFirstElement() instanceof SOAPFault;
}
/**
@@ -86,19 +75,7 @@ public abstract class SOAPBodyImpl exten
*/
public SOAPFault getFault() {
OMElement element = getFirstElement();
- if (element != null
- && SOAPConstants.SOAPFAULT_LOCAL_NAME.equals(element.getLocalName())) {
- OMNamespace ns = element.getNamespace();
- if (ns != null &&
- (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns.getNamespaceURI()) ||
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns.getNamespaceURI()))) {
- return (SOAPFault) element;
- } else {
- return null;
- }
- } else {
- return null;
- }
+ return element instanceof SOAPFault ? (SOAPFault)element : null;
}
/**
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java Sat Aug 4 12:34:29 2012
@@ -24,6 +24,7 @@ import junit.framework.TestSuite;
import org.apache.axiom.om.impl.dom.factory.OMDOMMetaFactory;
import org.apache.axiom.ts.om.OMTestSuiteBuilder;
import org.apache.axiom.ts.om.builder.TestCreateOMBuilderFromDOMSource;
+import org.apache.axiom.ts.om.container.TestGetXMLStreamReader;
import org.apache.axiom.ts.om.container.TestSerialize;
import org.apache.axiom.ts.om.document.TestClone;
import org.apache.axiom.ts.om.document.TestDigest;
@@ -62,6 +63,9 @@ public class OMImplementationTest extend
// TODO
builder.exclude(TestSerializationWithTwoNonBuiltOMElements.class);
+ // TODO
+ builder.exclude(TestGetXMLStreamReader.class, "(&(source=dom)(|(file=entity-reference-external-subset.xml)(file=entity-reference-internal-subset.xml)))");
+
return builder.build();
}
}
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-impl/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-impl/pom.xml?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-impl/pom.xml (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-impl/pom.xml Sat Aug 4 12:34:29 2012
@@ -111,7 +111,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
<scope>test</scope>
</dependency>
</dependencies>
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPBodyImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPBodyImpl.java?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPBodyImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPBodyImpl.java Sat Aug 4 12:34:29 2012
@@ -107,19 +107,7 @@ public abstract class SOAPBodyImpl exten
*/
public SOAPFault getFault() {
OMElement element = getFirstElement();
- if (element != null
- && SOAPConstants.SOAPFAULT_LOCAL_NAME.equals(element.getLocalName())) {
- OMNamespace ns = element.getNamespace();
- if (ns != null &&
- (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns.getNamespaceURI()) ||
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns.getNamespaceURI()))) {
- return (SOAPFault) element;
- } else {
- return null;
- }
- } else {
- return null;
- }
+ return element instanceof SOAPFault ? (SOAPFault)element : null;
}
/**
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java Sat Aug 4 12:34:29 2012
@@ -24,6 +24,7 @@ import junit.framework.TestSuite;
import org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory;
import org.apache.axiom.ts.om.OMTestSuiteBuilder;
import org.apache.axiom.ts.om.builder.TestCreateOMBuilderFromDOMSource;
+import org.apache.axiom.ts.om.container.TestGetXMLStreamReader;
import org.apache.axiom.ts.om.container.TestSerialize;
import org.apache.axiom.ts.om.document.TestClone;
import org.apache.axiom.ts.om.document.TestDigest;
@@ -50,6 +51,9 @@ public class OMImplementationTest extend
// TODO: if there is a comment node surrounded by text, then these text nodes need to be merged
builder.exclude(TestDigest.class, "(|(file=digest3.xml)(file=digest4.xml))");
+ // TODO
+ builder.exclude(TestGetXMLStreamReader.class, "(&(source=dom)(|(file=entity-reference-external-subset.xml)(file=entity-reference-internal-subset.xml)))");
+
return builder.build();
}
}
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-integration/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-integration/pom.xml?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-integration/pom.xml (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-integration/pom.xml Sat Aug 4 12:34:29 2012
@@ -73,12 +73,10 @@
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
- <version>2.1.9</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
- <version>2.9.1</version>
</dependency>
<dependency>
<groupId>xalan</groupId>
Propchange: webservices/axiom/branches/AXIOM-201/modules/axiom-jaxb/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Aug 4 12:34:29 2012
@@ -0,0 +1,4 @@
+target
+.classpath
+.project
+.settings
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-osgi-tests/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-osgi-tests/pom.xml?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-osgi-tests/pom.xml (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-osgi-tests/pom.xml Sat Aug 4 12:34:29 2012
@@ -84,7 +84,13 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
- <dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axiom-jaxb</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>stax2-api</artifactId>
<version>3.0.1</version>
@@ -108,6 +114,19 @@
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>org.apache.servicemix.specs</groupId>
+ <artifactId>org.apache.servicemix.specs.jaxb-api-2.1</artifactId>
+ <version>2.0.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.bundles</groupId>
+ <artifactId>org.apache.servicemix.bundles.jaxb-impl</artifactId>
+ <version>2.1.13_2</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam</artifactId>
<version>${exam.version}</version>
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-parent/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-parent/pom.xml?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-parent/pom.xml (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-parent/pom.xml Sat Aug 4 12:34:29 2012
@@ -470,6 +470,31 @@
<artifactId>xercesImpl</artifactId>
<version>2.9.1</version>
</dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.2</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.xml.stream</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.activation</groupId>
+ <artifactId>activation</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.1.9</version>
+ </dependency>
</dependencies>
</dependencyManagement>
<distributionManagement>
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-samples/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-samples/pom.xml?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-samples/pom.xml (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-samples/pom.xml Sat Aug 4 12:34:29 2012
@@ -77,7 +77,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>2.0</version>
</dependency>
</dependencies>
<build>
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-tests/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-tests/pom.xml?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-tests/pom.xml (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-tests/pom.xml Sat Aug 4 12:34:29 2012
@@ -120,7 +120,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
<scope>test</scope>
</dependency>
</dependencies>
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestCase.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestCase.java?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestCase.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestCase.java Sat Aug 4 12:34:29 2012
@@ -30,7 +30,7 @@ import org.apache.axiom.util.stax.dialec
import org.apache.commons.io.output.NullOutputStream;
public abstract class AxiomTestCase extends TestCaseEx {
- protected static final StAXParserConfiguration TEST_PARSER_CONFIGURATION = new StAXParserConfiguration() {
+ public static final StAXParserConfiguration TEST_PARSER_CONFIGURATION = new StAXParserConfiguration() {
public XMLInputFactory configure(XMLInputFactory factory, StAXDialect dialect) {
// For the tests, preserve as much of the syntactic structure of the test documents
factory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.FALSE);
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java Sat Aug 4 12:34:29 2012
@@ -25,6 +25,7 @@ import javax.xml.namespace.QName;
import org.apache.axiom.om.OMMetaFactory;
import org.apache.axiom.testutils.conformance.ConformanceTestFile;
import org.apache.axiom.testutils.suite.TestSuiteBuilder;
+import org.apache.axiom.ts.om.container.BuilderFactory;
import org.apache.axiom.ts.om.container.OMContainerFactory;
import org.apache.axiom.ts.om.container.OMElementFactory;
import org.apache.axiom.ts.om.container.SerializationMethod;
@@ -36,6 +37,10 @@ import org.apache.axiom.ts.om.xpath.AXIO
import org.apache.axiom.ts.om.xpath.TestAXIOMXPath;
public class OMTestSuiteBuilder extends TestSuiteBuilder {
+ private static final BuilderFactory[] builderFactories = {
+ BuilderFactory.PARSER,
+ BuilderFactory.DOM };
+
private static final OMContainerFactory[] containerFactories = {
OMContainerFactory.DOCUMENT,
new OMElementFactory(false),
@@ -103,8 +108,11 @@ public class OMTestSuiteBuilder extends
ConformanceTestFile file = conformanceFiles[i];
for (int j=0; j<containerFactories.length; j++) {
OMContainerFactory cf = containerFactories[j];
- addTest(new org.apache.axiom.ts.om.container.TestGetXMLStreamReader(metaFactory, file, cf, true));
- addTest(new org.apache.axiom.ts.om.container.TestGetXMLStreamReader(metaFactory, file, cf, false));
+ for (int k=0; k<builderFactories.length; k++) {
+ BuilderFactory bf = builderFactories[k];
+ addTest(new org.apache.axiom.ts.om.container.TestGetXMLStreamReader(metaFactory, file, bf, cf, true));
+ addTest(new org.apache.axiom.ts.om.container.TestGetXMLStreamReader(metaFactory, file, bf, cf, false));
+ }
// On a document containing entity references, serialization tests will only work correctly if
// the entire document is serialized (so that the DTD is available)
if (!file.hasEntityReferences() || cf == OMContainerFactory.DOCUMENT) {
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMContainerFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMContainerFactory.java?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMContainerFactory.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMContainerFactory.java Sat Aug 4 12:34:29 2012
@@ -29,7 +29,7 @@ import org.apache.axiom.ts.AxiomTestCase
import org.xml.sax.InputSource;
/**
- * Prepares {@link OMContainer} instances from a test file.
+ * Extracts an {@link OMContainer} instance from a test file.
*/
public interface OMContainerFactory {
OMContainerFactory DOCUMENT = new OMContainerFactory() {
@@ -51,7 +51,33 @@ public interface OMContainerFactory {
};
void addTestProperties(AxiomTestCase testCase);
+
+ /**
+ * Prepare a control document that has the same content as the container returned by
+ * {@link #getContainer(OMXMLParserWrapper)}.
+ *
+ * @param testFileContent
+ * the content of the test file
+ * @return the {@link InputSource} for the control document
+ * @throws Exception
+ */
InputSource getControl(InputStream testFileContent) throws Exception;
+
+ /**
+ * Extract the {@link OMContainer} from the given test file.
+ *
+ * @param builder the builder for the test file
+ * @return the container
+ */
OMContainer getContainer(OMXMLParserWrapper builder);
+
+ /**
+ * Filter the given stream so that its content matches the content of the container returned by
+ * {@link #getContainer(OMXMLParserWrapper)}.
+ *
+ * @param reader
+ * the original stream reader representing the content of the test file
+ * @return the filtered stream reader
+ */
XMLStreamReader filter(XMLStreamReader reader);
}
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetXMLStreamReader.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetXMLStreamReader.java?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetXMLStreamReader.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetXMLStreamReader.java Sat Aug 4 12:34:29 2012
@@ -36,13 +36,17 @@ import org.xml.sax.InputSource;
* native StAX parser.
*/
public class TestGetXMLStreamReader extends ConformanceTestCase {
+ private final BuilderFactory builderFactory;
private final OMContainerFactory containerFactory;
private final boolean cache;
- public TestGetXMLStreamReader(OMMetaFactory metaFactory, ConformanceTestFile file, OMContainerFactory containerFactory, boolean cache) {
+ public TestGetXMLStreamReader(OMMetaFactory metaFactory, ConformanceTestFile file,
+ BuilderFactory builderFactory, OMContainerFactory containerFactory, boolean cache) {
super(metaFactory, file);
+ this.builderFactory = builderFactory;
this.containerFactory = containerFactory;
this.cache = cache;
+ builderFactory.addTestProperties(this);
containerFactory.addTestProperties(this);
addTestProperty("cache", Boolean.toString(cache));
}
@@ -52,8 +56,7 @@ public class TestGetXMLStreamReader exte
try {
XMLStreamReader expected = StAXUtils.createXMLStreamReader(TEST_PARSER_CONFIGURATION, file.getUrl().toString(), in);
try {
- OMXMLParserWrapper builder = metaFactory.createOMBuilder(metaFactory.getOMFactory(),
- TEST_PARSER_CONFIGURATION, new InputSource(file.getUrl().toString()));
+ OMXMLParserWrapper builder = builderFactory.getBuilder(metaFactory, new InputSource(file.getUrl().toString()));
try {
XMLStreamReader actual = containerFactory.getContainer(builder).getXMLStreamReader(cache);
new XMLStreamReaderComparator(containerFactory.filter(expected), containerFactory.filter(actual)).compare();
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java Sat Aug 4 12:34:29 2012
@@ -77,6 +77,7 @@ public class SOAPTestSuiteBuilder extend
addTest(new org.apache.axiom.ts.soap.body.TestAddFault1(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.body.TestAddFault2(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.body.TestGetFault(metaFactory, spec));
+ addTest(new org.apache.axiom.ts.soap.body.TestGetFaultFakeFault(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.body.TestGetFaultWithParser(metaFactory, spec));
for (int i=0; i<generalQNames.length; i++) {
QName qname = generalQNames[i];
@@ -88,6 +89,7 @@ public class SOAPTestSuiteBuilder extend
for (int i=0; i<noFaultQNames.length; i++) {
QName qname = noFaultQNames[i];
addTest(new org.apache.axiom.ts.soap.body.TestGetFaultNoFault(metaFactory, spec, qname));
+ addTest(new org.apache.axiom.ts.soap.body.TestGetFaultWithParserNoFault(metaFactory, spec, qname));
addTest(new org.apache.axiom.ts.soap.body.TestHasFaultNoFault(metaFactory, spec, qname));
addTest(new org.apache.axiom.ts.soap.body.TestHasFaultWithParserNoFault(metaFactory, spec,
qname, supportsBodyElementNameOptimization));
@@ -96,6 +98,7 @@ public class SOAPTestSuiteBuilder extend
addTest(new org.apache.axiom.ts.soap.body.TestGetFirstElementNSEmptyBody(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.body.TestHasFault(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.body.TestHasFaultAfterReplace(metaFactory, spec));
+ addTest(new org.apache.axiom.ts.soap.body.TestHasFaultFakeFault(metaFactory, spec));
if (supportsOMSourcedElement) {
addTest(new org.apache.axiom.ts.soap.body.TestHasFaultWithOMSEUnknownName(metaFactory, spec));
}
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-testutils/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-testutils/pom.xml?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-testutils/pom.xml (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-testutils/pom.xml Sat Aug 4 12:34:29 2012
@@ -50,7 +50,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
</dependency>
<dependency>
<groupId>${stax.impl.groupid}</groupId>
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/stax/XMLStreamReaderComparator.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/stax/XMLStreamReaderComparator.java?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/stax/XMLStreamReaderComparator.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/stax/XMLStreamReaderComparator.java Sat Aug 4 12:34:29 2012
@@ -21,7 +21,6 @@ package org.apache.axiom.testutils.stax;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
-import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -45,8 +44,6 @@ import junit.framework.Assert;
* (return values or exceptions thrown) of these invocations are compared to each other.
*/
public class XMLStreamReaderComparator extends Assert {
- private static final Map noPrefixValueMap = Collections.singletonMap("", null);
-
private final XMLStreamReader expected;
private final XMLStreamReader actual;
private final LinkedList path = new LinkedList();
@@ -117,7 +114,8 @@ public class XMLStreamReaderComparator e
expectedException.getClass().getName() +
", but the method returned normally (" + getLocation() + ")");
} else {
- assertEquals(expectedException.getClass(), actualException.getClass());
+ assertEquals("Unexpected exception thrown by " + methodName,
+ expectedException.getClass(), actualException.getClass());
}
}
return null;
@@ -128,21 +126,12 @@ public class XMLStreamReaderComparator e
}
private Object assertSameResult(String methodName, Class[] paramTypes, Object[] args,
- Map valueMap) throws Exception {
+ Normalizer normalizer) throws Exception {
Object[] results = invoke(methodName, paramTypes, args);
if (results != null) {
- Object expected = results[0];
- Object actual = results[1];
- if (valueMap != null) {
- // Attention! The value in the map can be null
- if (valueMap.containsKey(expected)) {
- expected = valueMap.get(expected);
- }
- if (valueMap.containsKey(actual)) {
- actual = valueMap.get(actual);
- }
- }
+ Object expected = normalizer.normalize(results[0]);
+ Object actual = normalizer.normalize(results[1]);
assertEquals("Return value of " + methodName + " for arguments " +
Arrays.asList(args) + " (" + getLocation() + ")",
expected, actual);
@@ -153,15 +142,15 @@ public class XMLStreamReaderComparator e
}
private Object assertSameResult(String methodName, Class[] paramTypes, Object[] args) throws Exception {
- return assertSameResult(methodName, paramTypes, args, null);
+ return assertSameResult(methodName, paramTypes, args, Normalizer.IDENTITY);
}
- private Object assertSameResult(String methodName, Map valueMap) throws Exception {
- return assertSameResult(methodName, new Class[0], new Object[0], valueMap);
+ private Object assertSameResult(String methodName, Normalizer normalizer) throws Exception {
+ return assertSameResult(methodName, new Class[0], new Object[0], normalizer);
}
private Object assertSameResult(String methodName) throws Exception {
- return assertSameResult(methodName, null);
+ return assertSameResult(methodName, Normalizer.IDENTITY);
}
private Set toPrefixSet(Iterator it) {
@@ -215,7 +204,7 @@ public class XMLStreamReaderComparator e
path.addLast(expected.getName());
}
assertSameResult("getCharacterEncodingScheme");
- assertSameResult("getEncoding");
+ assertSameResult("getEncoding", Normalizer.LOWER_CASE);
Integer attributeCount = (Integer)assertSameResult("getAttributeCount");
// Test the behavior of the getAttributeXxx methods for all types of events,
// to check that an appropriate exception is thrown for events other than
@@ -226,7 +215,7 @@ public class XMLStreamReaderComparator e
assertSameResult("getAttributeLocalName", paramTypes, args);
assertSameResult("getAttributeName", paramTypes, args);
namespaceURIs.add(assertSameResult("getAttributeNamespace", paramTypes, args));
- prefixes.add(assertSameResult("getAttributePrefix", paramTypes, args, noPrefixValueMap));
+ prefixes.add(assertSameResult("getAttributePrefix", paramTypes, args, Normalizer.EMPTY_STRING_TO_NULL));
assertSameResult("getAttributeType", paramTypes, args);
assertSameResult("getAttributeValue", paramTypes, args);
assertSameResult("isAttributeSpecified", paramTypes, args);
@@ -266,7 +255,7 @@ public class XMLStreamReaderComparator e
assertSameResult("getPIData");
assertSameResult("getPITarget");
prefixes.add(assertSameResult("getPrefix"));
- assertSameResult("getText");
+ assertSameResult("getText", eventType == XMLStreamReader.DTD ? Normalizer.DTD : Normalizer.IDENTITY);
Integer textLength = (Integer)assertSameResult("getTextLength");
Object[] textStart = invoke("getTextStart");
Object[] textCharacters = invoke("getTextCharacters");
Modified: webservices/axiom/branches/AXIOM-201/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/pom.xml?rev=1369305&r1=1369304&r2=1369305&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/pom.xml (original)
+++ webservices/axiom/branches/AXIOM-201/pom.xml Sat Aug 4 12:34:29 2012
@@ -534,6 +534,7 @@
<module>modules/axiom-impl</module>
<module>modules/axiom-dom</module>
<module>modules/axiom-compat</module>
+ <module>modules/axiom-jaxb</module>
<module>modules/axiom-c14n</module>
<module>modules/axiom-tests</module>
<module>modules/axiom-osgi-tests</module>