james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r923012 - in /james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j: dom/MessageBuilder.java dom/MessageBuilderFactory.java message/MessageBuilderFactoryImpl.java message/MessageBuilderImpl.java
Date Mon, 15 Mar 2010 00:01:10 GMT
Author: bago
Date: Mon Mar 15 00:01:10 2010
New Revision: 923012

URL: http://svn.apache.org/viewvc?rev=923012&view=rev
Log:
First improvement to show how to support configuration of the MessageBuilder wrt StorageProvider
and DecodeMonitor (MIME4J-175).

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/dom/MessageBuilderFactory.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MessageBuilderFactoryImpl.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MessageBuilderImpl.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=923012&r1=923011&r2=923012&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 Mon
Mar 15 00:01:10 2010
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.io.InputStream;
 
 import org.apache.james.mime4j.MimeException;
+import org.apache.james.mime4j.codec.DecodeMonitor;
 
 public abstract class MessageBuilder {
     
@@ -32,4 +33,7 @@ public abstract class MessageBuilder {
 
     public abstract Message parse(InputStream source) throws MimeException, IOException;
 
+    public abstract void setDecodeMonitor(
+            DecodeMonitor decodeMonitor);
+
 }

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/dom/MessageBuilderFactory.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/dom/MessageBuilderFactory.java?rev=923012&r1=923011&r2=923012&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/dom/MessageBuilderFactory.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/dom/MessageBuilderFactory.java
Mon Mar 15 00:01:10 2010
@@ -35,5 +35,7 @@ public abstract class MessageBuilderFact
     public static MessageBuilderFactory newInstance() throws MimeException {
         return ServiceLoader.load(MessageBuilderFactory.class);
     }
+
+    public abstract void setAttribute(String name, Object value) throws IllegalArgumentException;
     
 }

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MessageBuilderFactoryImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MessageBuilderFactoryImpl.java?rev=923012&r1=923011&r2=923012&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MessageBuilderFactoryImpl.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MessageBuilderFactoryImpl.java
Mon Mar 15 00:01:10 2010
@@ -21,12 +21,27 @@ package org.apache.james.mime4j.message;
 import org.apache.james.mime4j.MimeException;
 import org.apache.james.mime4j.dom.MessageBuilder;
 import org.apache.james.mime4j.dom.MessageBuilderFactory;
+import org.apache.james.mime4j.storage.StorageProvider;
 
 public class MessageBuilderFactoryImpl extends MessageBuilderFactory {
 
+    private StorageProvider storageProvider = null;
+
     @Override
     public MessageBuilder newMessageBuilder() throws MimeException {
-        return new MessageBuilderImpl();
+        return new MessageBuilderImpl(storageProvider);
+    }
+
+    @Override
+    public void setAttribute(String name, Object value)
+            throws IllegalArgumentException {
+        if ("StorageProvider".equals(name) && value instanceof StorageProvider) {
+            this.storageProvider  = (StorageProvider) value;
+            return;
+        }
+            
+        throw new IllegalArgumentException("Unsupported attribute: "+name);
+        
     }
 
 }

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=923012&r1=923011&r2=923012&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
Mon Mar 15 00:01:10 2010
@@ -4,11 +4,20 @@ import java.io.IOException;
 import java.io.InputStream;
 
 import org.apache.james.mime4j.MimeException;
+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.storage.StorageProvider;
 
 public class MessageBuilderImpl extends MessageBuilder {
 
+    private StorageProvider storageProvider;
+    private DecodeMonitor decodeMonitor = null;
+
+    public MessageBuilderImpl(StorageProvider storageProvider) {
+        this.storageProvider = storageProvider;
+    }
+
     @Override
     public Message newMessage() {
         return new MessageImpl();
@@ -21,7 +30,12 @@ public class MessageBuilderImpl extends 
 
     @Override
     public Message parse(InputStream source) throws MimeException, IOException {
-        return new MessageImpl(source);
+        return new MessageImpl(source, null, storageProvider, null, decodeMonitor);
+    }
+
+    @Override
+    public void setDecodeMonitor(DecodeMonitor decodeMonitor) {
+        this.decodeMonitor = decodeMonitor;
     }
 
 }



Mime
View raw message