james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1068457 - in /james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j: dom/MessageBuilder.java dom/ParseParams.java message/MessageBuilderImpl.java message/MimeBuilder.java
Date Tue, 08 Feb 2011 15:59:29 GMT
Author: olegk
Date: Tue Feb  8 15:59:28 2011
New Revision: 1068457

URL: http://svn.apache.org/viewvc?rev=1068457&view=rev
Log:
Moved parser parameters to MimeBuilder and MessageBuilderImpl; removed ParseParams

Removed:
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/dom/ParseParams.java
Modified:
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/dom/MessageBuilder.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MessageBuilderImpl.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MimeBuilder.java

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/dom/MessageBuilder.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/dom/MessageBuilder.java?rev=1068457&r1=1068456&r2=1068457&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/dom/MessageBuilder.java (original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/dom/MessageBuilder.java Tue
Feb  8 15:59:28 2011
@@ -23,7 +23,6 @@ import java.io.IOException;
 import java.io.InputStream;
 
 import org.apache.james.mime4j.MimeException;
-import org.apache.james.mime4j.codec.DecodeMonitor;
 
 /**
  * Defines the API to obtain Message instances from a mime stream.
@@ -36,7 +35,4 @@ public interface MessageBuilder {
           
     Message parse(InputStream source) throws MimeException, IOException;
           
-    Message parse(InputStream source, 
-            ParseParams params, DecodeMonitor decodeMonitor) throws MimeException, IOException;
-
 }
\ No newline at end of file

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MessageBuilderImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MessageBuilderImpl.java?rev=1068457&r1=1068456&r2=1068457&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MessageBuilderImpl.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MessageBuilderImpl.java
Tue Feb  8 15:59:28 2011
@@ -26,7 +26,6 @@ import org.apache.james.mime4j.MimeExcep
 import org.apache.james.mime4j.codec.DecodeMonitor;
 import org.apache.james.mime4j.dom.Message;
 import org.apache.james.mime4j.dom.MessageBuilder;
-import org.apache.james.mime4j.dom.ParseParams;
 import org.apache.james.mime4j.stream.MimeEntityConfig;
 import org.apache.james.mime4j.stream.MutableBodyDescriptorFactory;
 
@@ -40,6 +39,9 @@ public class MessageBuilderImpl implemen
     private BodyFactory bodyFactory = null;
     private MimeEntityConfig mimeEntityConfig = null;
     private MutableBodyDescriptorFactory mutableBodyDescriptorFactory = null;
+    private boolean contentDecoding = true;
+    private boolean flatMode = false;
+    private DecodeMonitor decodeMonitor = null;
 
     public MessageBuilderImpl() {
     }
@@ -66,18 +68,8 @@ public class MessageBuilderImpl implemen
                 mimeEntityConfig, 
                 bodyFactory, 
                 mutableBodyDescriptorFactory, 
-                null,
-                null);
-    }
-    
-    public Message parse(
-            InputStream source, 
-            ParseParams params, DecodeMonitor decodeMonitor) throws MimeException, IOException
{
-        return getMimeBuilder().parse(source, 
-                mimeEntityConfig, 
-                bodyFactory, 
-                mutableBodyDescriptorFactory, 
-                params,
+                contentDecoding,
+                flatMode,
                 decodeMonitor);
     }
     
@@ -98,4 +90,16 @@ public class MessageBuilderImpl implemen
         this.mimeBuilder = mimeBuilder;
     }
 
+    public void setDecodeMonitor(DecodeMonitor decodeMonitor) {
+        this.decodeMonitor = decodeMonitor;
+    }
+
+    public void setContentDecoding(boolean contentDecoding) {
+        this.contentDecoding = contentDecoding;
+    }
+
+    public void setFlatMode(boolean flatMode) {
+        this.flatMode = flatMode;
+    }
+    
 }

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MimeBuilder.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MimeBuilder.java?rev=1068457&r1=1068456&r2=1068457&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MimeBuilder.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MimeBuilder.java
Tue Feb  8 15:59:28 2011
@@ -31,7 +31,6 @@ import org.apache.james.mime4j.dom.Entit
 import org.apache.james.mime4j.dom.Header;
 import org.apache.james.mime4j.dom.Message;
 import org.apache.james.mime4j.dom.Multipart;
-import org.apache.james.mime4j.dom.ParseParams;
 import org.apache.james.mime4j.dom.SingleBody;
 import org.apache.james.mime4j.dom.field.Field;
 import org.apache.james.mime4j.field.DefaultFieldParser;
@@ -249,22 +248,18 @@ public class MimeBuilder {
             final MimeEntityConfig config,
             final BodyFactory bodyFactory, 
             final MutableBodyDescriptorFactory bodyDescFactory,
-            final ParseParams params,
+            final boolean contentDecoding,
+            final boolean flatMode,
             final DecodeMonitor monitor) throws IOException, MimeIOException {
         try {
             MessageImpl message = new MessageImpl();
             DecodeMonitor mon = monitor != null ? monitor : DecodeMonitor.SILENT;
             MimeStreamParser parser = new MimeStreamParser(config, bodyDescFactory, mon);
             parser.setContentHandler(new EntityBuilder(message, bodyFactory, mon));
-            if (params != null) {
-                parser.setContentDecoding(params.isContentDecoding());
-                if (params.isFlatMode()) {
-                    parser.setFlat();
-                } else {
-                    parser.setRecurse();
-                }
+            parser.setContentDecoding(contentDecoding);
+            if (flatMode) {
+                parser.setFlat();
             } else {
-                parser.setContentDecoding(true);
                 parser.setRecurse();
             }
             parser.parse(is);
@@ -298,7 +293,7 @@ public class MimeBuilder {
             final BodyFactory bodyFactory, 
             final MutableBodyDescriptorFactory bodyDescFactory,
             final DecodeMonitor monitor) throws IOException, MimeIOException {
-        return parse(is, config, bodyFactory, bodyDescFactory, null, monitor);
+        return parse(is, config, bodyFactory, bodyDescFactory, true, false, monitor);
     }
     
     public Message parse(



Mime
View raw message