james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r737580 - in /james/protocols/imap/trunk: mailbox/src/main/java/org/apache/james/imap/mailbox/ mailbox/src/main/java/org/apache/james/imap/mailbox/util/ processor/src/main/java/org/apache/james/imap/processor/imap4rev1/fetch/ store/src/main...
Date Sun, 25 Jan 2009 21:06:50 GMT
Author: rdonkin
Date: Sun Jan 25 21:06:50 2009
New Revision: 737580

URL: http://svn.apache.org/viewvc?rev=737580&view=rev
Log:
Generify

Modified:
    james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxMetaData.java
    james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/MessageResultImpl.java
    james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/MessageResultUtils.java
    james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/imap4rev1/fetch/FetchResponseBuilder.java
    james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/PartContentBuilder.java
    james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/ResultUtils.java

Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxMetaData.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxMetaData.java?rev=737580&r1=737579&r2=737580&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxMetaData.java
(original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxMetaData.java
Sun Jan 25 21:06:50 2009
@@ -19,7 +19,6 @@
 
 package org.apache.james.imap.mailbox;
 
-import org.apache.james.imap.mailbox.util.SimpleMailboxMetaData;
 
 /**
  * Returned by the list method of MailboxRepository and others

Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/MessageResultImpl.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/MessageResultImpl.java?rev=737580&r1=737579&r2=737580&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/MessageResultImpl.java
(original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/MessageResultImpl.java
Sun Jan 25 21:06:50 2009
@@ -49,7 +49,7 @@
 
     private Date internalDate;
 
-    private List headers;
+    private List<Header> headers;
 
     private Content body;
 
@@ -57,7 +57,7 @@
 
     private int includedResults = FetchGroup.MINIMAL;
 
-    private Map partsByPath = new HashMap();
+    private Map<MimePath, PartContent> partsByPath = new HashMap<MimePath, PartContent>();
 
     private MimeDescriptor mimeDescriptor;
 
@@ -139,11 +139,11 @@
         return headers.iterator();
     }
 
-    public List getHeaders() {
+    public List<Header> getHeaders() {
         return headers;
     }
 
-    public void setHeaders(List headers) {
+    public void setHeaders(List<Header> headers) {
         this.headers = headers;
         if (headers != null) {
             includedResults |= FetchGroup.HEADERS;
@@ -223,7 +223,7 @@
 
     public Iterator<Header> iterateHeaders(MimePath path)
             throws MailboxException {
-        final Iterator result;
+        final Iterator<Header> result;
         final PartContent partContent = getPartContent(path);
         if (partContent == null) {
             result = null;
@@ -235,7 +235,7 @@
 
     public Iterator<Header> iterateMimeHeaders(MimePath path)
             throws MailboxException {
-        final Iterator result;
+        final Iterator<Header> result;
         final PartContent partContent = getPartContent(path);
         if (partContent == null) {
             result = null;
@@ -260,12 +260,12 @@
         partContent.setFull(content);
     }
 
-    public void setHeaders(MimePath path, Iterator headers) {
+    public void setHeaders(MimePath path, Iterator<Header> headers) {
         final PartContent partContent = getPartContent(path);
         partContent.setHeaders(headers);
     }
 
-    public void setMimeHeaders(MimePath path, Iterator headers) {
+    public void setMimeHeaders(MimePath path, Iterator<Header> headers) {
         final PartContent partContent = getPartContent(path);
         partContent.setMimeHeaders(headers);
     }
@@ -286,9 +286,9 @@
 
         private Content full;
 
-        private Iterator headers;
+        private Iterator<Header> headers;
 
-        private Iterator mimeHeaders;
+        private Iterator<Header> mimeHeaders;
 
         private int content;
 
@@ -323,20 +323,20 @@
             this.full = full;
         }
 
-        public final Iterator getHeaders() {
+        public final Iterator<Header> getHeaders() {
             return headers;
         }
 
-        public final void setHeaders(Iterator headers) {
+        public final void setHeaders(Iterator<Header> headers) {
             content = content | FetchGroup.HEADERS;
             this.headers = headers;
         }
 
-        public final Iterator getMimeHeaders() {
+        public final Iterator<Header> getMimeHeaders() {
             return mimeHeaders;
         }
 
-        public final void setMimeHeaders(Iterator mimeHeaders) {
+        public final void setMimeHeaders(Iterator<Header> mimeHeaders) {
             content = content | FetchGroup.MIME_HEADERS;
             this.mimeHeaders = mimeHeaders;
         }

Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/MessageResultUtils.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/MessageResultUtils.java?rev=737580&r1=737579&r2=737580&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/MessageResultUtils.java
(original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/MessageResultUtils.java
Sun Jan 25 21:06:50 2009
@@ -41,8 +41,8 @@
      * 
      * @throws MessagingException
      */
-    public static List getAll(final Iterator iterator) {
-        final List results = new ArrayList();
+    public static List<MessageResult.Header> getAll(final Iterator<MessageResult.Header>
iterator) {
+        final List<MessageResult.Header> results = new ArrayList<MessageResult.Header>();
         if (iterator != null) {
             while (iterator.hasNext()) {
                 results.add(iterator.next());
@@ -65,7 +65,7 @@
      */
     public static List getMatching(final String[] names, final Iterator iterator)
             throws MessagingException {
-        final List results = new ArrayList(20);
+        final List<MessageResult.Header> results = new ArrayList<MessageResult.Header>(20);
         if (iterator != null) {
             while (iterator.hasNext()) {
                 MessageResult.Header header = (MessageResult.Header) iterator
@@ -98,20 +98,19 @@
      *         their natural order
      * @throws MessagingException
      */
-    public static List getMatching(final Collection names,
-            final Iterator iterator) throws MessagingException {
-        final List result = matching(names, iterator, false);
+    public static List<MessageResult.Header> getMatching(final Collection names,
+            final Iterator<MessageResult.Header> iterator) throws MessagingException
{
+        final List<MessageResult.Header> result = matching(names, iterator, false);
         return result;
     }
 
-    private static List matching(final Collection names,
-            final Iterator iterator, boolean not)
+    private static List<MessageResult.Header> matching(final Collection names,
+            final Iterator<MessageResult.Header> iterator, boolean not)
             throws MailboxException {
-        final List results = new ArrayList(names.size());
+        final List<MessageResult.Header> results = new ArrayList<MessageResult.Header>(names.size());
         if (iterator != null) {
             while (iterator.hasNext()) {
-                final MessageResult.Header header = (MessageResult.Header) iterator
-                        .next();
+                final MessageResult.Header header = iterator.next();
                 final boolean match = contains(names, header);
                 final boolean add = (not && !match) || (!not && match);
                 if (add) {
@@ -150,9 +149,9 @@
      *         their natural order
      * @throws MessagingException
      */
-    public static List getNotMatching(final Collection names,
-            final Iterator iterator) throws MessagingException {
-        final List result = matching(names, iterator, true);
+    public static List<MessageResult.Header> getNotMatching(final Collection names,
+            final Iterator<MessageResult.Header> iterator) throws MessagingException
{
+        final List<MessageResult.Header> result = matching(names, iterator, true);
         return result;
     }
 
@@ -197,7 +196,7 @@
      */
     public static List getNotMatching(final String[] names,
             final Iterator iterator) throws MessagingException {
-        final List results = new ArrayList(20);
+        final List<MessageResult.Header> results = new ArrayList<MessageResult.Header>(20);
         if (iterator != null) {
             while (iterator.hasNext()) {
                 MessageResult.Header header = (MessageResult.Header) iterator

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/imap4rev1/fetch/FetchResponseBuilder.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/imap4rev1/fetch/FetchResponseBuilder.java?rev=737580&r1=737579&r2=737580&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/imap4rev1/fetch/FetchResponseBuilder.java
(original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/imap4rev1/fetch/FetchResponseBuilder.java
Sun Jan 25 21:06:50 2009
@@ -36,7 +36,6 @@
 import org.apache.james.api.imap.process.ImapSession;
 import org.apache.james.api.imap.process.SelectedMailbox;
 import org.apache.james.imap.mailbox.Content;
-import org.apache.james.imap.mailbox.Headers;
 import org.apache.james.imap.mailbox.Mailbox;
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxSession;
@@ -292,8 +291,8 @@
             final MessageResult messageResult, String name, final int[] path,
             final boolean isBase) throws MessagingException {
         final FetchResponse.BodyElement result;
-        final Iterator headers = getMimeHeaders(messageResult, path, isBase);
-        List lines = MessageResultUtils.getAll(headers);
+        final Iterator<MessageResult.Header> headers = getMimeHeaders(messageResult,
path, isBase);
+        List<MessageResult.Header> lines = MessageResultUtils.getAll(headers);
         result = new HeaderBodyElement(name, lines);
         return result;
     }
@@ -303,8 +302,8 @@
             final boolean isBase) throws MailboxException,
             MessagingException {
         final FetchResponse.BodyElement result;
-        final Iterator headers = getHeaders(messageResult, path, isBase);
-        List lines = MessageResultUtils.getAll(headers);
+        final Iterator<MessageResult.Header> headers = getHeaders(messageResult, path,
isBase);
+        List<MessageResult.Header> lines = MessageResultUtils.getAll(headers);
         result = new HeaderBodyElement(name, lines);
         return result;
     }
@@ -315,9 +314,9 @@
             throws MailboxException, MessagingException {
         final FetchResponse.BodyElement result;
 
-        final Iterator headers = getHeaders(messageResult, path, isBase);
+        final Iterator<MessageResult.Header> headers = getHeaders(messageResult, path,
isBase);
 
-        List lines = MessageResultUtils.getNotMatching(names, headers);
+        List<MessageResult.Header> lines = MessageResultUtils.getNotMatching(names,
headers);
         result = new HeaderBodyElement(name, lines);
         return result;
     }
@@ -327,8 +326,8 @@
             final boolean isBase) throws MailboxException,
             MessagingException {
         final FetchResponse.BodyElement result;
-        final Iterator headers = getHeaders(messageResult, path, isBase);
-        List lines = MessageResultUtils.getMatching(names, headers);
+        final Iterator<MessageResult.Header> headers = getHeaders(messageResult, path,
isBase);
+        List<MessageResult.Header> lines = MessageResultUtils.getMatching(names, headers);
         result = new HeaderBodyElement(name, lines);
         return result;
     }

Modified: james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/PartContentBuilder.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/PartContentBuilder.java?rev=737580&r1=737579&r2=737580&view=diff
==============================================================================
--- james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/PartContentBuilder.java
(original)
+++ james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/PartContentBuilder.java
Sun Jan 25 21:06:50 2009
@@ -26,6 +26,7 @@
 import java.util.List;
 
 import org.apache.james.imap.mailbox.Content;
+import org.apache.james.imap.mailbox.MessageResult;
 import org.apache.james.mime4j.MimeException;
 import org.apache.james.mime4j.parser.MimeTokenStream;
 
@@ -191,12 +192,12 @@
     }
 
     @SuppressWarnings("unchecked")
-    public List getMimeHeaders() throws IOException {
-        final List<ResultHeader> results;
+    public List<MessageResult.Header> getMimeHeaders() throws IOException {
+        final List<MessageResult.Header> results;
         if (empty) {
             results = Collections.EMPTY_LIST;
         } else {
-            results = new ArrayList<ResultHeader>();
+            results = new ArrayList<MessageResult.Header>();
             for (int state = parser.getState(); state != MimeTokenStream.T_END_HEADER; state
= parser
                     .next()) {
                 switch (state) {
@@ -216,12 +217,12 @@
     }
 
     @SuppressWarnings("unchecked")
-    public List getMessageHeaders() throws IOException {
-        final List<ResultHeader> results;
+    public List<MessageResult.Header> getMessageHeaders() throws IOException {
+        final List<MessageResult.Header> results;
         if (empty) {
             results = Collections.EMPTY_LIST;
         } else {
-            results = new ArrayList<ResultHeader>();
+            results = new ArrayList<MessageResult.Header>();
             try {
                 advancedToMessage();
 

Modified: james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/ResultUtils.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/ResultUtils.java?rev=737580&r1=737579&r2=737580&view=diff
==============================================================================
--- james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/ResultUtils.java
(original)
+++ james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/ResultUtils.java
Sun Jan 25 21:06:50 2009
@@ -68,10 +68,10 @@
         return results;
     }
 
-    public static List<ResultHeader> createHeaders(MailboxMembership message) {
+    public static List<MessageResult.Header> createHeaders(MailboxMembership message)
{
         final List<Header> headers = getSortedHeaders(message);
 
-        final List<ResultHeader> results = new ArrayList<ResultHeader>(headers.size());
+        final List<MessageResult.Header> results = new ArrayList<MessageResult.Header>(headers.size());
         for (Header header: headers) {
             final ResultHeader resultHeader = new ResultHeader(header);
             results.add(resultHeader);
@@ -161,7 +161,7 @@
 
     private static void addHeaders(final MailboxMembership message,
             MessageResultImpl messageResult) {
-        final List<ResultHeader> headers = createHeaders(message);
+        final List<MessageResult.Header> headers = createHeaders(message);
         messageResult.setHeaders(headers);
     }
 
@@ -280,7 +280,7 @@
             addHeaders(message, messageResult);
         } else {
             final PartContentBuilder builder = build(path, message);
-            final List headers = builder.getMessageHeaders();
+            final List<MessageResult.Header> headers = builder.getMessageHeaders();
             messageResult.setHeaders(mimePath, headers.iterator());
         }
     }
@@ -293,7 +293,7 @@
             addHeaders(message, messageResult);
         } else {
             final PartContentBuilder builder = build(path, message);
-            final List headers = builder.getMimeHeaders();
+            final List<MessageResult.Header> headers = builder.getMimeHeaders();
             messageResult.setMimeHeaders(mimePath, headers.iterator());
         }
     }



---------------------------------------------------------------------
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