org.apache.axiom.attachments
Class Attachments

java.lang.Object
  extended byorg.apache.axiom.attachments.Attachments

public class Attachments
extends java.lang.Object


Field Summary
protected static org.apache.commons.logging.Log log
           
 
Constructor Summary
Attachments()
          Use this constructor when instantiating this to store the attachments set programatically through the SwA API.
Attachments(java.io.InputStream inStream, java.lang.String contentTypeString)
          Sets file cache to false.
Attachments(java.io.InputStream inStream, java.lang.String contentTypeString, boolean fileCacheEnable, java.lang.String attachmentRepoDir, java.lang.String fileThreshold)
          Moves the pointer to the beginning of the first MIME part.
 
Method Summary
 void addDataHandler(java.lang.String contentID, javax.activation.DataHandler dataHandler)
          Programatically adding an SOAP with Attachments(SwA) Attachment.
 java.lang.String[] getAllContentIDs()
           
 java.lang.String getAttachmentSpecType()
           
 java.util.Set getContentIDSet()
           
 javax.activation.DataHandler getDataHandler(java.lang.String blobContentID)
          Checks whether the MIME part is already parsed by checking the attachments HashMap.
 IncomingAttachmentStreams getIncomingAttachmentStreams()
          Stream based access
 java.lang.String getSOAPPartContentID()
           
 java.lang.String getSOAPPartContentType()
           
 java.io.InputStream getSOAPPartInputStream()
           
 void removeDataHandler(java.lang.String blobContentID)
          Removes the DataHandler corresponding to the given contenID.
protected  void setEndOfStream(boolean value)
          endOfStreamReached will be set to true if the message ended in MIME Style having "--" suffix with the last mime boundary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log
Constructor Detail

Attachments

public Attachments(java.io.InputStream inStream,
                   java.lang.String contentTypeString,
                   boolean fileCacheEnable,
                   java.lang.String attachmentRepoDir,
                   java.lang.String fileThreshold)
            throws OMException
Moves the pointer to the beginning of the first MIME part. Reads till first MIME boundary is found or end of stream is reached.

Parameters:
inStream -
contentTypeString -
fileCacheEnable -
attachmentRepoDir -
Throws:
OMException

Attachments

public Attachments(java.io.InputStream inStream,
                   java.lang.String contentTypeString)
            throws OMException
Sets file cache to false.

Parameters:
inStream -
contentTypeString -
Throws:
OMException

Attachments

public Attachments()
Use this constructor when instantiating this to store the attachments set programatically through the SwA API.

Method Detail

getAttachmentSpecType

public java.lang.String getAttachmentSpecType()
Returns:
whether Message Type is SOAP with Attachments or MTOM optimized, by checking the application type parameter in the Content Type.

getDataHandler

public javax.activation.DataHandler getDataHandler(java.lang.String blobContentID)
Checks whether the MIME part is already parsed by checking the attachments HashMap. If it is not parsed yet then call the getNextPart() till the required part is found.

Parameters:
blobContentID - (without the surrounding angle brackets and "cid:" prefix)
Returns:
The DataHandler of the mime part referred by the Content-Id or *null* if the mime part referred by the content-id does not exist

addDataHandler

public void addDataHandler(java.lang.String contentID,
                           javax.activation.DataHandler dataHandler)
Programatically adding an SOAP with Attachments(SwA) Attachment. These attachments will get serialized only if SOAP with Attachments is enabled.

Parameters:
contentID -
dataHandler -

removeDataHandler

public void removeDataHandler(java.lang.String blobContentID)
Removes the DataHandler corresponding to the given contenID. If it is not present, then trying to find it calling the getNextPart() till the required part is found.

Parameters:
blobContentID -

getSOAPPartInputStream

public java.io.InputStream getSOAPPartInputStream()
                                           throws OMException
Returns:
the InputStream which includes the SOAP Envelope. It assumes that the root mime part is always pointed by "start" parameter in content-type.
Throws:
OMException

getSOAPPartContentID

public java.lang.String getSOAPPartContentID()
Returns:
the Content-ID of the SOAP part It'll be the value Start Parameter of Content-Type header if given in the Content type of the MIME message. Else it'll be the content-id of the first MIME part of the MIME message

getSOAPPartContentType

public java.lang.String getSOAPPartContentType()

getIncomingAttachmentStreams

public IncomingAttachmentStreams getIncomingAttachmentStreams()
                                                       throws java.lang.IllegalStateException
Stream based access

Returns:
The stream container of type IncomingAttachmentStreams
Throws:
java.lang.IllegalStateException - if application has alreadt started using Part's directly

getAllContentIDs

public java.lang.String[] getAllContentIDs()

getContentIDSet

public java.util.Set getContentIDSet()

setEndOfStream

protected void setEndOfStream(boolean value)
endOfStreamReached will be set to true if the message ended in MIME Style having "--" suffix with the last mime boundary

Parameters:
value -


Copyright © 2004-2007 Apache Software Foundation. All Rights Reserved.