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 no...@apache.org on 2006/10/07 13:41:39 UTC
svn commit: r453888 - in /james/server/trunk/src: conf/james-config.xml
java/org/apache/james/mailrepository/MBoxMailRepository.java
Author: norman
Date: Sat Oct 7 04:41:38 2006
New Revision: 453888
URL: http://svn.apache.org/viewvc?view=rev&rev=453888
Log:
Add FIFO function to MboxMailRepository. See JAMES-624
Modified:
james/server/trunk/src/conf/james-config.xml
james/server/trunk/src/java/org/apache/james/mailrepository/MBoxMailRepository.java
Modified: james/server/trunk/src/conf/james-config.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/src/conf/james-config.xml?view=diff&rev=453888&r1=453887&r2=453888
==============================================================================
--- james/server/trunk/src/conf/james-config.xml (original)
+++ james/server/trunk/src/conf/james-config.xml Sat Oct 7 04:41:38 2006
@@ -1110,6 +1110,8 @@
<types>
<type>MAIL</type>
</types>
+ <!-- Set if the messages should be listed sorted. False by default -->
+ <config FIFO="false"/>
</repository>
<repository class="org.apache.james.mailrepository.filepair.File_Persistent_Object_Repository">
Modified: james/server/trunk/src/java/org/apache/james/mailrepository/MBoxMailRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/mailrepository/MBoxMailRepository.java?view=diff&rev=453888&r1=453887&r2=453888
==============================================================================
--- james/server/trunk/src/java/org/apache/james/mailrepository/MBoxMailRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/mailrepository/MBoxMailRepository.java Sat Oct 7 04:41:38 2006
@@ -76,6 +76,7 @@
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
+import java.util.Collections;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Locale;
@@ -144,6 +145,8 @@
*/
private String mboxFile;
+ private boolean fifo;
+
/**
* A callback used when a message is read from the mbox file
*/
@@ -540,24 +543,26 @@
*/
public Iterator list() {
loadKeys();
+ ArrayList keys = new ArrayList(mList.keySet());
- if (mList.keySet().isEmpty() == false) {
+ if (keys.isEmpty() == false) {
// find the first message. This is a trick to make sure that if
// the file is changed out from under us, we will detect it and
// correct for it BEFORE we return the iterator.
- findMessage((String) mList.keySet().iterator().next());
+ findMessage((String) keys.iterator().next());
}
if ((DEEP_DEBUG) && (getLogger().isDebugEnabled())) {
StringBuffer logBuffer =
new StringBuffer(128)
.append(this.getClass().getName())
.append(" ")
- .append(mList.size())
+ .append(keys.size())
.append(" keys to be iterated over.");
getLogger().debug(logBuffer.toString());
}
- return mList.keySet().iterator();
+ if (fifo) Collections.sort(keys); // Keys is a HashSet; impose FIFO for apps that need it
+ return keys.iterator();
}
/**
@@ -779,6 +784,7 @@
String destination;
this.mList = null;
BUFFERING = conf.getAttributeAsBoolean("BUFFERING", true);
+ fifo = conf.getAttributeAsBoolean("FIFO", false);
destination = conf.getAttribute("destinationURL");
if (destination.charAt(destination.length() - 1) == '/') {
// Remove the trailing / as well as the protocol marker
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org