|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.nitido.nim.Nugget
com.nitido.nimx.nuggets.javamail.JavaMailNugget
com.nitido.nimx.nuggets.javamail.valet.JavaMailNuggetImpl
public class JavaMailNuggetImpl
Field Summary | |
---|---|
static java.lang.String |
KEY_VALET_EXPIRE_TIME
|
static java.lang.String |
KEY_VALET_TICKET_KEY
|
Fields inherited from class com.nitido.nim.Nugget |
---|
_entity, _nim, _nuggetName, _settings |
Fields inherited from interface com.nitido.nim.CredentialConstants |
---|
CRED_ADMIN, CRED_CONTAINER, CRED_HELPDESK, CRED_SYSTEM, CRED_USER, KEY_PASSWORD |
Constructor Summary | |
---|---|
JavaMailNuggetImpl(NuggetVisa visa)
Default constructor. |
Method Summary | |
---|---|
void |
activate()
Used by NiM Nugget mechnanism. |
protected void |
checkBoolean(java.lang.String key)
|
protected void |
checkEmail(java.lang.String key)
|
protected void |
checkFolderForUIDOps(javax.mail.Folder folder)
|
protected void |
checkInt(java.lang.String key)
|
protected void |
checkNonNull(java.lang.String key)
|
void |
checkUIDValidity(javax.mail.Folder folder,
long orgUIDValidity)
This method will throw an InvalidUIDException if the folder's current UIDValidity value is not the same as the original value. |
protected void |
checkWithDefault(java.lang.String key,
java.lang.String defaultValue)
|
void |
closeFolder(javax.mail.Folder folder,
boolean expunge)
Close the specified folder. |
void |
closeFolderQuietly(javax.mail.Folder folder,
boolean expunge)
Close the specified folder quietly. |
void |
connectIMAP()
Connect to to the IMAP server with the specified settings. |
javax.mail.Folder |
createFolder(java.lang.String folderName,
int type,
boolean isOpenedFolder)
Create a new folder by specifying the full name of the folder. |
javax.mail.internet.MimeMessage |
createMessage()
This method creates an empty MimeMessage for the user to populate and save/send. |
void |
deactivate()
Used by NiM Nugget mechnanism. |
protected void |
destroyImpl()
This method is invoked by the destroy() method when the associated Entity has been signaled as "dying". |
void |
disconnectIMAP()
Disconnect from the IMAP server. |
void |
disconnectIMAPQuietly()
Force a disconnection from the IMAP server. |
protected Credential |
fetchCredential(java.lang.String protocol,
java.lang.String settingKey)
Fetch the credential from the DataStore. |
protected java.lang.String |
getActualSetting(java.lang.String configKey)
This method return the actual value of a setting. |
javax.mail.Folder |
getDefaultFolder()
Get the folder that represents the 'root' of the mailbox. |
java.lang.String |
getDescriptor()
Used by NiM Nugget mechnanism. |
javax.mail.Folder |
getFolderByName(java.lang.String folderName)
Get the folder with the specified folder name. |
protected java.lang.String |
getIMAPPassword()
|
protected java.lang.String |
getIMAPUserID()
|
protected java.util.Properties |
getJavaMailProperties()
|
protected java.lang.String |
getLoginPassword(java.lang.String configKey)
|
protected java.lang.String |
getLoginUser(java.lang.String configKey)
|
protected long |
getLongSetting(java.lang.String key)
|
Usage |
getMailBoxUsage()
This method should work with iPlanet Calendar Server 5.1 or later. |
javax.mail.Message |
getMessageByUID(javax.mail.Folder folder,
long orgUIDValidity,
long uid)
Get the message by UID. |
javax.mail.Message[] |
getMessagesByUIDRange(javax.mail.Folder folder,
long orgUIDValidity,
long start,
long end)
Get messages by UIDs |
javax.mail.Message[] |
getMessagesByUIDs(javax.mail.Folder folder,
long orgUIDValidity,
long[] uids)
Get messages by UIDs |
java.lang.String[] |
getPersonalNamespaces()
Deprecated. |
java.lang.String[] |
getSharedNamespaces()
Deprecated. |
java.lang.String[] |
getSystemFolders()
This method reports a list of folders that are system folders. |
protected long |
getUID(javax.mail.UIDFolder uf,
javax.mail.Message msg)
|
long |
getUIDNext(javax.mail.Folder folder)
Get the UIDNext number of the folder. |
long |
getUIDofMessage(javax.mail.Folder folder,
javax.mail.Message msg)
Get the UID of the message. |
long[] |
getUIDofMessages(javax.mail.Folder folder,
javax.mail.Message[] msgs)
Get the UIDs of the messages. |
long |
getUIDValidity(javax.mail.Folder folder)
Get the UIDValidity number of the folder. |
protected Usage |
getUsageFromFolder(javax.mail.Folder inFolder)
get mailbox usage quota on a folder. |
protected void |
initImpl()
Used by NiM Nugget mechnanism. |
boolean |
isCachable()
This method indicates whether the Nugget implementation is a cachable nugget. |
javax.mail.Folder |
openDefaultFolder()
Open the folder that represents the 'root' of the mailbox. |
protected boolean |
openFolder(javax.mail.Folder folder)
|
javax.mail.Folder |
openFolderByName(java.lang.String folderName)
Open the folder with the specified folder name. |
void |
sendMessage(javax.mail.Message msg,
javax.mail.Address[] addr)
Send the message to the address. |
protected java.util.Properties |
settingsToJMProp()
|
protected void |
settingsToProperties(java.lang.String key,
java.util.Properties props)
|
Methods inherited from class com.nitido.nimx.nuggets.javamail.JavaMailNugget |
---|
createFolderByName |
Methods inherited from class com.nitido.nim.Nugget |
---|
destroy, getEntity, getNuggetName, getSetting, getSettings, init, requestBegin, requestEnd |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String KEY_VALET_TICKET_KEY
public static final java.lang.String KEY_VALET_EXPIRE_TIME
Constructor Detail |
---|
public JavaMailNuggetImpl(NuggetVisa visa)
Method Detail |
---|
public void connectIMAP() throws JavaMailNuggetException
connectIMAP
in class JavaMailNugget
JavaMailNuggetException
public void disconnectIMAP() throws ActivationException
disconnectIMAP
in class JavaMailNugget
ActivationException
- if network error occurs or problems with disconnection.public void disconnectIMAPQuietly()
JavaMailNugget
If the connection has been dropped already or IO/IMAP problem occured, this method will not do anything (i.e. no exception).
disconnectIMAPQuietly
in class JavaMailNugget
public void activate() throws ActivationException
activate
in class Nugget
ActivationException
- If unable to activate the Nuggetpublic void deactivate() throws ActivationException
deactivate
in class Nugget
ActivationException
- If unable to deactivate the Nuggetpublic java.lang.String getDescriptor()
getDescriptor
in class Nugget
protected void initImpl() throws InvalidSettingException
initImpl
in class Nugget
InvalidSettingException
- If any of the expected initialization settings are null.public javax.mail.Folder openDefaultFolder() throws javax.mail.FolderNotFoundException, javax.mail.MessagingException, JavaMailNuggetException
JavaMailNugget
openDefaultFolder
in class JavaMailNugget
javax.mail.FolderNotFoundException
javax.mail.MessagingException
JavaMailNuggetException
public javax.mail.Folder getDefaultFolder() throws javax.mail.FolderNotFoundException, javax.mail.MessagingException, JavaMailNuggetException
JavaMailNugget
getDefaultFolder
in class JavaMailNugget
javax.mail.FolderNotFoundException
javax.mail.MessagingException
JavaMailNuggetException
public javax.mail.Folder openFolderByName(java.lang.String folderName) throws javax.mail.FolderNotFoundException, javax.mail.MessagingException, JavaMailNuggetException
JavaMailNugget
openFolderByName
in class JavaMailNugget
folderName
- The folder name can be a full folder name or short name (with path
relative to the default 'root' folder for the user).
javax.mail.FolderNotFoundException
javax.mail.MessagingException
JavaMailNuggetException
public javax.mail.Folder getFolderByName(java.lang.String folderName) throws javax.mail.FolderNotFoundException, javax.mail.MessagingException, JavaMailNuggetException
JavaMailNugget
getFolderByName
in class JavaMailNugget
folderName
- The folder name can be a full folder name or short name (with path
relative to the default 'root' folder for the user).
javax.mail.FolderNotFoundException
javax.mail.MessagingException
JavaMailNuggetException
public javax.mail.Folder createFolder(java.lang.String folderName, int type, boolean isOpenedFolder) throws javax.mail.MessagingException, JavaMailNuggetException
JavaMailNugget
If the creation is successful, a Folder object of the new folder will be returned. This Folder object will be opened if the type parameter has set the Folder.HOLDS_MESSAGES bit, AND, the isOpenedFolder parameter is "true". Otherwise, the returning Folder object will remain closed.
This method is introduced in NiM 2.4 to replace the original "Folder createFolderByName( String folderName, int type )" method.
createFolder
in class JavaMailNugget
folderName
- the name of the new folder (this includes the full path)type
- The type of the folders. It is a bit-field stored as integer.
The valid fields are Folder.HOLDS_FOLDERS and Folder.HOLDS_MESSAGES.
If a folder can hold both folders and messages, the value would be
( Folder.HOLDS_FOLDERS | Folder.HOLDS_MESSAGES ) - i.e. bitwise OR of
the values. javax.mail.MessagingException
JavaMailNuggetException
public java.lang.String[] getPersonalNamespaces() throws javax.mail.MessagingException, JavaMailNuggetException
JavaMailNugget
This method is deprecated because future versions of JavaMail will not support this type of methods. JavaMail 1.2 is the last version that supports it.
getPersonalNamespaces
in class JavaMailNugget
javax.mail.MessagingException
JavaMailNuggetException
public java.lang.String[] getSharedNamespaces() throws javax.mail.MessagingException, JavaMailNuggetException
JavaMailNugget
getSharedNamespaces
in class JavaMailNugget
javax.mail.MessagingException
JavaMailNuggetException
public void closeFolder(javax.mail.Folder folder, boolean expunge) throws javax.mail.MessagingException, JavaMailNuggetException
JavaMailNugget
closeFolder
in class JavaMailNugget
folder
- the Folder object of the folder to be closed.
expunge
- Determine how the IMAP server treats "deleted" messages upon closing
the folder. If the parameter is set to true, the server will
permanently remove all the messages with flag marked as DELETED.
Otherwise, the server will just leave those messages on the system.
javax.mail.MessagingException
- if error has occurred when connecting the IMAP server and/or
when executing the command.
JavaMailNuggetException
- if the folder object is nullpublic void closeFolderQuietly(javax.mail.Folder folder, boolean expunge)
JavaMailNugget
closeFolderQuietly
in class JavaMailNugget
folder
- the Folder object of the folder to be closed.
expunge
- Determine how the IMAP server treats "deleted" messages upon closing
the folder. If the parameter is set to true, the server will
permanently remove all the messages with flag marked as DELETED.
Otherwise, the server will just leave those messages on the system.
public java.lang.String[] getSystemFolders() throws javax.mail.MessagingException, JavaMailNuggetException
JavaMailNugget
getSystemFolders
in class JavaMailNugget
javax.mail.MessagingException
JavaMailNuggetException
public long getUIDValidity(javax.mail.Folder folder) throws javax.mail.FolderNotFoundException, javax.mail.MessagingException, JavaMailNuggetException
JavaMailNugget
getUIDValidity
in class JavaMailNugget
folder
- The folder to fetch the UIDValidity number from
javax.mail.FolderNotFoundException
javax.mail.MessagingException
JavaMailNuggetException
public long getUIDNext(javax.mail.Folder folder) throws javax.mail.MessagingException
JavaMailNugget
getUIDNext
in class JavaMailNugget
folder
- The folder to fetch the UIDNext number from.
javax.mail.MessagingException
public long getUIDofMessage(javax.mail.Folder folder, javax.mail.Message msg) throws javax.mail.FolderNotFoundException, javax.mail.MessagingException, MessageNotInFolderException, JavaMailNuggetException
JavaMailNugget
getUIDofMessage
in class JavaMailNugget
MessageNotInFolderException
- If the message is not stored under the specified folder.
javax.mail.FolderNotFoundException
javax.mail.MessagingException
JavaMailNuggetException
public long[] getUIDofMessages(javax.mail.Folder folder, javax.mail.Message[] msgs) throws javax.mail.FolderNotFoundException, javax.mail.MessagingException, MessageNotInFolderException, JavaMailNuggetException
JavaMailNugget
getUIDofMessages
in class JavaMailNugget
MessageNotInFolderException
- If at least one of the message is not stored under the specified
folder.
javax.mail.FolderNotFoundException
javax.mail.MessagingException
JavaMailNuggetException
public javax.mail.Message getMessageByUID(javax.mail.Folder folder, long orgUIDValidity, long uid) throws javax.mail.FolderNotFoundException, javax.mail.MessagingException, InvalidUIDException, JavaMailNuggetException
JavaMailNugget
getMessageByUID
in class JavaMailNugget
folder
- The folder to get the message from.orgUIDValidity
- The original UIDValidity number that the folder returns when you
fetch the message UID. This number is used to determine whether the
server has altered the UIDs between your request.uid
- The uid of the message you want to fetch.
InvalidUIDException
- If the server has changed the UID between your requests.
javax.mail.FolderNotFoundException
javax.mail.MessagingException
JavaMailNuggetException
public javax.mail.Message[] getMessagesByUIDs(javax.mail.Folder folder, long orgUIDValidity, long[] uids) throws javax.mail.FolderNotFoundException, javax.mail.MessagingException, InvalidUIDException, JavaMailNuggetException
JavaMailNugget
getMessagesByUIDs
in class JavaMailNugget
folder
- The folder to get the message from.orgUIDValidity
- The original UIDValidity number that the folder returns when you
fetch the message UID. This number is used to determine whether the
server has altered the UIDs between your request.uids
- An array of uid of the messages you want to fetch.
InvalidUIDException
- If the server has changed the UID between your requests.
javax.mail.FolderNotFoundException
javax.mail.MessagingException
JavaMailNuggetException
public javax.mail.Message[] getMessagesByUIDRange(javax.mail.Folder folder, long orgUIDValidity, long start, long end) throws javax.mail.FolderNotFoundException, javax.mail.MessagingException, InvalidUIDException, JavaMailNuggetException
JavaMailNugget
getMessagesByUIDRange
in class JavaMailNugget
folder
- The folder to get the message from.orgUIDValidity
- The original UIDValidity number that the folder returns when you
fetch the message UID. This number is used to determine whether the
server has altered the UIDs between your request.start
- The smallest UID of the message to fetch.end
- The largest UID index of the message to fetch.
InvalidUIDException
- If the server has changed the UID between your requests.
javax.mail.FolderNotFoundException
javax.mail.MessagingException
JavaMailNuggetException
public Usage getMailBoxUsage() throws javax.mail.MessagingException, JavaMailNuggetException
getMailBoxUsage
in class JavaMailNugget
javax.mail.MessagingException
JavaMailNuggetException
public javax.mail.internet.MimeMessage createMessage()
JavaMailNugget
Its headers field is set to an empty InternetHeaders object. The flags field is set to an empty Flags object. The modified flag is set to true.
In other words, this method would not restrict the caller on the setting of the message. The caller can set these header information in anyway that is suitable for the nature of the message.
This method does not require the caller to have any folder opened,.
createMessage
in class JavaMailNugget
public void sendMessage(javax.mail.Message msg, javax.mail.Address[] addr) throws javax.mail.SendFailedException, javax.mail.MessagingException, JavaMailNuggetException
JavaMailNugget
sendMessage
in class JavaMailNugget
msg
- the message to be sent.addr
- an array of Address objects that are going to be sent. If this
parameter is null, it will use the addresses from msg.getAllRecipients()
instead.
javax.mail.SendFailedException
javax.mail.MessagingException
JavaMailNuggetException
protected java.util.Properties settingsToJMProp() throws InvalidSettingException
InvalidSettingException
protected Usage getUsageFromFolder(javax.mail.Folder inFolder) throws javax.mail.MessagingException
javax.mail.MessagingException
protected Credential fetchCredential(java.lang.String protocol, java.lang.String settingKey) throws InvalidSettingException
InvalidSettingException
protected void checkNonNull(java.lang.String key) throws InvalidSettingException
InvalidSettingException
protected void checkWithDefault(java.lang.String key, java.lang.String defaultValue) throws InvalidSettingException
InvalidSettingException
protected void checkEmail(java.lang.String key) throws InvalidSettingException
InvalidSettingException
protected void checkBoolean(java.lang.String key) throws InvalidSettingException
InvalidSettingException
protected void checkInt(java.lang.String key) throws InvalidSettingException
InvalidSettingException
protected long getLongSetting(java.lang.String key) throws InvalidSettingException
InvalidSettingException
protected void settingsToProperties(java.lang.String key, java.util.Properties props)
protected boolean openFolder(javax.mail.Folder folder) throws javax.mail.FolderNotFoundException, javax.mail.MessagingException
javax.mail.FolderNotFoundException
javax.mail.MessagingException
protected void checkFolderForUIDOps(javax.mail.Folder folder) throws javax.mail.FolderNotFoundException, javax.mail.MessagingException, JavaMailNuggetException
javax.mail.FolderNotFoundException
javax.mail.MessagingException
JavaMailNuggetException
public void checkUIDValidity(javax.mail.Folder folder, long orgUIDValidity) throws InvalidUIDException, javax.mail.MessagingException
JavaMailNugget
checkUIDValidity
in class JavaMailNugget
folder
- The folder object must be an UIDFolder instance and should be already
opened.orgUIDValidity
- The original UIDValidity value. If it is a negative number, no check
will be performed.
InvalidUIDException
javax.mail.MessagingException
protected long getUID(javax.mail.UIDFolder uf, javax.mail.Message msg) throws MessageNotInFolderException, javax.mail.MessagingException
MessageNotInFolderException
javax.mail.MessagingException
protected java.lang.String getLoginUser(java.lang.String configKey)
protected java.lang.String getLoginPassword(java.lang.String configKey)
protected java.lang.String getIMAPUserID()
protected java.lang.String getIMAPPassword()
protected java.util.Properties getJavaMailProperties()
protected java.lang.String getActualSetting(java.lang.String configKey)
protected void destroyImpl()
Nugget
For example, the WcapNugget will need to login to a backend Calendar server. The Calendar server will return a session ID that will be used by the Nugget for later operations. So, when the Nugget is "deactivate()", it does not need to logout from the Calendar Server and keep the session ID as the Nugget's persistent member. However, when the Nugget is "destroy()", the Nugget should logout the user from the backend Calendar server.
The base implementation of this method does nothing.
destroyImpl
in class Nugget
public boolean isCachable()
JavaMailNugget
isCachable
in class JavaMailNugget
|
Nitido NiM 2.5 Java API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1999-2009 Nitido Inc. Proprietary and Confidential. All Rights Reserved.