com.micromail
Class AttachmentManager

java.lang.Object
  extended bycom.micromail.AttachmentManager

public class AttachmentManager
extends java.lang.Object

Manages uploaded attachments during compositon and sending of mail, and attachments arriving from the Mail Server as parts of multipart messages


Nested Class Summary
 class AttachmentManager.Attachment
          Represents a file uploaded from the client, and providea access to the content
 
Constructor Summary
AttachmentManager(java.lang.String contextPath, java.lang.String userId)
          Creates an AttachmentManager
 
Method Summary
 void deleteAttachment(java.lang.String name)
          Removes a single attachment
 void deleteAttachments()
          Deletes the temporary files containing the uploads uploaded from the client, and clears the table Attachment objects.
 java.util.Iterator getAttachments()
          Gets an Iterator on the uploaded attachments
 java.lang.String getDownloadsURL()
          Gets the URL of a directory on the webserver where attachments downloaded from the mail server are stored
 boolean isHasAttachments()
          Determines if
 boolean storeUploadedAttachment(org.apache.struts.upload.FormFile formFile)
          Stores the contents of an attachment file uploaded from the client
 void transferAttachments()
          Transfers attachment files from the user's download directory to the user's upload directory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttachmentManager

public AttachmentManager(java.lang.String contextPath,
                         java.lang.String userId)
                  throws java.io.IOException
Creates an AttachmentManager

Parameters:
contextPath - the application context path
userId - the id string of the user
Method Detail

getDownloadsURL

public java.lang.String getDownloadsURL()
Gets the URL of a directory on the webserver where attachments downloaded from the mail server are stored

Returns:
string containing the URL

getAttachments

public java.util.Iterator getAttachments()
Gets an Iterator on the uploaded attachments

Returns:
ieterator across the Attachment objects stored in the attachment table

isHasAttachments

public boolean isHasAttachments()
Determines if

Returns:
true if

deleteAttachments

public void deleteAttachments()
Deletes the temporary files containing the uploads uploaded from the client, and clears the table Attachment objects.


deleteAttachment

public void deleteAttachment(java.lang.String name)
Removes a single attachment

Parameters:
name - name of the attachment file

storeUploadedAttachment

public boolean storeUploadedAttachment(org.apache.struts.upload.FormFile formFile)
                                throws java.lang.Exception
Stores the contents of an attachment file uploaded from the client

Parameters:
formFile - the FormFile object encapsulating the file contents
Returns:
true if attachment stored, false if total allowable size would be exceeded
Throws:
java.lang.Exception

transferAttachments

public void transferAttachments()
Transfers attachment files from the user's download directory to the user's upload directory