org.apache.axis.attachments
Class AttachmentsImpl

java.lang.Object
  |
  +--org.apache.axis.attachments.AttachmentsImpl
All Implemented Interfaces:
Attachments

public class AttachmentsImpl
extends java.lang.Object
implements Attachments

Implements the Attachment interface, via an actual Hashmap of actual AttachmentParts.


Field Summary
protected  java.lang.String contentLocation
          This is the content location as specified in SOAP with Attachments.
protected  MultiPartRelatedInputStream mpartStream
          The actual stream to manage the multi-related input stream.
 javax.mail.internet.MimeMultipart multipart
           
protected  SOAPPart soapPart
           
 
Constructor Summary
AttachmentsImpl(java.lang.Object intialContents, java.lang.String contentType, java.lang.String contentLocation)
          Construct one of these on a parent Message.
 
Method Summary
 Part addAttachmentPart(Part newPart)
          Adds an existing attachment to this list.
 Part createAttachmentPart(java.lang.Object datahandler)
          Create an attachment part with a buried JAF data handler.
 Part getAttachmentByReference(java.lang.String reference)
          This method should look at a refernce and determine if it is a CID: or url to look for attachment.
 int getAttachmentCount()
          This is the number of attachments.
 java.util.Collection getAttachments()
          This method will return all attachments as a collection.
 int getContentLength()
          Get the content length of the stream.
 java.lang.String getContentType()
          Gets the content type for the whole stream.
 Part getRootPart()
          From the complex stream return the root part.
 boolean isAttachment(java.lang.Object value)
          Determine if an object is to be treated as an attchment.
 Part removeAttachmentPart(java.lang.String reference)
          This method uses getAttacmentByReference() to look for attachment.
 void setAttachmentParts(java.util.Collection parts)
          Add the collection of parts.
 void setRootPart(Part newRoot)
          Sets the root part of this multipart block
 void writeContentToStream(java.io.OutputStream os)
          Write the content to the stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

soapPart

protected SOAPPart soapPart

mpartStream

protected MultiPartRelatedInputStream mpartStream
The actual stream to manage the multi-related input stream.

contentLocation

protected java.lang.String contentLocation
This is the content location as specified in SOAP with Attachments. This maybe null if the message had no Content-Location specifed.

multipart

public javax.mail.internet.MimeMultipart multipart
Constructor Detail

AttachmentsImpl

public AttachmentsImpl(java.lang.Object intialContents,
                       java.lang.String contentType,
                       java.lang.String contentLocation)
                throws AxisFault
Construct one of these on a parent Message. Should only ever be called by Message constructor!
Parameters:
initialContents - should be anything but today only a stream is supported.
The - mime content type of the stream for transports that provide it.
Method Detail

removeAttachmentPart

public Part removeAttachmentPart(java.lang.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.
Specified by:
removeAttachmentPart in interface Attachments
Parameters:
The - reference that referers to an attachment.
Returns:
The part associated with the removed attachment, or null.

addAttachmentPart

public Part addAttachmentPart(Part newPart)
                       throws AxisFault
Adds an existing attachment to this list. Note: Passed part will be bound to this message.
Specified by:
addAttachmentPart in interface Attachments
Parameters:
newPart - new part to add

createAttachmentPart

public Part createAttachmentPart(java.lang.Object datahandler)
                          throws AxisFault
Create an attachment part with a buried JAF data handler.
Specified by:
createAttachmentPart in interface Attachments
Following copied from interface: org.apache.axis.attachments.Attachments
Parameters:
The - part that is referenced

setAttachmentParts

public void setAttachmentParts(java.util.Collection parts)
                        throws AxisFault
Add the collection of parts.
Specified by:
setAttachmentParts in interface Attachments

getAttachmentByReference

public Part getAttachmentByReference(java.lang.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.
Specified by:
getAttachmentByReference in interface Attachments
Parameters:
The - reference in the xml that referers to an attachment.
Returns:
The part associated with the attachment.

getAttachments

public java.util.Collection getAttachments()
                                    throws AxisFault
This method will return all attachments as a collection.
Specified by:
getAttachments in interface Attachments
Returns:
A collection of attachments.

getRootPart

public Part getRootPart()
From the complex stream return the root part. Today this is SOAP.
Specified by:
getRootPart in interface Attachments
Following copied from interface: org.apache.axis.attachments.Attachments
Returns:
will return the root part if the stream is supported, otherwise null.

setRootPart

public void setRootPart(Part newRoot)
Sets the root part of this multipart block
Specified by:
setRootPart in interface Attachments

getContentLength

public int getContentLength()
                     throws AxisFault
Get the content length of the stream.
Specified by:
getContentLength in interface Attachments

writeContentToStream

public void writeContentToStream(java.io.OutputStream os)
                          throws AxisFault
Write the content to the stream.
Specified by:
writeContentToStream in interface Attachments

getContentType

public java.lang.String getContentType()
                                throws AxisFault
Gets the content type for the whole stream.
Specified by:
getContentType in interface Attachments

getAttachmentCount

public int getAttachmentCount()
This is the number of attachments.
Specified by:
getAttachmentCount in interface Attachments

isAttachment

public boolean isAttachment(java.lang.Object value)
Determine if an object is to be treated as an attchment.
Specified by:
isAttachment in interface Attachments
Parameters:
value - the value that is to be determined if its an attachment.
Returns:
True if value should be treated as an attchment.


Copyright © 2001 Apache XML Project. All Rights Reserved.