You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2018/04/03 10:03:07 UTC

[21/24] james-project git commit: JAMES-2361 move MimeMultipartReport to javax-mail-extension for reuse

JAMES-2361 move MimeMultipartReport to javax-mail-extension for reuse


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/3afb6b56
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/3afb6b56
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/3afb6b56

Branch: refs/heads/master
Commit: 3afb6b5615f2997d1d10f34a473d9c42ff5b9378
Parents: 203ad2d
Author: Matthieu Baechler <ma...@apache.org>
Authored: Tue Mar 27 17:04:34 2018 +0200
Committer: benwa <bt...@linagora.com>
Committed: Tue Apr 3 17:01:38 2018 +0700

----------------------------------------------------------------------
 .../apache/james/javax/MimeMultipartReport.java | 76 ++++++++++++++++++++
 mailet/base/pom.xml                             |  4 ++
 .../mailet/base/mail/MimeMultipartReport.java   | 76 --------------------
 .../mailet/base/mail/MultipartReport.java       |  2 +
 .../james/transport/mailets/DSNBounce.java      |  2 +-
 .../james/transport/mailets/DSNBounceTest.java  |  1 +
 6 files changed, 84 insertions(+), 77 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/3afb6b56/javax-mail-extension/src/main/java/org/apache/james/javax/MimeMultipartReport.java
----------------------------------------------------------------------
diff --git a/javax-mail-extension/src/main/java/org/apache/james/javax/MimeMultipartReport.java b/javax-mail-extension/src/main/java/org/apache/james/javax/MimeMultipartReport.java
new file mode 100644
index 0000000..1f24f0d
--- /dev/null
+++ b/javax-mail-extension/src/main/java/org/apache/james/javax/MimeMultipartReport.java
@@ -0,0 +1,76 @@
+/****************************************************************
+ * 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.javax;
+
+import javax.activation.DataSource;
+import javax.mail.MessagingException;
+import javax.mail.internet.ContentType;
+import javax.mail.internet.MimeMultipart;
+
+/**
+ * Class <code>MimeMultipartReport</code> implements JavaMail support
+ * for a MIME type of MimeMultipart with a subtype of report.
+ */
+public class MimeMultipartReport extends MimeMultipart {
+
+    /**
+     * Default constructor
+     */
+    public MimeMultipartReport() {
+        this("report");
+    }
+
+    /**
+     * Constructs a MimeMultipartReport of the given subtype.
+     * @param subtype
+     */
+    public MimeMultipartReport(String subtype) {
+        super(subtype);
+    }
+
+    /**
+     * Constructs a MimeMultipartReport from the passed DataSource.
+     * @param aDataSource
+     * @throws javax.mail.MessagingException
+     */
+    public MimeMultipartReport(DataSource aDataSource) throws MessagingException {
+        super(aDataSource);
+    }
+    
+    /**
+     * Sets the type of report.
+     * @param reportType
+     * @throws MessagingException
+     */
+    public void setReportType(String reportType) throws MessagingException {
+        ContentType contentType = new ContentType(getContentType());
+        contentType.setParameter("report-type", reportType);
+        setContentType(contentType);
+    }
+    
+    /**
+     * Sets the content type
+     * @param aContentType
+     */
+    protected void setContentType(ContentType aContentType) {
+        contentType = aContentType.toString();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3afb6b56/mailet/base/pom.xml
----------------------------------------------------------------------
diff --git a/mailet/base/pom.xml b/mailet/base/pom.xml
index 13923f1..c9fbe5c 100644
--- a/mailet/base/pom.xml
+++ b/mailet/base/pom.xml
@@ -49,6 +49,10 @@
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>javax-mail-extension</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>javax-mail-extension</artifactId>
             <type>test-jar</type>
             <scope>test</scope>
         </dependency>

http://git-wip-us.apache.org/repos/asf/james-project/blob/3afb6b56/mailet/base/src/main/java/org/apache/mailet/base/mail/MimeMultipartReport.java
----------------------------------------------------------------------
diff --git a/mailet/base/src/main/java/org/apache/mailet/base/mail/MimeMultipartReport.java b/mailet/base/src/main/java/org/apache/mailet/base/mail/MimeMultipartReport.java
deleted file mode 100644
index 8d548e1..0000000
--- a/mailet/base/src/main/java/org/apache/mailet/base/mail/MimeMultipartReport.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************
- * 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.mailet.base.mail;
-
-import javax.activation.DataSource;
-import javax.mail.MessagingException;
-import javax.mail.internet.ContentType;
-import javax.mail.internet.MimeMultipart;
-
-/**
- * Class <code>MimeMultipartReport</code> implements JavaMail support
- * for a MIME type of MimeMultipart with a subtype of report.
- */
-public class MimeMultipartReport extends MimeMultipart {
-
-    /**
-     * Default constructor
-     */
-    public MimeMultipartReport() {
-        this("report");
-    }
-
-    /**
-     * Constructs a MimeMultipartReport of the given subtype.
-     * @param subtype
-     */
-    public MimeMultipartReport(String subtype) {
-        super(subtype);
-    }
-
-    /**
-     * Constructs a MimeMultipartReport from the passed DataSource.
-     * @param aDataSource
-     * @throws javax.mail.MessagingException
-     */
-    public MimeMultipartReport(DataSource aDataSource) throws MessagingException {
-        super(aDataSource);
-    }
-    
-    /**
-     * Sets the type of report.
-     * @param reportType
-     * @throws MessagingException
-     */
-    public void setReportType(String reportType) throws MessagingException {
-        ContentType contentType = new ContentType(getContentType());
-        contentType.setParameter("report-type", reportType);
-        setContentType(contentType);
-    }
-    
-    /**
-     * Sets the content type
-     * @param aContentType
-     */
-    protected void setContentType(ContentType aContentType) {
-        contentType = aContentType.toString();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3afb6b56/mailet/base/src/main/java/org/apache/mailet/base/mail/MultipartReport.java
----------------------------------------------------------------------
diff --git a/mailet/base/src/main/java/org/apache/mailet/base/mail/MultipartReport.java b/mailet/base/src/main/java/org/apache/mailet/base/mail/MultipartReport.java
index c17be64..a65690d 100644
--- a/mailet/base/src/main/java/org/apache/mailet/base/mail/MultipartReport.java
+++ b/mailet/base/src/main/java/org/apache/mailet/base/mail/MultipartReport.java
@@ -26,6 +26,8 @@ import javax.activation.ActivationDataFlavor;
 import javax.activation.DataSource;
 import javax.mail.MessagingException;
 
+import org.apache.james.javax.MimeMultipartReport;
+
 
 /**
  * <p>Data Content Handler for...</p>

http://git-wip-us.apache.org/repos/asf/james-project/blob/3afb6b56/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/DSNBounce.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/DSNBounce.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/DSNBounce.java
index c1ecbeb..d03f391 100755
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/DSNBounce.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/DSNBounce.java
@@ -36,6 +36,7 @@ import javax.mail.internet.MimeMessage;
 import org.apache.commons.lang3.time.FastDateFormat;
 import org.apache.james.core.MailAddress;
 import org.apache.james.dnsservice.api.DNSService;
+import org.apache.james.javax.MimeMultipartReport;
 import org.apache.james.server.core.MailImpl;
 import org.apache.james.transport.mailets.managesieve.ManageSieveMailet;
 import org.apache.james.transport.mailets.redirect.InitParameters;
@@ -57,7 +58,6 @@ import org.apache.mailet.Mail;
 import org.apache.mailet.base.DateFormats;
 import org.apache.mailet.base.GenericMailet;
 import org.apache.mailet.base.RFC2822Headers;
-import org.apache.mailet.base.mail.MimeMultipartReport;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/3afb6b56/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/DSNBounceTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/DSNBounceTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/DSNBounceTest.java
index def7677..071a826 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/DSNBounceTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/DSNBounceTest.java
@@ -39,6 +39,7 @@ import org.apache.commons.io.IOUtils;
 import org.apache.james.core.MailAddress;
 import org.apache.james.core.builder.MimeMessageBuilder;
 import org.apache.james.dnsservice.api.DNSService;
+import org.apache.james.javax.MimeMultipartReport;
 import org.apache.james.transport.mailets.redirect.SpecialAddress;
 import org.apache.james.util.MimeMessageUtil;
 import org.apache.mailet.Mail;


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org