Package net.fortuna.mstor.connector.mbox
Class YamlMetaFolder
- java.lang.Object
-
- net.fortuna.mstor.connector.AbstractFolderDelegate<T>
-
- net.fortuna.mstor.connector.mbox.AbstractMetaFolder<YamlMetaMessage>
-
- net.fortuna.mstor.connector.mbox.YamlMetaFolder
-
- All Implemented Interfaces:
FolderDelegate<YamlMetaMessage>
public class YamlMetaFolder extends AbstractMetaFolder<YamlMetaMessage>
-
-
Field Summary
Fields Modifier and Type Field Description static StringFILE_EXTENSIONYAML file extension.
-
Constructor Summary
Constructors Constructor Description YamlMetaFolder(FolderDelegate<MessageDelegate> delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected YamlMetaMessagecreateMessage(int messageNumber)protected StringgetFileExtension()YamlMetaFoldergetFolder(String name)Returns a child folder delegate with the specified name.longgetLastUid()Retrieves the last allocated message UID for the folder.YamlMetaMessagegetMessage(int messageNumber)Returns message delegate corresponding to the specified message id.YamlMetaFoldergetParent()longgetUidValidity()Returns the UID validity associated with the metadata.YamlMetaFolder[]list(String pattern)Returns a list of child folder delegates matching the specified pattern.protected YamlMetaMessage[]removeMessages(javax.mail.Message[] deleted)protected voidsave()protected voidsetLastUid(long uid)-
Methods inherited from class net.fortuna.mstor.connector.mbox.AbstractMetaFolder
appendMessages, close, create, delete, exists, expunge, getDelegate, getFile, getFolderName, getFullName, getLastModified, getMessageAsStream, getMessageCount, getSeparator, getType, newUidValidity, open, renameTo
-
Methods inherited from class net.fortuna.mstor.connector.AbstractFolderDelegate
allocateUid, getDeletedMessageCount
-
-
-
-
Field Detail
-
FILE_EXTENSION
public static final String FILE_EXTENSION
YAML file extension.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
YamlMetaFolder
public YamlMetaFolder(FolderDelegate<MessageDelegate> delegate)
- Parameters:
delegate-
-
-
Method Detail
-
getFileExtension
protected String getFileExtension()
- Specified by:
getFileExtensionin classAbstractMetaFolder<YamlMetaMessage>- Returns:
-
removeMessages
protected YamlMetaMessage[] removeMessages(javax.mail.Message[] deleted)
- Specified by:
removeMessagesin classAbstractMetaFolder<YamlMetaMessage>
-
save
protected void save() throws DelegateException- Specified by:
savein classAbstractMetaFolder<YamlMetaMessage>- Throws:
DelegateException
-
createMessage
protected YamlMetaMessage createMessage(int messageNumber)
- Specified by:
createMessagein classAbstractFolderDelegate<YamlMetaMessage>- Parameters:
messageNumber- the message number to associate with the new message- Returns:
- a new message delegate instance
-
setLastUid
protected void setLastUid(long uid) throws UnsupportedOperationException- Specified by:
setLastUidin classAbstractFolderDelegate<YamlMetaMessage>- Parameters:
uid- the latest UID for the folder- Throws:
UnsupportedOperationException- if this method is not supported in the folder delegate
-
getFolder
public YamlMetaFolder getFolder(String name) throws javax.mail.MessagingException
Returns a child folder delegate with the specified name.- Parameters:
name- a folder name- Returns:
- the folder delegate with the specified name, or null if the folder doesn't exist
- Throws:
javax.mail.MessagingException- where an unexpected error occurs retrieving the folder
-
getLastUid
public long getLastUid() throws UnsupportedOperationExceptionRetrieves the last allocated message UID for the folder.- Returns:
- the latest UID for the folder
- Throws:
UnsupportedOperationException- if this method is not supported by the folder implementation
-
getMessage
public YamlMetaMessage getMessage(int messageNumber) throws DelegateException
Returns message delegate corresponding to the specified message id. If no delegate exists a new Message delegate is created.- Parameters:
messageNumber- the message number of the message to retrieve- Returns:
- the message with the specified message number, or null if the messages doesn't exist
- Throws:
DelegateException- where an error occurs retrieving the message
-
getParent
public YamlMetaFolder getParent()
- Returns:
- the parent folder delegate of this delegate.
-
getUidValidity
public long getUidValidity() throws UnsupportedOperationException, javax.mail.MessagingExceptionReturns the UID validity associated with the metadata. If no UID validity exist a new value is initialised.- Returns:
- a long representation of the UID validity
- Throws:
UnsupportedOperationException- if this method is not supported by the folder implementationjavax.mail.MessagingException- if an error occurs retrieving the validity value
-
list
public YamlMetaFolder[] list(String pattern)
Returns a list of child folder delegates matching the specified pattern.- Parameters:
pattern- a pattern to match folders against- Returns:
- a list of folder delegates
-
-