Package net.fortuna.mstor.connector.nntp
Class NntpFolder
- java.lang.Object
-
- net.fortuna.mstor.connector.AbstractFolderDelegate<MessageDelegate>
-
- net.fortuna.mstor.connector.nntp.NntpFolder
-
- All Implemented Interfaces:
FolderDelegate<MessageDelegate>
public class NntpFolder extends AbstractFolderDelegate<MessageDelegate>
-
-
Constructor Summary
Constructors Constructor Description NntpFolder(org.apache.commons.net.nntp.NewsgroupInfo newsgroupInfo, org.apache.commons.net.nntp.NNTPClient client)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendMessages(javax.mail.Message[] messages)Append the specified messages to this delegate.voidclose()Close the folder delegate.booleancreate(int type)Initialise the delegate based on the specified folder type.protected MessageDelegatecreateMessage(int messageNumber)booleandelete()Delete the folder delegate.booleanexists()Indicates whether the folder represented by this delegate exists.voidexpunge(javax.mail.Message[] deleted)Permanently delete the specified messages from this delegate.FolderDelegate<MessageDelegate>getFolder(String name)Returns a child folder delegate with the specified name.StringgetFolderName()StringgetFullName()longgetLastModified()Returns the last modification timestamp of this folder.longgetLastUid()Retrieves the last allocated message UID for the folder.MessageDelegategetMessage(int messageNumber)Returns message delegate corresponding to the specified message id.InputStreamgetMessageAsStream(int index)Returns an input stream from which to read the specified message.intgetMessageCount()Returns the number of messages in the folder delegate.FolderDelegate<MessageDelegate>getParent()chargetSeparator()intgetType()longgetUidValidity()Returns the UID validity associated with the metadata.FolderDelegate<MessageDelegate>[]list(String pattern)Returns a list of child folder delegates matching the specified pattern.voidopen(int mode)Open the folder delegate.booleanrenameTo(String name)Rename the folder delegate.protected voidsetLastUid(long uid)-
Methods inherited from class net.fortuna.mstor.connector.AbstractFolderDelegate
allocateUid, getDeletedMessageCount
-
-
-
-
Method Detail
-
createMessage
protected MessageDelegate createMessage(int messageNumber)
- Specified by:
createMessagein classAbstractFolderDelegate<MessageDelegate>- 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<MessageDelegate>- Parameters:
uid- the latest UID for the folder- Throws:
UnsupportedOperationException- if this method is not supported in the folder delegate
-
appendMessages
public void appendMessages(javax.mail.Message[] messages)
Description copied from interface:FolderDelegateAppend the specified messages to this delegate.- Parameters:
messages- an array of messages to append to the folder
-
close
public void close()
Description copied from interface:FolderDelegateClose the folder delegate.
-
create
public boolean create(int type)
Description copied from interface:FolderDelegateInitialise the delegate based on the specified folder type.- Parameters:
type- a folder type- Returns:
- true if the delegate is created, otherwise false
-
delete
public boolean delete()
Description copied from interface:FolderDelegateDelete the folder delegate.- Returns:
- true if the delegate is deleted, otherwise false
-
exists
public boolean exists()
Description copied from interface:FolderDelegateIndicates whether the folder represented by this delegate exists.- Returns:
- true if the folder exists, otherwise false
-
expunge
public void expunge(javax.mail.Message[] deleted)
Description copied from interface:FolderDelegatePermanently delete the specified messages from this delegate.- Parameters:
deleted- an array of deleted messages to expunge
-
getFolder
public FolderDelegate<MessageDelegate> getFolder(String name)
Description copied from interface:FolderDelegateReturns 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
-
getFullName
public String getFullName()
- Returns:
- the full name of the folder.
-
getLastModified
public long getLastModified() throws UnsupportedOperationExceptionDescription copied from interface:FolderDelegateReturns the last modification timestamp of this folder.- Returns:
- a timestamp as a long value
- Throws:
UnsupportedOperationException- if this method is not supported by the folder implementation
-
getLastUid
public long getLastUid() throws UnsupportedOperationExceptionDescription copied from interface:FolderDelegateRetrieves 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 MessageDelegate getMessage(int messageNumber)
Description copied from interface:FolderDelegateReturns 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
-
getMessageAsStream
public InputStream getMessageAsStream(int index)
Description copied from interface:FolderDelegateReturns an input stream from which to read the specified message.- Parameters:
index- the index of the message to return- Returns:
- an input stream for the specified message
-
getMessageCount
public int getMessageCount()
Description copied from interface:FolderDelegateReturns the number of messages in the folder delegate.- Returns:
- the total message count
-
getFolderName
public String getFolderName()
- Returns:
- Returns the name.
-
getParent
public FolderDelegate<MessageDelegate> getParent()
- Returns:
- the parent folder delegate of this delegate.
-
getSeparator
public char getSeparator()
- Returns:
- the folder separator for this delegate type.
-
getType
public int getType()
- Returns:
- the type of folder this delegate represents.
- See Also:
Folder.HOLDS_FOLDERS,Folder.HOLDS_MESSAGES
-
getUidValidity
public long getUidValidity() throws UnsupportedOperationExceptionDescription copied from interface:FolderDelegateReturns 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 implementation
-
list
public FolderDelegate<MessageDelegate>[] list(String pattern)
Description copied from interface:FolderDelegateReturns a list of child folder delegates matching the specified pattern.- Parameters:
pattern- a pattern to match folders against- Returns:
- a list of folder delegates
-
open
public void open(int mode)
Description copied from interface:FolderDelegateOpen the folder delegate.- Parameters:
mode- the mode to open the folder- See Also:
Folder.READ_ONLY,Folder.READ_WRITE
-
renameTo
public boolean renameTo(String name)
Description copied from interface:FolderDelegateRename the folder delegate.- Parameters:
name- the new folder name- Returns:
- true if the folder is renamed, otherwise false
-
-