You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by Davanum Srinivas <da...@gmail.com> on 2008/04/15 15:55:46 UTC
Axis2 build break (Re: svn commit: r648212 - in /webservices/commons/trunk/modules/axiom:
modules/axiom-api/src/main/java/org/apache/axiom/om/impl/ target-eclipse/
target-eclipse/classes/ target-eclipse/test-classes/)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jochen,
Looks like this change broke axis2 builds :(
- -- dims
jochen@apache.org wrote:
| Author: jochen
| Date: Tue Apr 15 04:30:30 2008
| New Revision: 648212
|
| URL: http://svn.apache.org/viewvc?rev=648212&view=rev
| Log:
| Opened the MTOMXMLStreamWriter for processing of attachments without OMText instances.
|
| Added:
|
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/DefaultMTOMAttachment.java
(with props)
|
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMAttachment.java
(with props)
| webservices/commons/trunk/modules/axiom/target-eclipse/
| webservices/commons/trunk/modules/axiom/target-eclipse/classes/
| webservices/commons/trunk/modules/axiom/target-eclipse/test-classes/
| Modified:
| webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java
|
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java
|
| Added:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/DefaultMTOMAttachment.java
| URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/DefaultMTOMAttachment.java?rev=648212&view=auto
| ==============================================================================
| ---
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/DefaultMTOMAttachment.java
(added)
| +++
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/DefaultMTOMAttachment.java
Tue Apr 15 04:30:30 2008
| @@ -0,0 +1,28 @@
| +package org.apache.axiom.om.impl;
| +
| +import javax.activation.DataHandler;
| +
| +
| +/**
| + * Default implementation of {@link MTOMAttachment}.
| + */
| +public class DefaultMTOMAttachment implements MTOMAttachment {
| + private final String id;
| + private final DataHandler dataHandler;
| +
| + /**
| + * Creates a new instance with the given data and content ID.
| + */
| + public DefaultMTOMAttachment(DataHandler pDataHandler, String pId) {
| + dataHandler = pDataHandler;
| + id = pId;
| + }
| +
| + public String getContentID() {
| + return id;
| + }
| +
| + public DataHandler getDataHandler() {
| + return dataHandler;
| + }
| +}
|
| Propchange:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/DefaultMTOMAttachment.java
| ------------------------------------------------------------------------------
| svn:mime-type = text/plain
|
| Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java
| URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java?rev=648212&r1=648211&r2=648212&view=diff
| ==============================================================================
| ---
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java
(original)
| +++
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java
Tue Apr 15 04:30:30 2008
| @@ -94,10 +94,24 @@
| // text nodes int the binary node list)
| Iterator binaryNodeIterator = binaryNodeList.iterator();
| while (binaryNodeIterator.hasNext()) {
| - OMText binaryNode = (OMText) binaryNodeIterator.next();
| - writeBodyPart(outStream, createMimeBodyPart(binaryNode
| - .getContentID(), (DataHandler) binaryNode
| - .getDataHandler()), boundary);
| + Object o = binaryNodeIterator.next();
| + /* Upwards compatibiliy: Should be an instance of
| + * MTOMAttachment, if the user calls us via
| + * {@link MTOMXMLStreamWriter#writeOptimized(OMText)},
| + * or {@link MTOMXMLStreamWriter#writeOptimized(MTOMAttachment)}.
| + * However, this is a public method and possibly someone
| + * invokes us directly.
| + */
| + final MTOMAttachment attachment;
| + if (o instanceof OMText) {
| + final OMText omText = (OMText) o;
| + attachment = new DefaultMTOMAttachment((DataHandler) omText.getDataHandler(), omText.getContentID());
| + } else {
| + attachment = (MTOMAttachment) o;
| + }
| + writeBodyPart(outStream, createMimeBodyPart(attachment
| + .getContentID(), attachment.getDataHandler()),
| + boundary);
| }
| finishWritingMime(outStream);
| outStream.flush();
|
| Added:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMAttachment.java
| URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMAttachment.java?rev=648212&view=auto
| ==============================================================================
| ---
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMAttachment.java (added)
| +++
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMAttachment.java Tue
Apr 15 04:30:30 2008
| @@ -0,0 +1,20 @@
| +package org.apache.axiom.om.impl;
| +
| +import javax.activation.DataHandler;
| +
| +
| +/**
| + * Interface of an MTOM attachment, as processed by
| + * {@link MTOMXMLStreamWriter#writeOptimized(org.apache.axiom.om.OMText)}
| + * and {@link MIMEOutputUtils#complete(java.io.OutputStream, java.io.StringWriter, java.util.LinkedList, String,
String, String, String)}.
| + */
| +public interface MTOMAttachment {
| + /**
| + * Returns the attachments ID.
| + */
| + String getContentID();
| + /**
| + * Returns the attachments contents.
| + */
| + DataHandler getDataHandler();
| +}
|
| Propchange:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMAttachment.java
| ------------------------------------------------------------------------------
| svn:mime-type = text/plain
|
| Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java
| URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java?rev=648212&r1=648211&r2=648212&view=diff
| ==============================================================================
| ---
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java
(original)
| +++
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java
Tue Apr 15 04:30:30 2008
| @@ -273,32 +273,46 @@
| return format.getContentType();
| }
|
| - public void writeOptimized(OMText node) {
| - if(log.isDebugEnabled()){
| - log.debug("Start MTOMXMLStreamWriter.writeOptimized()");
| - }
| - DataHandler dh = (DataHandler)node.getDataHandler();
| - int optimized = UNSUPPORTED;
| - if(dh!=null){
| + private boolean isAttachmentPossible(DataHandler pDataHandler) {
| + if (pDataHandler != null) {
| if(log.isDebugEnabled()){
| log.debug("DataHandler fetched, starting optimized Threshold processing");
| }
| - optimized= BufferUtils.doesDataHandlerExceedLimit(dh, format.getOptimizedThreshold());
| + int optimized = BufferUtils.doesDataHandlerExceedLimit(pDataHandler, format.getOptimizedThreshold());
| + return optimized != UNSUPPORTED && optimized != EXCEED_LIMIT;
| }
| - if(optimized == UNSUPPORTED || optimized == EXCEED_LIMIT){
| - if(log.isDebugEnabled()){
| - log.debug("node added to binart NodeList for optimization");
| - }
| - binaryNodeList.add(node);
| + return false;
| + }
| +
| + public void writeOptimized(MTOMAttachment attachment) {
| + if (log.isDebugEnabled()){
| + log.debug("Start MTOMXMLStreamWriter.writeOptimized()");
| + }
| + if (isAttachmentPossible(attachment.getDataHandler())) {
| + binaryNodeList.add(attachment);
| + } else {
| + throw new RuntimeException("Unable to inline an attachment.");
| + }
| + if (log.isDebugEnabled()){
| + log.debug("Exit MTOMXMLStreamWriter.writeOptimized()");
| + }
| + }
| +
| + public void writeOptimized(OMText node) {
| + if (log.isDebugEnabled()){
| + log.debug("Start MTOMXMLStreamWriter.writeOptimized()");
| }
| - else{
| + final DataHandler dh = (DataHandler) node.getDataHandler();
| + if (isAttachmentPossible(dh)) {
| + binaryNodeList.add(new DefaultMTOMAttachment(dh, node.getContentID()));
| + } else {
| try{
| writeOutput(node);
| - }catch(XMLStreamException e){
| + } catch(XMLStreamException e) {
| throw new RuntimeException("XMLStreamException in writeOutput() call", e);
| }
| }
| - if(log.isDebugEnabled()){
| + if (log.isDebugEnabled()){
| log.debug("Exit MTOMXMLStreamWriter.writeOptimized()");
| }
| }
|
|
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
| For additional commands, e-mail: commons-dev-help@ws.apache.org
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
iD8DBQFIBLPigNg6eWEDv1kRAqKDAKDaEoh0GMr/yEtY0FGZVnY5sqmNtwCg5k0G
je/h+kuZ8tw4z9PVDgAaNxQ=
=A/s3
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org