com.ericdaugherty.mail.server.persistence.smtp
Class IncrementalFileIOProccessor

java.lang.Object
  extended by com.ericdaugherty.mail.server.persistence.smtp.IncrementalFileIOProccessor
All Implemented Interfaces:
SMTPMessagePersistenceProccessor

public final class IncrementalFileIOProccessor
extends java.lang.Object
implements SMTPMessagePersistenceProccessor

A file system based SMTP persistance processor.

Author:
Andreas Kyrmegalos

Constructor Summary
IncrementalFileIOProccessor()
           
 
Method Summary
 void addDataLine(byte[] line)
           
 boolean deleteMessage()
           
 java.io.File getMessageLocation()
           
 java.lang.Object getPersistedID()
           
 long getPersistedSize()
           
 long getSize()
           
 void initializeMessage(java.lang.String filename, boolean headersOnly)
           
 boolean isNotSavedInAmavis()
           
 java.util.List loadIncrementally(int start)
           
 java.util.List loadIncrementally(int start, java.lang.String messageName)
           
 void moveToFailedFolder()
          Moves the message to the 'failed' Directory.
 void redirectToPostmaster()
           
 void save(boolean useAmavisSMTPDirectory)
          Saves the message to the Mail Spool Directory.
 boolean saveBegin(boolean useAmavisSMTPDirectory)
           
 boolean saveFinish()
           
 void saveIncrement(java.util.List<byte[]> dataLines, boolean writeHeaders, boolean append)
           
 void setMessage(SMTPMessage message)
           
 void setMessageLocation(java.io.File messageLocation)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IncrementalFileIOProccessor

public IncrementalFileIOProccessor()
Method Detail

setMessage

public void setMessage(SMTPMessage message)
Specified by:
setMessage in interface SMTPMessagePersistenceProccessor

getPersistedID

public java.lang.Object getPersistedID()
Specified by:
getPersistedID in interface SMTPMessagePersistenceProccessor

getMessageLocation

public java.io.File getMessageLocation()
Returns:
the messageLocation

setMessageLocation

public void setMessageLocation(java.io.File messageLocation)
Parameters:
messageLocation - the messageLocation to set

initializeMessage

public void initializeMessage(java.lang.String filename,
                              boolean headersOnly)
                       throws java.io.IOException
Specified by:
initializeMessage in interface SMTPMessagePersistenceProccessor
Throws:
java.io.IOException

getSize

public long getSize()
Specified by:
getSize in interface SMTPMessagePersistenceProccessor

addDataLine

public void addDataLine(byte[] line)
Specified by:
addDataLine in interface SMTPMessagePersistenceProccessor

save

public void save(boolean useAmavisSMTPDirectory)
          throws java.io.IOException
Saves the message to the Mail Spool Directory. Used when rescheduling.

Specified by:
save in interface SMTPMessagePersistenceProccessor
Throws:
java.io.IOException

saveBegin

public boolean saveBegin(boolean useAmavisSMTPDirectory)
Specified by:
saveBegin in interface SMTPMessagePersistenceProccessor

saveIncrement

public void saveIncrement(java.util.List<byte[]> dataLines,
                          boolean writeHeaders,
                          boolean append)
                   throws java.io.IOException
Specified by:
saveIncrement in interface SMTPMessagePersistenceProccessor
Throws:
java.io.IOException

saveFinish

public boolean saveFinish()
Specified by:
saveFinish in interface SMTPMessagePersistenceProccessor

loadIncrementally

public java.util.List loadIncrementally(int start)
                                 throws java.io.IOException
Specified by:
loadIncrementally in interface SMTPMessagePersistenceProccessor
Throws:
java.io.IOException

loadIncrementally

public final java.util.List loadIncrementally(int start,
                                              java.lang.String messageName)
                                       throws java.io.IOException
Specified by:
loadIncrementally in interface SMTPMessagePersistenceProccessor
Throws:
java.io.IOException

moveToFailedFolder

public void moveToFailedFolder()
                        throws java.lang.Exception
Moves the message to the 'failed' Directory.

Specified by:
moveToFailedFolder in interface SMTPMessagePersistenceProccessor
Throws:
java.lang.Exception

isNotSavedInAmavis

public boolean isNotSavedInAmavis()
Specified by:
isNotSavedInAmavis in interface SMTPMessagePersistenceProccessor

getPersistedSize

public long getPersistedSize()
Specified by:
getPersistedSize in interface SMTPMessagePersistenceProccessor

deleteMessage

public boolean deleteMessage()
Specified by:
deleteMessage in interface SMTPMessagePersistenceProccessor

redirectToPostmaster

public void redirectToPostmaster()
                          throws java.io.IOException
Specified by:
redirectToPostmaster in interface SMTPMessagePersistenceProccessor
Throws:
java.io.IOException