This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 32bea1de906dabacc3f344701b5426a6ea34065a
Author: Benoit Tellier <[email protected]>
AuthorDate: Mon Apr 6 18:39:10 2020 +0700

    [Release] Post 3.5.0 release removal
    
     - To be deprecated in upcoming 3.5.0 and removed in 3.6.0:
    
        - james-server-mailet BayesianAnalysis + BayesianAnalysisFeeder +
    JDBCBayesianAnalyser
          mailet/ai mailets to be used instead.
    
        - ToRecipientFolder.
          WithStorageDirective + LocalDelivery to be used instead.
          This will limit user misunderstandings
    
        - mpt/antlib + mpt/mpt-maven-plugin + mpt/app
          Not aware of usages, not exposed to users
---
 mpt/antlib/LICENSE.txt                             | 176 --------
 mpt/antlib/NOTICE.txt                              |  11 -
 mpt/antlib/pom.xml                                 | 165 --------
 .../apache/james/mpt/ant/MailProtocolTestTask.java | 426 -------------------
 .../resources/org/apache/james/mpt/ant/antlib.xml  |  26 --
 mpt/antlib/src/reporting-site/site.xml             |  29 --
 .../src/site/resources/images/asf-logo-reduced.gif | Bin 6636 -> 0 bytes
 .../src/site/resources/images/james-mpt-logo.gif   | Bin 5179 -> 0 bytes
 mpt/antlib/src/site/site.xml                       |  37 --
 mpt/antlib/src/site/xdoc/index.xml                 | 183 --------
 .../java/org/apache/james/mpt/ant/TestAddUser.java |  68 ---
 .../org/apache/james/mpt/ant/TestRunScripts.java   | 102 -----
 mpt/antlib/src/test/resources/build.xml            | 140 -------
 mpt/pom.xml                                        |   1 -
 .../james/transport/mailets/BayesianAnalysis.java  | 460 ---------------------
 .../transport/mailets/BayesianAnalysisFeeder.java  | 336 ---------------
 .../james/transport/mailets/ToRecipientFolder.java |  99 -----
 .../mailets/delivery/ToRecipientFolderTest.java    | 198 ---------
 18 files changed, 2457 deletions(-)

diff --git a/mpt/antlib/LICENSE.txt b/mpt/antlib/LICENSE.txt
deleted file mode 100644
index 2bb9ad2..0000000
--- a/mpt/antlib/LICENSE.txt
+++ /dev/null
@@ -1,176 +0,0 @@
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
\ No newline at end of file
diff --git a/mpt/antlib/NOTICE.txt b/mpt/antlib/NOTICE.txt
deleted file mode 100644
index 198c869..0000000
--- a/mpt/antlib/NOTICE.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-
-=========================================================================
-==      NOTICE file for use with the Apache License, Version 2.0,      ==
-=========================================================================
-
-Apache JAMES 
-Copyright 2007-2011 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-            
diff --git a/mpt/antlib/pom.xml b/mpt/antlib/pom.xml
deleted file mode 100644
index 40231a1..0000000
--- a/mpt/antlib/pom.xml
+++ /dev/null
@@ -1,165 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.apache.james</groupId>
-        <artifactId>apache-james-mpt</artifactId>
-        <version>3.6.0-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-
-    <artifactId>apache-james-mpt-antlib</artifactId>
-
-    <name>Apache James MPT AntLib</name>
-    <description>Apache James Mail Protocol Tester (MPT) is a library 
providing a framework for the 
-scritable functional testing of ASCII based line protocols. This AntLib 
provides an easy interface
-to the library requiring no extra coding.</description>
-    <url>http://james.apache.org/mpt/antlib</url>
-
-    <dependencies>
-        <dependency>
-            <groupId>${james.groupId}</groupId>
-            <artifactId>apache-james-mpt-core</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>${james.groupId}</groupId>
-            <artifactId>apache-james-mpt-core</artifactId>
-            <type>test-jar</type>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>${james.groupId}</groupId>
-            <artifactId>testing-base</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ant</groupId>
-            <artifactId>ant</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ant</groupId>
-            <artifactId>ant-antunit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>jcl-over-slf4j</artifactId>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-antrun-plugin</artifactId>
-                <dependencies>
-                    <!-- AntUnit require Ant 1.7+ -->
-                    <dependency>
-                        <groupId>org.apache.ant</groupId>
-                        <artifactId>ant</artifactId>
-                        <version>1.7.1</version>
-                    </dependency>
-                </dependencies>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>run</goal>
-                        </goals>
-                        <phase>test</phase>
-                        <configuration>
-                            <tasks>
-                                <ant antfile="src/test/resources/build.xml" 
inheritAll="false" inheritRefs="false">
-                                    <property 
location="${project.build.outputDirectory}" name="jar.name" />
-                                    <property location="${basedir}" 
name="base.dir" />
-                                    <property name="test.skipped" 
value="${maven.test.skip}" />
-                                    <property name="test.classpath" 
refid="maven.test.classpath" />
-                                </ant>
-                            </tasks>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-jar-plugin</artifactId>
-                <configuration>
-                    <archive>
-                        
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
-                        <manifestEntries>
-                            <Specification-Title>Apache James MPT 
AntLib</Specification-Title>
-                            
<Specification-Version>${project.version}</Specification-Version>
-                            <Specification-Vendor>The Apache Software 
Foundation</Specification-Vendor>
-                            <Implementation-Title>Apache James MPT 
AntLib</Implementation-Title>
-                            
<Implementation-Version>${project.version}</Implementation-Version>
-                            <Implementation-Vendor>The Apache Software 
Foundation</Implementation-Vendor>
-                            
<Implementation-Vendor-Id>org.apache</Implementation-Vendor-Id>
-                            <url>${project.url}</url>
-                        </manifestEntries>
-                    </archive>
-                </configuration>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>test-jar</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <version>${felix.plugin.version}</version>
-                <extensions>true</extensions>
-                <configuration>
-                    <instructions>
-                        
<Export-Package>org.apache.james.mpt.ant</Export-Package>
-                        <Embed-Dependency>*;scope=runtime</Embed-Dependency>
-                    </instructions>
-                </configuration>
-                <executions>
-                    <execution>
-                        <id>bundle-manifest</id>
-                        <goals>
-                            <goal>manifest</goal>
-                        </goals>
-                        <phase>process-classes</phase>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-javadoc-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>create-javadocs</id>
-                        <goals>
-                            <goal>javadoc</goal>
-                            <goal>jar</goal>
-                        </goals>
-                        <phase>package</phase>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-</project>
diff --git 
a/mpt/antlib/src/main/java/org/apache/james/mpt/ant/MailProtocolTestTask.java 
b/mpt/antlib/src/main/java/org/apache/james/mpt/ant/MailProtocolTestTask.java
deleted file mode 100644
index 24c8570..0000000
--- 
a/mpt/antlib/src/main/java/org/apache/james/mpt/ant/MailProtocolTestTask.java
+++ /dev/null
@@ -1,426 +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.james.mpt.ant;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Optional;
-
-import org.apache.james.core.Username;
-import org.apache.james.mpt.Runner;
-import org.apache.james.mpt.api.ImapFeatures;
-import org.apache.james.mpt.api.ImapFeatures.Feature;
-import org.apache.james.mpt.api.Monitor;
-import org.apache.james.mpt.host.ExternalHostSystem;
-import org.apache.james.mpt.protocol.ProtocolSessionBuilder;
-import org.apache.james.mpt.user.ScriptedUserAdder;
-import org.apache.james.util.Port;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.types.Resource;
-import org.apache.tools.ant.types.ResourceCollection;
-import org.apache.tools.ant.types.resources.FileResource;
-import org.apache.tools.ant.types.resources.Union;
-
-/**
- * Task executes MPT scripts against a server
- * running on a given port and host.
- */
-public class MailProtocolTestTask extends Task implements Monitor {
-
-    private static final ImapFeatures SUPPORTED_FEATURES = 
ImapFeatures.of(Feature.NAMESPACE_SUPPORT);
-    
-    private boolean quiet = false;
-    private File script;
-    private Union scripts;
-    private Optional<Port> port = Optional.empty();
-    private String host = "127.0.0.1";
-    private boolean skip = false;
-    private String shabang = null;
-    private final Collection<AddUser> users = new ArrayList<>();
-    private String errorProperty;
-    
-    /**
-     * Gets the error property.
-     * 
-     * @return name of the ant property to be set on error,
-     * null if the script should terminate on error
-     */
-    public String getErrorProperty() {
-        return errorProperty;
-    }
-
-    /**
-     * Sets the error property.
-     * @param errorProperty name of the ant property to be set on error,
-     * nul if the script should terminate on error
-     */
-    public void setErrorProperty(String errorProperty) {
-        this.errorProperty = errorProperty;
-    }
-
-    /**
-     * Should progress output be suppressed?
-     * @return true if progress information should be suppressed,
-     * false otherwise
-     */
-    public boolean isQuiet() {
-        return quiet;
-    }
-
-    /**
-     * Sets whether progress output should be suppressed/
-     * @param quiet true if progress information should be suppressed,
-     * false otherwise
-     */
-    public void setQuiet(boolean quiet) {
-        this.quiet = quiet;
-    }
-
-    /**
-     * Should the execution be skipped?
-     * @return true if exection should be skipped, 
-     * otherwise false
-     */
-    public boolean isSkip() {
-        return skip;
-    }
-
-    /**
-     * Sets execution skipping.
-     * @param skip true to skip excution
-     */
-    public void setSkip(boolean skip) {
-        this.skip = skip;
-    }
-
-    /**
-     * Gets the host (either name or number) against which this
-     * test will run.
-     * @return host, not null
-     */
-    public String getHost() {
-        return host;
-    }
-
-    /**
-     * Sets the host (either name or number) against which this
-     * test will run.
-     * @param host not null
-     */
-    public void setHost(String host) {
-        this.host = host;
-    }
-
-    /**
-     * Gets the port against which this test will run.
-     * @return port number
-     */
-    public int getPort() {
-        return port
-            .map(Port::getValue)
-            .orElseThrow(() -> new RuntimeException("Port must be set"));
-    }
-
-    /**
-     * Sets the port aginst which this test will run.
-     * @param port port number
-     */
-    public void setPort(int port) {
-        this.port = Optional.of(new Port(port));
-    }
-
-    /**
-     * Gets the script to execute.
-     * @return file containing test script
-     */
-    public File getScript() {
-        return script;
-    }
-
-    /**
-     * Sets the script to execute.
-     * @param script not null
-     */
-    public void setScript(File script) {
-        this.script = script;
-    }
-
-    /**
-     * Gets script shabang.
-     * This will be substituted for the first server response.
-     * @return script shabang, 
-     * or null for no shabang
-     */
-    public String getShabang() {
-        return shabang;
-    }
-    
-    /**
-     * Sets the script shabang.
-     * When not null, this value will be used to be substituted for the 
-     * first server response.
-     * @param shabang script shabang, 
-     * or null for no shabang.
-     */
-    public void setShabang(String shabang) {
-        this.shabang = shabang;
-    }
-
-    @Override
-    public void execute() throws BuildException {
-        if (! port.isPresent()) {
-            throw new BuildException("Port must be set");
-        }
-        
-        if (scripts == null && script == null) {
-            throw new BuildException("Scripts must be specified as an embedded 
resource collection"); 
-        }
-        
-        if (scripts != null && script != null) {
-            throw new BuildException("Scripts can be specified either by the 
script attribute or as resource collections but not both."); 
-        }
-        
-        for (AddUser user: users) {
-            user.validate();
-        }
-        
-        if (skip) {
-            log("Skipping excution");
-        } else if (errorProperty == null) {
-            doExecute();
-        } else {
-            try {
-                doExecute();
-            } catch (BuildException e) {
-                final Project project = getProject();
-                project.setProperty(errorProperty, e.getMessage());
-                log(e, Project.MSG_DEBUG);
-            }
-        }
-    }
-
-    public void add(ResourceCollection resources) {
-        if (scripts == null) {
-            scripts = new Union();
-        }
-        scripts.add(resources);
-    }
-    
-    private void doExecute() throws BuildException {
-        for (AddUser userAdder: users) {
-            userAdder.execute();
-        }
-        
-        final ExternalHostSystem host = new 
ExternalHostSystem(SUPPORTED_FEATURES, getHost(), port.get(), this, 
getShabang(), null);
-        final ProtocolSessionBuilder builder = new ProtocolSessionBuilder();
-        
-        if (scripts == null) {
-            scripts = new Union();
-            scripts.add(new FileResource(script));
-        }
-
-        for (final Resource resource : scripts) {
-            try {
-                final Runner runner = new Runner();
-
-                try {
-
-                    final InputStream inputStream = resource.getInputStream();
-                    final String name = resource.getName();
-                    builder.addProtocolLines(name == null ? "[Unknown]" : 
name, inputStream, runner.getTestElements());
-                    runner.runSessions(host);
-
-                } catch (UnsupportedOperationException e) {
-                    log("Resource cannot be read: " + resource.getName(), 
Project.MSG_WARN);
-                }
-            } catch (IOException e) {
-                throw new BuildException("Cannot load script " + 
resource.getName(), e);
-            } catch (Exception e) {
-                log(e.getMessage(), Project.MSG_ERR);
-                throw new BuildException("[FAILURE] in script " + 
resource.getName() + "\n" + e.getMessage(), e);
-            }
-
-        }
-    
-    }
-    
-    public AddUser createAddUser() {
-        final AddUser result = new AddUser();
-        users.add(result);
-        return result;
-    }
-
-    /**
-     * Adds a user.
-     */
-    public class AddUser {
-        
-        private Port port;
-        private String user;
-        private String passwd;
-        private File script;
-        private String scriptText;
-
-        /**
-         * Gets the port against which the user addition
-         * script should be executed.
-         * @return port number
-         */
-        public int getPort() {
-            return port.getValue();
-        }
-
-        /**
-         * Sets the port against which the user addition
-         * script should be executed.
-         * @param port port number
-         */
-        public void setPort(int port) {
-            this.port = new Port(port);
-        }
-
-        /**
-         * Gets the password for the user.
-         * @return password not null
-         */
-        public String getPasswd() {
-            return passwd;
-        }
-
-        /**
-         * Sets the password for the user.
-         * This will be passed in the user creation script.
-         * @param passwd not null
-         */
-        public void setPasswd(String passwd) {
-            this.passwd = passwd;
-        }
-
-        /**
-         * Gets the name of the user to be created.
-         * @return user name, not null
-         */
-        public String getUser() {
-            return user;
-        }
-
-        /**
-         * Sets the name of the user to be created.
-         * @param user not null
-         */
-        public void setUser(String user) {
-            this.user = user;
-        }
-        
-        /**
-         * Sets user addition script.
-         * @param scriptText not null
-         */
-        public void addText(String scriptText) {
-            this.scriptText = getProject().replaceProperties(scriptText);
-        }
-
-        /**
-         * Gets the file containing the user creation script.
-         * @return not null
-         */
-        public File getScript() {
-            return script;
-        }
-
-        /**
-         * Sets the file containing the user creation script.
-         * @param script not null
-         */
-        public void setScript(File script) {
-            this.script = script;
-        }
-        
-        /**
-         * Validates mandatory fields have been filled.
-         */
-        void validate() throws BuildException {
-            if (script == null && scriptText == null) {
-                throw new BuildException("Either the 'script' attribute must 
be set, or the body must contain the text of the script");
-            }
-            
-            if (script != null && scriptText != null) {
-                throw new BuildException("Choose either script text or script 
attribute but not both.");
-            }
-            
-            if (port == null) {
-                throw new BuildException("'port' attribute must be set on 
AddUser to the port against which the script should run.");
-            }
-        }
-        
-        /**
-         * Creates a user.
-         * @throws BuildException
-         */
-        void execute() throws BuildException {
-            validate();
-            try {
-                final File scriptFile = getScript();
-                final ScriptedUserAdder adder = new 
ScriptedUserAdder(getHost(), port, MailProtocolTestTask.this);
-                try (Reader reader = newReader(scriptFile)) {
-                    adder.addUser(Username.of(getUser()), getPasswd(), reader);
-                }
-            } catch (Exception e) {
-                log(e.getMessage(), Project.MSG_ERR);
-                throw new BuildException("User addition failed: \n" + 
e.getMessage(), e);
-            }
-        }
-
-        private Reader newReader(File scriptFile) throws FileNotFoundException 
{
-            if (scriptFile == null) {
-                return new StringReader(scriptText);
-            }
-            return new FileReader(scriptFile);
-        }
-    }
-
-    @Override
-    public void note(String message) {
-        if (quiet) {
-            log(message, Project.MSG_DEBUG);
-        } else {
-            log(message, Project.MSG_INFO);
-        }
-    }
-
-    @Override
-    public void debug(char character) {
-        log("'" + character + "'", Project.MSG_DEBUG);
-    }
-
-    @Override
-    public void debug(String message) {
-        log(message, Project.MSG_DEBUG);
-    }
-}
diff --git a/mpt/antlib/src/main/resources/org/apache/james/mpt/ant/antlib.xml 
b/mpt/antlib/src/main/resources/org/apache/james/mpt/ant/antlib.xml
deleted file mode 100644
index eed1393..0000000
--- a/mpt/antlib/src/main/resources/org/apache/james/mpt/ant/antlib.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version='1.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.                                           *
-
--->
-
-<antlib>
-  <typedef name="mpt"
-    classname="org.apache.james.mpt.ant.MailProtocolTestTask"/>
-</antlib>
\ No newline at end of file
diff --git a/mpt/antlib/src/reporting-site/site.xml 
b/mpt/antlib/src/reporting-site/site.xml
deleted file mode 100644
index d919164..0000000
--- a/mpt/antlib/src/reporting-site/site.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-    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.    
--->
-<project name="${project.name}">
-
-    <body>
-
-        <menu ref="parent" />
-        <menu ref="reports" />
-
-    </body>
-
-</project>
diff --git a/mpt/antlib/src/site/resources/images/asf-logo-reduced.gif 
b/mpt/antlib/src/site/resources/images/asf-logo-reduced.gif
deleted file mode 100644
index 93cc102..0000000
Binary files a/mpt/antlib/src/site/resources/images/asf-logo-reduced.gif and 
/dev/null differ
diff --git a/mpt/antlib/src/site/resources/images/james-mpt-logo.gif 
b/mpt/antlib/src/site/resources/images/james-mpt-logo.gif
deleted file mode 100644
index 9a75b4f..0000000
Binary files a/mpt/antlib/src/site/resources/images/james-mpt-logo.gif and 
/dev/null differ
diff --git a/mpt/antlib/src/site/site.xml b/mpt/antlib/src/site/site.xml
deleted file mode 100644
index 5437b74..0000000
--- a/mpt/antlib/src/site/site.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  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.    
--->
-<project name="JAMES Mail Protocol Tester (MPT)">
-
-  <body>
-
-    <menu ref="parent" />
-
-    <menu name="MPT AntLib">
-      <item name="Overview" href="index.html"/>
-      <item 
-          name="DOAP"
-          href="doap_apache-james-mpt-antlib.rdf"
-          img='http://www.w3.org/RDF/icons/rdf_metadata_button.32'/>
-    </menu>
-    
-    <menu ref="reports" />
-
-  </body>
-</project>
diff --git a/mpt/antlib/src/site/xdoc/index.xml 
b/mpt/antlib/src/site/xdoc/index.xml
deleted file mode 100644
index d95095b..0000000
--- a/mpt/antlib/src/site/xdoc/index.xml
+++ /dev/null
@@ -1,183 +0,0 @@
-<?xml version="1.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.    
--->
-
-<document>
-
- <properties>
-  <title>Overview</title>
-  <author email="[email protected]">Mail Protocol Tester 
AntLib</author>
- </properties>
-
-<body>
-<section name="What is the Apache James MPT?">
-<p>
-Apache James Mail Protocol Tester (MPT) is a library providing a framework for 
the 
-scritable functional testing of ASCII based line protocols.</p>
-<p>
-An antlib defines a suite of extensions for <a 
href='http://ant.apache.org'>Apache Ant</a>.
-This antlib defines a suite of functional testing tools particularly suitable 
for 
-use with ASCII based line protocols (as are common in mail).
-</p>
-</section>
-<section name='Usage'>
-<p>
-See: 
-</p>
-<ul>
-<li>Apache Ant <a 
href='http://ant.apache.org/manual/CoreTypes/antlib.html'>manual</a></li>
-<li><a 
href='http://www.onjava.com/pub/a/onjava/2006/08/09/ant-1-7-using-antlibs.html'>Using
 AntLibs</a> (article)</li>
-<li><a 
href='http://www.oracle.com/technology/pub/articles/bodewig_taskwriters.html'>Ant
 1.6 for Task Writers</a> (article)</li>
-</ul>
-</section>
-<section name='Tasks'>
-<subsection name='mpt'>
-<p>
-Executes <a href='../main'>MPT</a> scripts against a running independent 
server.
-If these scripts require users then these can be added by script by using the 
<code>AddUser</code>
-element.
-</p>
-<subsection name='Parameters'>
-<table> 
-<tr>
-    <td><strong>Attribute</strong></td> <td><strong>Description</strong></td> 
<td><strong>Required</strong></td>
-</tr> 
-<tr>
-    <td>port</td>
-    <td>Port number that the scripts should be executed against</td>
-    <td>Yes</td>
-</tr>
-<tr>
-    <td>host</td>
-    <td>Host name or IP address of the server against which the scripts should 
be executed</td>
-    <td>No (Defaults to <code>127.0.0.1</code>)</td>
-</tr> 
-<tr>
-    <td>script</td>
-    <td>File containing a script to be executed. To execute multiple scripts,
-    use a <a href='#Any Resource Collection'>Resource Collection</a></td>
-    <td>When no resource collections elements exist</td>
-</tr> 
-<tr>
-    <td>skip</td>
-    <td>Skips execution of scripts. For simple conditional execution.</td>
-    <td>No</td>
-</tr> 
-<tr>
-    <td>shabang</td> 
-    <td>Optional server shabang will be substituted for first server 
response.</td> 
-    <td>No</td>
-</tr>
-<tr>
-    <td>quiet</td> 
-    <td>Optional boolean setting when true will suppress progress output.</td> 
-    <td>No (defaults to false)</td>
-</tr>
-<tr>
-    <td>errorproperty</td> 
-    <td>Optionally names a property which will be set (with error message) 
when test fails.
-    When unset, the build will terminate when test fails.</td> 
-    <td>No</td>
-</tr>
-</table>
-</subsection>
-
-<subsection name='Nested Elements'>
-<subsection name='Any Resource Collection'>
-<p>
-<a 
href='http://ant.apache.org/manual/CoreTypes/resources.html#collection'>Resource
 Collection</a>s
-are used to specify a group of scripts to execute. When resource collections 
are set, attribute <code>
-</code>
-</p>
-</subsection>
-<subsection name='AddUser'>
-<p>
-Allows scripted addition of any users required by the tests. 
-The port can vary but the host is inherited.
-</p>
-<table> 
-<tr>
-    <td><strong>Attribute</strong></td> <td><strong>Description</strong></td> 
<td><strong>Required</strong></td>
-</tr> 
-<tr>
-    <td>port</td>
-    <td>Port number that the user addition script should be executed 
against</td>
-    <td>Yes</td>
-</tr>
-
-<tr>
-    <td>passwd</td>
-    <td>Password to be set for user created. Will be passed to the script.</td>
-    <td>No</td>
-</tr> 
-
-<tr>
-    <td>user</td>
-    <td>Name of the user to be created. Will be passed to the script.</td>
-    <td>No</td>
-</tr> 
-
-<tr>
-    <td>script</td>
-    <td>File containing the user creation script</td>
-    <td>Either this attribute must be set, or the user addition script </td>
-</tr> 
-</table>
-<p>
-User addition scripts are typically short. As an alternative to the script 
attribute
-(which specifies the file containing the script), the script text can be added 
directly
-as text to the body of this element.
-</p>
-</subsection>
-</subsection>
-<subsection name='Examples'>
-<source>
-<![CDATA[
-<project 
-    name="tests" 
-    default="main" 
-    xmlns:mpt="antlib:org.apache.james.mpt.ant">
-
-    <!-- Connect to port 10000 on localhost and run all scripts in 
src/test/resources/ -->
-    <target name='ConnectToServerPort10000'>
-        <mpt:mpt port='10000'>
-            <fileset dir='src/test/resources/>
-               <include name='**/*.mpt'/>
-            </fileset>
-        </mpt:mpt>
-    </target>
-    
-    <!-- 
-    Connects to port 4001 on example.org then runs user addition script
-    Then connects to port 143 on example.org and runs test script 'test.mpt'
-    -->
-    <target name='ConnectToExampleDotOrgPort143'>
-        <mpt:mpt port='143' host='example.org' script='test.mpt'>
-            <!-- Add users by running 'Add User "${user}" "${passwd}"' -->
-            <addUser port='4001' user='user' passwd='passwd'>C: Add User 
"${user}" "${passwd}"</addUser>
-        </mpt:mpt>
-    </target>
-</project>
-]]>
-</source>
-</subsection>
-</subsection>
-</section>
-</body>
-</document>
\ No newline at end of file
diff --git a/mpt/antlib/src/test/java/org/apache/james/mpt/ant/TestAddUser.java 
b/mpt/antlib/src/test/java/org/apache/james/mpt/ant/TestAddUser.java
deleted file mode 100644
index 2b1ec72..0000000
--- a/mpt/antlib/src/test/java/org/apache/james/mpt/ant/TestAddUser.java
+++ /dev/null
@@ -1,68 +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.james.mpt.ant;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import org.apache.james.mpt.DiscardProtocol;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.types.resources.Union;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TestAddUser {
-
-    DiscardProtocol fakeServer;
-    
-    DiscardProtocol.Record record;
-    
-    MailProtocolTestTask subject;
-    
-    @Before
-    public void setUp() throws Exception {
-        fakeServer = new DiscardProtocol();
-        fakeServer.start();
-        record = fakeServer.recordNext();
-        
-        subject = new MailProtocolTestTask();
-        subject.setHost("127.0.0.1");
-        subject.setPort(fakeServer.getPort().getValue());
-        subject.add(new Union());
-        subject.setProject(new Project());
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        fakeServer.stop();
-    }
-
-    @Test
-    public void testShouldExecuteScriptAgainstPort() throws Exception {
-        MailProtocolTestTask.AddUser user = subject.createAddUser();
-        user.setPort(fakeServer.getPort().getValue());
-        user.setPasswd("PASSWORD");
-        user.setUser("USER");
-        final String script = "This script adds a user";
-        user.addText("C: " + script);
-        subject.execute();
-        assertThat(record.complete()).isEqualTo(script + "\r\n");
-    }
-}
diff --git 
a/mpt/antlib/src/test/java/org/apache/james/mpt/ant/TestRunScripts.java 
b/mpt/antlib/src/test/java/org/apache/james/mpt/ant/TestRunScripts.java
deleted file mode 100644
index 04aef79..0000000
--- a/mpt/antlib/src/test/java/org/apache/james/mpt/ant/TestRunScripts.java
+++ /dev/null
@@ -1,102 +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.james.mpt.ant;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.InputStream;
-
-import org.apache.james.mpt.DiscardProtocol;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.types.Resource;
-import org.apache.tools.ant.types.resources.StringResource;
-import org.apache.tools.ant.types.resources.Union;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TestRunScripts {
-
-    private static final String SCRIPT = "A script";
-
-    Union stubResourceCollection;
-    Resource stubResource;
-    
-    DiscardProtocol fakeServer;
-    DiscardProtocol.Record record;
-    
-    MailProtocolTestTask subject;
-    
-    @Before
-    public void setUp() throws Exception {
-        fakeServer = new DiscardProtocol();
-        fakeServer.start();
-        record = fakeServer.recordNext();
-        
-        stubResourceCollection = new Union();        
-        stubResource = new StringResource("C: " + SCRIPT);
-        stubResourceCollection.add(stubResource);
-        
-        subject = new MailProtocolTestTask();
-        subject.setHost("127.0.0.1");
-        subject.setPort(fakeServer.getPort().getValue());
-        subject.setProject(new Project());
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        fakeServer.stop();
-    }
-
-    @Test
-    public void testIgnoreUnsupportedResource() throws Exception {
-        final Resource unsupportedResource = new StringResource() {
-            @Override
-            public InputStream getInputStream() {
-                throw new UnsupportedOperationException();
-            }
-        };
-        stubResourceCollection.add(unsupportedResource);
-        subject.add(stubResourceCollection);
-        subject.execute();
-        assertThat(record.complete()).isEqualTo(SCRIPT + "\r\n");
-    }
-
-    @Test
-    public void testRunOneScriptFromCollection() throws Exception {
-        subject.add(stubResourceCollection);
-        subject.execute();
-        assertThat(record.complete()).isEqualTo(SCRIPT + "\r\n");
-    }
-
-    @Test
-    public void testRunOneScriptFromAttribute() throws Exception {
-        final File file = File.createTempFile("Test", "mpt");
-        file.deleteOnExit();
-        final FileWriter writer = new FileWriter(file);
-        writer.write("C: " + SCRIPT);
-        writer.close();
-        subject.setScript(file);
-        subject.execute();
-        assertThat(record.complete()).isEqualTo(SCRIPT + "\r\n");
-    }
-}
diff --git a/mpt/antlib/src/test/resources/build.xml 
b/mpt/antlib/src/test/resources/build.xml
deleted file mode 100644
index f3946a7..0000000
--- a/mpt/antlib/src/test/resources/build.xml
+++ /dev/null
@@ -1,140 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.    
--->
-<project name="tests" default="all" xmlns:au="antlib:org.apache.ant.antunit" 
xmlns:mpt="antlib:org.apache.james.mpt.ant">
-
-    <taskdef uri="antlib:org.apache.ant.antunit" 
resource="org/apache/ant/antunit/antlib.xml" classpath="${test.classpath}" />
-
-    <taskdef uri="antlib:org.apache.james.mpt.ant" 
resource="org/apache/james/mpt/ant/antlib.xml">
-        <classpath>
-            <pathelement location="${jar.name}" />
-            <pathelement path='${test.classpath}' />
-        </classpath>
-    </taskdef>
-
-    <target name='testMustNotAllowScriptsAndScript'>
-        <au:expectfailure>
-            <mpt:mpt skip='true' port='10000' script='pom.xml'>
-                <fileset dir='${basedir}' />
-            </mpt:mpt>
-        </au:expectfailure>
-    </target>
-
-    <target name='testMustSetScriptsOrScript'>
-        <au:expectfailure>
-            <mpt:mpt skip='true' port='10000' />
-        </au:expectfailure>
-        <mpt:mpt port='10000' skip='true'>
-            <fileset dir='${basedir}' />
-        </mpt:mpt>
-        <mpt:mpt port='10000' skip='true' script='pom.xml' />
-    </target>
-
-    <target name='testMustSetPort'>
-        <au:expectfailure>
-            <mpt:mpt skip='true'>
-                <fileset dir='${basedir}' />
-            </mpt:mpt>
-        </au:expectfailure>
-        <mpt:mpt port='10000' skip='true'>
-            <fileset dir='${basedir}' />
-        </mpt:mpt>
-    </target>
-
-    <target name='testMaySetHost'>
-        <mpt:mpt port='10000' skip='true' host='example.org'>
-            <fileset dir='${basedir}' />
-        </mpt:mpt>
-        <mpt:mpt port='10000' skip='true' host='10.0.0.66'>
-            <fileset dir='${basedir}' />
-        </mpt:mpt>
-    </target>
-    
-    <target name='testMaySetShabang'>
-        <mpt:mpt port='10000' skip='true' shabang='Whatever'>
-            <fileset dir='${basedir}' />
-        </mpt:mpt>
-    </target>
-        
-    <target name='testMaySetQuiet'>
-            <mpt:mpt port='10000' skip='true' quiet='true'>
-                <fileset dir='${basedir}' />
-            </mpt:mpt>
-    </target>
-
-    <target name='testMaySetErrorProperty'>
-            <mpt:mpt port='10000' skip='true' errorproperty='mpt.failed'>
-                <fileset dir='${basedir}' />
-            </mpt:mpt>
-    </target>
-
-    <target name='testShouldAllowAddUserToBeSet'>
-        <mpt:mpt port='10000' skip='true' host='example.org'>
-            <fileset dir='${basedir}' />
-            <addUser port='10001' user='user' passwd='passwd' script='pom.xml' 
/>
-        </mpt:mpt>
-    </target>
-
-    <target name='testAddUserMaySetNamePassword'>
-        <mpt:mpt port='10000' skip='true' host='example.org'>
-            <fileset dir='${basedir}' />
-            <addUser port='10001' user='user' passwd='passwd' 
script='pom.xml'/>
-        </mpt:mpt>
-        <mpt:mpt port='10000' skip='true' host='example.org'>
-            <fileset dir='${basedir}' />
-            <addUser port='10001' script='pom.xml'/>
-        </mpt:mpt>
-    </target>
-
-    <target name='testAddUserMustSetPortScript'>
-        <au:expectfailure>
-            <mpt:mpt port='10000' skip='true' host='example.org'>
-                <fileset dir='${basedir}' />
-                <addUser script='pom.xml' />
-            </mpt:mpt>
-        </au:expectfailure>
-        <au:expectfailure>
-            <mpt:mpt port='10000' skip='true' host='example.org'>
-                <fileset dir='${basedir}' />
-                <addUser port='10001'/>
-            </mpt:mpt>
-        </au:expectfailure>
-    </target>
-
-    <target name='testAddUserMayIncludeScriptText'>
-        <mpt:mpt port='10000' skip='true' host='example.org'>
-            <fileset dir='${basedir}'/>
-            <addUser port='10000' user='user' passwd='passwd'>C: Foo 
Bar</addUser>
-        </mpt:mpt>
-    </target>
-    
-    <target name='testAddUserBothScriptTextAndScriptAttributeMayNotBeSet'>
-        <au:expectfailure>
-            <mpt:mpt port='10000' skip='true' host='example.org'>
-                <fileset dir='${basedir}'/>
-                <addUser port='10000' user='user' passwd='passwd' 
script='pom.xml'>C: Foo Bar</addUser>
-            </mpt:mpt>
-        </au:expectfailure>
-    </target>
-
-    <target name='testMptAttributes' depends='testMustSetPort, 
testMaySetHost,testMustSetScriptsOrScript, testMustNotAllowScriptsAndScript, 
testMaySetShabang, testMaySetQuiet, testMaySetErrorProperty'/>
-    <target name='testAddUser' depends='testShouldAllowAddUserToBeSet, 
testAddUserMustSetPortScript, testAddUserMayIncludeScriptText, 
testAddUserBothScriptTextAndScriptAttributeMayNotBeSet, 
testAddUserMaySetNamePassword'/>
-
-    <target name='all' depends='testMptAttributes, testAddUser'/>
-</project>
diff --git a/mpt/pom.xml b/mpt/pom.xml
index f51691d..9064939 100644
--- a/mpt/pom.xml
+++ b/mpt/pom.xml
@@ -37,7 +37,6 @@
 
     <modules>
         <module>all</module>
-        <module>antlib</module>
         <module>app</module>
         <module>core</module>
         <module>impl/imap-mailbox</module>
diff --git 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/BayesianAnalysis.java
 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/BayesianAnalysis.java
deleted file mode 100644
index 2d07e75..0000000
--- 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/BayesianAnalysis.java
+++ /dev/null
@@ -1,460 +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.james.transport.mailets;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
-import java.io.StringReader;
-import java.sql.Connection;
-import java.text.DecimalFormat;
-import java.util.Collection;
-
-import javax.inject.Inject;
-import javax.mail.MessagingException;
-import javax.mail.internet.MimeMessage;
-import javax.sql.DataSource;
-
-import org.apache.james.core.MailAddress;
-import org.apache.james.filesystem.api.FileSystem;
-import org.apache.james.util.bayesian.JDBCBayesianAnalyzer;
-import org.apache.james.util.sql.JDBCUtil;
-import org.apache.mailet.Attribute;
-import org.apache.mailet.AttributeName;
-import org.apache.mailet.AttributeValue;
-import org.apache.mailet.Experimental;
-import org.apache.mailet.Mail;
-import org.apache.mailet.base.GenericMailet;
-import org.apache.mailet.base.RFC2822Headers;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Joiner;
-
-/**
- * <p>
- * Spam detection mailet using bayesian analysis techniques.
- * </p>
- * 
- * <p>
- * Sets an email message header indicating the probability that an email 
message
- * is SPAM.
- * </p>
- * 
- * <p>
- * Based upon the principals described in: <a
- * href="http://www.paulgraham.com/spam.html";>A Plan For Spam</a> by Paul
- * Graham. Extended to Paul Grahams' <a
- * href="http://paulgraham.com/better.html";>Better Bayesian Filtering</a>.
- * </p>
- * 
- * <p>
- * The analysis capabilities are based on token frequencies (the <i>Corpus</i>)
- * learned through a training process (see {@link BayesianAnalysisFeeder}) and
- * stored in a JDBC database. After a training session, the Corpus must be
- * rebuilt from the database in order to acquire the new frequencies. Every 10
- * minutes a special thread in this mailet will check if any change was made to
- * the database by the feeder, and rebuild the corpus if necessary.
- * </p>
- * 
- * <p>
- * A <code>org.apache.james.spam.probability</code> mail attribute will be
- * created containing the computed spam probability as a
- * {@link java.lang.Double}. The <code>headerName</code> message header string
- * will be created containing such probability in floating point 
representation.
- * </p>
- * 
- * <p>
- * Sample configuration:
- * </p>
- * 
- * <pre>
- * <code>
- * &lt;mailet match="All" class="BayesianAnalysis"&gt;
- *   &lt;repositoryPath&gt;db://maildb&lt;/repositoryPath&gt;
- *   &lt;!--
- *     Set this to the header name to add with the spam probability
- *     (default is "X-MessageIsSpamProbability").
- *   --&gt;
- *   &lt;headerName&gt;X-MessageIsSpamProbability&lt;/headerName&gt;
- *   &lt;!--
- *     Set this to true if you want to ignore messages coming from local 
senders
- *     (default is false).
- *     By local sender we mean a return-path with a local server part (server 
listed
- *     in &lt;servernames&gt; in config.xml).
- *   --&gt;
- *   &lt;ignoreLocalSender&gt;true&lt;/ignoreLocalSender&gt;
- *   &lt;!--
- *     Set this to the maximum message size (in bytes) that a message may have
- *     to be considered spam (default is 100000).
- *   --&gt;
- *   &lt;maxSize&gt;100000&lt;/maxSize&gt;
- *   &lt;!--
- *     Set this to false if you not want to tag the message if spam is 
detected (Default is true).
- *   --&gt;
- *   &lt;tagSubject&gt;true&lt;/tagSubject&gt;
- * &lt;/mailet&gt;
- * </code>
- * </pre>
- * 
- * <p>
- * The probability of being spam is pre-pended to the subject if it is &gt; 0.1
- * (10%).
- * </p>
- * 
- * <p>
- * The required tables are automatically created if not already there (see
- * sqlResources.xml). The token field in both the ham and spam tables is 
<b>case
- * sensitive</b>.
- * </p>
- * 
- * @see BayesianAnalysisFeeder
- * @see org.apache.james.util.bayesian.BayesianAnalyzer
- * @see org.apache.james.util.bayesian.JDBCBayesianAnalyzer
- * @since 2.3.0
- */
-@Experimental
-public class BayesianAnalysis extends GenericMailet {
-    private static final Logger LOGGER = 
LoggerFactory.getLogger(BayesianAnalysis.class);
-
-    /**
-     * The JDBCUtil helper class
-     */
-    private final JDBCUtil theJDBCUtil = new JDBCUtil();
-
-    /**
-     * The JDBCBayesianAnalyzer class that does all the work.
-     */
-    private final JDBCBayesianAnalyzer analyzer = new JDBCBayesianAnalyzer();
-
-    private DataSource datasource;
-
-    private static final AttributeName MAIL_ATTRIBUTE_NAME = 
AttributeName.of("org.apache.james.spam.probability");
-    private static final String HEADER_NAME = "X-MessageIsSpamProbability";
-    private static final long CORPUS_RELOAD_INTERVAL = 600000;
-    private String headerName;
-    private boolean ignoreLocalSender = false;
-    private boolean tagSubject = true;
-
-    /**
-     * Return a string describing this mailet.
-     * 
-     * @return a string describing this mailet
-     */
-    @Override
-    public String getMailetInfo() {
-        return "BayesianAnalysis Mailet";
-    }
-
-    /**
-     * Holds value of property maxSize.
-     */
-    private int maxSize = 100000;
-
-    /**
-     * Holds value of property lastCorpusLoadTime.
-     */
-    private long lastCorpusLoadTime;
-
-    private FileSystem fs;
-
-    /**
-     * Getter for property maxSize.
-     * 
-     * @return Value of property maxSize.
-     */
-    public int getMaxSize() {
-
-        return this.maxSize;
-    }
-
-    /**
-     * Setter for property maxSize.
-     * 
-     * @param maxSize
-     *            New value of property maxSize.
-     */
-    public void setMaxSize(int maxSize) {
-
-        this.maxSize = maxSize;
-    }
-
-    /**
-     * Getter for property lastCorpusLoadTime.
-     * 
-     * @return Value of property lastCorpusLoadTime.
-     */
-    public long getLastCorpusLoadTime() {
-
-        return this.lastCorpusLoadTime;
-    }
-
-    @Inject
-    public void setDataSource(DataSource datasource) {
-        this.datasource = datasource;
-    }
-
-    @Inject
-    public void setFileSystem(FileSystem fs) {
-        this.fs = fs;
-    }
-
-    /**
-     * Sets lastCorpusLoadTime to System.currentTimeMillis().
-     */
-    private void touchLastCorpusLoadTime() {
-
-        this.lastCorpusLoadTime = System.currentTimeMillis();
-    }
-
-    /**
-     * Mailet initialization routine.
-     * 
-     * @throws MessagingException
-     *             if a problem arises
-     */
-    @Override
-    public void init() throws MessagingException {
-        String repositoryPath = getInitParameter("repositoryPath");
-
-        if (repositoryPath == null) {
-            throw new MessagingException("repositoryPath is null");
-        }
-
-        headerName = getInitParameter("headerName", HEADER_NAME);
-
-        ignoreLocalSender = 
Boolean.parseBoolean(getInitParameter("ignoreLocalSender"));
-
-        if (ignoreLocalSender) {
-            LOGGER.debug("Will ignore messages coming from local senders");
-        } else {
-            LOGGER.debug("Will analyze messages coming from local senders");
-        }
-
-        String maxSizeParam = getInitParameter("maxSize");
-        if (maxSizeParam != null) {
-            setMaxSize(Integer.parseInt(maxSizeParam));
-        }
-        LOGGER.debug("maxSize: {}", getMaxSize());
-
-        String tag = getInitParameter("tagSubject");
-        if (tag != null && tag.equals("false")) {
-            tagSubject = false;
-        }
-
-        initDb();
-
-        CorpusLoader corpusLoader = new CorpusLoader(this);
-        corpusLoader.setDaemon(true);
-        corpusLoader.start();
-
-    }
-
-    private void initDb() throws MessagingException {
-
-        try {
-            analyzer.initSqlQueries(datasource.getConnection(), 
fs.getFile("file://conf/sqlResources.xml"));
-        } catch (Exception e) {
-            throw new MessagingException("Exception initializing queries", e);
-        }
-
-        try {
-            loadData(datasource.getConnection());
-        } catch (java.sql.SQLException se) {
-            throw new MessagingException("SQLException loading data", se);
-        }
-    }
-
-    /**
-     * Scans the mail and determines the spam probability.
-     * 
-     * @param mail
-     *            The Mail message to be scanned.
-     * @throws MessagingException
-     *             if a problem arises
-     */
-    @Override
-    public void service(Mail mail) throws MessagingException {
-
-        try {
-            MimeMessage message = mail.getMessage();
-
-            if (ignoreLocalSender) {
-                // ignore the message if the sender is local
-                if (isSenderLocal(mail)) {
-                    return;
-                }
-            }
-
-            String[] headerArray = message.getHeader(headerName);
-            // ignore the message if already analyzed
-            if (headerArray != null && headerArray.length > 0) {
-                return;
-            }
-
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
-            double probability;
-
-            if (message.getSize() < getMaxSize()) {
-                message.writeTo(baos);
-                probability = analyzer.computeSpamProbability(new 
BufferedReader(new StringReader(baos.toString())));
-            } else {
-                probability = 0.0;
-            }
-
-            mail.setAttribute(new Attribute(MAIL_ATTRIBUTE_NAME, 
AttributeValue.of(probability)));
-            message.setHeader(headerName, Double.toString(probability));
-
-            DecimalFormat probabilityForm = (DecimalFormat) 
DecimalFormat.getInstance();
-            probabilityForm.applyPattern("##0.##%");
-            String probabilityString = probabilityForm.format(probability);
-
-            String senderString = mail.getMaybeSender().asString("null");
-
-            if (probability > 0.1) {
-                if (LOGGER.isDebugEnabled()) {
-                    LOGGER.debug(headerName + ": " + probabilityString + "; 
From: " + senderString + "; Recipient(s): " + 
getAddressesString(mail.getRecipients()));
-                }
-
-                // Check if we should tag the subject
-                if (tagSubject) {
-                    appendToSubject(message, " [" + probabilityString + 
(probability > 0.9 ? " SPAM" : " spam") + "]");
-                }
-            }
-
-            saveChanges(message);
-
-        } catch (Exception e) {
-            LOGGER.error("Exception: {}", e.getMessage(), e);
-            throw new MessagingException("Exception thrown", e);
-        }
-    }
-
-    private boolean isSenderLocal(Mail mail) {
-        return mail.getMaybeSender().asOptional()
-            .map(MailAddress::getDomain)
-            .map(domain -> getMailetContext().isLocalServer(domain))
-            .orElse(false);
-    }
-
-    private void loadData(Connection conn) throws java.sql.SQLException {
-
-        try {
-            // this is synchronized to avoid concurrent update of the corpus
-            synchronized (JDBCBayesianAnalyzer.DATABASE_LOCK) {
-                analyzer.tokenCountsClear();
-                analyzer.loadHamNSpam(conn);
-                analyzer.buildCorpus();
-                analyzer.tokenCountsClear();
-            }
-
-            LOGGER.error("BayesianAnalysis Corpus loaded");
-
-            touchLastCorpusLoadTime();
-
-        } finally {
-            if (conn != null) {
-                theJDBCUtil.closeJDBCConnection(conn);
-            }
-        }
-
-    }
-
-    private String getAddressesString(Collection<MailAddress> addresses) {
-        if (addresses == null) {
-            return "null";
-        }
-
-        StringBuilder sb = new StringBuilder();
-        sb.append('[');
-        Joiner.on(", ").appendTo(sb, addresses);
-        sb.append(']');
-        return sb.toString();
-    }
-
-    private void appendToSubject(MimeMessage message, String toAppend) {
-        try {
-            String subject = message.getSubject();
-
-            if (subject == null) {
-                message.setSubject(toAppend, "iso-8859-1");
-            } else {
-                message.setSubject(toAppend + " " + subject, "iso-8859-1");
-            }
-        } catch (MessagingException ex) {
-            LOGGER.error("Ignored error while modifying subject", ex);
-        }
-    }
-
-    /**
-     * Saves changes resetting the original message id.
-     */
-    private void saveChanges(MimeMessage message) throws MessagingException {
-        String messageId = message.getMessageID();
-        message.saveChanges();
-        if (messageId != null) {
-            message.setHeader(RFC2822Headers.MESSAGE_ID, messageId);
-        }
-    }
-
-    private static class CorpusLoader extends Thread {
-
-        private final BayesianAnalysis analysis;
-
-        private CorpusLoader(BayesianAnalysis analysis) {
-            super("BayesianAnalysis Corpus Loader");
-            this.analysis = analysis;
-        }
-
-        /**
-         * Thread entry point.
-         */
-        @Override
-        public void run() {
-            LOGGER.info("CorpusLoader thread started: will wake up every " + 
CORPUS_RELOAD_INTERVAL + " ms");
-
-            try {
-                Thread.sleep(CORPUS_RELOAD_INTERVAL);
-
-                while (true) {
-                    if (analysis.getLastCorpusLoadTime() < 
JDBCBayesianAnalyzer.getLastDatabaseUpdateTime()) {
-                        LOGGER.info("Reloading Corpus ...");
-                        try {
-                            
analysis.loadData(analysis.datasource.getConnection());
-                            LOGGER.info("Corpus reloaded");
-                        } catch (java.sql.SQLException se) {
-                            LOGGER.error("SQLException: ", se);
-                        }
-
-                    }
-
-                    if (Thread.interrupted()) {
-                        break;
-                    }
-                    Thread.sleep(CORPUS_RELOAD_INTERVAL);
-                }
-            } catch (InterruptedException ex) {
-                interrupt();
-            }
-        }
-
-    }
-
-}
diff --git 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/BayesianAnalysisFeeder.java
 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/BayesianAnalysisFeeder.java
deleted file mode 100644
index 38d8717..0000000
--- 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/BayesianAnalysisFeeder.java
+++ /dev/null
@@ -1,336 +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.james.transport.mailets;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
-import java.io.StringReader;
-import java.sql.Connection;
-import java.util.Enumeration;
-
-import javax.inject.Inject;
-import javax.mail.Header;
-import javax.mail.MessagingException;
-import javax.mail.internet.MimeMessage;
-import javax.sql.DataSource;
-
-import org.apache.james.filesystem.api.FileSystem;
-import org.apache.james.util.bayesian.JDBCBayesianAnalyzer;
-import org.apache.james.util.sql.JDBCUtil;
-import org.apache.mailet.Experimental;
-import org.apache.mailet.Mail;
-import org.apache.mailet.base.GenericMailet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * <p>
- * Feeds ham OR spam messages to train the {@link BayesianAnalysis} mailet.
- * </p>
- * 
- * <p>
- * The new token frequencies will be stored in a JDBC database.
- * </p>
- * 
- * <p>
- * Sample configuration:
- * </p>
- * 
- * <pre>
- * <code>
- * &lt;processor name="root"&gt;
- * 
- *   &lt;mailet match="[email protected]" 
class="BayesianAnalysisFeeder"&gt;
- *     &lt;repositoryPath&gt; db://maildb &lt;/repositoryPath&gt;
- *     &lt;feedType&gt;ham&lt;/feedType&gt;
- *     &lt;!--
- *       Set this to the maximum message size (in bytes) that a message may 
have
- *       to be analyzed (default is 100000).
- *     --&gt;
- *     &lt;maxSize&gt;100000&lt;/maxSize&gt;
- *   &lt;/mailet&gt;
- * 
- *   &lt;mailet match="[email protected]" 
class="BayesianAnalysisFeeder"&gt;
- *     &lt;repositoryPath&gt; db://maildb &lt;/repositoryPath&gt;
- *     &lt;feedType&gt;spam&lt;/feedType&gt;
- *     &lt;!--
- *       Set this to the maximum message size (in bytes) that a message may 
have
- *       to be analyzed (default is 100000).
- *     --&gt;
- *     &lt;maxSize&gt;100000&lt;/maxSize&gt;
- *   &lt;/mailet&gt;
- * 
- * &lt;processor&gt;
- * </code>
- * </pre>
- * 
- * <p>
- * The previous example will allow the user to send messages to the server and
- * use the recipient email address as the indicator for whether the message is
- * ham or spam.
- * </p>
- * 
- * <p>
- * Using the example above, send good messages (ham not spam) to the email
- * address "[email protected]" to pump good messages into the feeder, and
- * send spam messages (spam not ham) to the email address "[email protected]"
- * to pump spam messages into the feeder.
- * </p>
- * 
- * <p>
- * The bayesian database tables will be updated during the training reflecting
- * the new data
- * </p>
- * 
- * <p>
- * At the end the mail will be destroyed (ghosted).
- * </p>
- * 
- * <p>
- * <b>The correct approach is to send the original ham/spam message as an
- * attachment to another message sent to the feeder; all the headers of the
- * enveloping message will be removed and only the original message's tokens
- * will be analyzed.</b>
- * </p>
- * 
- * <p>
- * After a training session, the frequency <i>Corpus</i> used by
- * <code>BayesianAnalysis</code> must be rebuilt from the database, in order to
- * take advantage of the new token frequencies. Every 10 minutes a special
- * thread in the <code>BayesianAnalysis</code> mailet will check if any change
- * was made to the database, and rebuild the corpus if necessary.
- * </p>
- * 
- * <p>
- * Only one message at a time is scanned (the database update activity is
- * <i>synchronized</i>) in order to avoid too much database locking, as
- * thousands of rows may be updated just for one message fed.
- * </p>
- * 
- * @see BayesianAnalysis
- * @see org.apache.james.util.bayesian.BayesianAnalyzer
- * @see org.apache.james.util.bayesian.JDBCBayesianAnalyzer
- * @since 2.3.0
- */
-@Experimental
-public class BayesianAnalysisFeeder extends GenericMailet {
-    private static final Logger LOGGER = 
LoggerFactory.getLogger(BayesianAnalysisFeeder.class);
-
-    /**
-     * The JDBCUtil helper class
-     */
-    private final JDBCUtil theJDBCUtil = new JDBCUtil();
-
-    /**
-     * The JDBCBayesianAnalyzer class that does all the work.
-     */
-    private final JDBCBayesianAnalyzer analyzer = new JDBCBayesianAnalyzer();
-
-    private DataSource datasource;
-
-    private String feedType;
-
-    @Override
-    public String getMailetInfo() {
-        return "BayesianAnalysisFeeder Mailet";
-    }
-
-    /**
-     * Holds value of property maxSize.
-     */
-    private int maxSize = 100000;
-
-    private FileSystem fs;
-
-    /**
-     * Getter for property maxSize.
-     * 
-     * @return Value of property maxSize.
-     */
-    public int getMaxSize() {
-
-        return this.maxSize;
-    }
-
-    @Inject
-    public void setDataSource(DataSource datasource) {
-        this.datasource = datasource;
-    }
-
-    /**
-     * Setter for property maxSize.
-     * 
-     * @param maxSize
-     *            New value of property maxSize.
-     */
-    public void setMaxSize(int maxSize) {
-
-        this.maxSize = maxSize;
-    }
-
-    @Inject
-    public void setFileSystem(FileSystem fs) {
-        this.fs = fs;
-    }
-
-    @Override
-    public void init() throws MessagingException {
-        String repositoryPath = getInitParameter("repositoryPath");
-
-        if (repositoryPath == null) {
-            throw new MessagingException("repositoryPath is null");
-        }
-
-        feedType = getInitParameter("feedType");
-        if (feedType == null) {
-            throw new MessagingException("feedType is null");
-        }
-
-        String maxSizeParam = getInitParameter("maxSize");
-        if (maxSizeParam != null) {
-            setMaxSize(Integer.parseInt(maxSizeParam));
-        }
-        LOGGER.debug("maxSize: {}", getMaxSize());
-
-        initDb();
-
-    }
-
-    private void initDb() throws MessagingException {
-
-        try {
-            analyzer.initSqlQueries(datasource.getConnection(), 
fs.getFile("file://conf/sqlResources.xml"));
-        } catch (Exception e) {
-            throw new MessagingException("Exception initializing queries", e);
-        }
-
-    }
-
-    /**
-     * Scans the mail and updates the token frequencies in the database.
-     * 
-     * The method is synchronized in order to avoid too much database locking,
-     * as thousands of rows may be updated just for one message fed.
-     * 
-     * @param mail
-     *            The Mail message to be scanned.
-     */
-    @Override
-    public void service(Mail mail) {
-        boolean dbUpdated = false;
-
-        mail.setState(Mail.GHOST);
-
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
-        Connection conn = null;
-
-        try {
-
-            MimeMessage message = mail.getMessage();
-
-            String messageId = message.getMessageID();
-
-            if (message.getSize() > getMaxSize()) {
-                LOGGER.debug("{} Feeding HAM/SPAM ignored because message size 
> {}: {}", messageId, getMaxSize(), message.getSize());
-                return;
-            }
-
-            clearAllHeaders(message);
-
-            message.writeTo(baos);
-
-            BufferedReader br = new BufferedReader(new 
StringReader(baos.toString()));
-
-            // this is synchronized to avoid concurrent update of the corpus
-            synchronized (JDBCBayesianAnalyzer.DATABASE_LOCK) {
-
-                conn = datasource.getConnection();
-
-                if (conn.getAutoCommit()) {
-                    conn.setAutoCommit(false);
-                }
-
-                dbUpdated = true;
-
-                // Clear out any existing word/counts etc..
-                analyzer.clear();
-
-                if ("ham".equalsIgnoreCase(feedType)) {
-                    LOGGER.debug("{} Feeding HAM", messageId);
-                    // Process the stream as ham (not spam).
-                    analyzer.addHam(br);
-
-                    // Update storage statistics.
-                    analyzer.updateHamTokens(conn);
-                } else {
-                    LOGGER.debug("{} Feeding SPAM", messageId);
-                    // Process the stream as spam.
-                    analyzer.addSpam(br);
-
-                    // Update storage statistics.
-                    analyzer.updateSpamTokens(conn);
-                }
-
-                // Commit our changes if necessary.
-                if (conn != null && dbUpdated && !conn.getAutoCommit()) {
-                    conn.commit();
-                    dbUpdated = false;
-                    LOGGER.debug("{} Training ended successfully", messageId);
-                    JDBCBayesianAnalyzer.touchLastDatabaseUpdateTime();
-                }
-
-            }
-
-        } catch (java.sql.SQLException se) {
-            LOGGER.error("SQLException: ", se);
-        } catch (java.io.IOException ioe) {
-            LOGGER.error("IOException: ", ioe);
-        } catch (javax.mail.MessagingException me) {
-            LOGGER.error("MessagingException: ", me);
-        } finally {
-            // Rollback our changes if necessary.
-            try {
-                if (conn != null && dbUpdated && !conn.getAutoCommit()) {
-                    conn.rollback();
-                    dbUpdated = false;
-                }
-            } catch (Exception e) {
-                LOGGER.error("Ignored error while rolling back", e);
-            }
-            theJDBCUtil.closeJDBCConnection(conn);
-        }
-    }
-
-    private void clearAllHeaders(MimeMessage message) throws 
javax.mail.MessagingException {
-        Enumeration<Header> headers = message.getAllHeaders();
-
-        while (headers.hasMoreElements()) {
-            Header header = headers.nextElement();
-            try {
-                message.removeHeader(header.getName());
-            } catch (MessagingException me) {
-                LOGGER.error("Ignored error while removing header", me);
-            }
-        }
-        message.saveChanges();
-    }
-
-}
diff --git 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/ToRecipientFolder.java
 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/ToRecipientFolder.java
deleted file mode 100644
index 1ab3a2f..0000000
--- 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/ToRecipientFolder.java
+++ /dev/null
@@ -1,99 +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.james.transport.mailets;
-
-import static 
org.apache.james.transport.mailets.LocalDelivery.LOCAL_DELIVERED_MAILS_METRIC_NAME;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.mail.MessagingException;
-
-import org.apache.james.mailbox.MailboxManager;
-import org.apache.james.mailbox.model.MailboxConstants;
-import org.apache.james.metrics.api.MetricFactory;
-import org.apache.james.transport.mailets.delivery.MailDispatcher;
-import org.apache.james.transport.mailets.delivery.MailboxAppender;
-import org.apache.james.transport.mailets.delivery.SimpleMailStore;
-import org.apache.james.user.api.UsersRepository;
-import org.apache.mailet.Mail;
-import org.apache.mailet.base.GenericMailet;
-
-/**
- * Receives a Mail from the Queue and takes care to deliver the message
- * to a defined folder of the recipient(s).
- * 
- * You have to define the folder name of the recipient(s).
- * The flag 'consume' will tell is the mail will be further
- * processed by the upcoming processor mailets, or not.
- * 
- * <pre>
- * &lt;mailet match="RecipientIsLocal" class="ToRecipientFolder"&gt;
- *    &lt;folder&gt; <i>Junk</i> &lt;/folder&gt;
- *    &lt;consume&gt; <i>false</i> &lt;/consume&gt;
- * &lt;/mailet&gt;
- * </pre>
- *
- * @Deprecated This mailet duplicates the behaviour of LocalDelivery. Prefer 
using WithStorageDirective
- * in order to tell LocalDelivery in which folder the mail should be appended.
- *
- */
-@Deprecated
-public class ToRecipientFolder extends GenericMailet {
-
-    public static final String FOLDER_PARAMETER = "folder";
-    public static final String CONSUME_PARAMETER = "consume";
-
-    private final MailboxManager mailboxManager;
-    private final UsersRepository usersRepository;
-    private final MetricFactory metricFactory;
-    private MailDispatcher mailDispatcher;
-
-    @Inject
-    public ToRecipientFolder(@Named("mailboxmanager")MailboxManager 
mailboxManager, UsersRepository usersRepository,
-                             MetricFactory metricFactory) {
-        this.metricFactory = metricFactory;
-        this.mailboxManager = mailboxManager;
-        this.usersRepository = usersRepository;
-    }
-
-    @Override
-    public void service(Mail mail) throws MessagingException {
-        mailDispatcher.dispatch(mail);
-    }
-
-    @Override
-    public void init() throws MessagingException {
-        mailDispatcher = MailDispatcher.builder()
-            .mailStore(SimpleMailStore.builder()
-                .mailboxAppender(new MailboxAppender(mailboxManager))
-                .usersRepository(usersRepository)
-                .folder(getInitParameter(FOLDER_PARAMETER, 
MailboxConstants.INBOX))
-                
.metric(metricFactory.generate(LOCAL_DELIVERED_MAILS_METRIC_NAME))
-                .build())
-            .consume(getInitParameter(CONSUME_PARAMETER, false))
-            .mailetContext(getMailetContext())
-            .build();
-    }
-
-    @Override
-    public String getMailetInfo() {
-        return ToRecipientFolder.class.getName() + " Mailet";
-    }
-
-}
diff --git 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/ToRecipientFolderTest.java
 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/ToRecipientFolderTest.java
deleted file mode 100644
index 7108eb6..0000000
--- 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/ToRecipientFolderTest.java
+++ /dev/null
@@ -1,198 +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.james.transport.mailets.delivery;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.io.IOException;
-
-import javax.mail.MessagingException;
-import javax.mail.internet.MimeBodyPart;
-
-import org.apache.james.core.MailAddress;
-import org.apache.james.core.Username;
-import org.apache.james.core.builder.MimeMessageBuilder;
-import org.apache.james.mailbox.MailboxManager;
-import org.apache.james.mailbox.MailboxSession;
-import org.apache.james.mailbox.MessageManager;
-import org.apache.james.mailbox.model.MailboxPath;
-import org.apache.james.metrics.api.MetricFactory;
-import org.apache.james.metrics.tests.RecordingMetricFactory;
-import org.apache.james.transport.mailets.ToRecipientFolder;
-import org.apache.james.user.api.UsersRepository;
-import org.apache.mailet.Mail;
-import org.apache.mailet.base.test.FakeMail;
-import org.apache.mailet.base.test.FakeMailContext;
-import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-
-import reactor.core.publisher.Mono;
-
-@Deprecated
-public class ToRecipientFolderTest {
-
-    public static final String USER_LOCAL_PART = "receiver";
-    public static final String USER = USER_LOCAL_PART + "@domain.com";
-    public static final Username USERNAME = Username.of(USER);
-    public static final Username USERNAME_LOCAL_PART = 
Username.of(USER_LOCAL_PART);
-    public static final MailboxPath INBOX = MailboxPath.inbox(USERNAME);
-    public static final MailboxPath JUNK = 
MailboxPath.forUser(USERNAME_LOCAL_PART, "Junk");
-    public static final MailboxPath JUNK_VIRTUAL_HOSTING = 
MailboxPath.forUser(USERNAME, "Junk");
-    public static final String MAILET_NAME = "RecipientFolderTest";
-
-    private MessageManager messageManager;
-    private UsersRepository usersRepository;
-    private MailboxManager mailboxManager;
-    private ToRecipientFolder testee;
-    private FakeMailContext mailetContext;
-    private MailboxSession session;
-
-    @Before
-    public void setUp() throws Exception {
-        mailetContext = 
FakeMailContext.builder().logger(mock(Logger.class)).build();
-        messageManager = mock(MessageManager.class);
-        usersRepository = mock(UsersRepository.class);
-        mailboxManager = mock(MailboxManager.class);
-
-
-        MetricFactory metricFactory = new RecordingMetricFactory();
-        testee = new ToRecipientFolder(mailboxManager, usersRepository, 
metricFactory);
-
-        session = mock(MailboxSession.class);
-        when(session.getPathDelimiter()).thenReturn('.');
-        
when(mailboxManager.createSystemSession(any(Username.class))).thenReturn(session);
-        when(mailboxManager.mailboxExists(any(), 
any())).thenReturn(Mono.just(true));
-        when(session.getUser()).thenReturn(Username.of(USER));
-    }
-
-    @Test
-    public void initParameterTesting() throws Exception {
-        testee.init(FakeMailetConfig.builder()
-            .mailetName(MAILET_NAME)
-            .mailetContext(mailetContext)
-            .setProperty(ToRecipientFolder.FOLDER_PARAMETER, "Junk")
-            .build());
-
-        
assertThat(testee.getInitParameter(ToRecipientFolder.FOLDER_PARAMETER)).isEqualTo("Junk");
-    }
-
-    @Test
-    public void consumeOptionShouldGhostTheMail() throws Exception {
-        testee.init(FakeMailetConfig.builder()
-            .mailetName(MAILET_NAME)
-            .mailetContext(mailetContext)
-            .setProperty(ToRecipientFolder.CONSUME_PARAMETER, "true")
-            .build());
-
-        Mail mail = createMail();
-        testee.service(mail);
-
-        assertThat(mail.getState()).isEqualTo(Mail.GHOST);
-    }
-
-    @Test
-    public void consumeOptionShouldNotGhostTheMailByDefault() throws Exception 
{
-        testee.init(FakeMailetConfig.builder()
-            .mailetName(MAILET_NAME)
-            .mailetContext(mailetContext)
-            .build());
-
-        Mail mail = createMail();
-        testee.service(mail);
-
-        assertThat(mail.getState()).isEqualTo(Mail.DEFAULT);
-    }
-
-    @Test
-    public void folderParameterShouldIndicateDestinationFolder() throws 
Exception {
-        when(usersRepository.supportVirtualHosting()).thenReturn(true);
-        when(usersRepository.getUsername(new 
MailAddress(USER))).thenReturn(USERNAME);
-        when(mailboxManager.getMailbox(eq(JUNK_VIRTUAL_HOSTING), 
any(MailboxSession.class))).thenReturn(messageManager);
-
-        testee.init(FakeMailetConfig.builder()
-            .mailetName(MAILET_NAME)
-            .mailetContext(mailetContext)
-            .setProperty(ToRecipientFolder.FOLDER_PARAMETER, "Junk")
-            .build());
-        testee.service(createMail());
-
-        
verify(messageManager).appendMessage(any(MessageManager.AppendCommand.class), 
any(MailboxSession.class));
-    }
-
-    @Test
-    public void folderParameterShouldBeInboxByDefault() throws Exception {
-        when(usersRepository.supportVirtualHosting()).thenReturn(true);
-        when(usersRepository.getUsername(new 
MailAddress(USER))).thenReturn(USERNAME);
-        when(mailboxManager.getMailbox(eq(INBOX), 
any(MailboxSession.class))).thenReturn(messageManager);
-
-        testee.init(FakeMailetConfig.builder()
-            .mailetName(MAILET_NAME)
-            .mailetContext(mailetContext)
-            .build());
-        testee.service(createMail());
-
-        
verify(messageManager).appendMessage(any(MessageManager.AppendCommand.class), 
any(MailboxSession.class));
-    }
-
-    @Test
-    public void folderParameterShouldWorkWhenVirtualHostingIsTurnedOff() 
throws Exception {
-        when(usersRepository.supportVirtualHosting()).thenReturn(false);
-        when(usersRepository.getUsername(new MailAddress(USER_LOCAL_PART + 
"@localhost"))).thenReturn(USERNAME_LOCAL_PART);
-        when(usersRepository.getUsername(new 
MailAddress(USER))).thenReturn(USERNAME_LOCAL_PART);
-        when(mailboxManager.getMailbox(eq(JUNK), 
any(MailboxSession.class))).thenReturn(messageManager);
-        when(session.getUser()).thenReturn(Username.of(USER_LOCAL_PART));
-
-        testee.init(FakeMailetConfig.builder()
-            .mailetName(MAILET_NAME)
-            .mailetContext(mailetContext)
-            .setProperty(ToRecipientFolder.FOLDER_PARAMETER, "Junk")
-            .setProperty(ToRecipientFolder.CONSUME_PARAMETER, "true")
-            .build());
-        testee.service(createMail());
-
-        
verify(messageManager).appendMessage(any(MessageManager.AppendCommand.class), 
any(MailboxSession.class));
-    }
-
-    private Mail createMail() throws MessagingException, IOException {
-        return FakeMail.builder()
-            .name("name")
-            .mimeMessage(MimeMessageBuilder.mimeMessageBuilder()
-                .setSender("[email protected]")
-                .setSubject("Subject")
-                .addToRecipient(USER)
-                .setMultipartWithBodyParts(
-                    MimeMessageBuilder.bodyPartBuilder()
-                        .data("toto")
-                        .disposition(MimeBodyPart.ATTACHMENT)
-                        .filename("file.txt")
-                        .addHeader("Content-Type", "application/sieve; 
charset=UTF-8")))
-            .state(Mail.DEFAULT)
-            .recipient("[email protected]")
-            .build();
-    }
-
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to