javax.mail

Class Store

public abstract class Store extends Service

Abstract class that represents a message store.
Constructor Summary
protected Store(Session session, URLName name)
Constructor specifying session and url of this store.
Method Summary
voidaddFolderListener(FolderListener listener)
voidaddStoreListener(StoreListener listener)
abstract FoldergetDefaultFolder()
Retutn a Folder object that represents the root of the namespace for the current user.
abstract FoldergetFolder(String name)
Return the Folder corresponding to the given name.
abstract FoldergetFolder(URLName name)
Return the folder identified by the URLName; the URLName must refer to this Store.
Folder[]getPersonalNamespaces()
Return the root folders of the personal namespace belonging to the current user.
Folder[]getSharedNamespaces()
Return the root folders of namespaces that are intended to be shared between users.
Folder[]getUserNamespaces(String user)
Return the root folders of the personal namespaces belonging to the supplied user.
protected voidnotifyFolderListeners(int type, Folder folder)
protected voidnotifyFolderRenamedListeners(Folder oldFolder, Folder newFolder)
protected voidnotifyStoreListeners(int type, String message)
voidremoveFolderListener(FolderListener listener)
voidremoveStoreListener(StoreListener listener)

Constructor Detail

Store

protected Store(Session session, URLName name)
Constructor specifying session and url of this store. Subclasses MUST provide a constructor with this signature.

Parameters: session the session associated with this store name the URL of the store

Method Detail

addFolderListener

public void addFolderListener(FolderListener listener)

addStoreListener

public void addStoreListener(StoreListener listener)

getDefaultFolder

public abstract Folder getDefaultFolder()
Retutn a Folder object that represents the root of the namespace for the current user. Note that in some store configurations (such as IMAP4) then the root folder may not be the INBOX folder.

Returns: the root Folder

Throws: MessagingException if there was a problem accessing the store

getFolder

public abstract Folder getFolder(String name)
Return the Folder corresponding to the given name. The folder may not physically exist; the exists method can be used to determine if it is real.

Parameters: name the name of the Folder to return

Returns: the corresponding folder

Throws: MessagingException if there was a problem accessing the store

getFolder

public abstract Folder getFolder(URLName name)
Return the folder identified by the URLName; the URLName must refer to this Store. Implementations may use the getFile method to determined the folder name.

Parameters: name the folder to return

Returns: the corresponding folder

Throws: MessagingException if there was a problem accessing the store

getPersonalNamespaces

public Folder[] getPersonalNamespaces()
Return the root folders of the personal namespace belonging to the current user. The default implementation simply returns an array containing the folder returned by getDefaultFolder.

Returns: the root folders of the user's peronal namespaces

Throws: MessagingException if there was a problem accessing the store

getSharedNamespaces

public Folder[] getSharedNamespaces()
Return the root folders of namespaces that are intended to be shared between users. The default implementation simply returns an empty array.

Returns: the root folders of all shared namespaces

Throws: MessagingException if there was a problem accessing the store

getUserNamespaces

public Folder[] getUserNamespaces(String user)
Return the root folders of the personal namespaces belonging to the supplied user. The default implementation simply returns an empty array.

Parameters: user the user whose namespaces should be returned

Returns: the root folders of the given user's peronal namespaces

Throws: MessagingException if there was a problem accessing the store

notifyFolderListeners

protected void notifyFolderListeners(int type, Folder folder)

notifyFolderRenamedListeners

protected void notifyFolderRenamedListeners(Folder oldFolder, Folder newFolder)

notifyStoreListeners

protected void notifyStoreListeners(int type, String message)

removeFolderListener

public void removeFolderListener(FolderListener listener)

removeStoreListener

public void removeStoreListener(StoreListener listener)