javax.mail
Class Store

java.lang.Object
  extended by javax.mail.Service
      extended by javax.mail.Store

public abstract class Store
extends Service

Abstract class that represents a message store.

Version:
$Rev: 421852 $ $Date: 2006-07-14 03:02:19 -0700 (Fri, 14 Jul 2006) $

Field Summary
 
Fields inherited from class javax.mail.Service
debug, session, url
 
Constructor Summary
protected Store(Session session, URLName name)
          Constructor specifying session and url of this store.
 
Method Summary
 void addFolderListener(FolderListener listener)
           
 void addStoreListener(StoreListener listener)
           
abstract  Folder getDefaultFolder()
          Retutn a Folder object that represents the root of the namespace for the current user.
abstract  Folder getFolder(String name)
          Return the Folder corresponding to the given name.
abstract  Folder getFolder(URLName name)
          Return the folder identified by the URLName; the URLName must refer to this Store.
 Folder[] getPersonalNamespaces()
          Return the root folders of the personal namespace belonging to the current user.
 Folder[] getSharedNamespaces()
          Return the root folders of namespaces that are intended to be shared between users.
 Folder[] getUserNamespaces(String user)
          Return the root folders of the personal namespaces belonging to the supplied user.
protected  void notifyFolderListeners(int type, Folder folder)
           
protected  void notifyFolderRenamedListeners(Folder oldFolder, Folder newFolder)
           
protected  void notifyStoreListeners(int type, String message)
           
 void removeFolderListener(FolderListener listener)
           
 void removeStoreListener(StoreListener listener)
           
 
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

Store

protected Store(Session session,
                URLName name)
Constructor specifying session and url of this store. Subclasses MUST provide a constructor with this signature.

Parameters:
session - the session associated with this store
name - the URL of the store
Method Detail

getDefaultFolder

public abstract Folder getDefaultFolder()
                                 throws MessagingException
Retutn a Folder object that represents the root of the namespace for the current user. Note that in some store configurations (such as IMAP4) then the root folder may not be the INBOX folder.

Returns:
the root Folder
Throws:
MessagingException - if there was a problem accessing the store

getFolder

public abstract Folder getFolder(String name)
                          throws MessagingException
Return the Folder corresponding to the given name. The folder may not physically exist; the Folder.exists() method can be used to determine if it is real.

Parameters:
name - the name of the Folder to return
Returns:
the corresponding folder
Throws:
MessagingException - if there was a problem accessing the store

getFolder

public abstract Folder getFolder(URLName name)
                          throws MessagingException
Return the folder identified by the URLName; the URLName must refer to this Store. Implementations may use the URLName.getFile() method to determined the folder name.

Parameters:
name - the folder to return
Returns:
the corresponding folder
Throws:
MessagingException - if there was a problem accessing the store

getPersonalNamespaces

public Folder[] getPersonalNamespaces()
                               throws MessagingException
Return the root folders of the personal namespace belonging to the current user. The default implementation simply returns an array containing the folder returned by getDefaultFolder().

Returns:
the root folders of the user's peronal namespaces
Throws:
MessagingException - if there was a problem accessing the store

getUserNamespaces

public Folder[] getUserNamespaces(String user)
                           throws MessagingException
Return the root folders of the personal namespaces belonging to the supplied user. The default implementation simply returns an empty array.

Parameters:
user - the user whose namespaces should be returned
Returns:
the root folders of the given user's peronal namespaces
Throws:
MessagingException - if there was a problem accessing the store

getSharedNamespaces

public Folder[] getSharedNamespaces()
                             throws MessagingException
Return the root folders of namespaces that are intended to be shared between users. The default implementation simply returns an empty array.

Returns:
the root folders of all shared namespaces
Throws:
MessagingException - if there was a problem accessing the store

addStoreListener

public void addStoreListener(StoreListener listener)

removeStoreListener

public void removeStoreListener(StoreListener listener)

notifyStoreListeners

protected void notifyStoreListeners(int type,
                                    String message)

addFolderListener

public void addFolderListener(FolderListener listener)

removeFolderListener

public void removeFolderListener(FolderListener listener)

notifyFolderListeners

protected void notifyFolderListeners(int type,
                                     Folder folder)

notifyFolderRenamedListeners

protected void notifyFolderRenamedListeners(Folder oldFolder,
                                            Folder newFolder)


Copyright © 2006 Apache Software Foundation. All Rights Reserved.