oracle.mail.sdk.esmail
Class OracleFolder

java.lang.Object
  |
  +--javax.mail.Folder
        |
        +--oracle.mail.sdk.esmail.OracleFolder
All Implemented Interfaces:
javax.mail.UIDFolder
Direct Known Subclasses:
DefaultFolder, OracleSharedFolder

public class OracleFolder
extends javax.mail.Folder
implements javax.mail.UIDFolder

This class implements an Oracle folder.

When a folder is opened, a messageCache (Vector) and an uidMap (Hashtable) will be created. The messageCache contains a list of Message objects with only a small set of information filled in. The uidMap provides a quick access to Message object using message uid.

When information is needed from the store, a database connection is retrieved from the database pool (OracleDBPool) and then released back to the pool when the operation is complete.

NOTE: ...


Inner classes inherited from class javax.mail.UIDFolder
javax.mail.UIDFolder.FetchProfileItem

 

Fields inherited from class javax.mail.Folder
HOLDS_FOLDERS, HOLDS_MESSAGES, READ_ONLY, READ_WRITE

 

Fields inherited from interface javax.mail.UIDFolder
LASTUID

 

Method Summary
 void addACI(java.lang.String aUser, java.lang.String aAci)
          addACI method takes in a user_address, aci string and calls ldap api to set the aci for the user User type defaults to mailuser(ESDSConstants.DS_MAILUSER)

 void addACI(java.lang.String aUserType, java.lang.String aUser, java.lang.String aAci)
          addACI method takes in a user type, user_address, aci string and calls ldap api to set the aci for the user

 void appendMessages(javax.mail.Message[] msgs)
          Append messages to this folder.
 void appendMessages(javax.mail.Message[] msgs, java.lang.String migrationID_header)
          Append messages to this folder.
 void close(boolean expunge)
          Close the folder; expunge if requested.
 void copyMessages(javax.mail.Message[] msgs, javax.mail.Folder folder)
          Copy the spcified messages from this folder, to the destination folder specified.
 boolean create(int type)
          If type doesn't have HOLDS_MESSAGES ==> /NOSELECT If type doesn't have HOLDS_FOLDER ==> /NOINFERIORS NOTE: The INBOX is case-sensitive, all caps.
 boolean delete(boolean recurse)
          Delete this folder.
 boolean exists()
          exists -- check if folder exists on store
 javax.mail.Message[] expunge()
          Expunge messages marked \DELETED.
 void fetch(javax.mail.Message[] msgs, javax.mail.FetchProfile fp)
          Prefetch the items specified in the FetchProfile for the given Messages.
 javax.mail.Folder getFolder(java.lang.String name)
          Returns the Folder object corresponding to the given name.
 long getFolderId()
           
 int getFolderSize()
          getFolderSize returns a the sum total of the sizes of all the messages in a folder.
 java.lang.String getFullName()
          Return current folder's fullName which DOES NOT contain the nameSpace
 java.lang.String getFullPath()
          OracleFolder specific methods go here
 java.util.Vector getGranteeACI()
           getGranteeACI returns a vector of OracleGranteeACI objects.
 javax.mail.Message getMessage(int msgnum)
          Get the Message object corresponding to the given message number.
 javax.mail.Message[] getMessageByType(int type)
          Get the Message object that corresponds to the given message type.
 javax.mail.Message getMessageByUID(long uid)
          Get the Message object that corresponds to the given message uid.
 int getMessageCount()
          Return total number of messages in folder.
 javax.mail.Message[] getMessagesByUID(long[] uids)
          Get the messages specified in the uids array.
 javax.mail.Message[] getMessagesByUID(long start, long end)
          Return the messages specified in the range (inclusively).
 java.lang.String getName()
          Return the cannonical name of the folder.
 int getNewMessageCount()
          Get the number of messages with \RECENT flag in this Folder.
 javax.mail.Folder getParent()
          Return a new Folder object that represent the parent of this folder.
 javax.mail.Flags getPermanentFlags()
          NOTE: returning a list of hard coded permanent flags
 char getSeparator()
          Return the folder delimiter character.
 int getType()
          Return the folder type which it HOLDS_FOLDER, HOLDS_MESSAGE.
 long getUID(javax.mail.Message message)
          Return the msg UID for the specified message
 long getUIDValidity()
          Return the folder uidvalidity info.
 int getUnreadMessageCount()
          Return the total number of unread messages in folder.
 javax.mail.URLName getURLName()
          Return the URLName reprensenting this folder
 boolean hasNewMessages()
          Check whether folder has message with \RECENT flag set.
 boolean isOpen()
          Return the opened flag
 boolean isShared()
          isShared checks if the folder is shared
 boolean isSubscribed()
          Return true if this Folder is subscribed
 javax.mail.Folder[] list(java.lang.String pattern)
          Return a list of folder objects that matches the pattern
 javax.mail.Folder[] listSubscribed(java.lang.String pattern)
          Return a list subscribed of folder objects that matches the pattern
 void modifyACI(java.lang.String aUser, java.lang.String aACI)
          modifyACI method takes in a user_address and aci string and calls ldap api to modify the aci for the user.
 void modifyACI(java.lang.String aUserType, java.lang.String aUser, java.lang.String aACI)
          modifyACI method takes in a user type, user_address and aci string and calls ldap api to modify the aci for the user

 void open(int mode)
          Open -- Get folder information and then get all the messages in the folder...
 void removeACI(java.lang.String aUser)
          removeACI method takes in a user_address and removes access for the user and calls ldap api to remove shared folder aci for the user.
 void removeACI(java.lang.String aUserType, java.lang.String aUser)
          removeACI method takes in a user type, user_address and removes access for the user and calls ldap api to remove shared folder aci for the user

 boolean renameTo(javax.mail.Folder f)
          Rename this folder; notify the RenameListeners
 javax.mail.Message[] search(javax.mail.search.SearchTerm term)
          Construct the IMAP4 search string and call PL/SQL search
 javax.mail.Message[] search(javax.mail.search.SearchTerm term, javax.mail.Message[] msgs)
          Construct the IMAP4 search string and call PL/SQL search
 void setFlags(int[] msgnums, javax.mail.Flags flag, boolean value)
          Set flags
 void setFlags(int start, int end, javax.mail.Flags flag, boolean value)
          Set flags
 void setFlags(javax.mail.Message[] msgs, javax.mail.Flags flag, boolean value)
          Set flags
 void setSubscribed(boolean subscribe)
          Subscribe or unsubscribe the folder
 long[] sortMessages(java.util.Vector aSortCriteriaVector)
          Sort the messages in the folder according to the specified order, returning a list of message uids.

 

Methods inherited from class javax.mail.Folder
addConnectionListener, addFolderListener, addMessageChangedListener, addMessageCountListener, getMessages, getMessages, getMessages, getMode, getStore, list, listSubscribed, removeConnectionListener, removeFolderListener, removeMessageChangedListener, removeMessageCountListener, toString

 

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

 

Method Detail

appendMessages

public void appendMessages(javax.mail.Message[] msgs)
                    throws javax.mail.MessagingException
Append messages to this folder.
Overrides:
appendMessages in class javax.mail.Folder
Parameters:
msgs - Message objects to be append into this folder
See Also:
Folder.appendMessages

appendMessages

public void appendMessages(javax.mail.Message[] msgs,
                           java.lang.String migrationID_header)
                    throws javax.mail.MessagingException
Append messages to this folder.
Parameters:
msgs - Message objects to be append into this folder
migrationID_header - Message header where the migration ID is store
See Also:
javax.mail.Folder.appendMessages

close

public void close(boolean expunge)
           throws javax.mail.MessagingException
Close the folder; expunge if requested.
Overrides:
close in class javax.mail.Folder
Parameters:
expunge - Flag to indicate if expunge is required
See Also:
Folder.close()

copyMessages

public void copyMessages(javax.mail.Message[] msgs,
                         javax.mail.Folder folder)
                  throws javax.mail.MessagingException
Copy the spcified messages from this folder, to the destination folder specified. Message objects MUST belong to this Folder.
Overrides:
copyMessages in class javax.mail.Folder
See Also:
javax.mail.Folder.copyMessages

create

public boolean create(int type)
               throws javax.mail.MessagingException
If type doesn't have HOLDS_MESSAGES ==> /NOSELECT If type doesn't have HOLDS_FOLDER ==> /NOINFERIORS NOTE: The INBOX is case-sensitive, all caps. In addition, creation of any folder with the name inbox is not allowed.
Overrides:
create in class javax.mail.Folder
See Also:
javax.mail.Folder.create()

delete

public boolean delete(boolean recurse)
               throws javax.mail.MessagingException
Delete this folder. If recurse is true, delete all the sub-folders as well. Notify listeners of the DELETE event. NOTE: The INBOX is case-sensitive, all caps. In addition, creation or deletion of any folder with the name inbox is not allowed.
Overrides:
delete in class javax.mail.Folder
See Also:
Folder.delete

exists

public boolean exists()
               throws javax.mail.MessagingException
exists -- check if folder exists on store
Overrides:
exists in class javax.mail.Folder
See Also:
javax.mail.Folder.exists

expunge

public javax.mail.Message[] expunge()
                             throws javax.mail.MessagingException
Expunge messages marked \DELETED. Returns an array containing the expunged message objects.
Overrides:
expunge in class javax.mail.Folder
See Also:
Folder.expunge()

fetch

public void fetch(javax.mail.Message[] msgs,
                  javax.mail.FetchProfile fp)
           throws javax.mail.MessagingException
Prefetch the items specified in the FetchProfile for the given Messages.
Overrides:
fetch in class javax.mail.Folder
See Also:
javax.mail.Folder.fetch

getFolder

public javax.mail.Folder getFolder(java.lang.String name)
                            throws javax.mail.MessagingException
Returns the Folder object corresponding to the given name. It doesn't have to physically exist in the Store. NOTE: The INBOX is case-sensitive, all caps. In addition, creation or deletion of any folder with the name inbox is not allowed. ASSUME: name is relative to the current folder; abosolute path is NOT supported.
Overrides:
getFolder in class javax.mail.Folder
See Also:
javax.mail.Folder.getFolder

getFullName

public java.lang.String getFullName()
Return current folder's fullName which DOES NOT contain the nameSpace
Overrides:
getFullName in class javax.mail.Folder
See Also:
javax.mail.Folder.getFullName

getMessage

public javax.mail.Message getMessage(int msgnum)
                              throws javax.mail.MessagingException
Get the Message object corresponding to the given message number.
Overrides:
getMessage in class javax.mail.Folder
See Also:
javax.mail.Folder.getMessage

getMessageCount

public int getMessageCount()
                    throws javax.mail.MessagingException
Return total number of messages in folder. NOTE: for optimization, we can just use the cached number, but it then may be out of sync with what is in the store.
Overrides:
getMessageCount in class javax.mail.Folder
See Also:
javax.mail.Folder.getMessageCount

getName

public java.lang.String getName()
Return the cannonical name of the folder.
Overrides:
getName in class javax.mail.Folder
See Also:
javax.mail.Folder.getName

getNewMessageCount

public int getNewMessageCount()
                       throws javax.mail.MessagingException
Get the number of messages with \RECENT flag in this Folder. If opened: do a noop and return the #recent. IF closed: do a status and return the #recent.
Overrides:
getNewMessageCount in class javax.mail.Folder
See Also:
javax.mail.Folder.getNewMessageCount()

getParent

public javax.mail.Folder getParent()
                            throws javax.mail.MessagingException
Return a new Folder object that represent the parent of this folder.
Overrides:
getParent in class javax.mail.Folder
See Also:
javax.mail.Folder.getParent

getPermanentFlags

public javax.mail.Flags getPermanentFlags()
NOTE: returning a list of hard coded permanent flags
Overrides:
getPermanentFlags in class javax.mail.Folder
See Also:
javax.mail.Folder.getPermanentFlags

getSeparator

public char getSeparator()
Return the folder delimiter character.
Overrides:
getSeparator in class javax.mail.Folder
See Also:
javax.mail.Folder.getSeparator

getType

public int getType()
            throws javax.mail.MessagingException
Return the folder type which it HOLDS_FOLDER, HOLDS_MESSAGE. This information is from the cache; may be up of sync with the store.
Overrides:
getType in class javax.mail.Folder
See Also:
javax.mail.Folder.getType

getUnreadMessageCount

public int getUnreadMessageCount()
                          throws javax.mail.MessagingException
Return the total number of unread messages in folder. NOTE: in the opened state, returning a cached unread number; it may be out of sync with what is in the store.
Overrides:
getUnreadMessageCount in class javax.mail.Folder
See Also:
javax.mail.Folder.getUnreadMessageCount

getURLName

public javax.mail.URLName getURLName()
                              throws javax.mail.MessagingException
Return the URLName reprensenting this folder
Overrides:
getURLName in class javax.mail.Folder
See Also:
javax.mail.Folder.getURLName

hasNewMessages

public boolean hasNewMessages()
                       throws javax.mail.MessagingException
Check whether folder has message with \RECENT flag set. If folder is open, already know the number of recent msgs. If folder is closed, check for recent messages.
Overrides:
hasNewMessages in class javax.mail.Folder
See Also:
javax.mail.Folder.hasNewMessages

isOpen

public boolean isOpen()
Return the opened flag
Overrides:
isOpen in class javax.mail.Folder
See Also:
javax.mail.Folder.isOpen

isSubscribed

public boolean isSubscribed()
Return true if this Folder is subscribed
Overrides:
isSubscribed in class javax.mail.Folder
See Also:
javax.mail.Folder.isSubscribed

list

public javax.mail.Folder[] list(java.lang.String pattern)
                         throws javax.mail.MessagingException
Return a list of folder objects that matches the pattern
Overrides:
list in class javax.mail.Folder
See Also:
javax.mail.Folder.list

listSubscribed

public javax.mail.Folder[] listSubscribed(java.lang.String pattern)
                                   throws javax.mail.MessagingException
Return a list subscribed of folder objects that matches the pattern
Overrides:
listSubscribed in class javax.mail.Folder
See Also:
javax.mail.Folder.listSubscribed

open

public void open(int mode)
          throws javax.mail.MessagingException
Open -- Get folder information and then get all the messages in the folder... create light weight message objects.
Overrides:
open in class javax.mail.Folder
See Also:
javax.mail.Folder.open

renameTo

public boolean renameTo(javax.mail.Folder f)
                 throws javax.mail.MessagingException
Rename this folder; notify the RenameListeners
Overrides:
renameTo in class javax.mail.Folder
See Also:
javax.mail.Folder.renameTo

search

public javax.mail.Message[] search(javax.mail.search.SearchTerm term)
                            throws javax.mail.MessagingException
Construct the IMAP4 search string and call PL/SQL search
Overrides:
search in class javax.mail.Folder
See Also:
javax.mail.Folder.search

search

public javax.mail.Message[] search(javax.mail.search.SearchTerm term,
                                   javax.mail.Message[] msgs)
                            throws javax.mail.MessagingException
Construct the IMAP4 search string and call PL/SQL search
Overrides:
search in class javax.mail.Folder
See Also:
javax.mail.Folder.search

setFlags

public void setFlags(int[] msgnums,
                     javax.mail.Flags flag,
                     boolean value)
              throws javax.mail.MessagingException
Set flags
Overrides:
setFlags in class javax.mail.Folder
See Also:
javax.mail.Folder.setFlags

setFlags

public void setFlags(int start,
                     int end,
                     javax.mail.Flags flag,
                     boolean value)
              throws javax.mail.MessagingException
Set flags
Overrides:
setFlags in class javax.mail.Folder
See Also:
javax.mail.Folder.setFlags

setFlags

public void setFlags(javax.mail.Message[] msgs,
                     javax.mail.Flags flag,
                     boolean value)
              throws javax.mail.MessagingException
Set flags
Overrides:
setFlags in class javax.mail.Folder
See Also:
javax.mail.Folder.setFlags

setSubscribed

public void setSubscribed(boolean subscribe)
                   throws javax.mail.MessagingException
Subscribe or unsubscribe the folder
Overrides:
setSubscribed in class javax.mail.Folder
See Also:
javax.mail.Folder.setSubscribed

getMessageByUID

public javax.mail.Message getMessageByUID(long uid)
                                   throws javax.mail.MessagingException
Get the Message object that corresponds to the given message uid. If not such message exists, null is returned.
Specified by:
getMessageByUID in interface javax.mail.UIDFolder
See Also:
javax.mail.UIDFolder.getMessageByUID

getMessagesByUID

public javax.mail.Message[] getMessagesByUID(long[] uids)
                                      throws javax.mail.MessagingException
Get the messages specified in the uids array. If any uid in the array is invalid, a null entry is returned for that element.
Specified by:
getMessagesByUID in interface javax.mail.UIDFolder
See Also:
javax.mail.UIDFolder.getMessagesByUID

getMessagesByUID

public javax.mail.Message[] getMessagesByUID(long start,
                                             long end)
                                      throws javax.mail.MessagingException
Return the messages specified in the range (inclusively). If any uid in the range is invalid, a null entry is returned for that element.
Specified by:
getMessagesByUID in interface javax.mail.UIDFolder
See Also:
javax.mail.UIDFolder.getMessagesByUID

getUID

public long getUID(javax.mail.Message message)
            throws javax.mail.MessagingException
Return the msg UID for the specified message
Specified by:
getUID in interface javax.mail.UIDFolder
See Also:
javax.mail.UIDFolder.getUID

getUIDValidity

public long getUIDValidity()
                    throws javax.mail.MessagingException
Return the folder uidvalidity info.
Specified by:
getUIDValidity in interface javax.mail.UIDFolder
See Also:
javax.mail.UIDFolder.getUIDValidity

getFullPath

public java.lang.String getFullPath()
OracleFolder specific methods go here

getFolderId

public long getFolderId()
                 throws javax.mail.MessagingException

addACI

public void addACI(java.lang.String aUser,
                   java.lang.String aAci)
            throws javax.mail.MessagingException
addACI method takes in a user_address, aci string and calls ldap api to set the aci for the user User type defaults to mailuser(ESDSConstants.DS_MAILUSER)

Parameters:
aUser - user, dl, domain, etc to be granted access to shared folder
aAci - user's aci
Throws:
javax.mail.MessagingException - IOException

addACI

public void addACI(java.lang.String aUserType,
                   java.lang.String aUser,
                   java.lang.String aAci)
            throws javax.mail.MessagingException
addACI method takes in a user type, user_address, aci string and calls ldap api to set the aci for the user

Parameters:
aUserType - user - ESDSConstants.DS_MAILUSER, dl - ESDSConstants.DS_DISTRIBUTION_LIST, domain - ESDSConstants.DS_DOMAIN
aUser - user, dl, domain, etc to be granted access to shared folder
aAci - user's aci
Throws:
javax.mail.MessagingException - IOException

removeACI

public void removeACI(java.lang.String aUser)
               throws javax.mail.MessagingException
removeACI method takes in a user_address and removes access for the user and calls ldap api to remove shared folder aci for the user. User type defaults to mailuser(ESDSConstants.DS_MAILUSER)

Parameters:
aUser - user, dl, domain, etc to be granted access to shared folder
Throws:
javax.mail.MessagingException -  

removeACI

public void removeACI(java.lang.String aUserType,
                      java.lang.String aUser)
               throws javax.mail.MessagingException
removeACI method takes in a user type, user_address and removes access for the user and calls ldap api to remove shared folder aci for the user

Parameters:
aUserType - user - ESDSConstants.DS_MAILUSER, dl - ESDSConstants.DS_DISTRIBUTION_LIST, domain - ESDSConstants.DS_DOMAIN
aUser - user, dl, domain, etc to be granted access to shared folder
Throws:
javax.mail.MessagingException -  

modifyACI

public void modifyACI(java.lang.String aUser,
                      java.lang.String aACI)
               throws javax.mail.MessagingException
modifyACI method takes in a user_address and aci string and calls ldap api to modify the aci for the user. User type defaults to mailuser(ESDSConstants.DS_MAILUSER)

Parameters:
aUser - user, dl, domain, etc to be granted access to shared folder
aACI - new aci for the user
Throws:
javax.mail.MessagingException -  

modifyACI

public void modifyACI(java.lang.String aUserType,
                      java.lang.String aUser,
                      java.lang.String aACI)
               throws javax.mail.MessagingException
modifyACI method takes in a user type, user_address and aci string and calls ldap api to modify the aci for the user

Parameters:
aUserType - user - ESDSConstants.DS_MAILUSER, dl - ESDSConstants.DS_DISTRIBUTION_LIST, domain - ESDSConstants.DS_DOMAIN
aUser - user, dl, domain, etc to be granted access to shared folder
aACI - new aci for the user
Throws:
javax.mail.MessagingException -  

getGranteeACI

public java.util.Vector getGranteeACI()
                               throws javax.mail.MessagingException

getGranteeACI returns a vector of OracleGranteeACI objects. The complete list of grantee aci(s) on shared folders can be obtained by using the OracleGranteeACI objects.

Throws:
javax.mail.MessagingException -  

isShared

public boolean isShared()
                 throws javax.mail.MessagingException
isShared checks if the folder is shared
Returns:
boolean true/false

getFolderSize

public int getFolderSize()
                  throws javax.mail.MessagingException
getFolderSize returns a the sum total of the sizes of all the messages in a folder.
Returns:
Message size

sortMessages

public long[] sortMessages(java.util.Vector aSortCriteriaVector)
Sort the messages in the folder according to the specified order, returning a list of message uids.

Parameters:
aSortCriteriaVector - Construct a vector with all the sort criteria
Returns:
array of msg_uid(s)

getMessageByType

public javax.mail.Message[] getMessageByType(int type)
                                      throws javax.mail.MessagingException
Get the Message object that corresponds to the given message type. If not such message exists, null is returned. NOTE: this method does NOT update the message cache. To update the message cache, user can call getMessages(), getMessageCount(), getNewMessageCount() methods.