james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r894910 [1/2] - in /james/mime4j/branches/cycleclean/core/src: main/java/org/apache/james/mime4j/field/ main/java/org/apache/james/mime4j/field/impl/ main/java/org/apache/james/mime4j/message/ main/java/org/apache/james/mime4j/message/impl/...
Date Thu, 31 Dec 2009 17:52:57 GMT
Author: bago
Date: Thu Dec 31 17:52:56 2009
New Revision: 894910

URL: http://svn.apache.org/viewvc?rev=894910&view=rev
Log:
Moved field implementations and DefaultFieldParser/DelegatingFieldParser/Fields to the field.impl package. Extrapolated their interfaces and created interface placeholders in the original package. (MIME4J-156)
(Entity api should not reference Impl fields: will need further refactoring later)

Added:
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/AbstractField.java   (contents, props changed)
      - copied, changed from r894746, james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/AbstractField.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/AddressListFieldImpl.java   (contents, props changed)
      - copied, changed from r894746, james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/AddressListField.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/ContentDispositionFieldImpl.java   (contents, props changed)
      - copied, changed from r894746, james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentDispositionField.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/ContentTransferEncodingFieldImpl.java   (contents, props changed)
      - copied, changed from r894746, james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentTransferEncodingField.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/ContentTypeFieldImpl.java   (contents, props changed)
      - copied, changed from r894746, james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/DateTimeFieldImpl.java   (contents, props changed)
      - copied, changed from r894746, james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/DateTimeField.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/DefaultFieldParser.java   (contents, props changed)
      - copied, changed from r894746, james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/DefaultFieldParser.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/DelegatingFieldParser.java   (contents, props changed)
      - copied, changed from r894746, james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/Fields.java   (contents, props changed)
      - copied, changed from r894881, james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/Fields.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/MailboxFieldImpl.java   (contents, props changed)
      - copied, changed from r894746, james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/MailboxField.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/MailboxListFieldImpl.java   (contents, props changed)
      - copied, changed from r894746, james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/MailboxListField.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/UnstructuredFieldImpl.java   (contents, props changed)
      - copied, changed from r894746, james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java
Removed:
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/AbstractField.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/DefaultFieldParser.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/Fields.java
Modified:
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/AddressListField.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentDispositionField.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentTransferEncodingField.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/DateTimeField.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/MailboxField.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/MailboxListField.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/Entity.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/impl/BodyPart.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/impl/HeaderImpl.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/impl/MessageBuilder.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/impl/MessageImpl.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/impl/SimpleContentHandler.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/ContentDispositionFieldTest.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/ContentTransferEncodingFieldTest.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/ContentTypeFieldTest.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/FieldTest.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/FieldsTest.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/UnstructuredFieldTest.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/CopyConstructorTest.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/EntityTest.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/HeaderTest.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageTest.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MultipartFormTest.java

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/AddressListField.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/AddressListField.java?rev=894910&r1=894909&r2=894910&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/AddressListField.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/AddressListField.java Thu Dec 31 17:52:56 2009
@@ -19,61 +19,13 @@
 
 package org.apache.james.mime4j.field;
 
-import org.apache.commons.logging.Log;
-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.util.ByteSequence;
 
-/**
- * Address list field such as <code>To</code> or <code>Reply-To</code>.
- */
-public class AddressListField extends AbstractField {
-    private static Log log = LogFactory.getLog(AddressListField.class);
-
-    private boolean parsed = false;
-
-    private AddressList addressList;
-    private ParseException parseException;
-
-    AddressListField(String name, String body, ByteSequence raw) {
-        super(name, body, raw);
-    }
-
-    public AddressList getAddressList() {
-        if (!parsed)
-            parse();
-
-        return addressList;
-    }
-
-    @Override
-    public ParseException getParseException() {
-        if (!parsed)
-            parse();
-
-        return parseException;
-    }
-
-    private void parse() {
-        String body = getBody();
-
-        try {
-            addressList = AddressList.parse(body);
-        } catch (ParseException e) {
-            if (log.isDebugEnabled()) {
-                log.debug("Parsing value '" + body + "': " + e.getMessage());
-            }
-            parseException = e;
-        }
-
-        parsed = true;
-    }
-
-    static final FieldParser<AddressListField> PARSER = new FieldParser<AddressListField>() {
-        public AddressListField parse(final String name, final String body,
-                final ByteSequence raw) {
-            return new AddressListField(name, body, raw);
-        }
-    };
-}
+public interface AddressListField extends ParsedField {
+
+    public abstract AddressList getAddressList();
+
+    public abstract ParseException getParseException();
+
+}
\ No newline at end of file

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentDispositionField.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentDispositionField.java?rev=894910&r1=894909&r2=894910&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentDispositionField.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentDispositionField.java Thu Dec 31 17:52:56 2009
@@ -1,108 +1,37 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
 package org.apache.james.mime4j.field;
 
-import java.io.StringReader;
-import java.util.Collections;
 import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
 import java.util.Map;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-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.util.ByteSequence;
-
-/**
- * Represents a <code>Content-Disposition</code> field.
- */
-public class ContentDispositionField extends AbstractField {
-    private static Log log = LogFactory.getLog(ContentDispositionField.class);
+public interface ContentDispositionField extends ParsedField {
 
     /** The <code>inline</code> disposition type. */
     public static final String DISPOSITION_TYPE_INLINE = "inline";
-
     /** The <code>attachment</code> disposition type. */
     public static final String DISPOSITION_TYPE_ATTACHMENT = "attachment";
-
     /** The name of the <code>filename</code> parameter. */
     public static final String PARAM_FILENAME = "filename";
-
     /** The name of the <code>creation-date</code> parameter. */
     public static final String PARAM_CREATION_DATE = "creation-date";
-
     /** The name of the <code>modification-date</code> parameter. */
     public static final String PARAM_MODIFICATION_DATE = "modification-date";
-
     /** The name of the <code>read-date</code> parameter. */
     public static final String PARAM_READ_DATE = "read-date";
-
     /** The name of the <code>size</code> parameter. */
     public static final String PARAM_SIZE = "size";
 
-    private boolean parsed = false;
-
-    private String dispositionType = "";
-    private Map<String, String> parameters = new HashMap<String, String>();
-    private ParseException parseException;
-
-    private boolean creationDateParsed;
-    private Date creationDate;
-
-    private boolean modificationDateParsed;
-    private Date modificationDate;
-
-    private boolean readDateParsed;
-    private Date readDate;
-
-    ContentDispositionField(String name, String body, ByteSequence raw) {
-        super(name, body, raw);
-    }
-
     /**
      * Gets the exception that was raised during parsing of the field value, if
      * any; otherwise, null.
      */
-    @Override
-    public ParseException getParseException() {
-        if (!parsed)
-            parse();
-
-        return parseException;
-    }
+    public abstract ParseException getParseException();
 
     /**
      * Gets the disposition type defined in this Content-Disposition field.
      * 
      * @return the disposition type or an empty string if not set.
      */
-    public String getDispositionType() {
-        if (!parsed)
-            parse();
-
-        return dispositionType;
-    }
+    public abstract String getDispositionType();
 
     /**
      * Gets the value of a parameter. Parameter names are case-insensitive.
@@ -111,24 +40,14 @@
      *            the name of the parameter to get.
      * @return the parameter value or <code>null</code> if not set.
      */
-    public String getParameter(String name) {
-        if (!parsed)
-            parse();
-
-        return parameters.get(name.toLowerCase());
-    }
+    public abstract String getParameter(String name);
 
     /**
      * Gets all parameters.
      * 
      * @return the parameters.
      */
-    public Map<String, String> getParameters() {
-        if (!parsed)
-            parse();
-
-        return Collections.unmodifiableMap(parameters);
-    }
+    public abstract Map<String, String> getParameters();
 
     /**
      * Determines if the disposition type of this field matches the given one.
@@ -138,12 +57,7 @@
      * @return <code>true</code> if the disposition type of this field
      *         matches, <code>false</code> otherwise.
      */
-    public boolean isDispositionType(String dispositionType) {
-        if (!parsed)
-            parse();
-
-        return this.dispositionType.equalsIgnoreCase(dispositionType);
-    }
+    public abstract boolean isDispositionType(String dispositionType);
 
     /**
      * Return <code>true</code> if the disposition type of this field is
@@ -152,12 +66,7 @@
      * @return <code>true</code> if the disposition type of this field is
      *         <i>inline</i>, <code>false</code> otherwise.
      */
-    public boolean isInline() {
-        if (!parsed)
-            parse();
-
-        return dispositionType.equals(DISPOSITION_TYPE_INLINE);
-    }
+    public abstract boolean isInline();
 
     /**
      * Return <code>true</code> if the disposition type of this field is
@@ -166,12 +75,7 @@
      * @return <code>true</code> if the disposition type of this field is
      *         <i>attachment</i>, <code>false</code> otherwise.
      */
-    public boolean isAttachment() {
-        if (!parsed)
-            parse();
-
-        return dispositionType.equals(DISPOSITION_TYPE_ATTACHMENT);
-    }
+    public abstract boolean isAttachment();
 
     /**
      * Gets the value of the <code>filename</code> parameter if set.
@@ -179,9 +83,7 @@
      * @return the <code>filename</code> parameter value or <code>null</code>
      *         if not set.
      */
-    public String getFilename() {
-        return getParameter(PARAM_FILENAME);
-    }
+    public abstract String getFilename();
 
     /**
      * Gets the value of the <code>creation-date</code> parameter if set and
@@ -190,14 +92,7 @@
      * @return the <code>creation-date</code> parameter value or
      *         <code>null</code> if not set or invalid.
      */
-    public Date getCreationDate() {
-        if (!creationDateParsed) {
-            creationDate = parseDate(PARAM_CREATION_DATE);
-            creationDateParsed = true;
-        }
-
-        return creationDate;
-    }
+    public abstract Date getCreationDate();
 
     /**
      * Gets the value of the <code>modification-date</code> parameter if set
@@ -206,14 +101,7 @@
      * @return the <code>modification-date</code> parameter value or
      *         <code>null</code> if not set or invalid.
      */
-    public Date getModificationDate() {
-        if (!modificationDateParsed) {
-            modificationDate = parseDate(PARAM_MODIFICATION_DATE);
-            modificationDateParsed = true;
-        }
-
-        return modificationDate;
-    }
+    public abstract Date getModificationDate();
 
     /**
      * Gets the value of the <code>read-date</code> parameter if set and
@@ -222,14 +110,7 @@
      * @return the <code>read-date</code> parameter value or <code>null</code>
      *         if not set or invalid.
      */
-    public Date getReadDate() {
-        if (!readDateParsed) {
-            readDate = parseDate(PARAM_READ_DATE);
-            readDateParsed = true;
-        }
-
-        return readDate;
-    }
+    public abstract Date getReadDate();
 
     /**
      * Gets the value of the <code>size</code> parameter if set and valid.
@@ -237,90 +118,6 @@
      * @return the <code>size</code> parameter value or <code>-1</code> if
      *         not set or invalid.
      */
-    public long getSize() {
-        String value = getParameter(PARAM_SIZE);
-        if (value == null)
-            return -1;
-
-        try {
-            long size = Long.parseLong(value);
-            return size < 0 ? -1 : size;
-        } catch (NumberFormatException e) {
-            return -1;
-        }
-    }
-
-    private Date parseDate(String paramName) {
-        String value = getParameter(paramName);
-        if (value == null) {
-            if (log.isDebugEnabled()) {
-                log.debug("Parsing " + paramName + " null");
-            }
-            return null;
-        }
-
-        try {
-            return new DateTimeParser(new StringReader(value)).parseAll()
-                    .getDate();
-        } catch (ParseException e) {
-            if (log.isDebugEnabled()) {
-                log.debug("Parsing " + paramName + " '" + value + "': "
-                        + e.getMessage());
-            }
-            return null;
-        } catch (org.apache.james.mime4j.field.datetime.parser.TokenMgrError e) {
-            if (log.isDebugEnabled()) {
-                log.debug("Parsing " + paramName + " '" + value + "': "
-                        + e.getMessage());
-            }
-            return null;
-        }
-    }
-
-    private void parse() {
-        String body = getBody();
-
-        ContentDispositionParser parser = new ContentDispositionParser(
-                new StringReader(body));
-        try {
-            parser.parseAll();
-        } catch (ParseException e) {
-            if (log.isDebugEnabled()) {
-                log.debug("Parsing value '" + body + "': " + e.getMessage());
-            }
-            parseException = e;
-        } catch (TokenMgrError e) {
-            if (log.isDebugEnabled()) {
-                log.debug("Parsing value '" + body + "': " + e.getMessage());
-            }
-            parseException = new ParseException(e.getMessage());
-        }
-
-        final String dispositionType = parser.getDispositionType();
-
-        if (dispositionType != null) {
-            this.dispositionType = dispositionType.toLowerCase(Locale.US);
-
-            List<String> paramNames = parser.getParamNames();
-            List<String> paramValues = parser.getParamValues();
-
-            if (paramNames != null && paramValues != null) {
-                final int len = Math.min(paramNames.size(), paramValues.size());
-                for (int i = 0; i < len; i++) {
-                    String paramName = paramNames.get(i).toLowerCase(Locale.US);
-                    String paramValue = paramValues.get(i);
-                    parameters.put(paramName, paramValue);
-                }
-            }
-        }
-
-        parsed = true;
-    }
-
-    static final FieldParser<ContentDispositionField> PARSER = new FieldParser<ContentDispositionField>() {
-        public ContentDispositionField parse(final String name, final String body,
-                final ByteSequence raw) {
-            return new ContentDispositionField(name, body, raw);
-        }
-    };
-}
+    public abstract long getSize();
+
+}
\ No newline at end of file

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentTransferEncodingField.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentTransferEncodingField.java?rev=894910&r1=894909&r2=894910&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentTransferEncodingField.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentTransferEncodingField.java Thu Dec 31 17:52:56 2009
@@ -19,47 +19,13 @@
 
 package org.apache.james.mime4j.field;
 
-import org.apache.james.mime4j.util.ByteSequence;
-import org.apache.james.mime4j.util.MimeUtil;
-
-/**
- * Represents a <code>Content-Transfer-Encoding</code> field.
- */
-public class ContentTransferEncodingField extends AbstractField {
-    private String encoding;
-
-    ContentTransferEncodingField(String name, String body, ByteSequence raw) {
-        super(name, body, raw);
-        encoding = body.trim().toLowerCase();
-    }
+public interface ContentTransferEncodingField extends ParsedField {
 
     /**
      * Gets the encoding defined in this field.
      * 
      * @return the encoding or an empty string if not set.
      */
-    public String getEncoding() {
-        return encoding;
-    }
-
-    /**
-     * Gets the encoding of the given field if. Returns the default
-     * <code>7bit</code> if not set or if <code>f</code> is
-     * <code>null</code>.
-     * 
-     * @return the encoding.
-     */
-    public static String getEncoding(ContentTransferEncodingField f) {
-        if (f != null && f.getEncoding().length() != 0) {
-            return f.getEncoding();
-        }
-        return MimeUtil.ENC_7BIT;
-    }
+    public abstract String getEncoding();
 
-    static final FieldParser<ContentTransferEncodingField> PARSER = new FieldParser<ContentTransferEncodingField>() {
-        public ContentTransferEncodingField parse(final String name, final String body,
-                final ByteSequence raw) {
-            return new ContentTransferEncodingField(name, body, raw);
-        }
-    };
-}
+}
\ No newline at end of file

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java?rev=894910&r1=894909&r2=894910&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java Thu Dec 31 17:52:56 2009
@@ -19,76 +19,37 @@
 
 package org.apache.james.mime4j.field;
 
-import java.io.StringReader;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-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.util.ByteSequence;
 
-/**
- * Represents a <code>Content-Type</code> field.
- */
-public class ContentTypeField extends AbstractField {
-    private static Log log = LogFactory.getLog(ContentTypeField.class);
+public interface ContentTypeField extends ParsedField {
 
     /** The prefix of all <code>multipart</code> MIME types. */
     public static final String TYPE_MULTIPART_PREFIX = "multipart/";
-
     /** The <code>multipart/digest</code> MIME type. */
     public static final String TYPE_MULTIPART_DIGEST = "multipart/digest";
-
     /** The <code>text/plain</code> MIME type. */
     public static final String TYPE_TEXT_PLAIN = "text/plain";
-
     /** The <code>message/rfc822</code> MIME type. */
     public static final String TYPE_MESSAGE_RFC822 = "message/rfc822";
-
     /** The name of the <code>boundary</code> parameter. */
     public static final String PARAM_BOUNDARY = "boundary";
-
     /** The name of the <code>charset</code> parameter. */
     public static final String PARAM_CHARSET = "charset";
 
-    private boolean parsed = false;
-
-    private String mimeType = "";
-    private Map<String, String> parameters = new HashMap<String, String>();
-    private ParseException parseException;
-
-    ContentTypeField(String name, String body, ByteSequence raw) {
-        super(name, body, raw);
-    }
-
     /**
      * Gets the exception that was raised during parsing of the field value, if
      * any; otherwise, null.
      */
-    @Override
-    public ParseException getParseException() {
-        if (!parsed)
-            parse();
-
-        return parseException;
-    }
+    public abstract ParseException getParseException();
 
     /**
      * Gets the MIME type defined in this Content-Type field.
      * 
      * @return the MIME type or an empty string if not set.
      */
-    public String getMimeType() {
-        if (!parsed)
-            parse();
-
-        return mimeType;
-    }
+    public abstract String getMimeType();
 
     /**
      * Gets the value of a parameter. Parameter names are case-insensitive.
@@ -97,24 +58,14 @@
      *            the name of the parameter to get.
      * @return the parameter value or <code>null</code> if not set.
      */
-    public String getParameter(String name) {
-        if (!parsed)
-            parse();
-
-        return parameters.get(name.toLowerCase());
-    }
+    public abstract String getParameter(String name);
 
     /**
      * Gets all parameters.
      * 
      * @return the parameters.
      */
-    public Map<String, String> getParameters() {
-        if (!parsed)
-            parse();
-
-        return Collections.unmodifiableMap(parameters);
-    }
+    public abstract Map<String, String> getParameters();
 
     /**
      * Determines if the MIME type of this field matches the given one.
@@ -124,12 +75,7 @@
      * @return <code>true</code> if the MIME type of this field matches,
      *         <code>false</code> otherwise.
      */
-    public boolean isMimeType(String mimeType) {
-        if (!parsed)
-            parse();
-
-        return this.mimeType.equalsIgnoreCase(mimeType);
-    }
+    public abstract boolean isMimeType(String mimeType);
 
     /**
      * Determines if the MIME type of this field is <code>multipart/*</code>.
@@ -138,12 +84,7 @@
      *         <code>multipart/*</code> MIME type, <code>false</code>
      *         otherwise.
      */
-    public boolean isMultipart() {
-        if (!parsed)
-            parse();
-
-        return mimeType.startsWith(TYPE_MULTIPART_PREFIX);
-    }
+    public abstract boolean isMultipart();
 
     /**
      * Gets the value of the <code>boundary</code> parameter if set.
@@ -151,9 +92,7 @@
      * @return the <code>boundary</code> parameter value or <code>null</code>
      *         if not set.
      */
-    public String getBoundary() {
-        return getParameter(PARAM_BOUNDARY);
-    }
+    public abstract String getBoundary();
 
     /**
      * Gets the value of the <code>charset</code> parameter if set.
@@ -161,98 +100,6 @@
      * @return the <code>charset</code> parameter value or <code>null</code>
      *         if not set.
      */
-    public String getCharset() {
-        return getParameter(PARAM_CHARSET);
-    }
-
-    /**
-     * Gets the MIME type defined in the child's Content-Type field or derives a
-     * MIME type from the parent if child is <code>null</code> or hasn't got a
-     * MIME type value set. If child's MIME type is multipart but no boundary
-     * has been set the MIME type of child will be derived from the parent.
-     * 
-     * @param child
-     *            the child.
-     * @param parent
-     *            the parent.
-     * @return the MIME type.
-     */
-    public static String getMimeType(ContentTypeField child,
-            ContentTypeField parent) {
-        if (child == null || child.getMimeType().length() == 0
-                || child.isMultipart() && child.getBoundary() == null) {
-
-            if (parent != null && parent.isMimeType(TYPE_MULTIPART_DIGEST)) {
-                return TYPE_MESSAGE_RFC822;
-            } else {
-                return TYPE_TEXT_PLAIN;
-            }
-        }
-
-        return child.getMimeType();
-    }
-
-    /**
-     * Gets the value of the <code>charset</code> parameter if set for the
-     * given field. Returns the default <code>us-ascii</code> if not set or if
-     * <code>f</code> is <code>null</code>.
-     * 
-     * @return the <code>charset</code> parameter value.
-     */
-    public static String getCharset(ContentTypeField f) {
-        if (f != null) {
-            String charset = f.getCharset();
-            if (charset != null && charset.length() > 0) {
-                return charset;
-            }
-        }
-        return "us-ascii";
-    }
-
-    private void parse() {
-        String body = getBody();
-
-        ContentTypeParser parser = new ContentTypeParser(new StringReader(body));
-        try {
-            parser.parseAll();
-        } catch (ParseException e) {
-            if (log.isDebugEnabled()) {
-                log.debug("Parsing value '" + body + "': " + e.getMessage());
-            }
-            parseException = e;
-        } catch (TokenMgrError e) {
-            if (log.isDebugEnabled()) {
-                log.debug("Parsing value '" + body + "': " + e.getMessage());
-            }
-            parseException = new ParseException(e.getMessage());
-        }
-
-        final String type = parser.getType();
-        final String subType = parser.getSubType();
-
-        if (type != null && subType != null) {
-            mimeType = (type + "/" + subType).toLowerCase();
-
-            List<String> paramNames = parser.getParamNames();
-            List<String> paramValues = parser.getParamValues();
-
-            if (paramNames != null && paramValues != null) {
-                final int len = Math.min(paramNames.size(), paramValues.size());
-                for (int i = 0; i < len; i++) {
-                    String paramName = paramNames.get(i).toLowerCase();
-                    String paramValue = paramValues.get(i);
-                    parameters.put(paramName, paramValue);
-                }
-            }
-        }
-
-        parsed = true;
-    }
-
-    static final FieldParser<ContentTypeField> PARSER = new FieldParser<ContentTypeField>() {
-        public ContentTypeField parse(final String name, final String body,
-                final ByteSequence raw) {
-            return new ContentTypeField(name, body, raw);
-        }
-    };
-}
+    public abstract String getCharset();
+
+}
\ No newline at end of file

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/DateTimeField.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/DateTimeField.java?rev=894910&r1=894909&r2=894910&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/DateTimeField.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/DateTimeField.java Thu Dec 31 17:52:56 2009
@@ -1,89 +1,13 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
 package org.apache.james.mime4j.field;
 
-import java.io.StringReader;
 import java.util.Date;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-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.util.ByteSequence;
 
-/**
- * Date-time field such as <code>Date</code> or <code>Resent-Date</code>.
- */
-public class DateTimeField extends AbstractField {
-    private static Log log = LogFactory.getLog(DateTimeField.class);
-
-    private boolean parsed = false;
-
-    private Date date;
-    private ParseException parseException;
-
-    DateTimeField(String name, String body, ByteSequence raw) {
-        super(name, body, raw);
-    }
-
-    public Date getDate() {
-        if (!parsed)
-            parse();
-
-        return date;
-    }
-
-    @Override
-    public ParseException getParseException() {
-        if (!parsed)
-            parse();
-
-        return parseException;
-    }
-
-    private void parse() {
-        String body = getBody();
-
-        try {
-            date = new DateTimeParser(new StringReader(body)).parseAll()
-                    .getDate();
-        } catch (ParseException e) {
-            if (log.isDebugEnabled()) {
-                log.debug("Parsing value '" + body + "': " + e.getMessage());
-            }
-            parseException = e;
-        } catch (TokenMgrError e) {
-            if (log.isDebugEnabled()) {
-                log.debug("Parsing value '" + body + "': " + e.getMessage());
-            }
-            parseException = new ParseException(e.getMessage());
-        }
-
-        parsed = true;
-    }
-
-    static final FieldParser<DateTimeField> PARSER = new FieldParser<DateTimeField>() {
-        public DateTimeField parse(final String name, final String body,
-                final ByteSequence raw) {
-            return new DateTimeField(name, body, raw);
-        }
-    };
-}
+public interface DateTimeField extends ParsedField {
+
+    public abstract Date getDate();
+
+    public abstract ParseException getParseException();
+
+}
\ No newline at end of file

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/MailboxField.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/MailboxField.java?rev=894910&r1=894909&r2=894910&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/MailboxField.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/MailboxField.java Thu Dec 31 17:52:56 2009
@@ -19,66 +19,13 @@
 
 package org.apache.james.mime4j.field;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-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.field.address.parser.ParseException;
-import org.apache.james.mime4j.util.ByteSequence;
 
-/**
- * Mailbox field such as <code>Sender</code> or <code>Resent-Sender</code>.
- */
-public class MailboxField extends AbstractField {
-    private static Log log = LogFactory.getLog(MailboxField.class);
-
-    private boolean parsed = false;
-
-    private Mailbox mailbox;
-    private ParseException parseException;
-
-    MailboxField(final String name, final String body, final ByteSequence raw) {
-        super(name, body, raw);
-    }
-
-    public Mailbox getMailbox() {
-        if (!parsed)
-            parse();
-
-        return mailbox;
-    }
-
-    @Override
-    public ParseException getParseException() {
-        if (!parsed)
-            parse();
-
-        return parseException;
-    }
-
-    private void parse() {
-        String body = getBody();
-
-        try {
-            MailboxList mailboxList = AddressList.parse(body).flatten();
-            if (mailboxList.size() > 0) {
-                mailbox = mailboxList.get(0);
-            }
-        } catch (ParseException e) {
-            if (log.isDebugEnabled()) {
-                log.debug("Parsing value '" + body + "': " + e.getMessage());
-            }
-            parseException = e;
-        }
-
-        parsed = true;
-    }
-
-    static final FieldParser<MailboxField> PARSER = new FieldParser<MailboxField>() {
-        public MailboxField parse(final String name, final String body,
-                final ByteSequence raw) {
-            return new MailboxField(name, body, raw);
-        }
-    };
-}
+public interface MailboxField extends ParsedField {
+
+    public abstract Mailbox getMailbox();
+
+    public abstract ParseException getParseException();
+
+}
\ No newline at end of file

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/MailboxListField.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/MailboxListField.java?rev=894910&r1=894909&r2=894910&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/MailboxListField.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/MailboxListField.java Thu Dec 31 17:52:56 2009
@@ -19,62 +19,13 @@
 
 package org.apache.james.mime4j.field;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-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.util.ByteSequence;
 
-/**
- * Mailbox-list field such as <code>From</code> or <code>Resent-From</code>.
- */
-public class MailboxListField extends AbstractField {
-    private static Log log = LogFactory.getLog(MailboxListField.class);
-
-    private boolean parsed = false;
-
-    private MailboxList mailboxList;
-    private ParseException parseException;
-
-    MailboxListField(final String name, final String body, final ByteSequence raw) {
-        super(name, body, raw);
-    }
-
-    public MailboxList getMailboxList() {
-        if (!parsed)
-            parse();
-
-        return mailboxList;
-    }
-
-    @Override
-    public ParseException getParseException() {
-        if (!parsed)
-            parse();
-
-        return parseException;
-    }
-
-    private void parse() {
-        String body = getBody();
-
-        try {
-            mailboxList = AddressList.parse(body).flatten();
-        } catch (ParseException e) {
-            if (log.isDebugEnabled()) {
-                log.debug("Parsing value '" + body + "': " + e.getMessage());
-            }
-            parseException = e;
-        }
-
-        parsed = true;
-    }
-
-    static final FieldParser<MailboxListField> PARSER = new FieldParser<MailboxListField>() {
-        public MailboxListField parse(final String name, final String body,
-                final ByteSequence raw) {
-            return new MailboxListField(name, body, raw);
-        }
-    };
-}
+public interface MailboxListField extends ParsedField {
+
+    public abstract MailboxList getMailboxList();
+
+    public abstract ParseException getParseException();
+
+}
\ No newline at end of file

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java?rev=894910&r1=894909&r2=894910&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java Thu Dec 31 17:52:56 2009
@@ -19,40 +19,8 @@
 
 package org.apache.james.mime4j.field;
 
-import org.apache.james.mime4j.codec.DecoderUtil;
-import org.apache.james.mime4j.util.ByteSequence;
+public interface UnstructuredField extends ParsedField {
 
-/**
- * Simple unstructured field such as <code>Subject</code>.
- */
-public class UnstructuredField extends AbstractField {
-    private boolean parsed = false;
+    public abstract String getValue();
 
-    private String value;
-
-    UnstructuredField(String name, String body, ByteSequence raw) {
-        super(name, body, raw);
-    }
-
-    public String getValue() {
-        if (!parsed)
-            parse();
-
-        return value;
-    }
-
-    private void parse() {
-        String body = getBody();
-
-        value = DecoderUtil.decodeEncodedWords(body);
-
-        parsed = true;
-    }
-
-    static final FieldParser<UnstructuredField> PARSER = new FieldParser<UnstructuredField>() {
-        public UnstructuredField parse(final String name, final String body,
-                final ByteSequence raw) {
-            return new UnstructuredField(name, body, raw);
-        }
-    };
-}
+}
\ No newline at end of file

Copied: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/AbstractField.java (from r894746, james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/AbstractField.java)
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/AbstractField.java?p2=james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/AbstractField.java&p1=james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/AbstractField.java&r1=894746&r2=894910&rev=894910&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/AbstractField.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/AbstractField.java Thu Dec 31 17:52:56 2009
@@ -17,8 +17,10 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mime4j.field;
+package org.apache.james.mime4j.field.impl;
 
+import org.apache.james.mime4j.field.ParseException;
+import org.apache.james.mime4j.field.ParsedField;
 import org.apache.james.mime4j.util.ByteSequence;
 
 /**

Propchange: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/AbstractField.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/AbstractField.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Copied: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/AddressListFieldImpl.java (from r894746, james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/AddressListField.java)
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/AddressListFieldImpl.java?p2=james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/AddressListFieldImpl.java&p1=james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/AddressListField.java&r1=894746&r2=894910&rev=894910&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/AddressListField.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/AddressListFieldImpl.java Thu Dec 31 17:52:56 2009
@@ -17,10 +17,11 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mime4j.field;
+package org.apache.james.mime4j.field.impl;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.james.mime4j.field.FieldParser;
 import org.apache.james.mime4j.field.address.AddressList;
 import org.apache.james.mime4j.field.address.parser.ParseException;
 import org.apache.james.mime4j.util.ByteSequence;
@@ -28,18 +29,21 @@
 /**
  * Address list field such as <code>To</code> or <code>Reply-To</code>.
  */
-public class AddressListField extends AbstractField {
-    private static Log log = LogFactory.getLog(AddressListField.class);
+public class AddressListFieldImpl extends AbstractField implements org.apache.james.mime4j.field.AddressListField {
+    private static Log log = LogFactory.getLog(AddressListFieldImpl.class);
 
     private boolean parsed = false;
 
     private AddressList addressList;
     private ParseException parseException;
 
-    AddressListField(String name, String body, ByteSequence raw) {
+    AddressListFieldImpl(String name, String body, ByteSequence raw) {
         super(name, body, raw);
     }
 
+    /**
+     * @see org.apache.james.mime4j.field.AddressListField#getAddressList()
+     */
     public AddressList getAddressList() {
         if (!parsed)
             parse();
@@ -47,6 +51,9 @@
         return addressList;
     }
 
+    /**
+     * @see org.apache.james.mime4j.field.AddressListField#getParseException()
+     */
     @Override
     public ParseException getParseException() {
         if (!parsed)
@@ -70,10 +77,10 @@
         parsed = true;
     }
 
-    static final FieldParser<AddressListField> PARSER = new FieldParser<AddressListField>() {
-        public AddressListField parse(final String name, final String body,
+    static final FieldParser<AddressListFieldImpl> PARSER = new FieldParser<AddressListFieldImpl>() {
+        public AddressListFieldImpl parse(final String name, final String body,
                 final ByteSequence raw) {
-            return new AddressListField(name, body, raw);
+            return new AddressListFieldImpl(name, body, raw);
         }
     };
 }

Propchange: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/AddressListFieldImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/ContentDispositionFieldImpl.java (from r894746, james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentDispositionField.java)
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/ContentDispositionFieldImpl.java?p2=james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/ContentDispositionFieldImpl.java&p1=james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentDispositionField.java&r1=894746&r2=894910&rev=894910&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentDispositionField.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/ContentDispositionFieldImpl.java Thu Dec 31 17:52:56 2009
@@ -17,7 +17,7 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mime4j.field;
+package org.apache.james.mime4j.field.impl;
 
 import java.io.StringReader;
 import java.util.Collections;
@@ -29,7 +29,9 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.james.mime4j.field.FieldParser;
 import org.apache.james.mime4j.field.contentdisposition.parser.ContentDispositionParser;
+import org.apache.james.mime4j.field.contentdisposition.parser.ParseException;
 import org.apache.james.mime4j.field.contentdisposition.parser.TokenMgrError;
 import org.apache.james.mime4j.field.datetime.parser.DateTimeParser;
 import org.apache.james.mime4j.util.ByteSequence;
@@ -37,29 +39,8 @@
 /**
  * Represents a <code>Content-Disposition</code> field.
  */
-public class ContentDispositionField extends AbstractField {
-    private static Log log = LogFactory.getLog(ContentDispositionField.class);
-
-    /** The <code>inline</code> disposition type. */
-    public static final String DISPOSITION_TYPE_INLINE = "inline";
-
-    /** The <code>attachment</code> disposition type. */
-    public static final String DISPOSITION_TYPE_ATTACHMENT = "attachment";
-
-    /** The name of the <code>filename</code> parameter. */
-    public static final String PARAM_FILENAME = "filename";
-
-    /** The name of the <code>creation-date</code> parameter. */
-    public static final String PARAM_CREATION_DATE = "creation-date";
-
-    /** The name of the <code>modification-date</code> parameter. */
-    public static final String PARAM_MODIFICATION_DATE = "modification-date";
-
-    /** The name of the <code>read-date</code> parameter. */
-    public static final String PARAM_READ_DATE = "read-date";
-
-    /** The name of the <code>size</code> parameter. */
-    public static final String PARAM_SIZE = "size";
+public class ContentDispositionFieldImpl extends AbstractField implements org.apache.james.mime4j.field.ContentDispositionField {
+    private static Log log = LogFactory.getLog(ContentDispositionFieldImpl.class);
 
     private boolean parsed = false;
 
@@ -76,7 +57,7 @@
     private boolean readDateParsed;
     private Date readDate;
 
-    ContentDispositionField(String name, String body, ByteSequence raw) {
+    ContentDispositionFieldImpl(String name, String body, ByteSequence raw) {
         super(name, body, raw);
     }
 
@@ -93,9 +74,7 @@
     }
 
     /**
-     * Gets the disposition type defined in this Content-Disposition field.
-     * 
-     * @return the disposition type or an empty string if not set.
+     * @see org.apache.james.mime4j.field.ContentDispositionField#getDispositionType()
      */
     public String getDispositionType() {
         if (!parsed)
@@ -105,11 +84,7 @@
     }
 
     /**
-     * Gets the value of a parameter. Parameter names are case-insensitive.
-     * 
-     * @param name
-     *            the name of the parameter to get.
-     * @return the parameter value or <code>null</code> if not set.
+     * @see org.apache.james.mime4j.field.ContentDispositionField#getParameter(java.lang.String)
      */
     public String getParameter(String name) {
         if (!parsed)
@@ -119,9 +94,7 @@
     }
 
     /**
-     * Gets all parameters.
-     * 
-     * @return the parameters.
+     * @see org.apache.james.mime4j.field.ContentDispositionField#getParameters()
      */
     public Map<String, String> getParameters() {
         if (!parsed)
@@ -131,12 +104,7 @@
     }
 
     /**
-     * Determines if the disposition type of this field matches the given one.
-     * 
-     * @param dispositionType
-     *            the disposition type to match against.
-     * @return <code>true</code> if the disposition type of this field
-     *         matches, <code>false</code> otherwise.
+     * @see org.apache.james.mime4j.field.ContentDispositionField#isDispositionType(java.lang.String)
      */
     public boolean isDispositionType(String dispositionType) {
         if (!parsed)
@@ -146,11 +114,7 @@
     }
 
     /**
-     * Return <code>true</code> if the disposition type of this field is
-     * <i>inline</i>, <code>false</code> otherwise.
-     * 
-     * @return <code>true</code> if the disposition type of this field is
-     *         <i>inline</i>, <code>false</code> otherwise.
+     * @see org.apache.james.mime4j.field.ContentDispositionField#isInline()
      */
     public boolean isInline() {
         if (!parsed)
@@ -160,11 +124,7 @@
     }
 
     /**
-     * Return <code>true</code> if the disposition type of this field is
-     * <i>attachment</i>, <code>false</code> otherwise.
-     * 
-     * @return <code>true</code> if the disposition type of this field is
-     *         <i>attachment</i>, <code>false</code> otherwise.
+     * @see org.apache.james.mime4j.field.ContentDispositionField#isAttachment()
      */
     public boolean isAttachment() {
         if (!parsed)
@@ -174,21 +134,14 @@
     }
 
     /**
-     * Gets the value of the <code>filename</code> parameter if set.
-     * 
-     * @return the <code>filename</code> parameter value or <code>null</code>
-     *         if not set.
+     * @see org.apache.james.mime4j.field.ContentDispositionField#getFilename()
      */
     public String getFilename() {
         return getParameter(PARAM_FILENAME);
     }
 
     /**
-     * Gets the value of the <code>creation-date</code> parameter if set and
-     * valid.
-     * 
-     * @return the <code>creation-date</code> parameter value or
-     *         <code>null</code> if not set or invalid.
+     * @see org.apache.james.mime4j.field.ContentDispositionField#getCreationDate()
      */
     public Date getCreationDate() {
         if (!creationDateParsed) {
@@ -200,11 +153,7 @@
     }
 
     /**
-     * Gets the value of the <code>modification-date</code> parameter if set
-     * and valid.
-     * 
-     * @return the <code>modification-date</code> parameter value or
-     *         <code>null</code> if not set or invalid.
+     * @see org.apache.james.mime4j.field.ContentDispositionField#getModificationDate()
      */
     public Date getModificationDate() {
         if (!modificationDateParsed) {
@@ -216,11 +165,7 @@
     }
 
     /**
-     * Gets the value of the <code>read-date</code> parameter if set and
-     * valid.
-     * 
-     * @return the <code>read-date</code> parameter value or <code>null</code>
-     *         if not set or invalid.
+     * @see org.apache.james.mime4j.field.ContentDispositionField#getReadDate()
      */
     public Date getReadDate() {
         if (!readDateParsed) {
@@ -232,10 +177,7 @@
     }
 
     /**
-     * Gets the value of the <code>size</code> parameter if set and valid.
-     * 
-     * @return the <code>size</code> parameter value or <code>-1</code> if
-     *         not set or invalid.
+     * @see org.apache.james.mime4j.field.ContentDispositionField#getSize()
      */
     public long getSize() {
         String value = getParameter(PARAM_SIZE);
@@ -262,7 +204,7 @@
         try {
             return new DateTimeParser(new StringReader(value)).parseAll()
                     .getDate();
-        } catch (ParseException e) {
+        } catch (org.apache.james.mime4j.field.datetime.parser.ParseException e) {
             if (log.isDebugEnabled()) {
                 log.debug("Parsing " + paramName + " '" + value + "': "
                         + e.getMessage());
@@ -317,10 +259,10 @@
         parsed = true;
     }
 
-    static final FieldParser<ContentDispositionField> PARSER = new FieldParser<ContentDispositionField>() {
-        public ContentDispositionField parse(final String name, final String body,
+    static final FieldParser<ContentDispositionFieldImpl> PARSER = new FieldParser<ContentDispositionFieldImpl>() {
+        public ContentDispositionFieldImpl parse(final String name, final String body,
                 final ByteSequence raw) {
-            return new ContentDispositionField(name, body, raw);
+            return new ContentDispositionFieldImpl(name, body, raw);
         }
     };
 }

Propchange: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/ContentDispositionFieldImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/ContentTransferEncodingFieldImpl.java (from r894746, james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentTransferEncodingField.java)
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/ContentTransferEncodingFieldImpl.java?p2=james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/ContentTransferEncodingFieldImpl.java&p1=james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentTransferEncodingField.java&r1=894746&r2=894910&rev=894910&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentTransferEncodingField.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/ContentTransferEncodingFieldImpl.java Thu Dec 31 17:52:56 2009
@@ -17,26 +17,26 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mime4j.field;
+package org.apache.james.mime4j.field.impl;
 
+import org.apache.james.mime4j.field.ContentTransferEncodingField;
+import org.apache.james.mime4j.field.FieldParser;
 import org.apache.james.mime4j.util.ByteSequence;
 import org.apache.james.mime4j.util.MimeUtil;
 
 /**
  * Represents a <code>Content-Transfer-Encoding</code> field.
  */
-public class ContentTransferEncodingField extends AbstractField {
+public class ContentTransferEncodingFieldImpl extends AbstractField implements ContentTransferEncodingField {
     private String encoding;
 
-    ContentTransferEncodingField(String name, String body, ByteSequence raw) {
+    ContentTransferEncodingFieldImpl(String name, String body, ByteSequence raw) {
         super(name, body, raw);
         encoding = body.trim().toLowerCase();
     }
 
     /**
-     * Gets the encoding defined in this field.
-     * 
-     * @return the encoding or an empty string if not set.
+     * @see org.apache.james.mime4j.field.ContentTransferEncodingField#getEncoding()
      */
     public String getEncoding() {
         return encoding;
@@ -56,10 +56,10 @@
         return MimeUtil.ENC_7BIT;
     }
 
-    static final FieldParser<ContentTransferEncodingField> PARSER = new FieldParser<ContentTransferEncodingField>() {
-        public ContentTransferEncodingField parse(final String name, final String body,
+    static final FieldParser<ContentTransferEncodingFieldImpl> PARSER = new FieldParser<ContentTransferEncodingFieldImpl>() {
+        public ContentTransferEncodingFieldImpl parse(final String name, final String body,
                 final ByteSequence raw) {
-            return new ContentTransferEncodingField(name, body, raw);
+            return new ContentTransferEncodingFieldImpl(name, body, raw);
         }
     };
 }

Propchange: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/ContentTransferEncodingFieldImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/ContentTypeFieldImpl.java (from r894746, james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java)
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/ContentTypeFieldImpl.java?p2=james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/ContentTypeFieldImpl.java&p1=james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java&r1=894746&r2=894910&rev=894910&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/ContentTypeFieldImpl.java Thu Dec 31 17:52:56 2009
@@ -17,7 +17,7 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mime4j.field;
+package org.apache.james.mime4j.field.impl;
 
 import java.io.StringReader;
 import java.util.Collections;
@@ -27,6 +27,8 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.james.mime4j.field.ContentTypeField;
+import org.apache.james.mime4j.field.FieldParser;
 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;
@@ -35,26 +37,8 @@
 /**
  * Represents a <code>Content-Type</code> field.
  */
-public class ContentTypeField extends AbstractField {
-    private static Log log = LogFactory.getLog(ContentTypeField.class);
-
-    /** The prefix of all <code>multipart</code> MIME types. */
-    public static final String TYPE_MULTIPART_PREFIX = "multipart/";
-
-    /** The <code>multipart/digest</code> MIME type. */
-    public static final String TYPE_MULTIPART_DIGEST = "multipart/digest";
-
-    /** The <code>text/plain</code> MIME type. */
-    public static final String TYPE_TEXT_PLAIN = "text/plain";
-
-    /** The <code>message/rfc822</code> MIME type. */
-    public static final String TYPE_MESSAGE_RFC822 = "message/rfc822";
-
-    /** The name of the <code>boundary</code> parameter. */
-    public static final String PARAM_BOUNDARY = "boundary";
-
-    /** The name of the <code>charset</code> parameter. */
-    public static final String PARAM_CHARSET = "charset";
+public class ContentTypeFieldImpl extends AbstractField implements ContentTypeField {
+    private static Log log = LogFactory.getLog(ContentTypeFieldImpl.class);
 
     private boolean parsed = false;
 
@@ -62,13 +46,12 @@
     private Map<String, String> parameters = new HashMap<String, String>();
     private ParseException parseException;
 
-    ContentTypeField(String name, String body, ByteSequence raw) {
+    ContentTypeFieldImpl(String name, String body, ByteSequence raw) {
         super(name, body, raw);
     }
 
     /**
-     * Gets the exception that was raised during parsing of the field value, if
-     * any; otherwise, null.
+     * @see org.apache.james.mime4j.field.impl.ContentTypeField#getParseException()
      */
     @Override
     public ParseException getParseException() {
@@ -79,9 +62,7 @@
     }
 
     /**
-     * Gets the MIME type defined in this Content-Type field.
-     * 
-     * @return the MIME type or an empty string if not set.
+     * @see org.apache.james.mime4j.field.ContentTypeField#getMimeType()
      */
     public String getMimeType() {
         if (!parsed)
@@ -91,11 +72,7 @@
     }
 
     /**
-     * Gets the value of a parameter. Parameter names are case-insensitive.
-     * 
-     * @param name
-     *            the name of the parameter to get.
-     * @return the parameter value or <code>null</code> if not set.
+     * @see org.apache.james.mime4j.field.ContentTypeField#getParameter(java.lang.String)
      */
     public String getParameter(String name) {
         if (!parsed)
@@ -105,9 +82,7 @@
     }
 
     /**
-     * Gets all parameters.
-     * 
-     * @return the parameters.
+     * @see org.apache.james.mime4j.field.ContentTypeField#getParameters()
      */
     public Map<String, String> getParameters() {
         if (!parsed)
@@ -117,12 +92,7 @@
     }
 
     /**
-     * Determines if the MIME type of this field matches the given one.
-     * 
-     * @param mimeType
-     *            the MIME type to match against.
-     * @return <code>true</code> if the MIME type of this field matches,
-     *         <code>false</code> otherwise.
+     * @see org.apache.james.mime4j.field.ContentTypeField#isMimeType(java.lang.String)
      */
     public boolean isMimeType(String mimeType) {
         if (!parsed)
@@ -132,11 +102,7 @@
     }
 
     /**
-     * Determines if the MIME type of this field is <code>multipart/*</code>.
-     * 
-     * @return <code>true</code> if this field is has a
-     *         <code>multipart/*</code> MIME type, <code>false</code>
-     *         otherwise.
+     * @see org.apache.james.mime4j.field.ContentTypeField#isMultipart()
      */
     public boolean isMultipart() {
         if (!parsed)
@@ -146,20 +112,14 @@
     }
 
     /**
-     * Gets the value of the <code>boundary</code> parameter if set.
-     * 
-     * @return the <code>boundary</code> parameter value or <code>null</code>
-     *         if not set.
+     * @see org.apache.james.mime4j.field.ContentTypeField#getBoundary()
      */
     public String getBoundary() {
         return getParameter(PARAM_BOUNDARY);
     }
 
     /**
-     * Gets the value of the <code>charset</code> parameter if set.
-     * 
-     * @return the <code>charset</code> parameter value or <code>null</code>
-     *         if not set.
+     * @see org.apache.james.mime4j.field.ContentTypeField#getCharset()
      */
     public String getCharset() {
         return getParameter(PARAM_CHARSET);
@@ -249,10 +209,10 @@
         parsed = true;
     }
 
-    static final FieldParser<ContentTypeField> PARSER = new FieldParser<ContentTypeField>() {
-        public ContentTypeField parse(final String name, final String body,
+    static final FieldParser<ContentTypeFieldImpl> PARSER = new FieldParser<ContentTypeFieldImpl>() {
+        public ContentTypeFieldImpl parse(final String name, final String body,
                 final ByteSequence raw) {
-            return new ContentTypeField(name, body, raw);
+            return new ContentTypeFieldImpl(name, body, raw);
         }
     };
 }

Propchange: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/ContentTypeFieldImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/DateTimeFieldImpl.java (from r894746, james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/DateTimeField.java)
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/DateTimeFieldImpl.java?p2=james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/DateTimeFieldImpl.java&p1=james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/DateTimeField.java&r1=894746&r2=894910&rev=894910&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/DateTimeField.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/DateTimeFieldImpl.java Thu Dec 31 17:52:56 2009
@@ -17,13 +17,14 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mime4j.field;
+package org.apache.james.mime4j.field.impl;
 
 import java.io.StringReader;
 import java.util.Date;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.james.mime4j.field.FieldParser;
 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;
@@ -32,18 +33,21 @@
 /**
  * Date-time field such as <code>Date</code> or <code>Resent-Date</code>.
  */
-public class DateTimeField extends AbstractField {
-    private static Log log = LogFactory.getLog(DateTimeField.class);
+public class DateTimeFieldImpl extends AbstractField implements org.apache.james.mime4j.field.DateTimeField {
+    private static Log log = LogFactory.getLog(DateTimeFieldImpl.class);
 
     private boolean parsed = false;
 
     private Date date;
     private ParseException parseException;
 
-    DateTimeField(String name, String body, ByteSequence raw) {
+    DateTimeFieldImpl(String name, String body, ByteSequence raw) {
         super(name, body, raw);
     }
 
+    /**
+     * @see org.apache.james.mime4j.field.DateTimeField#getDate()
+     */
     public Date getDate() {
         if (!parsed)
             parse();
@@ -51,6 +55,9 @@
         return date;
     }
 
+    /**
+     * @see org.apache.james.mime4j.field.DateTimeField#getParseException()
+     */
     @Override
     public ParseException getParseException() {
         if (!parsed)
@@ -80,10 +87,10 @@
         parsed = true;
     }
 
-    static final FieldParser<DateTimeField> PARSER = new FieldParser<DateTimeField>() {
-        public DateTimeField parse(final String name, final String body,
+    static final FieldParser<DateTimeFieldImpl> PARSER = new FieldParser<DateTimeFieldImpl>() {
+        public DateTimeFieldImpl parse(final String name, final String body,
                 final ByteSequence raw) {
-            return new DateTimeField(name, body, raw);
+            return new DateTimeFieldImpl(name, body, raw);
         }
     };
 }

Propchange: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/DateTimeFieldImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/DefaultFieldParser.java (from r894746, james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/DefaultFieldParser.java)
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/DefaultFieldParser.java?p2=james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/DefaultFieldParser.java&p1=james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/DefaultFieldParser.java&r1=894746&r2=894910&rev=894910&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/DefaultFieldParser.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/DefaultFieldParser.java Thu Dec 31 17:52:56 2009
@@ -17,9 +17,20 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mime4j.field;
+package org.apache.james.mime4j.field.impl;
 
 import org.apache.james.mime4j.MimeException;
+import org.apache.james.mime4j.field.impl.AddressListFieldImpl;
+import org.apache.james.mime4j.field.impl.ContentDispositionFieldImpl;
+import org.apache.james.mime4j.field.impl.ContentTransferEncodingFieldImpl;
+import org.apache.james.mime4j.field.impl.ContentTypeFieldImpl;
+import org.apache.james.mime4j.field.impl.DateTimeFieldImpl;
+import org.apache.james.mime4j.field.FieldName;
+import org.apache.james.mime4j.field.FieldParser;
+import org.apache.james.mime4j.field.impl.MailboxFieldImpl;
+import org.apache.james.mime4j.field.impl.MailboxListFieldImpl;
+import org.apache.james.mime4j.field.ParsedField;
+import org.apache.james.mime4j.field.impl.UnstructuredFieldImpl;
 import org.apache.james.mime4j.parser.RawField;
 import org.apache.james.mime4j.util.ByteSequence;
 import org.apache.james.mime4j.util.ContentUtil;
@@ -62,14 +73,14 @@
      * <p>
      * <table>
      *   <tr><th>Class returned</th><th>Field names</th></tr>
-     *   <tr><td>{@link ContentTypeField}</td><td>Content-Type</td></tr>
-     *   <tr><td>{@link ContentTransferEncodingField}</td><td>Content-Transfer-Encoding</td></tr>
-     *   <tr><td>{@link ContentDispositionField}</td><td>Content-Disposition</td></tr>
-     *   <tr><td>{@link DateTimeField}</td><td>Date, Resent-Date</td></tr>
-     *   <tr><td>{@link MailboxField}</td><td>Sender, Resent-Sender</td></tr>
-     *   <tr><td>{@link MailboxListField}</td><td>From, Resent-From</td></tr>
-     *   <tr><td>{@link AddressListField}</td><td>To, Cc, Bcc, Reply-To, Resent-To, Resent-Cc, Resent-Bcc</td></tr>
-     *   <tr><td>{@link UnstructuredField}</td><td>Subject and others</td></tr>
+     *   <tr><td>{@link ContentTypeFieldImpl}</td><td>Content-Type</td></tr>
+     *   <tr><td>{@link ContentTransferEncodingFieldImpl}</td><td>Content-Transfer-Encoding</td></tr>
+     *   <tr><td>{@link ContentDispositionFieldImpl}</td><td>Content-Disposition</td></tr>
+     *   <tr><td>{@link DateTimeFieldImpl}</td><td>Date, Resent-Date</td></tr>
+     *   <tr><td>{@link MailboxFieldImpl}</td><td>Sender, Resent-Sender</td></tr>
+     *   <tr><td>{@link MailboxListFieldImpl}</td><td>From, Resent-From</td></tr>
+     *   <tr><td>{@link AddressListFieldImpl}</td><td>To, Cc, Bcc, Reply-To, Resent-To, Resent-Cc, Resent-Bcc</td></tr>
+     *   <tr><td>{@link UnstructuredFieldImpl}</td><td>Subject and others</td></tr>
      * </table>
      * 
      * @param rawStr the string to parse.
@@ -84,24 +95,24 @@
 
     public DefaultFieldParser() {
         setFieldParser(FieldName.CONTENT_TRANSFER_ENCODING,
-                ContentTransferEncodingField.PARSER);
-        setFieldParser(FieldName.CONTENT_TYPE, ContentTypeField.PARSER);
+                ContentTransferEncodingFieldImpl.PARSER);
+        setFieldParser(FieldName.CONTENT_TYPE, ContentTypeFieldImpl.PARSER);
         setFieldParser(FieldName.CONTENT_DISPOSITION,
-                ContentDispositionField.PARSER);
+                ContentDispositionFieldImpl.PARSER);
 
-        final FieldParser<DateTimeField> dateTimeParser = DateTimeField.PARSER;
+        final FieldParser<DateTimeFieldImpl> dateTimeParser = DateTimeFieldImpl.PARSER;
         setFieldParser(FieldName.DATE, dateTimeParser);
         setFieldParser(FieldName.RESENT_DATE, dateTimeParser);
 
-        final FieldParser<MailboxListField> mailboxListParser = MailboxListField.PARSER;
+        final FieldParser<MailboxListFieldImpl> mailboxListParser = MailboxListFieldImpl.PARSER;
         setFieldParser(FieldName.FROM, mailboxListParser);
         setFieldParser(FieldName.RESENT_FROM, mailboxListParser);
 
-        final FieldParser<MailboxField> mailboxParser = MailboxField.PARSER;
+        final FieldParser<MailboxFieldImpl> mailboxParser = MailboxFieldImpl.PARSER;
         setFieldParser(FieldName.SENDER, mailboxParser);
         setFieldParser(FieldName.RESENT_SENDER, mailboxParser);
 
-        final FieldParser<AddressListField> addressListParser = AddressListField.PARSER;
+        final FieldParser<AddressListFieldImpl> addressListParser = AddressListFieldImpl.PARSER;
         setFieldParser(FieldName.TO, addressListParser);
         setFieldParser(FieldName.RESENT_TO, addressListParser);
         setFieldParser(FieldName.CC, addressListParser);

Propchange: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/DefaultFieldParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/DelegatingFieldParser.java (from r894746, james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java)
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/DelegatingFieldParser.java?p2=james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/DelegatingFieldParser.java&p1=james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java&r1=894746&r2=894910&rev=894910&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/DelegatingFieldParser.java Thu Dec 31 17:52:56 2009
@@ -17,15 +17,18 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mime4j.field;
+package org.apache.james.mime4j.field.impl;
 
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.james.mime4j.field.FieldParser;
+import org.apache.james.mime4j.field.ParsedField;
+import org.apache.james.mime4j.field.impl.UnstructuredFieldImpl;
 import org.apache.james.mime4j.util.ByteSequence;
 
 public class DelegatingFieldParser implements FieldParser<ParsedField> {
-    private static final FieldParser<UnstructuredField> DEFAULT_PARSER = UnstructuredField.PARSER;
+    private static final FieldParser<UnstructuredFieldImpl> DEFAULT_PARSER = UnstructuredFieldImpl.PARSER;
 
     private Map<String, FieldParser<? extends ParsedField>> parsers = new HashMap<String, FieldParser<? extends ParsedField>>();
 

Propchange: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/DelegatingFieldParser.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message