james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r898843 - in /james/mime4j/branches/cycleclean/core/src: main/java/org/apache/james/mime4j/parser/ main/java/org/apache/james/mime4j/stream/ test/java/org/apache/james/mime4j/parser/ test/java/org/apache/james/mime4j/stream/
Date Wed, 13 Jan 2010 17:12:37 GMT
Author: bago
Date: Wed Jan 13 17:12:36 2010
New Revision: 898843

URL: http://svn.apache.org/viewvc?rev=898843&view=rev
Log:
Moved DefaultBodyDescriptor to the stream package as requested by Oleg (MIME4J-157)
This reintroduce "commons-logging" dependency to the stream package, so this will need a bit
more care later, however this is not a big issue, as MIME4J-158 was an ongoing effort, still.

Added:
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/stream/DefaultBodyDescriptor.java
      - copied, changed from r897190, james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/DefaultBodyDescriptor.java
Removed:
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/DefaultBodyDescriptor.java
Modified:
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/MaximalBodyDescriptor.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/MimeTokenStream.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/stream/BasicMimeTokenStream.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/stream/MimeEntityConfig.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/parser/DefaultBodyDescriptorTest.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/stream/MimeEntityTest.java

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/MaximalBodyDescriptor.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/MaximalBodyDescriptor.java?rev=898843&r1=898842&r2=898843&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/MaximalBodyDescriptor.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/MaximalBodyDescriptor.java
Wed Jan 13 17:12:36 2010
@@ -32,6 +32,7 @@
 import org.apache.james.mime4j.field.mimeversion.parser.MimeVersionParser;
 import org.apache.james.mime4j.field.structured.parser.StructuredFieldParser;
 import org.apache.james.mime4j.stream.BodyDescriptor;
+import org.apache.james.mime4j.stream.DefaultBodyDescriptor;
 import org.apache.james.mime4j.stream.MutableBodyDescriptor;
 import org.apache.james.mime4j.stream.RawField;
 import org.apache.james.mime4j.util.MimeUtil;

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/MimeTokenStream.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/MimeTokenStream.java?rev=898843&r1=898842&r2=898843&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/MimeTokenStream.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/MimeTokenStream.java
Wed Jan 13 17:12:36 2010
@@ -24,9 +24,9 @@
 import org.apache.james.mime4j.codec.DecodeMonitor;
 import org.apache.james.mime4j.stream.BasicMimeTokenStream;
 import org.apache.james.mime4j.stream.BodyDescriptor;
+import org.apache.james.mime4j.stream.DefaultBodyDescriptor;
 import org.apache.james.mime4j.stream.MimeEntityConfig;
 import org.apache.james.mime4j.stream.MutableBodyDescriptor;
-import org.apache.james.mime4j.stream.RawField;
 
 /**
  * <p>
@@ -108,40 +108,6 @@
         super(config, monitor);
     }
 
-    /** Instructs the {@code MimeTokenStream} to parse the given streams contents.
-     * If the {@code MimeTokenStream} has already been in use, resets the streams
-     * internal state.
-     */
-    public void parse(InputStream stream) {
-        doParse(stream, null);
-    }
-
-    /** Instructs the {@code MimeTokenStream} to parse the given content with 
-     * the content type. The message stream is assumed to have no message header
-     * and is expected to begin with a message body. This can be the case when 
-     * the message content is transmitted using a different transport protocol 
-     * such as HTTP.
-     * <p/>
-     * If the {@code MimeTokenStream} has already been in use, resets the streams
-     * internal state.
-     */    
-    public void parseHeadless(InputStream stream, String contentType) {
-        if (contentType == null) {
-            throw new IllegalArgumentException("Content type may not be null");
-        }
-        doParse(stream, contentType);
-    }
-
-    private void doParse(InputStream stream, String contentType) {
-        MutableBodyDescriptor newBodyDescriptor = newBodyDescriptor();
-        int start = T_START_MESSAGE;
-        if (contentType != null) {
-        	start = T_END_HEADER;
-        	newBodyDescriptor.addField(new RawField("Content-Type", contentType));
-        }
-        doParse(stream, newBodyDescriptor, start);
-    }
-
     /**
      * Creates a new instance of {@link BodyDescriptor}. Subclasses may override
      * this in order to create body descriptors, that provide more specific

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/stream/BasicMimeTokenStream.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/stream/BasicMimeTokenStream.java?rev=898843&r1=898842&r2=898843&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/stream/BasicMimeTokenStream.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/stream/BasicMimeTokenStream.java
Wed Jan 13 17:12:36 2010
@@ -103,7 +103,46 @@
         this.monitor = monitor != null ? monitor : (config.isStrictParsing() ? DecodeMonitor.STRICT
: DecodeMonitor.SILENT);
     }
 
-    public void doParse(InputStream stream,
+
+    /** Instructs the {@code MimeTokenStream} to parse the given streams contents.
+     * If the {@code MimeTokenStream} has already been in use, resets the streams
+     * internal state.
+     */
+    public void parse(InputStream stream) {
+        doParse(stream, null);
+    }
+
+    /** Instructs the {@code MimeTokenStream} to parse the given content with 
+     * the content type. The message stream is assumed to have no message header
+     * and is expected to begin with a message body. This can be the case when 
+     * the message content is transmitted using a different transport protocol 
+     * such as HTTP.
+     * <p/>
+     * If the {@code MimeTokenStream} has already been in use, resets the streams
+     * internal state.
+     */    
+    public void parseHeadless(InputStream stream, String contentType) {
+        if (contentType == null) {
+            throw new IllegalArgumentException("Content type may not be null");
+        }
+        doParse(stream, contentType);
+    }
+
+    protected void doParse(InputStream stream, String contentType) {
+        MutableBodyDescriptor newBodyDescriptor = newBodyDescriptor();
+        int start = T_START_MESSAGE;
+        if (contentType != null) {
+        	start = T_END_HEADER;
+        	newBodyDescriptor.addField(new RawField("Content-Type", contentType));
+        }
+        doParse(stream, newBodyDescriptor, start);
+    }
+
+    protected MutableBodyDescriptor newBodyDescriptor() {
+		return new DefaultBodyDescriptor(null);
+	}
+
+	public void doParse(InputStream stream,
             MutableBodyDescriptor newBodyDescriptor, int start) {
         LineNumberSource lineSource = null;
         if (config.isCountLineNumbers()) {

Copied: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/stream/DefaultBodyDescriptor.java
(from r897190, james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/DefaultBodyDescriptor.java)
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/stream/DefaultBodyDescriptor.java?p2=james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/stream/DefaultBodyDescriptor.java&p1=james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/DefaultBodyDescriptor.java&r1=897190&r2=898843&rev=898843&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/DefaultBodyDescriptor.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/stream/DefaultBodyDescriptor.java
Wed Jan 13 17:12:36 2010
@@ -17,16 +17,13 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mime4j.parser;
+package org.apache.james.mime4j.stream;
 
 import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.james.mime4j.stream.BodyDescriptor;
-import org.apache.james.mime4j.stream.MutableBodyDescriptor;
-import org.apache.james.mime4j.stream.RawField;
 import org.apache.james.mime4j.util.MimeUtil;
 
 /**

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/stream/MimeEntityConfig.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/stream/MimeEntityConfig.java?rev=898843&r1=898842&r2=898843&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/stream/MimeEntityConfig.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/stream/MimeEntityConfig.java
Wed Jan 13 17:12:36 2010
@@ -20,7 +20,6 @@
 package org.apache.james.mime4j.stream;
 
 import org.apache.james.mime4j.MimeException;
-import org.apache.james.mime4j.parser.DefaultBodyDescriptor;
 import org.apache.james.mime4j.parser.MaximalBodyDescriptor;
 import org.apache.james.mime4j.parser.MimeStreamParser;
 import org.apache.james.mime4j.parser.MimeTokenStream;

Modified: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/parser/DefaultBodyDescriptorTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/parser/DefaultBodyDescriptorTest.java?rev=898843&r1=898842&r2=898843&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/parser/DefaultBodyDescriptorTest.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/parser/DefaultBodyDescriptorTest.java
Wed Jan 13 17:12:36 2010
@@ -19,9 +19,9 @@
 
 package org.apache.james.mime4j.parser;
 
-import org.apache.james.mime4j.parser.DefaultBodyDescriptor;
 import org.apache.james.mime4j.stream.BaseTestForBodyDescriptors;
 import org.apache.james.mime4j.stream.BodyDescriptor;
+import org.apache.james.mime4j.stream.DefaultBodyDescriptor;
 import org.apache.james.mime4j.stream.MutableBodyDescriptor;
 
 public class DefaultBodyDescriptorTest extends BaseTestForBodyDescriptors {

Modified: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/stream/MimeEntityTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/stream/MimeEntityTest.java?rev=898843&r1=898842&r2=898843&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/stream/MimeEntityTest.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/stream/MimeEntityTest.java
Wed Jan 13 17:12:36 2010
@@ -29,7 +29,6 @@
 import org.apache.james.mime4j.io.MaxHeaderLimitException;
 import org.apache.james.mime4j.io.MaxLineLimitException;
 import org.apache.james.mime4j.io.LineNumberInputStream;
-import org.apache.james.mime4j.parser.DefaultBodyDescriptor;
 import org.apache.james.mime4j.stream.EntityStateMachine;
 import org.apache.james.mime4j.stream.EntityStates;
 import org.apache.james.mime4j.stream.MimeEntity;



Mime
View raw message