javax.mail

Class Store

Known Direct Subclasses:
IMAPStore, MaildirStore, MboxStore, NNTPStore, POP3Store

public abstract class Store
extends Service

A message store that can be used to save and retrieve messages.
Version:
1.4
Author:
Chris Burdess

Field Summary

Fields inherited from class javax.mail.Service

debug, session, url

Constructor Summary

Store(Session session, URLName url)
Constructor.

Method Summary

void
addFolderListener(FolderListener l)
Adds a listener for folder events on any folder object obtained from this store.
void
addStoreListener(StoreListener l)
Adds a listener for store events on this store.
abstract Folder
getDefaultFolder()
Returns a folder that represents the root of the primary namespace presented to the user by this store.
abstract Folder
getFolder(String name)
Returns the folder with the given name.
abstract Folder
getFolder(URLName url)
Returns the folder corresponding to the given URLName.
Folder[]
getPersonalNamespaces()
Returns the personal namespaces for the authenticated user.
Folder[]
getSharedNamespaces()
Returns the shared namespaces.
Folder[]
getUserNamespaces(String user)
Returns the personal namespaces for the specified user.
protected void
notifyFolderListeners(int type, Folder folder)
Notifies all folder listeners.
protected void
notifyFolderRenamedListeners(Folder oldFolder, Folder newFolder)
Notifies all folder listeners about the renaming of a folder.
protected void
notifyStoreListeners(int type, String message)
Notifies all store event listeners.
void
removeFolderListener(FolderListener l)
Removes a folder event listener.
void
removeStoreListener(StoreListener l)
Removes a store events listener.

Methods inherited from class javax.mail.Service

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

Constructor Details

Store

protected Store(Session session,
                URLName url)
Constructor.
Parameters:
session - session context for this store
url - URLName to be used for this store

Method Details

addFolderListener

public void addFolderListener(FolderListener l)
Adds a listener for folder events on any folder object obtained from this store.

addStoreListener

public void addStoreListener(StoreListener l)
Adds a listener for store events on this store.

getDefaultFolder

public abstract Folder getDefaultFolder()
            throws MessagingException
Returns a folder that represents the root of the primary namespace presented to the user by this store.

getFolder

public abstract Folder getFolder(String name)
            throws MessagingException
Returns the folder with the given name.

The exists method can be used to determine whether the folder actually exists.

In some Stores, name can be an absolute path if it starts with the hierarchy delimiter. Otherwise it is interpreted relative to the root of this namespace.

Parameters:
name - the folder name

getFolder

public abstract Folder getFolder(URLName url)
            throws MessagingException
Returns the folder corresponding to the given URLName.
Parameters:
url - a URLName denoting a folder

getPersonalNamespaces

public Folder[] getPersonalNamespaces()
            throws MessagingException
Returns the personal namespaces for the authenticated user.

getSharedNamespaces

public Folder[] getSharedNamespaces()
            throws MessagingException
Returns the shared namespaces.

getUserNamespaces

public Folder[] getUserNamespaces(String user)
            throws MessagingException
Returns the personal namespaces for the specified user.

notifyFolderListeners

protected void notifyFolderListeners(int type,
                                     Folder folder)
Notifies all folder listeners.

notifyFolderRenamedListeners

protected void notifyFolderRenamedListeners(Folder oldFolder,
                                            Folder newFolder)
Notifies all folder listeners about the renaming of a folder.

notifyStoreListeners

protected void notifyStoreListeners(int type,
                                    String message)
Notifies all store event listeners.

removeFolderListener

public void removeFolderListener(FolderListener l)
Removes a folder event listener.

removeStoreListener

public void removeStoreListener(StoreListener l)
Removes a store events listener.

© Copyright 2003, 2004 The Free Software Foundation, All rights reserved