Keel 2.1RC2

org.keel.services.mail
Interface Reader

All Known Implementing Classes:
DefaultReader

public interface Reader

This interface defines a Reader service for receiving email from a server.

Version:
$Revision: 1.3 $ $Date: 2003/10/10 23:12:03 $
Author:
Shash Chatterjee Created on Jan 4, 2003

Field Summary
static java.lang.String ROLE
          The ROLE name used to acquire services that implement this service
 
Method Summary
 void connect()
          Get the client in a state connected to the server so that it is ready to retrieve messages.
 void connect(java.lang.String host, java.lang.String user, java.lang.String password)
          Connect while overriding the user and password supplied by configuration Saying "connect(null, null, null)" is the same as "connect()"
 int count()
          Return a count of messages retrieved from the server.
 void disconnect()
          Close the client-server connection.
 java.lang.String[] getBcc(int msgIndex)
          Get the contents of the Bcc: header
 java.lang.String[] getCc(int msgIndex)
          Get the contents of the Cc: header
 java.lang.String getContentType(int msgIndex)
          Get the content of the ContentType header of a single-part message
 java.lang.String getContentType(int msgIndex, int partIndex)
          Get the content of the ContentType header of a part of a multi-part message
 java.lang.String getDisposition(int msgIndex)
          Get the content of the disposition header of a single-part message
 java.lang.String getDisposition(int msgIndex, int partIndex)
          Get the content of the disposition header of a part of a multi-part message
 java.io.File getFile(int msgIndex)
          Get the contents of a single-part message
 java.io.File getFile(int msgIndex, int partIndex)
          Get the contents of a particular part of a multi-part message
 java.lang.String getFileName(int msgIndex)
          Get the file name in the header of a single-part message
 java.lang.String getFileName(int msgIndex, int partIndex)
          Get the file name in the header of a part in the multi-part message
 java.lang.String[] getFrom(int msgIndex)
          Get the contents of the From: header
 java.util.Enumeration getHeaders(int msgIndex)
          Get all headers for a message
 java.lang.String getInline(int msgIndex)
          Get the content of an inline message
 int getLineCount(int msgIndex)
          Get the number of lines in a message (meaningless for multi-part messages)
 int getMultiPartCount(int msgIndex)
          Get the number of parts in a multi-part message
 java.lang.String[] getReplyTo(int msgIndex)
          Get the contents of the ReplyTo: header
 java.util.Date getSentDate(int msgIndex)
          Get the date a message was sent (Date header)
 int getSize(int msgIndex)
          Get the size of a message
 java.lang.String getSubject(int msgIndex)
          Get the subject header from a message
 java.lang.String[] getTo(int msgIndex)
          Get the contents of the To: header
 boolean isAnswered(int msgIndex)
          Check if this message has been marked as "answered" by a client
 boolean isDeleted(int msgIndex)
          Check if this message has been marked by a client as "deleted" or not
 boolean isDraft(int msgIndex)
          Check if this message has been marked by some client as "draft" or not
 boolean isFlagged(int msgIndex)
          Check if this message has been marked by a client as "flagged"
 boolean isInline(int msgIndex)
          Check if the message content is inline
 boolean isMultiPart(int msgIndex)
          Check if the message content is formatted as MIME multi-part
 boolean isRecent(int msgIndex)
          Check if this message is amrked by the server as "recent" or not
 boolean isSeen(int msgIndex)
          Check if this message has already been read or not
 boolean isSinglePart(int msgIndex)
          Check if the message content is formatted as MIME single-part
 void read()
          Retrieve all messages from the server
 void setAnswered(int msgIndex, boolean state)
          Mark a message as "answered"
 void setDeleted(int msgIndex, boolean state)
          Mark a message as "deleted"
 void setDraft(int msgIndex, boolean state)
          Mark a message as "draft
 void setFlagged(int msgIndex, boolean state)
          Mark a message as "flagged
 void setSeen(int msgIndex, boolean state)
          Mark a message as "read"
 

Field Detail

ROLE

public static final java.lang.String ROLE
The ROLE name used to acquire services that implement this service

See Also:
Constant Field Values
Method Detail

connect

public void connect()
             throws NestedException
Get the client in a state connected to the server so that it is ready to retrieve messages. The next thing to do would be to call read, repeatedly if necessary.

Throws:
NestedException

connect

public void connect(java.lang.String host,
                    java.lang.String user,
                    java.lang.String password)
             throws NestedException
Connect while overriding the user and password supplied by configuration Saying "connect(null, null, null)" is the same as "connect()"

Parameters:
user - Username to use for connect - leave null to use configuration defaults
password - Password to use to authenticate user - leave null to use configuration default
Throws:
NestedException - If the connect does not succeed

disconnect

public void disconnect()
                throws NestedException
Close the client-server connection. Messages can no longer be accessed.

Throws:
NestedException

read

public void read()
          throws NestedException
Retrieve all messages from the server

Throws:
NestedException

count

public int count()
Return a count of messages retrieved from the server. Can only be called after a read().

Returns:
int

getSize

public int getSize(int msgIndex)
            throws NestedException
Get the size of a message

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
int The size of the message in bytes
Throws:
NestedException

getLineCount

public int getLineCount(int msgIndex)
                 throws NestedException
Get the number of lines in a message (meaningless for multi-part messages)

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
int The number of lines in the message (can return -1)
Throws:
NestedException

getSubject

public java.lang.String getSubject(int msgIndex)
                            throws NestedException
Get the subject header from a message

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
String The value of the subject header
Throws:
NestedException

getSentDate

public java.util.Date getSentDate(int msgIndex)
                           throws NestedException
Get the date a message was sent (Date header)

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
Date The date the message was sent
Throws:
NestedException

getTo

public java.lang.String[] getTo(int msgIndex)
                         throws NestedException
Get the contents of the To: header

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
String[] A string array of addresses, can be null
Throws:
NestedException

getFrom

public java.lang.String[] getFrom(int msgIndex)
                           throws NestedException
Get the contents of the From: header

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
String[] A string array of addresses, can be null
Throws:
NestedException

getReplyTo

public java.lang.String[] getReplyTo(int msgIndex)
                              throws NestedException
Get the contents of the ReplyTo: header

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
String[] A string array of addresses, can be null
Throws:
NestedException

getCc

public java.lang.String[] getCc(int msgIndex)
                         throws NestedException
Get the contents of the Cc: header

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
String[] A string array of addresses, can be null
Throws:
NestedException

getBcc

public java.lang.String[] getBcc(int msgIndex)
                          throws NestedException
Get the contents of the Bcc: header

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
String[] A string array of addresses, can be null
Throws:
NestedException

getHeaders

public java.util.Enumeration getHeaders(int msgIndex)
                                 throws NestedException
Get all headers for a message

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
Enumeration An enumeration of javax.mail.Header containing name/value pairs
Throws:
NestedException

isSeen

public boolean isSeen(int msgIndex)
               throws NestedException
Check if this message has already been read or not

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
boolean true if already read
Throws:
NestedException

setSeen

public void setSeen(int msgIndex,
                    boolean state)
             throws NestedException
Mark a message as "read"

Parameters:
msgIndex - A number from 0 to count()-1
state - true=set, false=clear
Throws:
NestedException

isDeleted

public boolean isDeleted(int msgIndex)
                  throws NestedException
Check if this message has been marked by a client as "deleted" or not

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
boolean true if deleted
Throws:
NestedException

setDeleted

public void setDeleted(int msgIndex,
                       boolean state)
                throws NestedException
Mark a message as "deleted"

Parameters:
msgIndex - A number from 0 to count()-1
state - true=set, false=clear
Throws:
NestedException

isAnswered

public boolean isAnswered(int msgIndex)
                   throws NestedException
Check if this message has been marked as "answered" by a client

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
boolean true if answered
Throws:
NestedException

setAnswered

public void setAnswered(int msgIndex,
                        boolean state)
                 throws NestedException
Mark a message as "answered"

Parameters:
msgIndex - A number from 0 to count()-1
state - true=set, false=clear
Throws:
NestedException

isFlagged

public boolean isFlagged(int msgIndex)
                  throws NestedException
Check if this message has been marked by a client as "flagged"

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
boolean true if flagged
Throws:
NestedException

setFlagged

public void setFlagged(int msgIndex,
                       boolean state)
                throws NestedException
Mark a message as "flagged

Parameters:
msgIndex - A number from 0 to count()-1
state - true=set, false=clear
Throws:
NestedException

isRecent

public boolean isRecent(int msgIndex)
                 throws NestedException
Check if this message is amrked by the server as "recent" or not

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
boolean true if recent
Throws:
NestedException

isDraft

public boolean isDraft(int msgIndex)
                throws NestedException
Check if this message has been marked by some client as "draft" or not

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
boolean true if draft
Throws:
NestedException

setDraft

public void setDraft(int msgIndex,
                     boolean state)
              throws NestedException
Mark a message as "draft

Parameters:
msgIndex - A number from 0 to count()-1
state - true=set, false=clear
Throws:
NestedException

isMultiPart

public boolean isMultiPart(int msgIndex)
                    throws NestedException
Check if the message content is formatted as MIME multi-part

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
boolean true if multipart
Throws:
NestedException

isSinglePart

public boolean isSinglePart(int msgIndex)
                     throws NestedException
Check if the message content is formatted as MIME single-part

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
boolean true if single-part
Throws:
NestedException

isInline

public boolean isInline(int msgIndex)
                 throws NestedException
Check if the message content is inline

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
boolean true if inline
Throws:
NestedException

getMultiPartCount

public int getMultiPartCount(int msgIndex)
                      throws NestedException
Get the number of parts in a multi-part message

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
int The number of parts in the message
Throws:
NestedException

getFile

public java.io.File getFile(int msgIndex,
                            int partIndex)
                     throws NestedException
Get the contents of a particular part of a multi-part message

Parameters:
msgIndex - A number from 0 to count()-1
partIndex - A number from 0 to getMultiPartCount()-1
Returns:
File
Throws:
NestedException

getFileName

public java.lang.String getFileName(int msgIndex,
                                    int partIndex)
                             throws NestedException
Get the file name in the header of a part in the multi-part message

Parameters:
msgIndex - A number from 0 to count()-1
partIndex - A number from 0 to getMultiPartCount()-1
Returns:
String
Throws:
NestedException

getDisposition

public java.lang.String getDisposition(int msgIndex,
                                       int partIndex)
                                throws NestedException
Get the content of the disposition header of a part of a multi-part message

Parameters:
msgIndex - A number from 0 to count()-1
partIndex - A number from 0 to getMultiPartCount()-1
Returns:
String
Throws:
NestedException

getContentType

public java.lang.String getContentType(int msgIndex,
                                       int partIndex)
                                throws NestedException
Get the content of the ContentType header of a part of a multi-part message

Parameters:
msgIndex - A number from 0 to count()-1
partIndex - A number from 0 to getMultiPartCount()-1
Returns:
String
Throws:
NestedException

getFile

public java.io.File getFile(int msgIndex)
                     throws NestedException
Get the contents of a single-part message

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
File
Throws:
NestedException

getFileName

public java.lang.String getFileName(int msgIndex)
                             throws NestedException
Get the file name in the header of a single-part message

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
String
Throws:
NestedException

getDisposition

public java.lang.String getDisposition(int msgIndex)
                                throws NestedException
Get the content of the disposition header of a single-part message

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
String
Throws:
NestedException

getContentType

public java.lang.String getContentType(int msgIndex)
                                throws NestedException
Get the content of the ContentType header of a single-part message

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
String
Throws:
NestedException

getInline

public java.lang.String getInline(int msgIndex)
                           throws NestedException
Get the content of an inline message

Parameters:
msgIndex - A number from 0 to count()-1
Returns:
String
Throws:
NestedException

Keel 2.1RC2

Please see keelframework.org for information about new Keel releases.