org.apache.james.jcr
Class JCRStoreBean

java.lang.Object
  extended by org.apache.james.jcr.JCRStoreBean

public class JCRStoreBean
extends java.lang.Object

JavaBean that stores messages to a JCR content repository.

After instantiating this bean you should use the setParentNode(Node) method to specify the root node under which all messages should be stored. Then you can call storeMessage(Message) to store messages in the repository.

The created content structure below the given parent node consists of a date based .../year/month/day tree structure, below which the actual messages are stored. A stored message consists of an nt:file node whose name is based on the subject of the message. The jcr:content child of the nt:file node contains the MIME structure and all relevant headers of the message. Note that the original message source is not stored, which means that some of the message information will be lost.

The messages are stored using the session associated with the specified parent node. No locking or synchronization is performed, and it is expected that only one thread writing to the message subtree at any given moment. You should use JCR locking or some other explicit synchronization mechanism if you want to have concurrent writes to the message subtree.


Constructor Summary
JCRStoreBean()
           
 
Method Summary
 void setParentNode(javax.jcr.Node parent)
           
 void storeMessage(javax.mail.Message message)
          Stores the given mail message to the content repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JCRStoreBean

public JCRStoreBean()
Method Detail

setParentNode

public void setParentNode(javax.jcr.Node parent)

storeMessage

public void storeMessage(javax.mail.Message message)
                  throws javax.mail.MessagingException,
                         javax.jcr.RepositoryException
Stores the given mail message to the content repository.

Parameters:
message - mail message
Throws:
javax.mail.MessagingException - if the message could not be read
javax.jcr.RepositoryException - if the message could not be saved


Copyright ? 2002-2009 The Apache Software Foundation. All Rights Reserved.