Package com.sun.mail.gimap
Class GmailStore
java.lang.Object
javax.mail.Service
javax.mail.Store
com.sun.mail.imap.IMAPStore
com.sun.mail.gimap.GmailStore
- All Implemented Interfaces:
ResponseHandler
,AutoCloseable
,QuotaAwareStore
- Direct Known Subclasses:
GmailSSLStore
A Gmail Store. Defaults to imap.gmail.com with SSL.
Uses a GmailProtocol and Gmail Folder to support Gmail extensions.
- Since:
- JavaMail 1.4.6
- Author:
- Bill Shannon
-
Field Summary
Fields inherited from class com.sun.mail.imap.IMAPStore
authorizationID, defaultPort, host, ID_ADDRESS, ID_ARGUMENTS, ID_COMMAND, ID_DATE, ID_ENVIRONMENT, ID_NAME, ID_OS, ID_OS_VERSION, ID_SUPPORT_URL, ID_VENDOR, ID_VERSION, isSSL, logger, name, password, proxyAuthUser, RESPONSE, saslRealm, user
-
Constructor Summary
ConstructorsModifierConstructorDescriptionGmailStore
(Session session, URLName url) Constructor that takes a Session object and a URLName that represents a specific IMAP server.protected
GmailStore
(Session session, URLName url, String name, boolean isSSL) Constructor used by GmailSSLStore subclass. -
Method Summary
Modifier and TypeMethodDescriptionprotected IMAPFolder
Create an IMAPFolder object.protected IMAPFolder
newIMAPFolder
(String fullName, char separator, Boolean isNamespace) Create an IMAPFolder object.protected IMAPProtocol
newIMAPProtocol
(String host, int port) Create an IMAPProtocol object connected to the host and port.protected boolean
protocolConnect
(String host, int pport, String user, String password) Implementation of protocolConnect().Methods inherited from class com.sun.mail.imap.IMAPStore
close, finalize, getDefaultFolder, getFolder, getFolder, getPersonalNamespaces, getProxyAuthUser, getQuota, getSharedNamespaces, getUserNamespaces, handleResponse, hasCapability, id, idle, isConnected, isSSL, newIMAPFolder, preLogin, setPassword, setProxyAuthUser, setQuota, setUsername
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, connect, getURLName, notifyConnectionListeners, queueEvent, removeConnectionListener, setConnected, setURLName, toString
-
Constructor Details
-
GmailStore
Constructor that takes a Session object and a URLName that represents a specific IMAP server.- Parameters:
session
- the Sessionurl
- the URLName of this store
-
GmailStore
Constructor used by GmailSSLStore subclass.- Parameters:
session
- the Sessionurl
- the URLName of this storename
- the protocol nameisSSL
- use SSL to connect?
-
-
Method Details
-
protocolConnect
protected boolean protocolConnect(String host, int pport, String user, String password) throws MessagingException Description copied from class:IMAPStore
Implementation of protocolConnect(). Will create a connection to the server and authenticate the user using the mechanisms specified by various properties.The
host
,user
, andpassword
parameters must all be non-null. If the authentication mechanism being used does not require a password, an empty string or other suitable dummy password should be used.- Overrides:
protocolConnect
in classIMAPStore
- Parameters:
host
- the name of the host to connect topport
- the port to use (-1 means use default port)user
- the name of the user to login aspassword
- the user's password- Returns:
- true if connection successful, false if authentication failed
- Throws:
AuthenticationFailedException
- for authentication failuresMessagingException
- for non-authentication failures
-
newIMAPProtocol
Description copied from class:IMAPStore
Create an IMAPProtocol object connected to the host and port. Subclasses of IMAPStore may override this method to return a subclass of IMAPProtocol that supports product-specific extensions.- Overrides:
newIMAPProtocol
in classIMAPStore
- Parameters:
host
- the host nameport
- the port number- Returns:
- the new IMAPProtocol object
- Throws:
IOException
- for I/O errorsProtocolException
- for protocol errors
-
newIMAPFolder
Create an IMAPFolder object.- Overrides:
newIMAPFolder
in classIMAPStore
- Parameters:
fullName
- the full name of the folderseparator
- the separator character for the folder hierarchyisNamespace
- does this name represent a namespace?- Returns:
- the new IMAPFolder object
-
newIMAPFolder
Create an IMAPFolder object.- Overrides:
newIMAPFolder
in classIMAPStore
- Parameters:
li
- the ListInfo for the folder- Returns:
- the new IMAPFolder object
-