org.jboss.soa.esb.actions.soap.attachment
Class XmlDataContentHandler

java.lang.Object
  extended by org.jboss.soa.esb.actions.soap.attachment.XmlDataContentHandler
All Implemented Interfaces:
javax.activation.DataContentHandler

public class XmlDataContentHandler
extends java.lang.Object
implements javax.activation.DataContentHandler

XmlDataContentHandler is a JAF content handler that provides marchalling/unmarshalling between a StreamSource and a generic stream.

Author:
Jason T. Greene

Constructor Summary
XmlDataContentHandler()
           
 
Method Summary
 java.lang.Object getContent(javax.activation.DataSource ds)
          Returns a StreamSource from the specified data source.
 java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor df, javax.activation.DataSource ds)
          Returns a StreamSource from the specified data source.
 java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
          Returns the acceptable data flavors that this content handler supports.
 void writeTo(java.lang.Object obj, java.lang.String mimeType, java.io.OutputStream os)
          Writes the passed in StreamSource object using the specified mime type to the specified output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlDataContentHandler

public XmlDataContentHandler()
Method Detail

getContent

public java.lang.Object getContent(javax.activation.DataSource ds)
                            throws java.io.IOException
Returns a StreamSource from the specified data source.

Specified by:
getContent in interface javax.activation.DataContentHandler
Parameters:
ds - the activation datasource
Returns:
an XML stream source
Throws:
java.io.IOException

getTransferData

public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor df,
                                        javax.activation.DataSource ds)
                                 throws java.awt.datatransfer.UnsupportedFlavorException,
                                        java.io.IOException
Returns a StreamSource from the specified data source. The flavor must be one of the ones returned by getTransferDataFlavors().

Specified by:
getTransferData in interface javax.activation.DataContentHandler
Parameters:
df - the flavor specifiying the mime type of ds
ds - the activation data source
Returns:
an XML stream source
Throws:
java.awt.datatransfer.UnsupportedFlavorException
java.io.IOException

getTransferDataFlavors

public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
Returns the acceptable data flavors that this content handler supports.

Specified by:
getTransferDataFlavors in interface javax.activation.DataContentHandler
Returns:
array of ActivationDataHandlers

writeTo

public void writeTo(java.lang.Object obj,
                    java.lang.String mimeType,
                    java.io.OutputStream os)
             throws java.io.IOException
Writes the passed in StreamSource object using the specified mime type to the specified output stream. The mime type must be text/xml.

Specified by:
writeTo in interface javax.activation.DataContentHandler
Parameters:
obj - an XML stream source
mimeType - the string "text/xml"
os - the output stream to write this xml stream to
Throws:
java.io.IOException