|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.mail.Service javax.mail.Store
public abstract class 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
Field Summary |
---|
Fields inherited from class javax.mail.Service |
---|
debug, session, url |
Constructor Summary | |
---|---|
protected |
Store(Session session,
URLName urlname)
Constructor. |
Method Summary | |
---|---|
void |
addFolderListener(FolderListener l)
Add a listener for Folder events on any Folder object obtained from this Store. |
void |
addStoreListener(StoreListener l)
Add a listener for StoreEvents on this Store. |
abstract Folder |
getDefaultFolder()
Returns a Folder object that represents the 'root' of the default namespace presented to the user by the Store. |
abstract Folder |
getFolder(java.lang.String name)
Return the Folder object corresponding to the given name. |
abstract Folder |
getFolder(URLName url)
Return a closed Folder object, corresponding to the given URLName. |
Folder[] |
getPersonalNamespaces()
Return a set of folders representing the personal namespaces for the current user. |
Folder[] |
getSharedNamespaces()
Return a set of folders representing the shared namespaces. |
Folder[] |
getUserNamespaces(java.lang.String user)
Return a set of folders representing the namespaces for user . |
protected void |
notifyFolderListeners(int type,
Folder folder)
Notify all FolderListeners. |
protected void |
notifyFolderRenamedListeners(Folder oldF,
Folder newF)
Notify all FolderListeners about the renaming of a folder. |
protected void |
notifyStoreListeners(int type,
java.lang.String message)
Notify all StoreListeners. |
void |
removeFolderListener(FolderListener l)
Remove a listener for Folder events. |
void |
removeStoreListener(StoreListener l)
Remove a listener for Store events. |
Methods inherited from class javax.mail.Service |
---|
addConnectionListener, close, connect, 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 |
Constructor Detail |
---|
protected Store(Session session, URLName urlname)
session
- Session object for this Store.urlname
- URLName object to be used for this StoreMethod Detail |
---|
public abstract Folder getDefaultFolder() throws MessagingException
IllegalStateException
- if this Store is not connected.
MessagingException
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.
IllegalStateException
- if this Store is not connected.
MessagingException
Folder#exists
,
Folder#create
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 folder
IllegalStateException
- if this Store is not connected.
MessagingException
URLName
public Folder[] getPersonalNamespaces() throws MessagingException
This implementation returns an array with a single entry containing
the return value of the getDefaultFolder
method.
Subclasses should override this method to return appropriate information.
IllegalStateException
- if this Store is not connected.
MessagingException
public Folder[] getUserNamespaces(java.lang.String user) throws MessagingException
user
. The namespaces returned represent the
personal namespaces for the user. To access mail folders in the
other user's namespace, the currently authenticated user must be
explicitly granted access rights. For example, it is common for
a manager to grant to their secretary access rights to their
mail folders. This implementation returns an empty array. Subclasses should override this method to return appropriate information.
IllegalStateException
- if this Store is not connected.
MessagingException
public Folder[] getSharedNamespaces() throws MessagingException
This implementation returns an empty array. Subclasses should override this method to return appropriate information.
IllegalStateException
- if this Store is not connected.
MessagingException
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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2009-2011, Oracle Corporation and/or its affiliates. All Rights Reserved. Use is subject to license terms.
Generated on 10-February-2011 12:41