javax.mail

Class Store


public abstract class Store
extends Service

Abstract class that represents a message store.

Field Summary

Fields inherited from class javax.mail.Service

debug, session, url

Constructor Summary

Store(Session session, URLName name)
Constructor specifying session and url of this store.

Method Summary

void
addFolderListener(FolderListener listener)
void
addStoreListener(StoreListener listener)
abstract Folder
getDefaultFolder()
Retutn a Folder object that represents the root of the namespace for the current user.
abstract Folder
getFolder(String name)
Return the Folder corresponding to the given name.
abstract Folder
getFolder(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 void
notifyFolderListeners(int type, Folder folder)
protected void
notifyFolderRenamedListeners(Folder oldFolder, Folder newFolder)
protected void
notifyStoreListeners(int type, String message)
void
removeFolderListener(FolderListener listener)
void
removeStoreListener(StoreListener listener)

Methods inherited from class javax.mail.Service

addConnectionListener, close, connect, connect, connect, finalize, getURLName, isConnected, notifyConnectionListeners, protocolConnect, queueEvent, removeConnectionListener, setConnected, setURLName, toString

Constructor Details

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 Details

addFolderListener

public void addFolderListener(FolderListener listener)

addStoreListener

public void addStoreListener(StoreListener listener)

getDefaultFolder

public abstract Folder getDefaultFolder()
            throws MessagingException
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)
            throws MessagingException
Return the Folder corresponding to the given name. The folder may not physically exist; the Folder.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)
            throws MessagingException
Return the folder identified by the URLName; the URLName must refer to this Store. Implementations may use the URLName.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()
            throws MessagingException
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()
            throws MessagingException
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)
            throws MessagingException
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)