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 rd...@apache.org on 2008/09/18 23:45:03 UTC
svn commit: r696828 [9/32] - in /james/protocols/imap/trunk:
api/src/main/java/org/apache/james/api/imap/
api/src/main/java/org/apache/james/api/imap/display/
api/src/main/java/org/apache/james/api/imap/imap4rev1/
api/src/main/java/org/apache/james/api...
Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/MailboxEventDispatcher.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/MailboxEventDispatcher.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/MailboxEventDispatcher.java (original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/MailboxEventDispatcher.java Thu Sep 18 14:44:56 2008
@@ -31,7 +31,7 @@
import EDU.oswego.cs.dl.util.concurrent.CopyOnWriteArraySet;
public class MailboxEventDispatcher implements MailboxListener {
-
+
private final Set listeners = new CopyOnWriteArraySet();
public void addMailboxListener(MailboxListener mailboxListener) {
@@ -58,9 +58,9 @@
}
}
- public void flagsUpdated(final long uid, long sessionId, final Flags original,
- final Flags updated) {
- final FlagsUpdatedImpl flags = new FlagsUpdatedImpl(sessionId, uid,
+ public void flagsUpdated(final long uid, long sessionId,
+ final Flags original, final Flags updated) {
+ final FlagsUpdatedImpl flags = new FlagsUpdatedImpl(sessionId, uid,
original, updated);
for (Iterator iter = listeners.iterator(); iter.hasNext();) {
MailboxListener mailboxListener = (MailboxListener) iter.next();
@@ -74,7 +74,7 @@
mailboxListener.event(event);
}
}
-
+
public int size() {
return listeners.size();
}
@@ -82,8 +82,9 @@
private final static class AddedImpl extends MailboxListener.Added {
private final long sessionId;
+
private final long subjectUid;
-
+
public AddedImpl(final long sessionId, final long subjectUid) {
super();
this.sessionId = sessionId;
@@ -98,12 +99,13 @@
return sessionId;
}
}
-
+
private final static class ExpungedImpl extends MailboxListener.Expunged {
private final long sessionId;
+
private final long subjectUid;
-
+
public ExpungedImpl(final long sessionId, final long subjectUid) {
super();
this.sessionId = sessionId;
@@ -118,38 +120,46 @@
return sessionId;
}
}
-
- private final static class FlagsUpdatedImpl extends MailboxListener.FlagsUpdated {
- private static final boolean isChanged(final Flags original, final Flags updated,
- Flags.Flag flag) {
- return original != null && updated != null
- && (original.contains(flag) ^ updated.contains(flag)) ;
- }
-
- private static final Flags.Flag[] FLAGS = {Flags.Flag.ANSWERED,
- Flags.Flag.DELETED, Flags.Flag.DRAFT, Flags.Flag.FLAGGED,
- Flags.Flag.RECENT, Flags.Flag.SEEN};
+ private final static class FlagsUpdatedImpl extends
+ MailboxListener.FlagsUpdated {
+
+ private static final boolean isChanged(final Flags original,
+ final Flags updated, Flags.Flag flag) {
+ return original != null && updated != null
+ && (original.contains(flag) ^ updated.contains(flag));
+ }
+
+ private static final Flags.Flag[] FLAGS = { Flags.Flag.ANSWERED,
+ Flags.Flag.DELETED, Flags.Flag.DRAFT, Flags.Flag.FLAGGED,
+ Flags.Flag.RECENT, Flags.Flag.SEEN };
+
private static final int NUMBER_OF_SYSTEM_FLAGS = 6;
-
+
private final long sessionId;
+
private final long subjectUid;
+
private final boolean[] modifiedFlags;
+
private final Flags newFlags;
-
- public FlagsUpdatedImpl(final long sessionId, final long subjectUid,
+
+ public FlagsUpdatedImpl(final long sessionId, final long subjectUid,
final Flags original, final Flags updated) {
- this(sessionId, subjectUid, updated, isChanged(original, updated, Flags.Flag.ANSWERED),
- isChanged(original, updated, Flags.Flag.DELETED),
- isChanged(original, updated, Flags.Flag.DRAFT),
- isChanged(original, updated, Flags.Flag.FLAGGED),
- isChanged(original, updated, Flags.Flag.RECENT),
- isChanged(original, updated, Flags.Flag.SEEN));
- }
-
- public FlagsUpdatedImpl(final long sessionId, final long subjectUid, final Flags newFlags,
- boolean answeredUpdated, boolean deletedUpdated, boolean draftUpdated,
- boolean flaggedUpdated, boolean recentUpdated, boolean seenUpdated) {
+ this(sessionId, subjectUid, updated, isChanged(original, updated,
+ Flags.Flag.ANSWERED), isChanged(original, updated,
+ Flags.Flag.DELETED), isChanged(original, updated,
+ Flags.Flag.DRAFT), isChanged(original, updated,
+ Flags.Flag.FLAGGED), isChanged(original, updated,
+ Flags.Flag.RECENT), isChanged(original, updated,
+ Flags.Flag.SEEN));
+ }
+
+ public FlagsUpdatedImpl(final long sessionId, final long subjectUid,
+ final Flags newFlags, boolean answeredUpdated,
+ boolean deletedUpdated, boolean draftUpdated,
+ boolean flaggedUpdated, boolean recentUpdated,
+ boolean seenUpdated) {
super();
this.sessionId = sessionId;
this.subjectUid = subjectUid;
@@ -174,14 +184,14 @@
public Iterator flagsIterator() {
return new FlagsIterator();
}
-
+
public Flags getNewFlags() {
return newFlags;
}
-
+
private class FlagsIterator implements Iterator {
private int position;
-
+
public FlagsIterator() {
position = 0;
nextPosition();
@@ -195,7 +205,7 @@
}
}
}
-
+
public boolean hasNext() {
return position < NUMBER_OF_SYSTEM_FLAGS;
}
@@ -216,16 +226,18 @@
}
public void mailboxDeleted(long sessionId) {
- final MailboxDeletionEventImpl event = new MailboxDeletionEventImpl(sessionId);
+ final MailboxDeletionEventImpl event = new MailboxDeletionEventImpl(
+ sessionId);
for (Iterator iter = listeners.iterator(); iter.hasNext();) {
MailboxListener mailboxListener = (MailboxListener) iter.next();
mailboxListener.event(event);
}
}
- private static final class MailboxDeletionEventImpl implements MailboxListener.MailboxDeletionEvent {
+ private static final class MailboxDeletionEventImpl implements
+ MailboxListener.MailboxDeletionEvent {
private final long sessionId;
-
+
public MailboxDeletionEventImpl(final long sessionId) {
super();
this.sessionId = sessionId;
@@ -234,6 +246,6 @@
public long getSessionId() {
return sessionId;
}
-
+
}
}
Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/MailboxListenerCollector.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/MailboxListenerCollector.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/MailboxListenerCollector.java (original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/MailboxListenerCollector.java Thu Sep 18 14:44:56 2008
@@ -27,10 +27,12 @@
import org.apache.james.mailboxmanager.MailboxListener;
public class MailboxListenerCollector implements MailboxListener {
-
- protected List addedList =new ArrayList();
- protected List expungedList =new ArrayList();
- protected List flaggedList =new ArrayList();
+
+ protected List addedList = new ArrayList();
+
+ protected List expungedList = new ArrayList();
+
+ protected List flaggedList = new ArrayList();
public void added(final long uid) {
addedList.add(new Long(uid));
@@ -43,27 +45,27 @@
public void flagsUpdated(final long uid, final Flags flags) {
flaggedList.add(new MessageFlags(uid, flags));
}
-
+
public synchronized List getAddedList(boolean reset) {
- List list=addedList;
+ List list = addedList;
if (reset) {
- addedList=new ArrayList();
+ addedList = new ArrayList();
}
return list;
}
public synchronized List getExpungedList(boolean reset) {
- List list=expungedList;
+ List list = expungedList;
if (reset) {
- expungedList=new ArrayList();
+ expungedList = new ArrayList();
}
return list;
}
public synchronized List getFlaggedList(boolean reset) {
- List list=flaggedList;
+ List list = flaggedList;
if (reset) {
- flaggedList=new ArrayList();
+ flaggedList = new ArrayList();
}
return list;
}
Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/MessageFlags.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/MessageFlags.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/MessageFlags.java (original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/MessageFlags.java Thu Sep 18 14:44:56 2008
@@ -31,32 +31,35 @@
* Represents the flags for a message.
*/
public class MessageFlags {
-
-
+
/**
* Converts given message results into {@link MessageFlags}.
- * @param messageResults <code>Collection</code> of {@link MessageResult}, not null
+ *
+ * @param messageResults
+ * <code>Collection</code> of {@link MessageResult}, not null
* @return <code>MessageFlags</code> array, not null
- * @throws MessagingException
+ * @throws MessagingException
*/
- public static final MessageFlags[] toMessageFlags(Collection messageResults) throws MessagingException {
+ public static final MessageFlags[] toMessageFlags(Collection messageResults)
+ throws MessagingException {
final int size = messageResults.size();
final MessageFlags[] results = new MessageFlags[size];
- int i=0;
- for (final Iterator it=messageResults.iterator();it.hasNext();) {
+ int i = 0;
+ for (final Iterator it = messageResults.iterator(); it.hasNext();) {
final MessageResult result = (MessageResult) it.next();
results[i++] = new MessageFlags(result);
}
return results;
}
-
+
private final long uid;
+
private Flags flags;
-
+
public MessageFlags(final MessageResult result) throws MessagingException {
- this(result.getUid(),result.getFlags());
+ this(result.getUid(), result.getFlags());
}
-
+
public MessageFlags(final long uid, Flags flags) {
this.uid = uid;
this.flags = flags;
@@ -64,22 +67,26 @@
/**
* Gets the message flags.
+ *
* @return <code>Flags</code>, not null
*/
public final Flags getFlags() {
return flags;
}
-
+
/**
* Sets the message flags
- * @param flags <code>Flags</code>, not null
+ *
+ * @param flags
+ * <code>Flags</code>, not null
*/
public final void setFlags(Flags flags) {
this.flags = flags;
}
-
+
/**
* Gets the UID for the message.
+ *
* @return the message UID
*/
public final long getUid() {
@@ -89,7 +96,7 @@
/**
* @see java.lang.Object#hashCode()
*/
-// @Override
+ // @Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
@@ -100,7 +107,7 @@
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
-// @Override
+ // @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -116,22 +123,17 @@
/**
* Represents this object suitable for logging.
- *
- * @return a <code>String</code> representation
- * of this object.
- */
-// @Override
- public String toString()
- {
+ *
+ * @return a <code>String</code> representation of this object.
+ */
+ // @Override
+ public String toString() {
final String TAB = " ";
-
- final String retValue = "MessageFlags ( "
- + "uid = " + this.uid + TAB
- + "flags = " + this.flags + TAB
- + " )";
-
+
+ final String retValue = "MessageFlags ( " + "uid = " + this.uid + TAB
+ + "flags = " + this.flags + TAB + " )";
+
return retValue;
- }
-
-
+ }
+
}
Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/MessageRangeImpl.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/MessageRangeImpl.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/MessageRangeImpl.java (original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/MessageRangeImpl.java Thu Sep 18 14:44:56 2008
@@ -31,8 +31,8 @@
private final long uidTo;
-
- private MessageRangeImpl(final int type, final long uidFrom, final long uidTo) {
+ private MessageRangeImpl(final int type, final long uidFrom,
+ final long uidTo) {
super();
this.type = type;
this.uidFrom = uidFrom;
@@ -51,14 +51,14 @@
return uidTo;
}
-
public static MessageRange oneUid(long uid) {
MessageRangeImpl result = new MessageRangeImpl(TYPE_UID, uid, uid);
return result;
}
public static MessageRange all() {
- MessageRangeImpl result = new MessageRangeImpl(TYPE_ALL, NOT_A_UID, NOT_A_UID);
+ MessageRangeImpl result = new MessageRangeImpl(TYPE_ALL, NOT_A_UID,
+ NOT_A_UID);
return result;
}
Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/MessageResultImpl.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/MessageResultImpl.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/MessageResultImpl.java (original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/MessageResultImpl.java Thu Sep 18 14:44:56 2008
@@ -34,23 +34,33 @@
import org.apache.james.mailboxmanager.util.MessageResultUtils;
/**
- * Bean based implementation.
- * {@link #getIncludedResults()} is updated when setters are called.
+ * Bean based implementation. {@link #getIncludedResults()} is updated when
+ * setters are called.
*/
public class MessageResultImpl implements MessageResult {
-
+
private MimeMessage mimeMessage;
+
private long uid;
+
private Flags flags;
+
private int size;
+
private Date internalDate;
+
private List headers;
+
private Content body;
+
private Content fullContent;
+
private int includedResults = FetchGroup.MINIMAL;
+
private Map partsByPath = new HashMap();
+
private MimeDescriptor mimeDescriptor;
-
+
public MessageResultImpl(long uid) {
setUid(uid);
}
@@ -63,8 +73,9 @@
setFlags(flags);
}
- public MessageResultImpl(MessageResult result) throws MailboxManagerException {
- setUid(result.getUid());
+ public MessageResultImpl(MessageResult result)
+ throws MailboxManagerException {
+ setUid(result.getUid());
if (MessageResultUtils.isFlagsIncluded(result)) {
setFlags(result.getFlags());
}
@@ -86,16 +97,16 @@
}
private List toList(Iterator iterator) {
- final List results = new ArrayList();
- if (iterator != null) {
- while (iterator.hasNext()) {
- results.add(iterator.next());
- }
- }
- return results;
- }
+ final List results = new ArrayList();
+ if (iterator != null) {
+ while (iterator.hasNext()) {
+ results.add(iterator.next());
+ }
+ }
+ return results;
+ }
- public MessageResult.FetchGroup getIncludedResults() {
+ public MessageResult.FetchGroup getIncludedResults() {
final FetchGroupImpl fetchGroup = new FetchGroupImpl(includedResults);
return fetchGroup;
}
@@ -103,7 +114,7 @@
public MimeMessage getMimeMessage() {
return mimeMessage;
}
-
+
public long getUid() {
return uid;
}
@@ -122,37 +133,38 @@
}
public void setUid(long uid) {
- this.uid=uid;
+ this.uid = uid;
}
-
+
public int getSize() {
return size;
}
public void setFlags(Flags flags) {
- this.flags=flags;
+ this.flags = flags;
if (flags != null) {
includedResults |= FetchGroup.FLAGS;
}
}
public int compareTo(Object o) {
- MessageResult that=(MessageResult)o;
- if (this.uid>0 && that.getUid()>0) {
+ MessageResult that = (MessageResult) o;
+ if (this.uid > 0 && that.getUid() > 0) {
// TODO: this seems inefficient
- return new Long(uid).compareTo(new Long(that.getUid()));
+ return new Long(uid).compareTo(new Long(that.getUid()));
} else {
// TODO: throwing an undocumented untyped runtime seems wrong
- // TODO: if uids must be greater than zero then this should be enforced
+ // TODO: if uids must be greater than zero then this should be
+ // enforced
// TODO: on the way in
// TODO: probably an IllegalArgumentException would be better
throw new RuntimeException("can't compare");
}
-
+
}
public void setSize(int size) {
- this.size=size;
+ this.size = size;
includedResults |= FetchGroup.SIZE;
}
@@ -166,7 +178,7 @@
public Iterator headers() {
return headers.iterator();
}
-
+
public List getHeaders() {
return headers;
}
@@ -202,22 +214,17 @@
/**
* Renders suitably for logging.
- *
- * @return a <code>String</code> representation
- * of this object.
+ *
+ * @return a <code>String</code> representation of this object.
*/
- public String toString()
- {
+ public String toString() {
final String TAB = " ";
-
- String retValue = "MessageResultImpl ( "
- + "uid = " + this.uid + TAB
- + "flags = " + this.flags + TAB
- + "size = " + this.size + TAB
- + "internalDate = " + this.internalDate + TAB
- + "includedResults = " + this.includedResults + TAB
- + " )";
-
+
+ String retValue = "MessageResultImpl ( " + "uid = " + this.uid + TAB
+ + "flags = " + this.flags + TAB + "size = " + this.size + TAB
+ + "internalDate = " + this.internalDate + TAB
+ + "includedResults = " + this.includedResults + TAB + " )";
+
return retValue;
}
@@ -228,10 +235,9 @@
result = null;
} else {
result = partContent.getBody();
- }
- return result;
+ }
+ return result;
}
-
public Content getMimeBody(MimePath path) throws MailboxManagerException {
final Content result;
@@ -240,8 +246,8 @@
result = null;
} else {
result = partContent.getMimeBody();
- }
- return result;
+ }
+ return result;
}
public Content getFullContent(MimePath path) throws MailboxManagerException {
@@ -251,57 +257,59 @@
result = null;
} else {
result = partContent.getFull();
- }
- return result;
+ }
+ return result;
}
- public Iterator iterateHeaders(MimePath path) throws MailboxManagerException {
+ public Iterator iterateHeaders(MimePath path)
+ throws MailboxManagerException {
final Iterator result;
final PartContent partContent = getPartContent(path);
if (partContent == null) {
result = null;
} else {
result = partContent.getHeaders();
- }
- return result;
+ }
+ return result;
}
-
- public Iterator iterateMimeHeaders(MimePath path) throws MailboxManagerException {
+
+ public Iterator iterateMimeHeaders(MimePath path)
+ throws MailboxManagerException {
final Iterator result;
final PartContent partContent = getPartContent(path);
if (partContent == null) {
result = null;
} else {
result = partContent.getMimeHeaders();
- }
- return result;
+ }
+ return result;
}
-
+
public void setBodyContent(MimePath path, Content content) {
final PartContent partContent = getPartContent(path);
partContent.setBody(content);
}
-
+
public void setMimeBodyContent(MimePath path, Content content) {
final PartContent partContent = getPartContent(path);
partContent.setMimeBody(content);
}
-
+
public void setFullContent(MimePath path, Content content) {
final PartContent partContent = getPartContent(path);
- partContent.setFull(content);
+ partContent.setFull(content);
}
-
+
public void setHeaders(MimePath path, Iterator headers) {
final PartContent partContent = getPartContent(path);
- partContent.setHeaders(headers);
+ partContent.setHeaders(headers);
}
-
+
public void setMimeHeaders(MimePath path, Iterator headers) {
final PartContent partContent = getPartContent(path);
- partContent.setMimeHeaders(headers);
+ partContent.setMimeHeaders(headers);
}
-
+
private PartContent getPartContent(MimePath path) {
PartContent result = (PartContent) partsByPath.get(path);
if (result == null) {
@@ -310,15 +318,20 @@
}
return result;
}
-
+
private static final class PartContent {
private Content body;
+
private Content mimeBody;
+
private Content full;
+
private Iterator headers;
+
private Iterator mimeHeaders;
+
private int content;
-
+
public final int getContent() {
return content;
}
@@ -326,7 +339,7 @@
public final Content getBody() {
return body;
}
-
+
public final void setBody(Content body) {
content = content | FetchGroup.BODY_CONTENT;
this.body = body;
@@ -335,35 +348,35 @@
public final Content getMimeBody() {
return mimeBody;
}
-
+
public final void setMimeBody(Content mimeBody) {
content = content | FetchGroup.MIME_CONTENT;
this.mimeBody = mimeBody;
}
-
+
public final Content getFull() {
return full;
}
-
+
public final void setFull(Content full) {
content = content | FetchGroup.FULL_CONTENT;
this.full = full;
}
-
+
public final Iterator getHeaders() {
return headers;
}
-
- public final void setHeaders(Iterator headers) {
+
+ public final void setHeaders(Iterator headers) {
content = content | FetchGroup.HEADERS;
this.headers = headers;
}
-
+
public final Iterator getMimeHeaders() {
return mimeHeaders;
}
-
- public final void setMimeHeaders(Iterator mimeHeaders) {
+
+ public final void setMimeHeaders(Iterator mimeHeaders) {
content = content | FetchGroup.MIME_HEADERS;
this.mimeHeaders = mimeHeaders;
}
@@ -373,7 +386,7 @@
includedResults |= FetchGroup.MIME_DESCRIPTOR;
this.mimeDescriptor = mimeDescriptor;
}
-
+
public MimeDescriptor getMimeDescriptor() {
return mimeDescriptor;
}
Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/PartContentDescriptorImpl.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/PartContentDescriptorImpl.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/PartContentDescriptorImpl.java (original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/PartContentDescriptorImpl.java Thu Sep 18 14:44:56 2008
@@ -25,8 +25,9 @@
public class PartContentDescriptorImpl implements PartContentDescriptor {
private int content = 0;
+
private final MimePath path;
-
+
public PartContentDescriptorImpl(final MimePath path) {
super();
this.path = path;
@@ -37,11 +38,11 @@
this.content = content;
this.path = path;
}
-
+
public void or(int content) {
this.content = this.content | content;
}
-
+
public int content() {
return content;
}
@@ -73,5 +74,4 @@
return true;
}
-
}
Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/UidChangeTracker.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/UidChangeTracker.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/UidChangeTracker.java (original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/UidChangeTracker.java Thu Sep 18 14:44:56 2008
@@ -39,9 +39,9 @@
import org.apache.james.mailboxmanager.util.UidRange;
public class UidChangeTracker implements Constants {
-
+
private final MailboxEventDispatcher eventDispatcher;
-
+
private final TreeMap cache;
private long lastUidAtStart;
@@ -59,23 +59,27 @@
public synchronized void expunged(final long[] uidsExpunged) {
final int length = uidsExpunged.length;
- for (int i=0;i< length;i++) {
+ for (int i = 0; i < length; i++) {
final long uid = uidsExpunged[i];
cache.remove(new Long(uid));
eventDispatcher.expunged(uid, 0);
}
}
-
+
/**
* Indicates that the flags on the given messages may have been updated.
- * @param messageFlags flags
- * @param sessionId id of the session upating the flags
+ *
+ * @param messageFlags
+ * flags
+ * @param sessionId
+ * id of the session upating the flags
* @see #flagsUpdated(MessageResult, long)
*/
- public synchronized void flagsUpdated(MessageFlags[] messageFlags, long sessionId) {
+ public synchronized void flagsUpdated(MessageFlags[] messageFlags,
+ long sessionId) {
if (messageFlags != null) {
final int length = messageFlags.length;
- for (int i=0;i< length;i++){
+ for (int i = 0; i < length; i++) {
final MessageFlags result = messageFlags[i];
final long uid = result.getUid();
final Flags flags = result.getFlags();
@@ -84,30 +88,38 @@
}
}
}
-
+
/**
* Indicates that the flags on the given messages may have been updated.
- * @param messageResults results
- * @param sessionId id of the session upating the flags
- * @throws MailboxManagerException
+ *
+ * @param messageResults
+ * results
+ * @param sessionId
+ * id of the session upating the flags
+ * @throws MailboxManagerException
* @see #flagsUpdated(MessageResult, long)
*/
- public synchronized void flagsUpdated(Collection messageResults, long sessionId) throws MailboxManagerException {
+ public synchronized void flagsUpdated(Collection messageResults,
+ long sessionId) throws MailboxManagerException {
if (messageResults != null) {
- for (final Iterator it = messageResults.iterator();it.hasNext();) {
+ for (final Iterator it = messageResults.iterator(); it.hasNext();) {
final MessageResult result = (MessageResult) it.next();
flagsUpdated(result, sessionId);
}
}
}
-
+
/**
* Indicates that the flags on the given message may have been updated.
- * @param messageResult result of update
- * @param sessionId id of the session updating the flags
- * @throws MailboxManagerException
+ *
+ * @param messageResult
+ * result of update
+ * @param sessionId
+ * id of the session updating the flags
+ * @throws MailboxManagerException
*/
- public synchronized void flagsUpdated(MessageResult messageResult, long sessionId) throws MailboxManagerException {
+ public synchronized void flagsUpdated(MessageResult messageResult,
+ long sessionId) throws MailboxManagerException {
if (messageResult != null) {
final Flags flags = messageResult.getFlags();
final long uid = messageResult.getUid();
@@ -115,27 +127,28 @@
updatedFlags(uid, flags, uidLong, sessionId);
}
}
-
- public synchronized void found(UidRange range, final Collection messageResults) throws MessagingException {
+
+ public synchronized void found(UidRange range,
+ final Collection messageResults) throws MessagingException {
found(range, MessageFlags.toMessageFlags(messageResults));
}
-
- public synchronized void found(UidRange range, final MessageFlags[] messageFlags) {
+
+ public synchronized void found(UidRange range,
+ final MessageFlags[] messageFlags) {
Set expectedSet = getSubSet(range);
final int length = messageFlags.length;
- for (int i=0;i<length;i++) {
+ for (int i = 0; i < length; i++) {
final MessageFlags message = messageFlags[i];
if (message != null) {
long uid = message.getUid();
- if (uid>lastScannedUid) {
- lastScannedUid=uid;
+ if (uid > lastScannedUid) {
+ lastScannedUid = uid;
}
final Flags flags = message.getFlags();
final Long uidLong = new Long(uid);
if (expectedSet.contains(uidLong)) {
expectedSet.remove(uidLong);
- updatedFlags(uid, flags, uidLong,
- Mailbox.ANONYMOUS_SESSION);
+ updatedFlags(uid, flags, uidLong, Mailbox.ANONYMOUS_SESSION);
} else {
cache.put(uidLong, flags);
if (uid > lastUidAtStart) {
@@ -146,30 +159,31 @@
}
- if (lastScannedUid>lastUid) {
- lastUid=lastScannedUid;
+ if (lastScannedUid > lastUid) {
+ lastUid = lastScannedUid;
}
- if (range.getToUid()==UID_INFINITY || range.getToUid()>=lastUid) {
- lastScannedUid=lastUid;
- } else if (range.getToUid()!=UID_INFINITY && range.getToUid()<lastUid && range.getToUid() > lastScannedUid) {
- lastScannedUid=range.getToUid();
+ if (range.getToUid() == UID_INFINITY || range.getToUid() >= lastUid) {
+ lastScannedUid = lastUid;
+ } else if (range.getToUid() != UID_INFINITY
+ && range.getToUid() < lastUid
+ && range.getToUid() > lastScannedUid) {
+ lastScannedUid = range.getToUid();
}
-
+
for (Iterator iter = expectedSet.iterator(); iter.hasNext();) {
long uid = ((Long) iter.next()).longValue();
eventDispatcher.expunged(uid, 0);
}
}
- private void updatedFlags(final long uid, final Flags flags,
+ private void updatedFlags(final long uid, final Flags flags,
final Long uidLong, final long sessionId) {
if (flags != null) {
Flags cachedFlags = (Flags) cache.get(uidLong);
- if (cachedFlags == null
- || !flags.equals(cachedFlags)) {
+ if (cachedFlags == null || !flags.equals(cachedFlags)) {
if (cachedFlags != null) {
- eventDispatcher.flagsUpdated(uid, sessionId,
- cachedFlags, flags);
+ eventDispatcher.flagsUpdated(uid, sessionId, cachedFlags,
+ flags);
}
cache.put(uidLong, flags);
}
@@ -181,17 +195,18 @@
if (range.getToUid() > 0) {
final long nextUidAfterRange = range.getToUid() + 1;
final Long nextUidAfterRangeLong = new Long(nextUidAfterRange);
- final SortedMap subMap = cache.subMap(rangeStartLong, nextUidAfterRangeLong);
+ final SortedMap subMap = cache.subMap(rangeStartLong,
+ nextUidAfterRangeLong);
final Set keySet = subMap.keySet();
return new TreeSet(keySet);
} else {
- return new TreeSet(cache
- .tailMap(rangeStartLong).keySet());
+ return new TreeSet(cache.tailMap(rangeStartLong).keySet());
}
}
- public synchronized void found(MessageResult messageResult) throws MessagingException {
+ public synchronized void found(MessageResult messageResult)
+ throws MessagingException {
if (messageResult != null) {
long uid = messageResult.getUid();
Collection results = new ArrayList();
@@ -203,10 +218,10 @@
public synchronized long getLastUid() {
return lastUid;
}
-
+
public synchronized void foundLastUid(long foundLastUid) {
- if (foundLastUid>lastUid) {
- lastUid=foundLastUid;
+ if (foundLastUid > lastUid) {
+ lastUid = foundLastUid;
}
}
Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/mailbox/Mailbox.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/mailbox/Mailbox.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/mailbox/Mailbox.java (original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/mailbox/Mailbox.java Thu Sep 18 14:44:56 2008
@@ -37,7 +37,7 @@
public interface Mailbox {
public static final long ANONYMOUS_SESSION = 0;
-
+
/**
* Example #mail.paul.lists.apache.james-dev (3rd level folder of user paul)
*
@@ -46,15 +46,16 @@
*/
String getName();
- int getMessageCount(MailboxSession mailboxSession) throws MailboxManagerException;
+ int getMessageCount(MailboxSession mailboxSession)
+ throws MailboxManagerException;
boolean isWriteable();
-
-
+
/**
* @param fetchGroup
* which fields to be returned in MessageResult
- * @param mailboxSession TODO
+ * @param mailboxSession
+ * TODO
* @return MessageResult with the fields defined by <b>result</b>
* <ul>
* <li> IMAP: msn or (msn and uid)</li>
@@ -62,36 +63,41 @@
* </ul>
* @throws MailboxManagerException
* if anything went wrong
- * @throws UnsupportedCriteriaException when any of the search parameters are
- * not supported by this mailbox
+ * @throws UnsupportedCriteriaException
+ * when any of the search parameters are not supported by this
+ * mailbox
*/
- Iterator search(SearchQuery searchQuery, FetchGroup fetchGroup, MailboxSession mailboxSession) throws MailboxManagerException;
-
-
- long getUidValidity(MailboxSession mailboxSession) throws MailboxManagerException;
-
+ Iterator search(SearchQuery searchQuery, FetchGroup fetchGroup,
+ MailboxSession mailboxSession) throws MailboxManagerException;
+
+ long getUidValidity(MailboxSession mailboxSession)
+ throws MailboxManagerException;
+
/**
*
- * @param mailboxSession TODO
+ * @param mailboxSession
+ * TODO
* @return the uid that will be assigned to the next appended message
- * @throws MailboxManagerException
+ * @throws MailboxManagerException
*/
- long getUidNext(MailboxSession mailboxSession) throws MailboxManagerException;
-
-
+ long getUidNext(MailboxSession mailboxSession)
+ throws MailboxManagerException;
+
/**
* @return Flags that can be stored
*/
Flags getPermanentFlags();
-
- long[] recent(boolean reset, MailboxSession mailboxSession) throws MailboxManagerException;
-
- int getUnseenCount(MailboxSession mailboxSession) throws MailboxManagerException;
-
- MessageResult getFirstUnseen(FetchGroup fetchGroup, MailboxSession mailboxSession) throws MailboxManagerException;
-
+ long[] recent(boolean reset, MailboxSession mailboxSession)
+ throws MailboxManagerException;
+
+ int getUnseenCount(MailboxSession mailboxSession)
+ throws MailboxManagerException;
+
+ MessageResult getFirstUnseen(FetchGroup fetchGroup,
+ MailboxSession mailboxSession) throws MailboxManagerException;
+
/**
*
* @param set
@@ -101,10 +107,11 @@
* </ul>
* @param fetchGroup
* which fields to be returned in MessageResult
- * @param mailboxSession TODO
+ * @param mailboxSession
+ * TODO
*
- * @return {@link MessageResult} <code>Iterator</code> with
- * the fields defined by <b>result</b><br />
+ * @return {@link MessageResult} <code>Iterator</code> with the fields
+ * defined by <b>result</b><br />
* <ul>
* <li> IMAP, UIDPLUS: nothing required </li>
* <li> Javamail Folder: requires the expunged Message[]</li>
@@ -112,8 +119,8 @@
* @throws MailboxManagerException
* if anything went wrong
*/
- Iterator expunge(MessageRange set, FetchGroup fetchGroup, MailboxSession mailboxSession) throws MailboxManagerException;
-
+ Iterator expunge(MessageRange set, FetchGroup fetchGroup,
+ MailboxSession mailboxSession) throws MailboxManagerException;
/**
* this is much more straight forward for IMAP instead of setting Flags of
@@ -128,25 +135,33 @@
* replace all Flags with this flags, value has to be true
* @param set
* the range of messages
- * @param fetchGroup fetch group for results
- * @param mailboxSession TODO
+ * @param fetchGroup
+ * fetch group for results
+ * @param mailboxSession
+ * TODO
* @return {@link MessageResult} <code>Iterator</code> containing messages
- * whose flags have been updated, not null
+ * whose flags have been updated, not null
* @throws MailboxManagerException
*/
- Iterator setFlags(Flags flags, boolean value, boolean replace,
- MessageRange set, FetchGroup fetchGroup, MailboxSession mailboxSession) throws MailboxManagerException;
-
+ Iterator setFlags(Flags flags, boolean value, boolean replace,
+ MessageRange set, FetchGroup fetchGroup,
+ MailboxSession mailboxSession) throws MailboxManagerException;
+
/**
* @param internalDate
- * <p>IMAP defines this as the time when the message has arrived to
+ * <p>
+ * IMAP defines this as the time when the message has arrived to
* this server (by smtp). Clients are also allowed to set the
- * internalDate on apppend.</p><p>Is this Mail.getLastUpdates() for
- * James delivery? Should we use MimeMessage.getReceivedDate()?
+ * internalDate on apppend.
+ * </p>
+ * <p>
+ * Is this Mail.getLastUpdates() for James delivery? Should we
+ * use MimeMessage.getReceivedDate()?
* @param fetchGroup
- * which fields to be returned in MessageResult
- * or null for minimal fetch group only
- * @param mailboxSession TODO
+ * which fields to be returned in MessageResult or null for
+ * minimal fetch group only
+ * @param mailboxSession
+ * TODO
* @return MessageResult with the fields defined by <b>result</b>
* <ul>
* <li> IMAP, Javamail Folder: nothing required </li>
@@ -157,23 +172,26 @@
* if anything went wrong
*/
MessageResult appendMessage(MimeMessage message, Date internalDate,
- FetchGroup fetchGroup, MailboxSession mailboxSession) throws MailboxManagerException;
-
+ FetchGroup fetchGroup, MailboxSession mailboxSession)
+ throws MailboxManagerException;
+
/**
* TODO: consolidate search and getMessages into a single method
+ *
* @param set
- * @param mailboxSession TODO
+ * @param mailboxSession
+ * TODO
* @return MessageResult with the fields defined by <b>result</b>
* <ul>
* <li> IMAP: a set of msn, uid, Flags, header lines, content, mime
* parts...</li>
* <li> Javamail Folder: Message[]</li>
* </ul>
- * @throws MailboxManagerException
+ * @throws MailboxManagerException
*/
- Iterator getMessages(MessageRange set, FetchGroup fetchGroup, MailboxSession mailboxSession)
- throws MailboxManagerException;
+ Iterator getMessages(MessageRange set, FetchGroup fetchGroup,
+ MailboxSession mailboxSession) throws MailboxManagerException;
/**
* Implementations of Mailbox may interpret the fact that someone is
@@ -181,7 +199,7 @@
* everyone has removed itself.
*
* @param listener
- * @throws MailboxManagerException
+ * @throws MailboxManagerException
*/
void addListener(MailboxListener listener) throws MailboxManagerException;
Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/manager/MailboxExpression.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/manager/MailboxExpression.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/manager/MailboxExpression.java (original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/manager/MailboxExpression.java Thu Sep 18 14:44:56 2008
@@ -23,23 +23,32 @@
* Expresses select criteria for mailboxes.
*/
public class MailboxExpression {
-
+
private final String base;
+
private final String expression;
+
private final char freeWildcard;
+
private final char localWildcard;
+
private final int expressionLength;
-
+
/**
* Constructs an expression determining a set of mailbox names.
- * @param base base reference name, not null
- * @param expression mailbox match expression, not null
- * @param freeWildcard matches any series of charaters
- * @param localWildcard matches any sequence of characters
- * up to the next hierarchy delimiter
+ *
+ * @param base
+ * base reference name, not null
+ * @param expression
+ * mailbox match expression, not null
+ * @param freeWildcard
+ * matches any series of charaters
+ * @param localWildcard
+ * matches any sequence of characters up to the next hierarchy
+ * delimiter
*/
public MailboxExpression(final String base, final String expression,
- final char freeWildcard, final char localWildcard) {
+ final char freeWildcard, final char localWildcard) {
super();
if (base == null) {
this.base = "";
@@ -55,9 +64,10 @@
this.freeWildcard = freeWildcard;
this.localWildcard = localWildcard;
}
-
+
/**
* Gets the base reference name for the search.
+ *
* @return the base
*/
public final String getBase() {
@@ -65,16 +75,17 @@
}
/**
- * Gets the name search expression.
- * This may contain wildcards.
+ * Gets the name search expression. This may contain wildcards.
+ *
* @return the expression
*/
public final String getExpression() {
return expression;
}
-
+
/**
* Gets wildcard character that matches any series of characters.
+ *
* @return the freeWildcard
*/
public final char getFreeWildcard() {
@@ -82,28 +93,30 @@
}
/**
- * Gets wildacard character that matches any series of characters
- * excluding hierarchy delimiters. Effectively, this means that
- * it matches any sequence within a name part.
+ * Gets wildacard character that matches any series of characters excluding
+ * hierarchy delimiters. Effectively, this means that it matches any
+ * sequence within a name part.
+ *
* @return the localWildcard
*/
public final char getLocalWildcard() {
return localWildcard;
}
-
+
/**
* Is the given name a match for {@link #getExpression()}?
- * @param name name to be matched
- * @param hierarchyDelimiter mailbox hierarchy delimiter
- * @return true if the given name matches this expression,
- * false otherwise
+ *
+ * @param name
+ * name to be matched
+ * @param hierarchyDelimiter
+ * mailbox hierarchy delimiter
+ * @return true if the given name matches this expression, false otherwise
*/
public final boolean isExpressionMatch(String name, char hierarchyDelimiter) {
final boolean result;
if (isWild()) {
- if (name == null)
- {
- result = false;
+ if (name == null) {
+ result = false;
} else {
result = isWildcardMatch(name, 0, 0, hierarchyDelimiter);
}
@@ -112,21 +125,25 @@
}
return result;
}
-
- private final boolean isWildcardMatch(final String name, final int nameIndex,
- final int expressionIndex, final char hierarchyDelimiter) {
+
+ private final boolean isWildcardMatch(final String name,
+ final int nameIndex, final int expressionIndex,
+ final char hierarchyDelimiter) {
final boolean result;
if (expressionIndex < expressionLength) {
final char expressionNext = expression.charAt(expressionIndex);
if (expressionNext == freeWildcard) {
- result = isFreeWildcardMatch(name, nameIndex, expressionIndex, hierarchyDelimiter);
+ result = isFreeWildcardMatch(name, nameIndex, expressionIndex,
+ hierarchyDelimiter);
} else if (expressionNext == localWildcard) {
- result = isLocalWildcardMatch(name, nameIndex, expressionIndex, hierarchyDelimiter);
+ result = isLocalWildcardMatch(name, nameIndex, expressionIndex,
+ hierarchyDelimiter);
} else {
if (nameIndex < name.length()) {
final char nameNext = name.charAt(nameIndex);
- if(nameNext == expressionNext) {
- result = isWildcardMatch(name, nameIndex +1, expressionIndex +1, hierarchyDelimiter);
+ if (nameNext == expressionNext) {
+ result = isWildcardMatch(name, nameIndex + 1,
+ expressionIndex + 1, hierarchyDelimiter);
} else {
result = false;
}
@@ -143,20 +160,25 @@
return result;
}
- private boolean isLocalWildcardMatch(final String name, final int nameIndex, final int expressionIndex, final char hierarchyDelimiter) {
+ private boolean isLocalWildcardMatch(final String name,
+ final int nameIndex, final int expressionIndex,
+ final char hierarchyDelimiter) {
final boolean result;
if (expressionIndex < expressionLength) {
final char expressionNext = expression.charAt(expressionIndex);
if (expressionNext == localWildcard) {
- result = isLocalWildcardMatch(name, nameIndex, expressionIndex+1, hierarchyDelimiter);
+ result = isLocalWildcardMatch(name, nameIndex,
+ expressionIndex + 1, hierarchyDelimiter);
} else if (expressionNext == freeWildcard) {
- result = isFreeWildcardMatch(name, nameIndex, expressionIndex+1, hierarchyDelimiter);
+ result = isFreeWildcardMatch(name, nameIndex,
+ expressionIndex + 1, hierarchyDelimiter);
} else {
boolean matchRest = false;
- for (int i=nameIndex; i< name.length() ; i++) {
+ for (int i = nameIndex; i < name.length(); i++) {
final char tasteNextName = name.charAt(i);
if (expressionNext == tasteNextName) {
- if (isLocalWildcardMatch(name, i, expressionIndex+1, hierarchyDelimiter)) {
+ if (isLocalWildcardMatch(name, i, expressionIndex + 1,
+ hierarchyDelimiter)) {
matchRest = true;
break;
}
@@ -169,7 +191,7 @@
}
} else {
boolean containsDelimiter = false;
- for (int i=nameIndex; i< name.length() ; i++) {
+ for (int i = nameIndex; i < name.length(); i++) {
if (name.charAt(i) == hierarchyDelimiter) {
containsDelimiter = true;
break;
@@ -183,17 +205,19 @@
private boolean isWildcard(char character) {
return character == freeWildcard || character == localWildcard;
}
-
- private boolean isFreeWildcardMatch(final String name, final int nameIndex, final int expressionIndex, final char hierarchyDelimiter) {
+
+ private boolean isFreeWildcardMatch(final String name, final int nameIndex,
+ final int expressionIndex, final char hierarchyDelimiter) {
final boolean result;
int nextNormal = expressionIndex;
- while (nextNormal<expressionLength && isWildcard(expression.charAt(nextNormal))) {
+ while (nextNormal < expressionLength
+ && isWildcard(expression.charAt(nextNormal))) {
nextNormal++;
}
if (nextNormal < expressionLength) {
final char expressionNextNormal = expression.charAt(nextNormal);
boolean matchRest = false;
- for (int i=nameIndex; i< name.length() ; i++) {
+ for (int i = nameIndex; i < name.length(); i++) {
final char tasteNextName = name.charAt(i);
if (expressionNextNormal == tasteNextName) {
if (isWildcardMatch(name, i, nextNormal, hierarchyDelimiter)) {
@@ -209,23 +233,25 @@
}
return result;
}
-
+
/**
- * Get combined name formed by adding expression to base using
- * the given hierarchy delimiter.
- * Note that the wildcards are retained in the combined name.
- * @param hierarchyDelimiter delimiter for mailbox hierarchy
- * @return {@link #getBase()} combined with {@link #getExpression()},
- * not null
+ * Get combined name formed by adding expression to base using the given
+ * hierarchy delimiter. Note that the wildcards are retained in the combined
+ * name.
+ *
+ * @param hierarchyDelimiter
+ * delimiter for mailbox hierarchy
+ * @return {@link #getBase()} combined with {@link #getExpression()}, not
+ * null
*/
public String getCombinedName(char hierarchyDelimiter) {
final String result;
final int baseLength = base.length();
- if (base != null && baseLength>0) {
- final int lastChar = baseLength-1;
- if(base.charAt(lastChar)==hierarchyDelimiter) {
+ if (base != null && baseLength > 0) {
+ final int lastChar = baseLength - 1;
+ if (base.charAt(lastChar) == hierarchyDelimiter) {
if (expression != null && expression.length() > 0) {
- if (expression.charAt(0)==hierarchyDelimiter) {
+ if (expression.charAt(0) == hierarchyDelimiter) {
result = base + expression.substring(1);
} else {
result = base + expression;
@@ -235,7 +261,7 @@
}
} else {
if (expression != null && expression.length() > 0) {
- if (expression.charAt(0)==hierarchyDelimiter) {
+ if (expression.charAt(0) == hierarchyDelimiter) {
result = base + expression;
} else {
result = base + hierarchyDelimiter + expression;
@@ -244,41 +270,39 @@
result = base;
}
}
- } else {
- result = expression;
- }
- return result;
+ } else {
+ result = expression;
+ }
+ return result;
}
-
+
/**
- * Is this expression wild?
+ * Is this expression wild?
+ *
* @return true if wildcard contained, false otherwise
*/
public boolean isWild() {
- return expression != null && (expression.indexOf(freeWildcard) >= 0
- || expression.indexOf(localWildcard) >= 0);
+ return expression != null
+ && (expression.indexOf(freeWildcard) >= 0 || expression
+ .indexOf(localWildcard) >= 0);
}
/**
* Renders a string sutable for logging.
- * @return a <code>String</code> representation
- * of this object.
+ *
+ * @return a <code>String</code> representation of this object.
*/
- public String toString()
- {
+ public String toString() {
final String TAB = " ";
-
+
String retValue = "";
-
- retValue = "MailboxExpression [ "
- + "base = " + this.base + TAB
- + "expression = " + this.expression + TAB
- + "freeWildcard = " + this.freeWildcard + TAB
- + "localWildcard = " + this.localWildcard + TAB
- + " ]";
-
+
+ retValue = "MailboxExpression [ " + "base = " + this.base + TAB
+ + "expression = " + this.expression + TAB + "freeWildcard = "
+ + this.freeWildcard + TAB + "localWildcard = "
+ + this.localWildcard + TAB + " ]";
+
return retValue;
}
-
-
+
}
Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/manager/MailboxManager.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/manager/MailboxManager.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/manager/MailboxManager.java (original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/manager/MailboxManager.java Thu Sep 18 14:44:56 2008
@@ -29,19 +29,18 @@
import org.apache.james.mailboxmanager.MailboxSession;
import org.apache.james.mailboxmanager.mailbox.Mailbox;
-
/**
* <p>
- * Central MailboxManager which creates, lists, provides, renames and
- * deletes Mailboxes
+ * Central MailboxManager which creates, lists, provides, renames and deletes
+ * Mailboxes
* </p>
* <p>
* An important goal is to be JavaMail feature compatible. That means JavaMail
* could be used in both directions: As a backend for e.g. accessing a Maildir
- * JavaMail store or as a frontend to access a JDBC MailboxManager
- * through JavaMail. This should be possible by not too complicated wrapper
- * classes. Due to the complexity of JavaMail it might be impossible to avoid
- * some limitations.
+ * JavaMail store or as a frontend to access a JDBC MailboxManager through
+ * JavaMail. This should be possible by not too complicated wrapper classes. Due
+ * to the complexity of JavaMail it might be impossible to avoid some
+ * limitations.
* </p>
* <p>
* Internally MailboxManager deals with named repositories that could have
@@ -65,106 +64,141 @@
public interface MailboxManager {
- public static final char HIERARCHY_DELIMITER='.';
-
- public static final String USER_NAMESPACE="#mail";
-
+ public static final char HIERARCHY_DELIMITER = '.';
+
+ public static final String USER_NAMESPACE = "#mail";
+
public static final String INBOX = "INBOX";
-
+
/**
- * <p>Resolves a path for the given user.</p>
- * TODO: Think about replacing this operation
- * TODO: More elegant to pass in the username
- * TODO: Or switch to URLs
- */
+ * <p>
+ * Resolves a path for the given user.
+ * </p>
+ * TODO: Think about replacing this operation TODO: More elegant to pass in
+ * the username TODO: Or switch to URLs
+ */
String resolve(String userName, String mailboxPath);
/**
* Gets an session suitable for IMAP.
- * @param mailboxName the name of the mailbox, not null
- * @param autocreate create this mailbox if it doesn't exist
+ *
+ * @param mailboxName
+ * the name of the mailbox, not null
+ * @param autocreate
+ * create this mailbox if it doesn't exist
* @return <code>ImapMailboxSession</code>, not null
- * @throws MailboxManagerException when the mailbox cannot be opened
- * @throws MailboxNotFoundException when the given mailbox does not exist
- */
- Mailbox getMailbox(String mailboxName, boolean autocreate) throws MailboxManagerException;
+ * @throws MailboxManagerException
+ * when the mailbox cannot be opened
+ * @throws MailboxNotFoundException
+ * when the given mailbox does not exist
+ */
+ Mailbox getMailbox(String mailboxName, boolean autocreate)
+ throws MailboxManagerException;
/**
- * Creates a new mailbox.
- * Any intermediary mailboxes missing from the hierarchy should be created.
- * @param mailboxName name, not null
+ * Creates a new mailbox. Any intermediary mailboxes missing from the
+ * hierarchy should be created.
+ *
+ * @param mailboxName
+ * name, not null
* @throws MailboxManagerException
*/
void createMailbox(String mailboxName) throws MailboxManagerException;
- void deleteMailbox(String mailboxName, MailboxSession session) throws MailboxManagerException;
+ void deleteMailbox(String mailboxName, MailboxSession session)
+ throws MailboxManagerException;
/**
- * Renames a mailbox.
- * @param from original name for the mailbox
- * @param to new name for the mailbox
+ * Renames a mailbox.
+ *
+ * @param from
+ * original name for the mailbox
+ * @param to
+ * new name for the mailbox
* @throws MailboxManagerException
- * @throws MailboxExistsException when the <code>to</code> mailbox exists
- * @throws MailboxNotFound when the <code>from</code> mailbox does not exist
+ * @throws MailboxExistsException
+ * when the <code>to</code> mailbox exists
+ * @throws MailboxNotFound
+ * when the <code>from</code> mailbox does not exist
*/
void renameMailbox(String from, String to) throws MailboxManagerException;
/**
* this is done by the MailboxRepository because maybe this operation could
* be optimized in the corresponding store.
+ *
* @param set
* messages to copy
- * @param from name of the source mailbox
+ * @param from
+ * name of the source mailbox
* @param to
* name of the destination mailbox
- * @param session <code>MailboxSession</code>, not null
+ * @param session
+ * <code>MailboxSession</code>, not null
*/
- void copyMessages(MessageRange set, String from, String to, MailboxSession session) throws MailboxManagerException;
+ void copyMessages(MessageRange set, String from, String to,
+ MailboxSession session) throws MailboxManagerException;
/**
- * TODO: Expression requires parsing. Probably easier for the caller to
+ * TODO: Expression requires parsing. Probably easier for the caller to
* parse the expression into an object representation and use that instead.
- * @param expression <code>MailboxExpression</code> used to select mailboxes
- * to be returned
- * @throws MailboxManagerException
+ *
+ * @param expression
+ * <code>MailboxExpression</code> used to select mailboxes to
+ * be returned
+ * @throws MailboxManagerException
*/
- ListResult[] list(MailboxExpression expression) throws MailboxManagerException;
+ ListResult[] list(MailboxExpression expression)
+ throws MailboxManagerException;
boolean existsMailbox(String mailboxName) throws MailboxManagerException;
-
+
/**
* Creates a new session.
+ *
* @return <code>MailboxSession</code>, not null
*/
public MailboxSession createSession();
/**
* Autenticates the given user against the given password.
- * @param userid user name
- * @param passwd password supplied
+ *
+ * @param userid
+ * user name
+ * @param passwd
+ * password supplied
* @return true if the user is authenticated
*/
boolean isAuthentic(String userid, String passwd);
-
+
/**
* Subscribes the user to the given mailbox.
- * @param user the user name, not null
- * @param mailbox the mailbox name, not null
+ *
+ * @param user
+ * the user name, not null
+ * @param mailbox
+ * the mailbox name, not null
*/
- public void subscribe(String user, String mailbox) throws SubscriptionException;
-
+ public void subscribe(String user, String mailbox)
+ throws SubscriptionException;
+
/**
* Unsubscribes the user from the given mailbox.
- * @param user the user name, not null
- * @param mailbox the mailbox name, not null
+ *
+ * @param user
+ * the user name, not null
+ * @param mailbox
+ * the mailbox name, not null
*/
- public void unsubscribe(String user, String mailbox) throws SubscriptionException;
-
+ public void unsubscribe(String user, String mailbox)
+ throws SubscriptionException;
+
/**
* Lists current subscriptions for the given user.
- * @param user the user name, not null
+ *
+ * @param user
+ * the user name, not null
* @return a <code>Collection<String></code> of mailbox names
*/
public Collection subscriptions(String user) throws SubscriptionException;
}
-
Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/manager/MailboxManagerProvider.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/manager/MailboxManagerProvider.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/manager/MailboxManagerProvider.java (original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/manager/MailboxManagerProvider.java Thu Sep 18 14:44:56 2008
@@ -21,15 +21,14 @@
import org.apache.james.mailboxmanager.MailboxManagerException;
-//TODO: remove this pointless interface
+// TODO: remove this pointless interface
public interface MailboxManagerProvider {
- /**
- * @deprecated remove avalon coupling
- */
- public static final String ROLE
- = "org.apache.james.mailboxmanager.manager.MailboxManagerProvider";
-
+ /**
+ * @deprecated remove avalon coupling
+ */
+ public static final String ROLE = "org.apache.james.mailboxmanager.manager.MailboxManagerProvider";
+
public MailboxManager getMailboxManager() throws MailboxManagerException;
}
Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/manager/SubscriptionException.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/manager/SubscriptionException.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/manager/SubscriptionException.java (original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/manager/SubscriptionException.java Thu Sep 18 14:44:56 2008
@@ -29,7 +29,7 @@
private static final long serialVersionUID = -2057022968413471837L;
private final HumanReadableTextKey key;
-
+
public SubscriptionException(HumanReadableTextKey key, Throwable cause) {
super(key.toString(), cause);
this.key = key;
@@ -47,11 +47,11 @@
/**
* Gets the message key.
+ *
* @return the key, possibly null
*/
public final HumanReadableTextKey getKey() {
return key;
}
-
-
+
}
Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/util/MailboxEventAnalyser.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/util/MailboxEventAnalyser.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/util/MailboxEventAnalyser.java (original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/util/MailboxEventAnalyser.java Thu Sep 18 14:44:56 2008
@@ -30,13 +30,19 @@
public class MailboxEventAnalyser implements MailboxListener {
private boolean isDeletedByOtherSession = false;
+
private boolean sizeChanged = false;
+
private boolean silentFlagChanges = false;
+
private final long sessionId;
+
private final Set flagUpdateUids;
+
private final Flags.Flag uninterestingFlag;
+
private final Set expungedUids;
-
+
public MailboxEventAnalyser(final long sessionId) {
super();
this.sessionId = sessionId;
@@ -49,13 +55,13 @@
final long eventSessionId = event.getSessionId();
if (event instanceof MessageEvent) {
final MessageEvent messageEvent = (MessageEvent) event;
- final long uid = messageEvent.getSubjectUid();
+ final long uid = messageEvent.getSubjectUid();
if (messageEvent instanceof Added) {
sizeChanged = true;
} else if (messageEvent instanceof FlagsUpdated) {
FlagsUpdated updated = (FlagsUpdated) messageEvent;
- if (interestingFlags(updated) &&
- (sessionId != eventSessionId || !silentFlagChanges)) {
+ if (interestingFlags(updated)
+ && (sessionId != eventSessionId || !silentFlagChanges)) {
final Long uidObject = new Long(uid);
flagUpdateUids.add(uidObject);
}
@@ -92,11 +98,12 @@
expungedUids.clear();
isDeletedByOtherSession = false;
}
-
+
/**
* Are flag changes from current session ignored?
- * @return true if any flag changes from current session
- * will be ignored, false otherwise
+ *
+ * @return true if any flag changes from current session will be ignored,
+ * false otherwise
*/
public final boolean isSilentFlagChanges() {
return silentFlagChanges;
@@ -104,8 +111,10 @@
/**
* Sets whether changes from current session should be ignored.
- * @param silentFlagChanges true if any flag changes from current session
- * should be ignored, false otherwise
+ *
+ * @param silentFlagChanges
+ * true if any flag changes from current session should be
+ * ignored, false otherwise
*/
public final void setSilentFlagChanges(boolean silentFlagChanges) {
this.silentFlagChanges = silentFlagChanges;
@@ -113,17 +122,18 @@
/**
* Has the size of the mailbox changed?
- * @return true if new messages have been added,
- * false otherwise
+ *
+ * @return true if new messages have been added, false otherwise
*/
public final boolean isSizeChanged() {
return sizeChanged;
}
-
+
/**
* Is the mailbox deleted?
- * @return true when the mailbox has been deleted by another session,
- * false otherwise
+ *
+ * @return true when the mailbox has been deleted by another session, false
+ * otherwise
*/
public final boolean isDeletedByOtherSession() {
return isDeletedByOtherSession;
@@ -132,11 +142,11 @@
public Iterator flagUpdateUids() {
return flagUpdateUids.iterator();
}
-
+
public Iterator expungedUids() {
return expungedUids.iterator();
}
-
+
public boolean hasExpungedUids() {
return !expungedUids.isEmpty();
}
Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/util/MessageResultUtils.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/util/MessageResultUtils.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/util/MessageResultUtils.java (original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/util/MessageResultUtils.java Thu Sep 18 14:44:56 2008
@@ -34,7 +34,9 @@
/**
* Gets all header lines.
- * @param iterator {@link MessageResult.Header} <code>Iterator</code>
+ *
+ * @param iterator
+ * {@link MessageResult.Header} <code>Iterator</code>
* @return <code>List</code> of <code>MessageResult.Header<code>'s,
* in their natural order
*
@@ -43,31 +45,36 @@
public static List getAll(final Iterator iterator) {
final List results = new ArrayList();
if (iterator != null) {
- while(iterator.hasNext()) {
- results.add(iterator.next());
- }
+ while (iterator.hasNext()) {
+ results.add(iterator.next());
+ }
}
return results;
}
-
+
/**
- * Gets header lines whose header names matches (ignoring case)
- * any of those given.
- * @param names header names to be matched, not null
- * @param iterator {@link MessageResult.Header} <code>Iterator</code>
- * @return <code>List</code> of <code>MessageResult.Header</code>'s,
- * in their natural order
+ * Gets header lines whose header names matches (ignoring case) any of those
+ * given.
+ *
+ * @param names
+ * header names to be matched, not null
+ * @param iterator
+ * {@link MessageResult.Header} <code>Iterator</code>
+ * @return <code>List</code> of <code>MessageResult.Header</code>'s, in
+ * their natural order
* @throws MessagingException
*/
- public static List getMatching(final String[] names, final Iterator iterator) throws MessagingException {
+ public static List getMatching(final String[] names, final Iterator iterator)
+ throws MessagingException {
final List results = new ArrayList(20);
if (iterator != null) {
- while(iterator.hasNext()) {
- MessageResult.Header header = (MessageResult.Header) iterator.next();
+ while (iterator.hasNext()) {
+ MessageResult.Header header = (MessageResult.Header) iterator
+ .next();
final String headerName = header.getName();
if (headerName != null) {
final int length = names.length;
- for (int i=0;i<length;i++) {
+ for (int i = 0; i < length; i++) {
final String name = names[i];
if (headerName.equalsIgnoreCase(name)) {
results.add(header);
@@ -79,26 +86,33 @@
}
return results;
}
-
+
/**
- * Gets header lines whose header names matches (ignoring case)
- * any of those given.
- * @param names header names to be matched, not null
- * @param iterator {@link MessageResult.Header} <code>Iterator</code>
- * @return <code>List</code> of <code>MessageResult.Header</code>'s,
- * in their natural order
+ * Gets header lines whose header names matches (ignoring case) any of those
+ * given.
+ *
+ * @param names
+ * header names to be matched, not null
+ * @param iterator
+ * {@link MessageResult.Header} <code>Iterator</code>
+ * @return <code>List</code> of <code>MessageResult.Header</code>'s, in
+ * their natural order
* @throws MessagingException
*/
- public static List getMatching(final Collection names, final Iterator iterator) throws MessagingException {
+ public static List getMatching(final Collection names,
+ final Iterator iterator) throws MessagingException {
final List result = matching(names, iterator, false);
return result;
}
- private static List matching(final Collection names, final Iterator iterator, boolean not) throws MailboxManagerException {
+ private static List matching(final Collection names,
+ final Iterator iterator, boolean not)
+ throws MailboxManagerException {
final List results = new ArrayList(names.size());
if (iterator != null) {
- while(iterator.hasNext()) {
- final MessageResult.Header header = (MessageResult.Header) iterator.next();
+ while (iterator.hasNext()) {
+ final MessageResult.Header header = (MessageResult.Header) iterator
+ .next();
final boolean match = contains(names, header);
final boolean add = (not && !match) || (!not && match);
if (add) {
@@ -109,7 +123,8 @@
return results;
}
- private static boolean contains(final Collection names, MessageResult.Header header) throws MailboxManagerException {
+ private static boolean contains(final Collection names,
+ MessageResult.Header header) throws MailboxManagerException {
boolean match = false;
final String headerName = header.getName();
if (headerName != null) {
@@ -123,36 +138,44 @@
}
return match;
}
-
+
/**
- * Gets header lines whose header names matches (ignoring case)
- * any of those given.
- * @param names header names to be matched, not null
- * @param iterator {@link MessageResult.Header} <code>Iterator</code>
- * @return <code>List</code> of <code>MessageResult.Header</code>'s,
- * in their natural order
+ * Gets header lines whose header names matches (ignoring case) any of those
+ * given.
+ *
+ * @param names
+ * header names to be matched, not null
+ * @param iterator
+ * {@link MessageResult.Header} <code>Iterator</code>
+ * @return <code>List</code> of <code>MessageResult.Header</code>'s, in
+ * their natural order
* @throws MessagingException
*/
- public static List getNotMatching(final Collection names, final Iterator iterator) throws MessagingException {
+ public static List getNotMatching(final Collection names,
+ final Iterator iterator) throws MessagingException {
final List result = matching(names, iterator, true);
return result;
}
-
+
/**
- * Gets a header matching the given name.
- * The matching is case-insensitive.
- * @param name name to be matched, not null
- * @param iterator <code>Iterator</code> of <code>MessageResult.Header</code>'s,
- * not null
- * @return <code>MessageResult.Header</code>,
- * or null if the header does not exist
- * @throws MessagingException
+ * Gets a header matching the given name. The matching is case-insensitive.
+ *
+ * @param name
+ * name to be matched, not null
+ * @param iterator
+ * <code>Iterator</code> of <code>MessageResult.Header</code>'s,
+ * not null
+ * @return <code>MessageResult.Header</code>, or null if the header does
+ * not exist
+ * @throws MessagingException
*/
- public static MessageResult.Header getMatching(final String name, final Iterator iterator) throws MessagingException {
+ public static MessageResult.Header getMatching(final String name,
+ final Iterator iterator) throws MessagingException {
MessageResult.Header result = null;
if (name != null) {
- while(iterator.hasNext()) {
- MessageResult.Header header = (MessageResult.Header) iterator.next();
+ while (iterator.hasNext()) {
+ MessageResult.Header header = (MessageResult.Header) iterator
+ .next();
final String headerName = header.getName();
if (name.equalsIgnoreCase(headerName)) {
result = header;
@@ -164,24 +187,28 @@
}
/**
- * Gets header lines whose header name fails to match (ignoring case)
- * all of the given names.
- * @param names header names, not null
- * @param iterator {@link MessageResult.Header} <code>Iterator</code>
- * @return <code>List</code> of <code>@MessageResult.Header</code>'s,
- * in their natural order
+ * Gets header lines whose header name fails to match (ignoring case) all of
+ * the given names.
+ *
+ * @param names
+ * header names, not null
+ * @param iterator
+ * {@link MessageResult.Header} <code>Iterator</code>
+ * @return <code>List</code> of <code>@MessageResult.Header</code>'s, in their natural order
* @throws MessagingException
*/
- public static List getNotMatching(final String[] names, final Iterator iterator) throws MessagingException {
+ public static List getNotMatching(final String[] names,
+ final Iterator iterator) throws MessagingException {
final List results = new ArrayList(20);
if (iterator != null) {
- while(iterator.hasNext()) {
- MessageResult.Header header = (MessageResult.Header) iterator.next();
+ while (iterator.hasNext()) {
+ MessageResult.Header header = (MessageResult.Header) iterator
+ .next();
final String headerName = header.getName();
if (headerName != null) {
final int length = names.length;
boolean match = false;
- for (int i=0;i<length;i++) {
+ for (int i = 0; i < length; i++) {
final String name = names[i];
if (headerName.equalsIgnoreCase(name)) {
match = true;
@@ -196,16 +223,20 @@
}
return results;
}
-
+
/**
* Is the given datum included in these results?
- * @param message <code>MessageResult</code>, possibly null
- * @param datum {@link MessageResult} datum constant
- * @return true if <code>MessageResult</code> includes
- * the given datum, false if <code>MessageResult</code> is null
- * or does not contain this datum
+ *
+ * @param message
+ * <code>MessageResult</code>, possibly null
+ * @param datum
+ * {@link MessageResult} datum constant
+ * @return true if <code>MessageResult</code> includes the given datum,
+ * false if <code>MessageResult</code> is null or does not contain
+ * this datum
*/
- public static boolean isIncluded(final MessageResult message, final int datum) {
+ public static boolean isIncluded(final MessageResult message,
+ final int datum) {
final boolean result;
if (message == null) {
result = false;
@@ -217,73 +248,82 @@
}
return result;
}
-
+
/**
* Is {@link FetchGroup#BODY_CONTENT} included in these results?
- * @param message <code>MessageResult</code>, possibly null
- * @return true if <code>MessageResult</code> includes
- * BODY_CONTENT, false if <code>MessageResult</code> is null
- * or does not contain BODY_CONTENT
+ *
+ * @param message
+ * <code>MessageResult</code>, possibly null
+ * @return true if <code>MessageResult</code> includes BODY_CONTENT, false
+ * if <code>MessageResult</code> is null or does not contain
+ * BODY_CONTENT
* @see #isIncluded(MessageResult, int)
*/
public static boolean isBodyContentIncluded(final MessageResult message) {
return isIncluded(message, FetchGroup.BODY_CONTENT);
}
-
+
/**
* Is {@link FetchGroup#FLAGS} included in these results?
- * @param message <code>MessageResult</code>, possibly null
- * @return true if <code>MessageResult</code> includes
- * FLAGS, false if <code>MessageResult</code> is null
- * or does not contain FLAGS
+ *
+ * @param message
+ * <code>MessageResult</code>, possibly null
+ * @return true if <code>MessageResult</code> includes FLAGS, false if
+ * <code>MessageResult</code> is null or does not contain FLAGS
* @see #isIncluded(MessageResult, int)
*/
public static boolean isFlagsIncluded(final MessageResult message) {
return isIncluded(message, FetchGroup.FLAGS);
}
-
+
/**
* Is {@link FetchGroup#FULL_CONTENT} included in these results?
- * @param message <code>MessageResult</code>, possibly null
- * @return true if <code>MessageResult</code> includes
- * FULL_CONTENT, false if <code>MessageResult</code> is null
- * or does not contain FULL_CONTENT
+ *
+ * @param message
+ * <code>MessageResult</code>, possibly null
+ * @return true if <code>MessageResult</code> includes FULL_CONTENT, false
+ * if <code>MessageResult</code> is null or does not contain
+ * FULL_CONTENT
* @see #isIncluded(MessageResult, int)
*/
public static boolean isFullContentIncluded(final MessageResult message) {
return isIncluded(message, FetchGroup.FULL_CONTENT);
}
-
+
/**
* Is {@link FetchGroup#HEADERS} included in these results?
- * @param message <code>MessageResult</code>, possibly null
- * @return true if <code>MessageResult</code> includes
- * HEADERS, false if <code>MessageResult</code> is null
- * or does not contain HEADERS
+ *
+ * @param message
+ * <code>MessageResult</code>, possibly null
+ * @return true if <code>MessageResult</code> includes HEADERS, false if
+ * <code>MessageResult</code> is null or does not contain HEADERS
* @see #isIncluded(MessageResult, int)
*/
public static boolean isHeadersIncluded(final MessageResult message) {
return isIncluded(message, FetchGroup.HEADERS);
}
-
+
/**
* Is {@link FetchGroup#INTERNAL_DATE} included in these results?
- * @param message <code>MessageResult</code>, possibly null
- * @return true if <code>MessageResult</code> includes
- * INTERNAL_DATE, false if <code>MessageResult</code> is null
- * or does not contain INTERNAL_DATE
+ *
+ * @param message
+ * <code>MessageResult</code>, possibly null
+ * @return true if <code>MessageResult</code> includes INTERNAL_DATE,
+ * false if <code>MessageResult</code> is null or does not contain
+ * INTERNAL_DATE
* @see #isIncluded(MessageResult, int)
*/
public static boolean isInternalDateIncluded(final MessageResult message) {
return isIncluded(message, FetchGroup.INTERNAL_DATE);
}
-
+
/**
* Is {@link FetchGroup#SIZE} included in these results?
- * @param message <code>MessageResult</code>, possibly null
- * @return true if <code>MessageResult</code> includes
- * SIZE, false if <code>MessageResult</code> is null
- * or does not contain SIZE
+ *
+ * @param message
+ * <code>MessageResult</code>, possibly null
+ * @return true if <code>MessageResult</code> includes SIZE, false if
+ * <code>MessageResult</code> is null or does not contain SIZE
* @see #isIncluded(MessageResult, int)
*/
public static boolean isSizeIncluded(final MessageResult message) {
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org