james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mwiederk...@apache.org
Subject svn commit: r746243 - in /james/mime4j/trunk: examples/src/java/org/apache/james/mime4j/samples/tree/ src/main/java/org/apache/james/mime4j/field/ src/main/java/org/apache/james/mime4j/message/ src/main/java/org/apache/james/mime4j/util/ src/test/java/...
Date Fri, 20 Feb 2009 14:05:29 GMT
Author: mwiederkehr
Date: Fri Feb 20 14:05:28 2009
New Revision: 746243

URL: http://svn.apache.org/viewvc?rev=746243&view=rev
Log:
MIME4J-118: use Field instead of AbstractField where appropriate

Modified:
    james/mime4j/trunk/examples/src/java/org/apache/james/mime4j/samples/tree/MessageTree.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/AddressListField.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/ContentDispositionField.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/ContentTransferEncodingField.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/DateTimeField.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/Fields.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/MailboxField.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/MailboxListField.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Entity.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Message.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/util/StringArrayMap.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/field/FieldsTest.java

Modified: james/mime4j/trunk/examples/src/java/org/apache/james/mime4j/samples/tree/MessageTree.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/examples/src/java/org/apache/james/mime4j/samples/tree/MessageTree.java?rev=746243&r1=746242&r2=746243&view=diff
==============================================================================
--- james/mime4j/trunk/examples/src/java/org/apache/james/mime4j/samples/tree/MessageTree.java
(original)
+++ james/mime4j/trunk/examples/src/java/org/apache/james/mime4j/samples/tree/MessageTree.java
Fri Feb 20 14:05:28 2009
@@ -43,7 +43,6 @@
 import org.apache.james.mime4j.field.AddressListField;
 import org.apache.james.mime4j.field.ContentTypeField;
 import org.apache.james.mime4j.field.DateTimeField;
-import org.apache.james.mime4j.field.AbstractField;
 import org.apache.james.mime4j.field.UnstructuredField;
 import org.apache.james.mime4j.field.address.Mailbox;
 import org.apache.james.mime4j.field.address.MailboxList;
@@ -322,8 +321,8 @@
                 textView.setText(date.toString());                
             } else if (o instanceof UnstructuredField){
                 textView.setText(((UnstructuredField) o).getValue());                
-            } else if (o instanceof AbstractField){
-                textView.setText(((AbstractField) o).getBody());                
+            } else if (o instanceof Field){
+                textView.setText(((Field) o).getBody());                
             } else {
                 /*
                  * The Object should be a Header or a String containing a 

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/AddressListField.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/AddressListField.java?rev=746243&r1=746242&r2=746243&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/AddressListField.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/AddressListField.java Fri
Feb 20 14:05:28 2009
@@ -23,6 +23,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.james.mime4j.field.address.AddressList;
 import org.apache.james.mime4j.field.address.parser.ParseException;
+import org.apache.james.mime4j.parser.Field;
 
 /**
  * Address list field such as <code>To</code> or <code>Reply-To</code>.
@@ -70,7 +71,7 @@
     }
 
     static class Parser implements FieldParser {
-        public AbstractField parse(final String name, final String body,
+        public Field parse(final String name, final String body,
                 final String raw) {
             return new AddressListField(name, body, raw);
         }

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/ContentDispositionField.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/ContentDispositionField.java?rev=746243&r1=746242&r2=746243&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/ContentDispositionField.java
(original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/ContentDispositionField.java
Fri Feb 20 14:05:28 2009
@@ -32,7 +32,7 @@
 import org.apache.james.mime4j.field.contentdisposition.parser.ContentDispositionParser;
 import org.apache.james.mime4j.field.contentdisposition.parser.TokenMgrError;
 import org.apache.james.mime4j.field.datetime.parser.DateTimeParser;
-import org.apache.james.mime4j.field.ParseException;
+import org.apache.james.mime4j.parser.Field;
 
 /**
  * Represents a <code>Content-Disposition</code> field.
@@ -318,7 +318,7 @@
     }
 
     static class Parser implements FieldParser {
-        public AbstractField parse(final String name, final String body,
+        public Field parse(final String name, final String body,
                 final String raw) {
             return new ContentDispositionField(name, body, raw);
         }

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/ContentTransferEncodingField.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/ContentTransferEncodingField.java?rev=746243&r1=746242&r2=746243&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/ContentTransferEncodingField.java
(original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/ContentTransferEncodingField.java
Fri Feb 20 14:05:28 2009
@@ -19,6 +19,7 @@
 
 package org.apache.james.mime4j.field;
 
+import org.apache.james.mime4j.parser.Field;
 import org.apache.james.mime4j.util.MimeUtil;
 
 /**
@@ -56,7 +57,7 @@
     }
 
     static class Parser implements FieldParser {
-        public AbstractField parse(final String name, final String body,
+        public Field parse(final String name, final String body,
                 final String raw) {
             return new ContentTransferEncodingField(name, body, raw);
         }

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java?rev=746243&r1=746242&r2=746243&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java Fri
Feb 20 14:05:28 2009
@@ -30,6 +30,7 @@
 import org.apache.james.mime4j.field.contenttype.parser.ContentTypeParser;
 import org.apache.james.mime4j.field.contenttype.parser.ParseException;
 import org.apache.james.mime4j.field.contenttype.parser.TokenMgrError;
+import org.apache.james.mime4j.parser.Field;
 
 /**
  * Represents a <code>Content-Type</code> field.
@@ -249,7 +250,7 @@
     }
 
     static class Parser implements FieldParser {
-        public AbstractField parse(final String name, final String body,
+        public Field parse(final String name, final String body,
                 final String raw) {
             return new ContentTypeField(name, body, raw);
         }

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/DateTimeField.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/DateTimeField.java?rev=746243&r1=746242&r2=746243&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/DateTimeField.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/DateTimeField.java Fri
Feb 20 14:05:28 2009
@@ -24,6 +24,7 @@
 import org.apache.james.mime4j.field.datetime.parser.DateTimeParser;
 import org.apache.james.mime4j.field.datetime.parser.ParseException;
 import org.apache.james.mime4j.field.datetime.parser.TokenMgrError;
+import org.apache.james.mime4j.parser.Field;
 
 import java.io.StringReader;
 import java.util.Date;
@@ -80,7 +81,7 @@
     }
 
     static class Parser implements FieldParser {
-        public AbstractField parse(final String name, final String body,
+        public Field parse(final String name, final String body,
                 final String raw) {
             return new DateTimeField(name, body, raw);
         }

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/Fields.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/Fields.java?rev=746243&r1=746242&r2=746243&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/Fields.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/Fields.java Fri Feb 20
14:05:28 2009
@@ -34,7 +34,7 @@
 import org.apache.james.mime4j.util.MimeUtil;
 
 /**
- * Factory for concrete {@link AbstractField} instances.
+ * Factory for concrete {@link Field} instances.
  */
 public class Fields {
 
@@ -289,7 +289,7 @@
      *            <code>null</code> if no host name should be included.
      * @return the newly created <i>Message-ID</i> field.
      */
-    public static AbstractField messageId(String hostname) {
+    public static Field messageId(String hostname) {
         String fieldValue = MimeUtil.createUniqueMessageId(hostname);
         return parse(UnstructuredField.class, AbstractField.MESSAGE_ID, fieldValue);
     }
@@ -566,7 +566,7 @@
         return EncoderUtil.isToken(dispositionType);
     }
 
-    private static <F extends AbstractField> F parse(Class<F> fieldClass,
+    private static <F extends Field> F parse(Class<F> fieldClass,
             String fieldName, String fieldBody) {
         try {
             String raw = MimeUtil.fold(fieldName + ": " + fieldBody, 0);

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/MailboxField.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/MailboxField.java?rev=746243&r1=746242&r2=746243&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/MailboxField.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/MailboxField.java Fri Feb
20 14:05:28 2009
@@ -25,6 +25,7 @@
 import org.apache.james.mime4j.field.address.Mailbox;
 import org.apache.james.mime4j.field.address.MailboxList;
 import org.apache.james.mime4j.field.address.parser.ParseException;
+import org.apache.james.mime4j.parser.Field;
 
 /**
  * Mailbox field such as <code>Sender</code> or <code>Resent-Sender</code>.
@@ -75,7 +76,7 @@
     }
 
     static class Parser implements FieldParser {
-        public AbstractField parse(final String name, final String body,
+        public Field parse(final String name, final String body,
                 final String raw) {
             return new MailboxField(name, body, raw);
         }

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/MailboxListField.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/MailboxListField.java?rev=746243&r1=746242&r2=746243&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/MailboxListField.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/MailboxListField.java Fri
Feb 20 14:05:28 2009
@@ -24,6 +24,7 @@
 import org.apache.james.mime4j.field.address.AddressList;
 import org.apache.james.mime4j.field.address.MailboxList;
 import org.apache.james.mime4j.field.address.parser.ParseException;
+import org.apache.james.mime4j.parser.Field;
 
 /**
  * Mailbox-list field such as <code>From</code> or <code>Resent-From</code>.
@@ -71,7 +72,7 @@
     }
 
     static class Parser implements FieldParser {
-        public AbstractField parse(final String name, final String body,
+        public Field parse(final String name, final String body,
                 final String raw) {
             return new MailboxListField(name, body, raw);
         }

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java?rev=746243&r1=746242&r2=746243&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java
(original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java
Fri Feb 20 14:05:28 2009
@@ -20,6 +20,7 @@
 package org.apache.james.mime4j.field;
 
 import org.apache.james.mime4j.codec.DecoderUtil;
+import org.apache.james.mime4j.parser.Field;
 
 /**
  * Simple unstructured field such as <code>Subject</code>.
@@ -49,7 +50,7 @@
     }
 
     static class Parser implements FieldParser {
-        public AbstractField parse(final String name, final String body,
+        public Field parse(final String name, final String body,
                 final String raw) {
             return new UnstructuredField(name, body, raw);
         }

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Entity.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Entity.java?rev=746243&r1=746242&r2=746243&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Entity.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Entity.java Fri Feb 20
14:05:28 2009
@@ -24,11 +24,12 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.james.mime4j.field.AbstractField;
 import org.apache.james.mime4j.field.ContentDispositionField;
 import org.apache.james.mime4j.field.ContentTransferEncodingField;
 import org.apache.james.mime4j.field.ContentTypeField;
-import org.apache.james.mime4j.field.AbstractField;
 import org.apache.james.mime4j.field.Fields;
+import org.apache.james.mime4j.parser.Field;
 import org.apache.james.mime4j.util.MimeUtil;
 
 /**
@@ -521,7 +522,7 @@
      * @return the header field or <code>null</code> if this entity has no
      *         header or the header contains no such field.
      */
-    <F extends AbstractField> F obtainField(String fieldName) {
+    <F extends Field> F obtainField(String fieldName) {
         Header header = getHeader();
         if (header == null)
             return null;

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Message.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Message.java?rev=746243&r1=746242&r2=746243&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Message.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Message.java Fri Feb
20 14:05:28 2009
@@ -30,9 +30,9 @@
 
 import org.apache.james.mime4j.MimeException;
 import org.apache.james.mime4j.MimeIOException;
+import org.apache.james.mime4j.field.AbstractField;
 import org.apache.james.mime4j.field.AddressListField;
 import org.apache.james.mime4j.field.DateTimeField;
-import org.apache.james.mime4j.field.AbstractField;
 import org.apache.james.mime4j.field.Fields;
 import org.apache.james.mime4j.field.MailboxField;
 import org.apache.james.mime4j.field.MailboxListField;
@@ -41,6 +41,7 @@
 import org.apache.james.mime4j.field.address.AddressList;
 import org.apache.james.mime4j.field.address.Mailbox;
 import org.apache.james.mime4j.field.address.MailboxList;
+import org.apache.james.mime4j.parser.Field;
 import org.apache.james.mime4j.parser.MimeEntityConfig;
 import org.apache.james.mime4j.parser.MimeStreamParser;
 import org.apache.james.mime4j.storage.DefaultStorageProvider;
@@ -110,9 +111,8 @@
      * @throws MimeIOException
      *             on MIME protocol violations.
      */
-    public Message(
-            InputStream is, 
-            MimeEntityConfig config) throws IOException, MimeIOException {
+    public Message(InputStream is, MimeEntityConfig config) throws IOException,
+            MimeIOException {
         this(is, config, DefaultStorageProvider.getInstance());
     }
 
@@ -132,9 +132,7 @@
      * @throws MimeIOException
      *             on MIME protocol violations.
      */
-    public Message(
-            InputStream is, 
-            MimeEntityConfig config,
+    public Message(InputStream is, MimeEntityConfig config,
             StorageProvider storageProvider) throws IOException,
             MimeIOException {
         try {
@@ -169,7 +167,7 @@
      * @return the identifier of this message.
      */
     public String getMessageId() {
-        AbstractField field = obtainField(AbstractField.MESSAGE_ID);
+        Field field = obtainField(AbstractField.MESSAGE_ID);
         if (field == null)
             return null;
 

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java?rev=746243&r1=746242&r2=746243&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java Fri
Feb 20 14:05:28 2009
@@ -96,8 +96,8 @@
      */
     public void field(Field field) throws MimeException {
         expect(Header.class);
-        Field parsedfield = AbstractField.parse(field.getRaw()); 
-        ((Header) stack.peek()).addField(parsedfield);
+        Field parsedField = AbstractField.parse(field.getRaw()); 
+        ((Header) stack.peek()).addField(parsedField);
     }
     
     /**

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/util/StringArrayMap.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/util/StringArrayMap.java?rev=746243&r1=746242&r2=746243&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/util/StringArrayMap.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/util/StringArrayMap.java Fri
Feb 20 14:05:28 2009
@@ -29,9 +29,9 @@
 import java.util.Map;
 import java.util.NoSuchElementException;
 
-import org.apache.james.mime4j.field.AbstractField;
 import org.apache.james.mime4j.message.Header;
 import org.apache.james.mime4j.parser.ContentHandler;
+import org.apache.james.mime4j.parser.Field;
 
 /**
  * An object, which may be used to implement header, or parameter
@@ -40,7 +40,7 @@
  * <p>
  * Note that this class is not directly used anywhere in Mime4j.
  * Instead a user might choose to use it instead of {@link Header}
- * and {@link AbstractField} in a custom {@link ContentHandler} implementation.
+ * and {@link Field} in a custom {@link ContentHandler} implementation.
  * See also MIME4j-24.
  */
 public class StringArrayMap implements Serializable {

Modified: james/mime4j/trunk/src/test/java/org/apache/james/mime4j/field/FieldsTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/test/java/org/apache/james/mime4j/field/FieldsTest.java?rev=746243&r1=746242&r2=746243&view=diff
==============================================================================
--- james/mime4j/trunk/src/test/java/org/apache/james/mime4j/field/FieldsTest.java (original)
+++ james/mime4j/trunk/src/test/java/org/apache/james/mime4j/field/FieldsTest.java Fri Feb
20 14:05:28 2009
@@ -29,6 +29,7 @@
 
 import org.apache.james.mime4j.field.address.Group;
 import org.apache.james.mime4j.field.address.Mailbox;
+import org.apache.james.mime4j.parser.Field;
 import org.apache.james.mime4j.util.MimeUtil;
 
 public class FieldsTest extends TestCase {
@@ -200,7 +201,7 @@
     }
 
     public void testMessageId() throws Exception {
-        AbstractField messageId = Fields.messageId("acme.org");
+        Field messageId = Fields.messageId("acme.org");
 
         String raw = messageId.getRaw();
         assertTrue(raw.startsWith("Message-ID: <Mime4j."));



Mime
View raw message