Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.mail.imap
Class IMAPStore

    java.lang.Object
      |
      +--javax.mail.Service
            |
            +--javax.mail.Store
                  |
                  +--com.sun.mail.imap.IMAPStore

All Implemented Interfaces:
  com.sun.mail.iap.ResponseHandler

public class IMAPStore
extends Store
implements com.sun.mail.iap.ResponseHandler

This class provides access to an IMAP message store.

Applications that need to make use of IMAP-specific features may cast a `Store` object to an `IMAPStore` object and use the methods on this class. The `getQuota` and `setQuota` methods support the IMAP QUOTA extension. Refer to RFC 2087 for more information.

See the com.sun.mail.imap package documentation for further information on the IMAP protocol provider.

WARNING: The APIs unique to this class should be considered EXPERIMENTAL. They may be changed in the future in ways that are incompatible with applications using the current APIs.

Fields inherited from class javax.mail.Service
`debug, session, url`

Constructor Summary
`IMAPStore(Session session, URLName url)` Constructor that takes a Session object and a URLName that represents a specific IMAP server.

Method Summary
`void` | `close()` Close this Store.
`protected void` | `finalize()` Stop the event dispatcher thread so the queue can be garbage collected.
`Folder` | `getDefaultFolder()` Get the default folder, representing the root of this user's namespace.
`Folder` | `getFolder(java.lang.String name)` Get named folder.
`Folder` | `getFolder(URLName url)` Get named folder.
`Folder[]` | `getPersonalNamespaces()` Using the IMAP NAMESPACE command (RFC 2342), return a set of folders representing the Personal namespaces.
`Quota[]` | `getQuota(java.lang.String root)` Get the quotas for the named quota root.
`Folder[]` | `getSharedNamespaces()` Using the IMAP NAMESPACE command (RFC 2342), return a set of folders representing the Shared namespaces.
`Folder[]` | `getUserNamespaces(java.lang.String user)` Using the IMAP NAMESPACE command (RFC 2342), return a set of folders representing the User's namespaces.
`void` | `handleResponse(com.sun.mail.iap.Response r)` Response handler method.
`boolean` | `isConnected()` Check whether this store is connected.
`protected boolean` | `protocolConnect(java.lang.String host, int pport, java.lang.String user, java.lang.String password)` Implementation of protocolConnect()
`void` | `setQuota(Quota quota)` Set the quotas for the quota root specified in the quota argument.

Methods inherited from class javax.mail.Store
`addFolderListener, addStoreListener, notifyFolderListeners, notifyFolderRenamedListeners, notifyStoreListeners, removeFolderListener, removeStoreListener`

Methods inherited from class javax.mail.Service
`addConnectionListener, connect, connect, connect, getURLName, notifyConnectionListeners, queueEvent, removeConnectionListener, setConnected, setURLName, toString`

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### IMAPStore

    public IMAPStore(Session session,
                     URLName url)

  Constructor that takes a Session object and a URLName that represents a specific IMAP server.

Method Detail

### protocolConnect

    protected boolean protocolConnect(java.lang.String host,
                                      int pport,
                                      java.lang.String user,
                                      java.lang.String password)
                               throws MessagingException

  Implementation of protocolConnect()
  Overrides:
    `protocolConnect` in class `Service`
  Following copied from class: `javax.mail.Service`
  Parameters:
    `host` - the name of the host to connect to
    `port` - the port to use (-1 means use default port)
    `user` - the name of the user to login as
    `password` - the user's password
  Returns:
    true if connection successful, false if authentication failed
  Throws:
    `AuthenticationFailedException` - for authentication failures
    `MessagingException` - for non-authentication failures

### isConnected

    public boolean isConnected()

  Check whether this store is connected. Override superclass method, to actually ping our server connection.
  Overrides:
    `isConnected` in class `Service`
  Following copied from class: `javax.mail.Service`
  Returns:
    true if the service is connected, false if it is not connected

### close

    public void close()
               throws MessagingException

  Close this Store.
  Overrides:
    `close` in class `Service`
  Following copied from class: `javax.mail.Service`
  Throws:
    `MessagingException` - for errors while closing
  See Also:
    `ConnectionEvent`

### finalize

    protected void finalize()
                     throws java.lang.Throwable

  Description copied from class: `Service`
  Stop the event dispatcher thread so the queue can be garbage collected.
  Overrides:
    `finalize` in class `Service`

### getDefaultFolder

    public Folder getDefaultFolder()
                            throws MessagingException

  Get the default folder, representing the root of this user's namespace. Returns a closed DefaultFolder object.
  Overrides:
    `getDefaultFolder` in class `Store`
  Following copied from class: `javax.mail.Store`
  Returns:
    the root Folder
  Throws:
    `IllegalStateException` - if this Store is not connected.

### getFolder

    public Folder getFolder(java.lang.String name)
                     throws MessagingException

  Get named folder. Returns a new, closed IMAPFolder.
  Overrides:
    `getFolder` in class `Store`
  Following copied from class: `javax.mail.Store`
  Parameters:
    `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.
  Returns:
    Folder object
  Throws:
    `IllegalStateException` - if this Store is not connected.
  See Also:
    `Folder.exists()`, `Folder.create(int)`

### getFolder

    public Folder getFolder(URLName url)
                     throws MessagingException

  Get named folder. Returns a new, closed IMAPFolder.
  Overrides:
    `getFolder` in class `Store`
  Following copied from class: `javax.mail.Store`
  Parameters:
    `url` - URLName that denotes a folder
  Returns:
    Folder object
  Throws:
    `IllegalStateException` - if this Store is not connected.
  See Also:
    `URLName`

### getPersonalNamespaces

    public Folder[] getPersonalNamespaces()
                                   throws MessagingException

  Using the IMAP NAMESPACE command (RFC 2342), return a set of folders representing the Personal namespaces.
  Overrides:
    `getPersonalNamespaces` in class `Store`
  Following copied from class: `javax.mail.Store`
  Returns:
    array of Folder objects
  Throws:
    `IllegalStateException` - if this Store is not connected.

### getUserNamespaces

    public Folder[] getUserNamespaces(java.lang.String user)
                               throws MessagingException

  Using the IMAP NAMESPACE command (RFC 2342), return a set of folders representing the User's namespaces.
  Overrides:
    `getUserNamespaces` in class `Store`
  Following copied from class: `javax.mail.Store`
  Returns:
    array of Folder objects
  Throws:
    `IllegalStateException` - if this Store is not connected.

### getSharedNamespaces

    public Folder[] getSharedNamespaces()
                                 throws MessagingException

  Using the IMAP NAMESPACE command (RFC 2342), return a set of folders representing the Shared namespaces.
  Overrides:
    `getSharedNamespaces` in class `Store`
  Following copied from class: `javax.mail.Store`
  Returns:
    array of Folder objects
  Throws:
    `IllegalStateException` - if this Store is not connected.

### getQuota

    public Quota[] getQuota(java.lang.String root)
                     throws MessagingException

  Get the quotas for the named quota root. Quotas are controlled on the basis of a quota root, not (necessarily) a folder. The relationship between folders and quota roots depends on the IMAP server. Some servers might implement a single quota root for all folders owned by a user. Other servers might implement a separate quota root for each folder. A single folder can even have multiple quota roots, perhaps controlling quotas for different resources.
  Parameters:
    `root` - the name of the quota root
  Returns:
    array of Quota objects
  Throws:
    `MessagingException` - if the server doesn't support the QUOTA extension

### setQuota

    public void setQuota(Quota quota)
                  throws MessagingException

  Set the quotas for the quota root specified in the quota argument. Typically this will be one of the quota roots obtained from the `getQuota` method, but it need not be.
  Parameters:
    `quota` - the quota to set
  Throws:
    `MessagingException` - if the server doesn't support the QUOTA extension

### handleResponse

    public void handleResponse(com.sun.mail.iap.Response r)

  Response handler method.
  Specified by:
    `handleResponse` in interface `com.sun.mail.iap.ResponseHandler`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD