Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.axis.attachments
Class AttachmentsImpl

    java.lang.Object
      org.apache.axis.attachments.AttachmentsImpl

All Implemented Interfaces:
  Attachments, Serializable

public class AttachmentsImpl
extends Object
implements Attachments

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

See Also:
  Serialized Form

Field Summary
`protected String` | `contentLocation` This is the content location as specified in SOAP with Attachments.
`protected MultiPartInputStream` | `mpartStream` The actual stream to manage the multi-related input stream.
`protected int` | `sendtype` The form of the attachments, whether MIME or DIME.
`protected MessagePart` | `soapPart` Field soapPart.

Fields inherited from interface org.apache.axis.attachments.Attachments
`CIDprefix, SEND_TYPE_DEFAULT, SEND_TYPE_DIME, SEND_TYPE_MAX, SEND_TYPE_MIME, SEND_TYPE_NONE, SEND_TYPE_NOTSET`

Constructor Summary
`AttachmentsImpl(Object intialContents, String contentType, 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()` Create a new attachment Part in this Message.
`Part` | `createAttachmentPart(Object datahandler)` Create a new attachment Part in this Message.
`protected DimeMultiPart` | `createDimeMessage()` Creates the DIME message
`void` | `dispose()` dispose of the attachments and their files; do not use the object after making this call.
`Part` | `getAttachmentByReference(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.
`Collection` | `getAttachments()` This method will return all attachments as a collection.
`Iterator` | `getAttachments(javax.xml.soap.MimeHeaders headers)` Retrieves all the `AttachmentPart` objects that have header entries that match the specified headers.
`long` | `getContentLength()` Get the content length of the stream.
`String` | `getContentType()` Gets the content type for the whole stream.
`Part` | `getRootPart()` From the complex stream return the root part.
`int` | `getSendType()` Determine if an object is to be treated as an attchment.
`static int` | `getSendType(String value)` Determine how an object typically sent as attachments are to be represented.
`static String` | `getSendTypeString(int value)` For a given sendType value, return a string representation.
`boolean` | `isAttachment(Object value)` Determine if an object is to be treated as an attchment.
`void` | `removeAllAttachments()` Removes all `AttachmentPart` objects that have been added to this `SOAPMessage` object.
`Part` | `removeAttachmentPart(String reference)` This method uses getAttacmentByReference() to look for attachment.
`void` | `setAttachmentParts(Collection parts)` Add the collection of parts.
`void` | `setRootPart(Part newRoot)` Sets the root part of this multipart block * * @param newRoot the new root `Part`
`void` | `setSendType(int sendtype)` Set the format for attachments.
`void` | `writeContentToStream(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 MessagePart soapPart

  Field soapPart.

### mpartStream

    protected MultiPartInputStream mpartStream

  The actual stream to manage the multi-related input stream.

### sendtype

    protected int sendtype

  The form of the attachments, whether MIME or DIME.

### contentLocation

    protected String contentLocation

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

Constructor Detail

### AttachmentsImpl

    public AttachmentsImpl(Object intialContents,
                           String contentType,
                           String contentLocation)
                    throws AxisFault

  Construct one of these on a parent Message. Should only ever be called by Message constructor!

  1. mime-type: [unknown] do nothing

  2. mime-type: multipart/related 2.1 create a MultiPartRelatedInputStream that does the parsing of the input stream 2.2 create a SOAPPart from the MultiPartRelatedInputStream

  3. mime-type: application/dime 3.1 create a MultiPartDimeInputStream that does the parsing of the input stream 3.2 create a SOAPPart from the MultiPartDimeInputStream

Parameters:
  `intialContents` - should be anything but today only a stream is supported.
  `contentType` - The mime content type of the stream for transports that provide it.
  `contentLocation` -
Throws:
  `AxisFault`

Method Detail

### 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.

  Specified by:
    `removeAttachmentPart` in interface `Attachments`
  Parameters:
    `reference` - The reference that referers to an attachment.
  Returns:
    The part associated with the removed attachment, or null.
  Throws:
    `AxisFault`

### 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
  Returns:
    Part old attachment with the same Content-ID, or null.
  Throws:
    `AxisFault`

### createAttachmentPart

    public Part createAttachmentPart(Object datahandler)
                              throws AxisFault

  Description copied from interface: `Attachments`
  Create a new attachment Part in this Message. * Will actually, and always, return an AttachmentPart. * * @param part The part that is referenced * @return a new attachment part * @throws org.apache.axis.AxisFault

  Specified by:
    `createAttachmentPart` in interface `Attachments`
  Throws:
    `AxisFault`

### setAttachmentParts

    public void setAttachmentParts(Collection parts)
                            throws AxisFault

  Add the collection of parts.

  Specified by:
    `setAttachmentParts` in interface `Attachments`
  Parameters:
    `parts` -
  Throws:
    `AxisFault`

### 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.

  Specified by:
    `getAttachmentByReference` in interface `Attachments`
  Parameters:
    `reference` - The reference in the xml that referers to an attachment.
  Returns:
    The part associated with the attachment.
  Throws:
    `AxisFault`

### getAttachments

    public Collection getAttachments()
                              throws AxisFault

  This method will return all attachments as a collection.

  Specified by:
    `getAttachments` in interface `Attachments`
  Returns:
    A collection of attachments.
  Throws:
    `AxisFault`

### getRootPart

    public Part getRootPart()

  From the complex stream return the root part. Today this is SOAP.

  Specified by:
    `getRootPart` in interface `Attachments`
  Returns:
    the root `Part`

### setRootPart

    public void setRootPart(Part newRoot)

  Description copied from interface: `Attachments`
  Sets the root part of this multipart block * * @param newRoot the new root `Part`

  Specified by:
    `setRootPart` in interface `Attachments`

### getContentLength

    public long getContentLength()
                          throws AxisFault

  Get the content length of the stream.

  Specified by:
    `getContentLength` in interface `Attachments`
  Returns:
    the content length of the stream
  Throws:
    `AxisFault`

### createDimeMessage

    protected DimeMultiPart createDimeMessage()
                                       throws AxisFault

  Creates the DIME message

  Returns:
    a DIME part
  Throws:
    `AxisFault` - if the part could not be built

### writeContentToStream

    public void writeContentToStream(OutputStream os)
                              throws AxisFault

  Write the content to the stream.

  Specified by:
    `writeContentToStream` in interface `Attachments`
  Parameters:
    `os` -
  Throws:
    `AxisFault`

### getContentType

    public String getContentType()
                          throws AxisFault

  Gets the content type for the whole stream.

  Specified by:
    `getContentType` in interface `Attachments`
  Returns:
    the content type for the whole stream
  Throws:
    `AxisFault`

### getAttachmentCount

    public int getAttachmentCount()

  This is the number of attachments.

  Specified by:
    `getAttachmentCount` in interface `Attachments`
  Returns:
    the number of attachments

### isAttachment

    public boolean isAttachment(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.

### removeAllAttachments

    public void removeAllAttachments()

  Removes all `AttachmentPart` objects that have been added to this `SOAPMessage` object.

  This method does not touch the SOAP part.

  Specified by:
    `removeAllAttachments` in interface `Attachments`

### getAttachments

    public Iterator getAttachments(javax.xml.soap.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.

  Specified by:
    `getAttachments` in interface `Attachments`
  Parameters:
    `headers` - a `MimeHeaders` object containing the MIME headers for which to search
  Returns:
    an iterator over all attachments that have a header that matches one of the given headers

### createAttachmentPart

    public Part createAttachmentPart()
                              throws AxisFault

  Create a new attachment Part in this Message. Will actually, and always, return an AttachmentPart.

  Specified by:
    `createAttachmentPart` in interface `Attachments`
  Returns:
    a new attachment Part
  Throws:
    `AxisFault`

### setSendType

    public void setSendType(int sendtype)

  Description copied from interface: `Attachments`
  Set the format for attachments. * * @param sendtype the format to send. * SEND_TYPE_MIME for Multipart Releated Mail type attachments. * SEND_TYPE_DIME for DIME type attachments.

  Specified by:
    `setSendType` in interface `Attachments`

### getSendType

    public int getSendType()

  Description copied from interface: `Attachments`
  Determine if an object is to be treated as an attchment. * * @return SEND_TYPE_MIME, SEND_TYPE_DIME, SEND_TYPE_NOTSET

  Specified by:
    `getSendType` in interface `Attachments`

### dispose

    public void dispose()

  dispose of the attachments and their files; do not use the object after making this call.

  Specified by:
    `dispose` 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.

  Parameters:
    `value` - a String representing a sending type, treated in a case-insensetive manner
  Returns:
    an `int` send type code

### getSendTypeString

    public static String getSendTypeString(int value)

  For a given sendType value, return a string representation.

  Parameters:
    `value` - a type code integer
  Returns:
    a `String` representation of `value`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 JBoss Group, LLC. All Rights Reserved.