You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ma...@apache.org on 2016/01/12 14:18:30 UTC
svn commit: r1724226 - in /james/project/trunk:
mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/
mailbox/lucene/src/test/java/org/apache/james/mailbox/lucene/search/
mailbox/store/src/main/java/org/apache/james/mailbox/s...
Author: matthieu
Date: Tue Jan 12 13:18:30 2016
New Revision: 1724226
URL: http://svn.apache.org/viewvc?rev=1724226&view=rev
Log:
MAILBOX-262 split Message properties into Mailbox relationship related properties and Message own ones
Added:
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/Message.java
- copied, changed from r1724225, james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/MailboxMessage.java
Modified:
james/project/trunk/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/MimePartParser.java
james/project/trunk/mailbox/lucene/src/test/java/org/apache/james/mailbox/lucene/search/LuceneMailboxMessageSearchIndexTest.java
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/LazyMimeDescriptor.java
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/MessageResultImpl.java
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/MailboxMessage.java
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/streaming/InputStreamContent.java
james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/message/MimePartParser.java
Modified: james/project/trunk/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/MimePartParser.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/MimePartParser.java?rev=1724226&r1=1724225&r2=1724226&view=diff
==============================================================================
--- james/project/trunk/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/MimePartParser.java (original)
+++ james/project/trunk/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/MimePartParser.java Tue Jan 12 13:18:30 2016
@@ -21,8 +21,7 @@ package org.apache.james.mailbox.elastic
import com.google.common.base.Preconditions;
import org.apache.james.mailbox.store.extractor.TextExtractor;
-import org.apache.james.mailbox.store.mail.model.MailboxId;
-import org.apache.james.mailbox.store.mail.model.MailboxMessage;
+import org.apache.james.mailbox.store.mail.model.Message;
import org.apache.james.mime4j.MimeException;
import org.apache.james.mime4j.message.DefaultBodyDescriptorBuilder;
import org.apache.james.mime4j.message.MaximalBodyDescriptor;
@@ -36,14 +35,14 @@ import java.util.LinkedList;
public class MimePartParser {
- private final MailboxMessage<? extends MailboxId> message;
+ private final Message message;
private final TextExtractor textExtractor;
private final MimeTokenStream stream;
private final Deque<MimePartContainerBuilder> builderStack;
private MimePart result;
private MimePartContainerBuilder currentlyBuildMimePart;
- public MimePartParser(MailboxMessage<? extends MailboxId> message, TextExtractor textExtractor) {
+ public MimePartParser(Message message, TextExtractor textExtractor) {
this.message = message;
this.textExtractor = textExtractor;
this.builderStack = new LinkedList<>();
Modified: james/project/trunk/mailbox/lucene/src/test/java/org/apache/james/mailbox/lucene/search/LuceneMailboxMessageSearchIndexTest.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/lucene/src/test/java/org/apache/james/mailbox/lucene/search/LuceneMailboxMessageSearchIndexTest.java?rev=1724226&r1=1724225&r2=1724226&view=diff
==============================================================================
--- james/project/trunk/mailbox/lucene/src/test/java/org/apache/james/mailbox/lucene/search/LuceneMailboxMessageSearchIndexTest.java (original)
+++ james/project/trunk/mailbox/lucene/src/test/java/org/apache/james/mailbox/lucene/search/LuceneMailboxMessageSearchIndexTest.java Tue Jan 12 13:18:30 2016
@@ -44,7 +44,6 @@ import org.apache.james.mailbox.store.Me
import org.apache.james.mailbox.store.SimpleMailboxMembership;
import org.apache.james.mailbox.store.TestId;
import org.apache.james.mailbox.store.mail.model.Mailbox;
-import org.apache.james.mailbox.store.mail.model.MailboxMessage;
import org.apache.lucene.store.RAMDirectory;
import org.junit.Before;
import org.junit.Test;
@@ -70,8 +69,6 @@ public class LuceneMailboxMessageSearchI
+ "It has " + RHUBARD + ".\r\n" + "It has " + CUSTARD + ".\r\n"
+ "It needs naught else.\r\n";
- MailboxMessage<TestId> row;
-
protected boolean useLenient() {
return true;
}
Modified: james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/LazyMimeDescriptor.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/LazyMimeDescriptor.java?rev=1724226&r1=1724225&r2=1724226&view=diff
==============================================================================
--- james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/LazyMimeDescriptor.java (original)
+++ james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/LazyMimeDescriptor.java Tue Jan 12 13:18:30 2016
@@ -30,7 +30,7 @@ import org.apache.james.mailbox.exceptio
import org.apache.james.mailbox.model.MessageResult;
import org.apache.james.mailbox.model.MimeDescriptor;
import org.apache.james.mailbox.model.MessageResult.Header;
-import org.apache.james.mailbox.store.mail.model.MailboxMessage;
+import org.apache.james.mailbox.store.mail.model.Message;
import org.apache.james.mailbox.store.mail.model.impl.PropertyBuilder;
/**
@@ -41,11 +41,11 @@ import org.apache.james.mailbox.store.ma
*/
public class LazyMimeDescriptor implements MimeDescriptor{
- private final MailboxMessage<?> message;
+ private final Message message;
private final MessageResult result;
private PropertyBuilder pbuilder;
- public LazyMimeDescriptor(final MessageResult result, final MailboxMessage<?> message) {
+ public LazyMimeDescriptor(final MessageResult result, final Message message) {
this.message = message;
this.result = result;
}
Modified: james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/MessageResultImpl.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/MessageResultImpl.java?rev=1724226&r1=1724225&r2=1724226&view=diff
==============================================================================
--- james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/MessageResultImpl.java (original)
+++ james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/MessageResultImpl.java Tue Jan 12 13:18:30 2016
@@ -35,6 +35,7 @@ import org.apache.james.mailbox.model.He
import org.apache.james.mailbox.model.MessageResult;
import org.apache.james.mailbox.model.MimeDescriptor;
import org.apache.james.mailbox.store.mail.model.MailboxMessage;
+import org.apache.james.mailbox.store.mail.model.Message;
import org.apache.james.mailbox.store.streaming.InputStreamContent;
import org.apache.james.mailbox.store.streaming.InputStreamContent.Type;
import org.apache.james.mime4j.MimeException;
@@ -373,10 +374,10 @@ public class MessageResultImpl implement
private final class HeadersImpl implements Headers {
- private MailboxMessage<?> msg;
+ private Message msg;
private List<Header> headers;
- public HeadersImpl(MailboxMessage<?> msg) {
+ public HeadersImpl(Message msg) {
this.msg = msg;
}
Modified: james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/MailboxMessage.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/MailboxMessage.java?rev=1724226&r1=1724225&r2=1724226&view=diff
==============================================================================
--- james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/MailboxMessage.java (original)
+++ james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/MailboxMessage.java Tue Jan 12 13:18:30 2016
@@ -18,11 +18,6 @@
****************************************************************/
package org.apache.james.mailbox.store.mail.model;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Date;
-import java.util.List;
-
import javax.mail.Flags;
/**
@@ -30,11 +25,7 @@ import javax.mail.Flags;
* plus body content. In the case of multipart documents, this body content
* has internal structure described by the meta-data.
*/
-public interface MailboxMessage<Id extends MailboxId> extends Comparable<MailboxMessage<Id>>{
-
- MessageId getMessageId();
-
- Date getInternalDate();
+public interface MailboxMessage<Id extends MailboxId> extends Message, Comparable<MailboxMessage<Id>> {
/**
* Return the mailbox id of the linked mailbox
@@ -132,81 +123,6 @@ public interface MailboxMessage<Id exten
* @return new instance, not null
*/
Flags createFlags();
-
-
- /**
- * Gets the body content of the document. Headers are excluded.
- *
- * Be aware that this method need to return a new fresh {@link InputStream}
- * on every call, which basicly means it need to start at position 0
- * @return body, not null
- */
- InputStream getBodyContent() throws IOException;
- /**
- * Gets the top level MIME content media type.
- *
- * @return top level MIME content media type, or null if default
- */
- String getMediaType();
-
- /**
- * Gets the MIME content subtype.
- *
- * @return the MIME content subtype, or null if default
- */
- String getSubType();
-
- /**
- * The number of octets contained in the body of this document.
- *
- * @return number of octets
- */
- long getBodyOctets();
-
- /**
- * The number of octets contained in the full content of this document.
- *
- * @return number of octets
- */
- long getFullContentOctets();
-
- /**
- * Gets the number of CRLF in a textual document.
- * @return CRLF count when document is textual,
- * null otherwise
- */
- public Long getTextualLineCount();
-
- /**
- * Gets the header as {@link InputStream}. This MUST INCLUDE the CRLF terminator
- *
- * Be aware that this method need to return a new fresh {@link InputStream}
- * on every call
- *
- * @return header
- * @throws IOException
- */
- InputStream getHeaderContent() throws IOException;
-
- /**
- *Returns the full raw content of the MailboxMessage via an {@link InputStream}.
- *
- * Be aware that this method need to return a new fresh {@link InputStream}
- * on every call
- *
- * @return content
- * @throws IOException
- */
- InputStream getFullContent() throws IOException;
-
- /**
- * Gets a read-only list of meta-data properties.
- * For properties with multiple values, this list will contain
- * several enteries with the same namespace and local name.
- *
- * @return unmodifiable list of meta-data, not null
- */
- List<Property> getProperties();
}
\ No newline at end of file
Copied: james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/Message.java (from r1724225, james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/MailboxMessage.java)
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/Message.java?p2=james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/Message.java&p1=james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/MailboxMessage.java&r1=1724225&r2=1724226&rev=1724226&view=diff
==============================================================================
--- james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/MailboxMessage.java (original)
+++ james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/Message.java Tue Jan 12 13:18:30 2016
@@ -23,120 +23,15 @@ import java.io.InputStream;
import java.util.Date;
import java.util.List;
-import javax.mail.Flags;
-
-/**
- * A MIME message, consisting of meta-data (including MIME headers)
- * plus body content. In the case of multipart documents, this body content
- * has internal structure described by the meta-data.
- */
-public interface MailboxMessage<Id extends MailboxId> extends Comparable<MailboxMessage<Id>>{
+public interface Message {
MessageId getMessageId();
-
- Date getInternalDate();
-
- /**
- * Return the mailbox id of the linked mailbox
- *
- * @return mailboxId
- */
- Id getMailboxId();
-
- /**
- * Return the uid
- *
- * @return uid
- */
- long getUid();
-
- /**
- * Set the uid for the message. This must be called before the message is added to the store
- * and must be unique / sequential.
- *
- * @param uid
- */
- void setUid(long uid);
-
-
-
- /**
- * Set the mod-sequence for the message. This must be called before the message is added to the store
- * or any flags are changed. This must be unique / sequential.
- *
- * @param modSeq
- */
- void setModSeq(long modSeq);
-
- /**
- * Return the mod-sequence for the message
- *
- * @return message
- */
- long getModSeq();
-
- /**
- * Return if it was marked as answered
- *
- * @return answered
- */
- boolean isAnswered();
-
- /**
- * Return if it was mark as deleted
- *
- * @return deleted
- */
- boolean isDeleted();
-
- /**
- * Return if it was mark as draft
- *
- * @return draft
- */
- boolean isDraft();
-
- /**
- * Return if it was flagged
- *
- * @return flagged
- */
- boolean isFlagged();
- /**
- * Return if it was marked as recent
- *
- * @return recent
- */
- boolean isRecent();
-
- /**
- * Return if it was marked as seen
- *
- * @return seen
- */
- boolean isSeen();
-
-
- /**
- * Set the Flags
- *
- * @param flags
- */
- void setFlags(Flags flags);
+ Date getInternalDate();
/**
- * Creates a new flags instance populated
- * with the current flag data.
- *
- * @return new instance, not null
- */
- Flags createFlags();
-
-
- /**
* Gets the body content of the document. Headers are excluded.
- *
+ *
* Be aware that this method need to return a new fresh {@link InputStream}
* on every call, which basicly means it need to start at position 0
* @return body, not null
@@ -145,50 +40,50 @@ public interface MailboxMessage<Id exten
/**
* Gets the top level MIME content media type.
- *
+ *
* @return top level MIME content media type, or null if default
*/
String getMediaType();
/**
* Gets the MIME content subtype.
- *
+ *
* @return the MIME content subtype, or null if default
*/
String getSubType();
-
+
/**
* The number of octets contained in the body of this document.
- *
+ *
* @return number of octets
*/
long getBodyOctets();
-
+
/**
* The number of octets contained in the full content of this document.
- *
+ *
* @return number of octets
*/
long getFullContentOctets();
-
+
/**
* Gets the number of CRLF in a textual document.
* @return CRLF count when document is textual,
* null otherwise
*/
- public Long getTextualLineCount();
-
+ Long getTextualLineCount();
+
/**
* Gets the header as {@link InputStream}. This MUST INCLUDE the CRLF terminator
- *
+ *
* Be aware that this method need to return a new fresh {@link InputStream}
* on every call
- *
+ *
* @return header
- * @throws IOException
+ * @throws IOException
*/
InputStream getHeaderContent() throws IOException;
-
+
/**
*Returns the full raw content of the MailboxMessage via an {@link InputStream}.
*
@@ -200,13 +95,12 @@ public interface MailboxMessage<Id exten
*/
InputStream getFullContent() throws IOException;
-
/**
* Gets a read-only list of meta-data properties.
* For properties with multiple values, this list will contain
* several enteries with the same namespace and local name.
- *
+ *
* @return unmodifiable list of meta-data, not null
*/
List<Property> getProperties();
-}
\ No newline at end of file
+}
Modified: james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/streaming/InputStreamContent.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/streaming/InputStreamContent.java?rev=1724226&r1=1724225&r2=1724226&view=diff
==============================================================================
--- james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/streaming/InputStreamContent.java (original)
+++ james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/streaming/InputStreamContent.java Tue Jan 12 13:18:30 2016
@@ -22,14 +22,15 @@ import java.io.IOException;
import java.io.InputStream;
import org.apache.james.mailbox.model.Content;
-import org.apache.james.mailbox.store.mail.model.MailboxMessage;
+import org.apache.james.mailbox.store.mail.model.Message;
/**
* {@link Content} which is stored in a {@link InputStream}
*
*/
public final class InputStreamContent implements Content{
- private MailboxMessage<?> m;
+
+ private Message m;
private Type type;
public static enum Type {
@@ -37,7 +38,7 @@ public final class InputStreamContent im
Body
}
- public InputStreamContent(MailboxMessage<?> m, Type type) throws IOException{
+ public InputStreamContent(Message m, Type type) throws IOException{
this.m = m;
this.type = type;
}
Modified: james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/message/MimePartParser.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/message/MimePartParser.java?rev=1724226&r1=1724225&r2=1724226&view=diff
==============================================================================
--- james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/message/MimePartParser.java (original)
+++ james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/message/MimePartParser.java Tue Jan 12 13:18:30 2016
@@ -21,8 +21,7 @@ package org.apache.james.jmap.model.mess
import com.google.common.base.Preconditions;
import org.apache.james.mailbox.store.extractor.TextExtractor;
-import org.apache.james.mailbox.store.mail.model.MailboxId;
-import org.apache.james.mailbox.store.mail.model.MailboxMessage;
+import org.apache.james.mailbox.store.mail.model.Message;
import org.apache.james.mime4j.MimeException;
import org.apache.james.mime4j.message.DefaultBodyDescriptorBuilder;
import org.apache.james.mime4j.message.MaximalBodyDescriptor;
@@ -36,14 +35,14 @@ import java.util.LinkedList;
public class MimePartParser {
- private final MailboxMessage<? extends MailboxId> message;
+ private final Message message;
private final TextExtractor textExtractor;
private final MimeTokenStream stream;
private final Deque<MimePartContainerBuilder> builderStack;
private MimePart result;
private MimePartContainerBuilder currentlyBuildMimePart;
- public MimePartParser(MailboxMessage<? extends MailboxId> message, TextExtractor textExtractor) {
+ public MimePartParser(Message message, TextExtractor textExtractor) {
this.message = message;
this.textExtractor = textExtractor;
this.builderStack = new LinkedList<>();
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org