java.lang.Object | +--javax.mail.Service | +--javax.mail.Store
An abstract class that models a message store and its access protocol, for storing and retrieving messages. Subclasses provide actual implementations.
Note that Store
extends the Service
class, which provides many common methods for naming stores,
connecting to stores, and listening to connection events.
Service
,
ConnectionEvent
,
StoreEvent
void
addFolderListener(FolderListener l)
abstract Folder
getDefaultFolder()
abstract Folder
getFolder(java.lang.String name)
abstract Folder
getFolder(URLName url)
protected void
notifyFolderRenamedListeners(Folder oldF,
Folder newF)
addConnectionListener, close, connect, connect, connect, finalize, getURLName, isConnected, notifyConnectionListeners, protocolConnect, queueEvent, removeConnectionListener, setConnected, setURLName, toString
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
protected Store(Session session, URLName urlname)
session
- Session object for this Store.url
- URLName object to be used for this Storepublic abstract Folder getDefaultFolder() throws MessagingException
java.lang.IllegalStateException
- if this Store is not connected.public abstract Folder getFolder(java.lang.String name) throws MessagingException
exists()
method on the folder object indicates whether this folder really
exists. Folder objects are not cached by the Store, so invoking this method on the same name multiple times will return that many distinct Folder objects.
name
- The name of the Folder. In some Stores, name can
be an absolute path if it starts with the
hierarchy delimiter. Else it is interpreted
relative to the 'root' of this namespace.java.lang.IllegalStateException
- if this Store is not connected.Folder.exists()
,
Folder.create(int)
public abstract Folder getFolder(URLName url) throws MessagingException
Implementations of this method may obtain the name of the
actual folder using the getFile()
method on
URLName, and use that name to create the folder.
url
- URLName that denotes a folderjava.lang.IllegalStateException
- if this Store is not connected.URLName
public void addStoreListener(StoreListener l)
The default implementation provided here adds this listener to an internal list of StoreListeners.
l
- the Listener for Store eventsStoreEvent
public void removeStoreListener(StoreListener l)
The default implementation provided here removes this listener from the internal list of StoreListeners.
l
- the listeneraddStoreListener(javax.mail.event.StoreListener)
protected void notifyStoreListeners(int type, java.lang.String message)
The provided default implementation queues the event into an internal event queue. An event dispatcher thread dequeues events from the queue and dispatches them to the registered StoreListeners. Note that the event dispatching occurs in a separate thread, thus avoiding potential deadlock problems.
public void addFolderListener(FolderListener l)
The default implementation provided here adds this listener to an internal list of FolderListeners.
l
- the Listener for Folder eventsFolderEvent
public void removeFolderListener(FolderListener l)
The default implementation provided here removes this listener from the internal list of FolderListeners.
l
- the listeneraddFolderListener(javax.mail.event.FolderListener)
protected void notifyFolderListeners(int type, Folder folder)
The provided default implementation queues the event into an internal event queue. An event dispatcher thread dequeues events from the queue and dispatches them to the registered FolderListeners. Note that the event dispatching occurs in a separate thread, thus avoiding potential deadlock problems.
type
- type of FolderEventfolder
- affected FoldernotifyFolderRenamedListeners(javax.mail.Folder, javax.mail.Folder)
protected void notifyFolderRenamedListeners(Folder oldF, Folder newF)
The provided default implementation queues the event into an internal event queue. An event dispatcher thread dequeues events from the queue and dispatches them to the registered FolderListeners. Note that the event dispatching occurs in a separate thread, thus avoiding potential deadlock problems.
oldF
- the folder being renamednewF
- the folder representing the new name.