org.apache.geronimo.javamail.store.pop3
Class POP3Store

java.lang.Object
  extended by javax.mail.Service
      extended by javax.mail.Store
          extended by org.apache.geronimo.javamail.store.pop3.POP3Store
Direct Known Subclasses:
POP3SSLStore

public class POP3Store
extends Store

POP3 implementation of javax.mail.Store POP protocol spec is implemented in org.apache.geronimo.javamail.store.pop3.POP3Connection

Version:
$Rev: 693530 $ $Date: 2008-09-09 13:57:23 -0400 (Tue, 09 Sep 2008) $

Field Summary
protected  POP3ConnectionPool connectionPool
           
protected  boolean debug
           
protected  PrintStream debugStream
           
protected static int DEFAULT_POP3_PORT
           
protected static int DEFAULT_POP3_SSL_PORT
           
protected  LinkedList openFolders
           
protected  ProtocolProperties props
           
protected  POP3RootFolder root
           
 
Fields inherited from class javax.mail.Service
session, url
 
Constructor Summary
  POP3Store(Session session, URLName name)
           
protected POP3Store(Session session, URLName name, String protocol, int defaultPort, boolean sslConnection)
          Common constructor used by the POP3Store and POP3SSLStore classes to do common initialization of defaults.
 
Method Summary
 void close()
          Close the store, and any open folders associated with the store.
protected  void closeOpenFolders()
          Close all open folders.
protected  void finalize()
          Finalizer to perform IMAPStore() cleanup when no longer in use.
protected  POP3Connection getConnection()
          Get a connection for the store.
 Folder getDefaultFolder()
          Return a Folder object that represents the root of the namespace for the current user.
 Folder getFolder(String name)
          Return the Folder corresponding to the given name.
 Folder getFolder(URLName url)
          Return the folder identified by the URLName; the URLName must refer to this Store.
 boolean isConnected()
           
protected  boolean protocolConnect(String host, int port, String username, String password)
           
protected  void releaseConnection(POP3Connection connection)
          Return a connection back to the connection pool after it has been used for a request.
 
Methods inherited from class javax.mail.Store
addFolderListener, addStoreListener, getPersonalNamespaces, getSharedNamespaces, getUserNamespaces, notifyFolderListeners, notifyFolderRenamedListeners, notifyStoreListeners, removeFolderListener, removeStoreListener
 
Methods inherited from class javax.mail.Service
addConnectionListener, connect, 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
 

Field Detail

DEFAULT_POP3_PORT

protected static final int DEFAULT_POP3_PORT
See Also:
Constant Field Values

DEFAULT_POP3_SSL_PORT

protected static final int DEFAULT_POP3_SSL_PORT
See Also:
Constant Field Values

props

protected ProtocolProperties props

connectionPool

protected POP3ConnectionPool connectionPool

debugStream

protected PrintStream debugStream

debug

protected boolean debug

root

protected POP3RootFolder root

openFolders

protected LinkedList openFolders
Constructor Detail

POP3Store

public POP3Store(Session session,
                 URLName name)

POP3Store

protected POP3Store(Session session,
                    URLName name,
                    String protocol,
                    int defaultPort,
                    boolean sslConnection)
Common constructor used by the POP3Store and POP3SSLStore classes to do common initialization of defaults.

Parameters:
session - The host session instance.
name - The URLName of the target.
protocol - The protocol type ("pop3"). This helps us in retrieving protocol-specific session properties.
defaultPort - The default port used by this protocol. For pop3, this will be 110. The default for pop3 with ssl is 995.
sslConnection - Indicates whether an SSL connection should be used to initial contact the server. This is different from the STARTTLS support, which switches the connection to SSL after the initial startup.
Method Detail

getDefaultFolder

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

Specified by:
getDefaultFolder in class Store
Returns:
the root Folder
Throws:
MessagingException - if there was a problem accessing the store

getFolder

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

Specified by:
getFolder in class Store
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 Folder getFolder(URLName url)
                 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.

Specified by:
getFolder in class Store
Parameters:
url -
Returns:
the corresponding folder
Throws:
MessagingException - if there was a problem accessing the store

protocolConnect

protected boolean protocolConnect(String host,
                                  int port,
                                  String username,
                                  String password)
                           throws MessagingException
Overrides:
protocolConnect in class Service
Throws:
MessagingException
See Also:
Service.protocolConnect(java.lang.String, int, java.lang.String, java.lang.String)

getConnection

protected POP3Connection getConnection()
                                throws MessagingException
Get a connection for the store.

Returns:
The request connection object.
Throws:
MessagingException

releaseConnection

protected void releaseConnection(POP3Connection connection)
                          throws MessagingException
Return a connection back to the connection pool after it has been used for a request.

Parameters:
connection - The return connection.
Throws:
MessagingException

closeOpenFolders

protected void closeOpenFolders()
Close all open folders. We have a small problem here with a race condition. There's no safe, single synchronization point for us to block creation of new folders while we're closing. So we make a copy of the folders list, close all of those folders, and keep repeating until we're done.


isConnected

public boolean isConnected()
Overrides:
isConnected in class Service
See Also:
Service.isConnected()

close

public void close()
           throws MessagingException
Close the store, and any open folders associated with the store.

Overrides:
close in class Service
Throws:
MessagingException

finalize

protected void finalize()
                 throws Throwable
Finalizer to perform IMAPStore() cleanup when no longer in use.

Overrides:
finalize in class Service
Throws:
Throwable


Copyright © 2003-2009 The Apache Software Foundation. All Rights Reserved.