Nitido Inc.

com.nitido.nimx.nuggets.extmail
Class ExternalMailNugget

java.lang.Object
  extended by com.nitido.nim.Nugget
      extended by com.nitido.nim.NonCachableNugget
          extended by com.nitido.nimx.nuggets.extmail.ExternalMailNugget
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ExternalMailNuggetImpl

public abstract class ExternalMailNugget
extends NonCachableNugget

The ExternalMailNugget is a NiM nugget that abstracts access to external POP3 servers.

Programming Model

 Folder folder = myExternalMailNugget.connect( myExtMailSetting );
 Message[] msgs = folder.getMessages();
 for( int i=0; i<msgs.length; i++ )
 {
     // format the message header info into HTML display here
     ...
 } // end for
 ...
 // The request has been completed... now close the folder
 myExternalMailNugget.close( folder );
 
ExternalMailNugget Settings
The optional settings are:

Name Constant Type Description
javamail.connectiontimeout KEY_POP3_CONNECTIONTIMEOUT String The JavaMail socket connection timeout in milliseconds. This Nugget's default is 30000 (30 seconds).
javamail.timeout KEY_POP3_TIMEOUT String The JavaMail socket I/O timeout in milliseconds. This Nugget's default is 30000 (30 seconds).
javamail.debug KEY_JAVAMAIL_DEBUG boolean String A string of "true" means turning on the Sun's JavaMail debug messages (the string is case insensitive). Any other string means turning the debug message off. This Nugget's default is "false". NOTE: if this setting is set to "true", the JavaMail library will output the debug message to the JVM's System.out

See Also:
Serialized Form

Field Summary
static java.lang.String DEFAULT_CONNECTIONTIMEOUT
           
static java.lang.String DEFAULT_TIMEOUT
           
static java.lang.String KEY_JAVAMAIL_DEBUG
           
static java.lang.String KEY_POP3_CONNECTIONTIMEOUT
           
static java.lang.String KEY_POP3_TIMEOUT
           
 
Fields inherited from class com.nitido.nim.Nugget
_entity, _nim, _nuggetName, _settings
 
Constructor Summary
ExternalMailNugget(NuggetVisa visa)
          Default constructor
 
Method Summary
protected  void checkBoolean(java.util.Hashtable settings, java.lang.String key)
           
protected  void checkEmail(java.util.Hashtable settings, java.lang.String key)
           
protected  void checkInt(java.util.Hashtable settings, java.lang.String key)
           
protected  void checkNonNull(java.util.Hashtable settings, java.lang.String key)
           
protected  void checkWithDefault(java.util.Hashtable settings, java.lang.String key, java.lang.String defaultValue)
           
abstract  javax.mail.Folder connect(java.lang.String host, int port, java.lang.String username, java.lang.String password, boolean leaveMail)
          Get the folder that represents the 'root' of the mailbox.
abstract  javax.mail.Folder connect(java.lang.String host, int port, java.lang.String username, java.lang.String password, boolean leaveMail, boolean useSSL)
          Get the folder that represents the 'root' of the mailbox.
abstract  void disconnect()
          Close the connection to the mail server.
protected  void settingsToProperties(java.lang.String key, java.util.Properties props)
           
 
Methods inherited from class com.nitido.nim.NonCachableNugget
isCachable
 
Methods inherited from class com.nitido.nim.Nugget
activate, deactivate, destroy, destroyImpl, getDescriptor, getEntity, getNuggetName, getSetting, getSettings, init, initImpl, requestBegin, requestEnd
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_POP3_CONNECTIONTIMEOUT

public static final java.lang.String KEY_POP3_CONNECTIONTIMEOUT
See Also:
Constant Field Values

KEY_POP3_TIMEOUT

public static final java.lang.String KEY_POP3_TIMEOUT
See Also:
Constant Field Values

KEY_JAVAMAIL_DEBUG

public static final java.lang.String KEY_JAVAMAIL_DEBUG
See Also:
Constant Field Values

DEFAULT_CONNECTIONTIMEOUT

public static final java.lang.String DEFAULT_CONNECTIONTIMEOUT
See Also:
Constant Field Values

DEFAULT_TIMEOUT

public static final java.lang.String DEFAULT_TIMEOUT
See Also:
Constant Field Values
Constructor Detail

ExternalMailNugget

public ExternalMailNugget(NuggetVisa visa)
Default constructor

Method Detail

connect

public abstract javax.mail.Folder connect(java.lang.String host,
                                          int port,
                                          java.lang.String username,
                                          java.lang.String password,
                                          boolean leaveMail)
                                   throws javax.mail.MessagingException,
                                          ExternalMailNuggetException
Get the folder that represents the 'root' of the mailbox.

Parameters:
host - The host name of the target external POP3 server.
port - The port of the target external POP3 server.
username - The external POP3 server's login user name.
password - The external POP3 server's login user password.
leaveMail - The flag to indicate whether to leave emails on the external POP3 server after downloaded them.
Returns:
an opened Folder object for the requested folder.
Throws:
javax.mail.MessagingException
ExternalMailNuggetException

connect

public abstract javax.mail.Folder connect(java.lang.String host,
                                          int port,
                                          java.lang.String username,
                                          java.lang.String password,
                                          boolean leaveMail,
                                          boolean useSSL)
                                   throws javax.mail.MessagingException,
                                          ExternalMailNuggetException
Get the folder that represents the 'root' of the mailbox.

Parameters:
host - The host name of the target external POP3 server.
port - The port of the target external POP3 server.
username - The external POP3 server's login user name.
password - The external POP3 server's login user password.
leaveMail - The flag to indicate whether to leave emails on the external POP3 server after downloaded them.
useSSL - The flag to indicate whether to use SSL socket to connect to the external POP3 server.
Returns:
an opened Folder object for the requested folder.
Throws:
javax.mail.MessagingException
ExternalMailNuggetException

disconnect

public abstract void disconnect()
                         throws javax.mail.MessagingException,
                                ExternalMailNuggetException
Close the connection to the mail server.

Throws:
javax.mail.MessagingException
ExternalMailNuggetException

checkNonNull

protected void checkNonNull(java.util.Hashtable settings,
                            java.lang.String key)
                     throws InvalidSettingException
Throws:
InvalidSettingException

checkWithDefault

protected void checkWithDefault(java.util.Hashtable settings,
                                java.lang.String key,
                                java.lang.String defaultValue)
                         throws InvalidSettingException
Throws:
InvalidSettingException

checkEmail

protected void checkEmail(java.util.Hashtable settings,
                          java.lang.String key)
                   throws InvalidSettingException
Throws:
InvalidSettingException

checkBoolean

protected void checkBoolean(java.util.Hashtable settings,
                            java.lang.String key)
                     throws InvalidSettingException
Throws:
InvalidSettingException

checkInt

protected void checkInt(java.util.Hashtable settings,
                        java.lang.String key)
                 throws InvalidSettingException
Throws:
InvalidSettingException

settingsToProperties

protected void settingsToProperties(java.lang.String key,
                                    java.util.Properties props)

Nitido NiM 2.5 Java API

These JavaDoc pages are generated for release/nim_2_5-2.5.44

Copyright © 1999-2009 Nitido Inc.    Proprietary and Confidential.    All Rights Reserved.