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 thatStore
extends theService
class, which provides many common methods for naming stores, connecting to stores, and listening to connection events.
Service
,ConnectionEvent
,StoreEvent
Fields inherited from class javax.mail.Service |
debug,session,url |
Store(Session session,URLName urlname) Constructor. |
addFolderListener(FolderListener l) Add a listener for Folder events on any Folder object obtained from this Store. | |
addStoreListener(StoreListener l) Add a listener for StoreEvents on this Store. | |
getDefaultFolder() Returns a Folder object that represents the 'root' of the default namespace presented to the user by the Store. | |
getFolder(java.lang.String name) Return the Folder object corresponding to the given name. | |
getFolder(URLName url) Return a closed Folder object, corresponding to the given URLName. | |
notifyFolderListeners(int type,Folder folder) Notify all FolderListeners. | |
notifyFolderRenamedListeners(Folder oldF,Folder newF) Notify all FolderListeners about the renaming of a folder. | |
notifyStoreListeners(int type, java.lang.String message) Notify all StoreListeners. | |
removeFolderListener(FolderListener l) Remove a listener for Folder events. | |
removeStoreListener(StoreListener l) Remove a listener for Store events. |
Methods inherited from class javax.mail.Service |
addConnectionListener,close,connect,connect,connect,finalize,getURLName,isConnected,notifyConnectionListeners,protocolConnect,queueEvent,removeConnectionListener,setConnected,setURLName,toString |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
protectedStore(Session session,URLName urlname)
session
- Session object for this Store.url
- URLName object to be used for this Storepublic abstractFoldergetDefaultFolder() throwsMessagingException
java.lang.IllegalStateException
- if this Store is not connected.public abstractFoldergetFolder(java.lang.String name) throwsMessagingException
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 canbe an absolute path if it starts with thehierarchy delimiter. Else it is interpretedrelative to the 'root' of this namespace.java.lang.IllegalStateException
- if this Store is not connected.Folder.exists()
,Folder.create(int)
public abstractFoldergetFolder(URLName url) throwsMessagingException
Implementations of this method may obtain the name of the actual folder using thegetFile()
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 voidaddStoreListener(StoreListener l)
The default implementation provided here adds this listener to an internal list of StoreListeners.
l
- the Listener for Store eventsStoreEvent
public voidremoveStoreListener(StoreListener l)
The default implementation provided here removes this listener from the internal list of StoreListeners.
l
- the listeneraddStoreListener(javax.mail.event.StoreListener)
protected voidnotifyStoreListeners(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 voidaddFolderListener(FolderListener l)
The default implementation provided here adds this listener to an internal list of FolderListeners.
l
- the Listener for Folder eventsFolderEvent
public voidremoveFolderListener(FolderListener l)
The default implementation provided here removes this listener from the internal list of FolderListeners.
l
- the listeneraddFolderListener(javax.mail.event.FolderListener)
protected voidnotifyFolderListeners(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 voidnotifyFolderRenamedListeners(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.