org.apache.james.mailrepository
Class MimeMessageJDBCSource

java.lang.Object
  |
  +--org.apache.james.core.MimeMessageSource
        |
        +--org.apache.james.mailrepository.MimeMessageJDBCSource

public class MimeMessageJDBCSource
extends MimeMessageSource

This class points to a specific message in a repository. This will return an InputStream to the JDBC field/record, possibly sequenced with the file stream.


Constructor Summary
MimeMessageJDBCSource(JDBCMailRepository repository, String key, StreamRepository sr)
          Construct a MimeMessageSource based on a JDBC repository, a key, and a stream repository (where we might store the message body)
 
Method Summary
 boolean equals(Object obj)
          Check to see whether this is the same repository and the same key
 InputStream getInputStream()
          Return the input stream to the database field and then the file stream.
 long getMessageSize()
          Runs a custom SQL statement to check the size of the message body
 String getSourceId()
          Returns a unique String ID that represents the location from where this source is loaded.
 int hashCode()
          Provide a hash code that is consistent with equals for this class
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MimeMessageJDBCSource

public MimeMessageJDBCSource(JDBCMailRepository repository,
                             String key,
                             StreamRepository sr)
                      throws IOException
Construct a MimeMessageSource based on a JDBC repository, a key, and a stream repository (where we might store the message body)

Method Detail

getSourceId

public String getSourceId()
Returns a unique String ID that represents the location from where this source is loaded. This will be used to identify where the data is, primarily to avoid situations where this data would get overwritten.

Specified by:
getSourceId in class MimeMessageSource
Returns:
the String ID

getInputStream

public InputStream getInputStream()
                           throws IOException
Return the input stream to the database field and then the file stream. This should be smart enough to work even if the file does not exist. This is to support a repository with the entire message in the database, which is how James 1.2 worked.

Specified by:
getInputStream in class MimeMessageSource
Returns:
a InputStream containing the data
Throws:
IOException - if an error occurs while generating the InputStream

getMessageSize

public long getMessageSize()
                    throws IOException
Runs a custom SQL statement to check the size of the message body

Overrides:
getMessageSize in class MimeMessageSource
Returns:
the size of the data represented by this source
Throws:
IOException - if an error is encountered while computing the message size

equals

public boolean equals(Object obj)
Check to see whether this is the same repository and the same key

Overrides:
equals in class Object

hashCode

public int hashCode()
Provide a hash code that is consistent with equals for this class

Overrides:
hashCode in class Object
Returns:
the hash code


"Copyright © 1999-2002 Apache Jakarta Project. All Rights Reserved."