james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject svn commit: r1413331 - /james/server/trunk/protocols-pop3/src/main/java/org/apache/james/pop3server/mailbox/MailboxAdapter.java
Date Sun, 25 Nov 2012 10:57:37 GMT
Author: eric
Date: Sun Nov 25 10:57:36 2012
New Revision: 1413331

URL: http://svn.apache.org/viewvc?rev=1413331&view=rev
Log:
Impact protocols-pop3 MailboxAdapter further to Decouple POP3 UID forming logic from protocol
implementation (PROTOCOLS-98)

Modified:
    james/server/trunk/protocols-pop3/src/main/java/org/apache/james/pop3server/mailbox/MailboxAdapter.java

Modified: james/server/trunk/protocols-pop3/src/main/java/org/apache/james/pop3server/mailbox/MailboxAdapter.java
URL: http://svn.apache.org/viewvc/james/server/trunk/protocols-pop3/src/main/java/org/apache/james/pop3server/mailbox/MailboxAdapter.java?rev=1413331&r1=1413330&r2=1413331&view=diff
==============================================================================
--- james/server/trunk/protocols-pop3/src/main/java/org/apache/james/pop3server/mailbox/MailboxAdapter.java
(original)
+++ james/server/trunk/protocols-pop3/src/main/java/org/apache/james/pop3server/mailbox/MailboxAdapter.java
Sun Nov 25 10:57:36 2012
@@ -46,7 +46,7 @@ public class MailboxAdapter implements M
             return null;
         }
     }
-    
+
     private final static FetchGroup FULL_GROUP = new POP3FetchGroup() {
 
         @Override
@@ -80,7 +80,7 @@ public class MailboxAdapter implements M
             return MINIMAL;
         }
     };
-    
+
     private final MessageManager manager;
     private final MailboxSession session;
 
@@ -93,10 +93,10 @@ public class MailboxAdapter implements M
     }
 
     @Override
-    public InputStream getMessageBody(long uid) throws IOException {
+    public InputStream getMessageBody(String uid) throws IOException {
         try {
             mailboxManager.startProcessingRequest(session);
-            Iterator<MessageResult> results = manager.getMessages(MessageRange.one(uid),
BODY_GROUP, session);
+            Iterator<MessageResult> results = manager.getMessages(MessageRange.one(new
Long(uid)), BODY_GROUP, session);
             if (results.hasNext()) {
                 return results.next().getBody().getInputStream();
             } else {
@@ -110,10 +110,11 @@ public class MailboxAdapter implements M
     }
 
     @Override
-    public InputStream getMessageHeaders(long uid) throws IOException {
+    public InputStream getMessageHeaders(String uid) throws IOException {
         try {
             mailboxManager.startProcessingRequest(session);
-            Iterator<MessageResult> results = manager.getMessages(MessageRange.one(uid),
HEADERS_GROUP, session);
+            Iterator<MessageResult> results = manager.getMessages(MessageRange.one(new
Long(uid)), HEADERS_GROUP,
+                    session);
             if (results.hasNext()) {
                 return results.next().getHeaders().getInputStream();
             } else {
@@ -127,10 +128,10 @@ public class MailboxAdapter implements M
     }
 
     @Override
-    public InputStream getMessage(long uid) throws IOException {
+    public InputStream getMessage(String uid) throws IOException {
         try {
             mailboxManager.startProcessingRequest(session);
-            Iterator<MessageResult> results = manager.getMessages(MessageRange.one(uid),
FULL_GROUP, session);
+            Iterator<MessageResult> results = manager.getMessages(MessageRange.one(new
Long(uid)), FULL_GROUP, session);
             if (results.hasNext()) {
                 return results.next().getFullContent().getInputStream();
             } else {
@@ -151,8 +152,7 @@ public class MailboxAdapter implements M
             List<MessageMetaData> mList = new ArrayList<MessageMetaData>();
             while (results.hasNext()) {
                 MessageResult result = results.next();
-                
-                MessageMetaData metaData = new MessageMetaData(result.getUid(), result.getSize());
+                MessageMetaData metaData = new MessageMetaData(Long.toString(result.getUid()),
result.getSize());
                 mList.add(metaData);
             }
             return Collections.unmodifiableList(mList);
@@ -164,11 +164,11 @@ public class MailboxAdapter implements M
     }
 
     @Override
-    public void remove(long... uids) throws IOException {
+    public void remove(String... uids) throws IOException {
         List<Long> uidList = new ArrayList<Long>();
 
         for (int i = 0; i < uids.length; i++) {
-            uidList.add(uids[i]);
+            uidList.add(new Long(uids[i]));
         }
 
         List<MessageRange> ranges = MessageRange.toRanges(uidList);
@@ -189,7 +189,8 @@ public class MailboxAdapter implements M
     public String getIdentifier() throws IOException {
         try {
             mailboxManager.startProcessingRequest(session);
-            long validity = manager.getMetaData(false, session, MessageManager.MetaData.FetchGroup.NO_COUNT).getUidValidity();
+            long validity = manager.getMetaData(false, session, MessageManager.MetaData.FetchGroup.NO_COUNT)
+                    .getUidValidity();
             return Long.toString(validity);
         } catch (MailboxException e) {
             throw new IOException("Unable to retrieve indentifier for mailbox", e);



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message