Implements the Attachment interface, via an actual Hashmap of actual
AttachmentParts.
addAttachmentPart
public Part addAttachmentPart(Part newPart)
throws AxisFault
Adds an existing attachment to this list.
Note: Passed part will be bound to this message.
- addAttachmentPart in interface Attachments
newPart
- new part to add
- Part old attachment with the same Content-ID, or null.
dispose
public void dispose()
dispose of the attachments and their files; do not use the object
after making this call.
- dispose in interface Attachments
getAttachmentByReference
public Part getAttachmentByReference(String reference)
throws AxisFault
This method should look at a refernce and determine if it is a CID: or
url to look for attachment.
Note: if Content-Id or Content-Location headers have changed by outside
code, lookup will not return proper values. In order to change these
values attachment should be removed, then added again.
- getAttachmentByReference in interface Attachments
reference
- The reference in the xml that referers to an attachment.
- The part associated with the attachment.
getAttachmentCount
public int getAttachmentCount()
This is the number of attachments.
- getAttachmentCount in interface Attachments
- the number of attachments
getAttachments
public Collection getAttachments()
throws AxisFault
This method will return all attachments as a collection.
- getAttachments in interface Attachments
- A collection of attachments.
getAttachments
public java.util.Iterator getAttachments(MimeHeaders headers)
Retrieves all the AttachmentPart
objects
that have header entries that match the specified headers.
Note that a returned attachment could have headers in
addition to those specified.
- getAttachments in interface Attachments
headers
- a MimeHeaders
object containing the MIME headers for which to
search
- an iterator over all attachments that have a header
that matches one of the given headers
getContentType
public String getContentType()
throws AxisFault
Gets the content type for the whole stream.
- getContentType in interface Attachments
- the content type for the whole stream
getIncomingAttachmentStreams
public IncomingAttachmentStreams getIncomingAttachmentStreams()
Once this method is called, attachments can only be accessed via the InputStreams.
Any other access to the attachments collection (e.g. via getAttachments()) is
prohibited and will cause a IllegalStateException to be thrown.
- getIncomingAttachmentStreams in interface Attachments
- All of the attachment streams.
getRootPart
public Part getRootPart()
From the complex stream return the root part.
Today this is SOAP.
- getRootPart in interface Attachments
getSendType
public static int getSendType(String value)
Determine how an object typically sent as attachments are to
be represented. Currently, MIME DIME and NONE are reccognised.
value
- a String representing a sending type, treated in a
case-insensetive manner
getSendTypeString
public static String getSendTypeString(int value)
For a given sendType value, return a string representation.
value
- a type code integer
- a
String
representation of value
isAttachment
public boolean isAttachment(Object value)
Determine if an object is to be treated as an attchment.
- isAttachment in interface Attachments
value
- the value that is to be determined if
its an attachment.
- True if value should be treated as an attchment.
removeAllAttachments
public void removeAllAttachments()
Removes all
AttachmentPart
objects that have
been added to this
SOAPMessage
object.
This method does not touch the SOAP part.
- removeAllAttachments in interface Attachments
removeAttachmentPart
public Part removeAttachmentPart(String reference)
throws AxisFault
This method uses getAttacmentByReference() to look for attachment.
If attachment has been found, it will be removed from the list, and
returned to the user.
- removeAttachmentPart in interface Attachments
reference
- The reference that referers to an attachment.
- The part associated with the removed attachment, or null.
setAttachmentParts
public void setAttachmentParts(Collection parts)
throws AxisFault
Add the collection of parts.