Package mireka.transmission.queue
Class FileDirStore
- Object
-
- mireka.transmission.queue.FileDirStore
-
public class FileDirStore extends ObjectFileDirStore stores scheduled mails in the file system in a single directory. Mails are stored in two files. A properties file contains the envelope information and a binary file contains the message content. In order to provide some consistency in case of a system failure, the two files are created and deleted in a specific order. On creation first the message content file is saved, then the properties file. On deletion the order is the opposite, the properties file is deleted first. The two files have the same name but with different extension (.properties and .eml). The name is the scheduled date with an additional serial number if it is necessary, so it become a unique.
-
-
Constructor Summary
Constructors Constructor Description FileDirStore()use this constructor with settersFileDirStore(java.io.File dir, int maxQueueSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddelete(mireka.transmission.queue.MailName mailName)mireka.transmission.queue.MailName[]initializeAndQueryMailNamesOrderedBySchedule()this function must be called before any other method, and it cannot be called more then once.voidmoveToErrorDir(mireka.transmission.queue.MailName mailName)Mailread(mireka.transmission.queue.MailName mailName)mireka.transmission.queue.MailNamesave(Mail srcMail)voidsetDir(String dir)voidsetMaxSize(int maxSize)StringtoString()
-
-
-
Method Detail
-
initializeAndQueryMailNamesOrderedBySchedule
public mireka.transmission.queue.MailName[] initializeAndQueryMailNamesOrderedBySchedule() throws QueueStorageExceptionthis function must be called before any other method, and it cannot be called more then once.- Throws:
QueueStorageException- if the store cannot be initialized for some reason.
-
save
public mireka.transmission.queue.MailName save(Mail srcMail) throws QueueStorageException
- Throws:
QueueStorageException
-
read
public Mail read(mireka.transmission.queue.MailName mailName) throws QueueStorageException
- Throws:
QueueStorageException
-
moveToErrorDir
public void moveToErrorDir(mireka.transmission.queue.MailName mailName) throws QueueStorageException- Throws:
QueueStorageException
-
delete
public void delete(mireka.transmission.queue.MailName mailName) throws QueueStorageException- Throws:
QueueStorageException
-
toString
public String toString()
- Overrides:
toStringin classObject
-
setDir
public void setDir(String dir)
- Category:
- GETSET
-
setMaxSize
public void setMaxSize(int maxSize)
- Category:
- GETSET
-
-