public abstract class Store extends Service
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
Modifier and Type | Method and Description |
---|---|
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 . |
void |
removeFolderListener(FolderListener l)
Remove a listener for Folder events.
|
void |
removeStoreListener(StoreListener l)
Remove a listener for Store events.
|
addConnectionListener, close, connect, connect, connect, connect, getURLName, isConnected, removeConnectionListener, toString
public abstract Folder getDefaultFolder() throws MessagingException
java.lang.IllegalStateException
- if this Store is not connected.MessagingException
- for other failurespublic 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.MessagingException
- for other failuresFolder.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.MessagingException
- for other failuresURLName
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.
java.lang.IllegalStateException
- if this Store is not connected.MessagingException
- for other failurespublic 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.
user
- the user namejava.lang.IllegalStateException
- if this Store is not connected.MessagingException
- for other failurespublic Folder[] getSharedNamespaces() throws MessagingException
This implementation returns an empty array. Subclasses should override this method to return appropriate information.
java.lang.IllegalStateException
- if this Store is not connected.MessagingException
- for other failurespublic 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)
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)
Copyright © 2010 - 2020 Adobe. All Rights Reserved