You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2019/11/20 01:56:28 UTC

[james-project] branch master updated (e477ab5 -> caaed8b)

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

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


    from e477ab5  JAMES-2964 fix wrong unit test in DTOTest using json assertions on domain objects
     new b8c3d74  JAMES-2949 Fix metric reporting upon dequeue
     new d5372d9  [Refactoring] Lock is only used by FileMailRepository
     new 780d342  [Refactoring] Lock::canI is never used
     new 282d1e7  [Refactoring] Repository::getChildRepository is never used
     new 316bad3  [Refactoring] AbstractFileRepository::createChildRepository is never used
     new 3e3b046  [Refactoring] DuplicateUserException is never used
     new c7732f0  [Refactoring] Cleanup SieveRepository exceptions
     new 8cd3907  [Refactoring] Fix DomainList exceptions
     new a01d449  [Refactoring] JPADomainList should not open transactions upon read
     new 56ff7c9  [Refactoring] JPARecipientRewriteTable should not open transactions upon read
     new 66d51c9  [Refactoring] JPAUsersRepository::getRealName is never called
     new 728cd95  [Refactoring] Cleanup JPAUsersRepository javadoc
     new 6c9f76a  [Refactoring] JPAMailbox remove uneeded methods
     new 2478c5e  [Refactoring] JPAMailbox rewrite equals & hashCode
     new 92a00ae  [Refactoring] JPAMailbox inline generateAssociatedPath
     new 6801945  [Refactoring] JPAMailbox remove setMailboxId
     new 228aad4  [Refactoring] JPAProperty remove unused methods
     new c8341a7  [Refactoring] JPAProperty equals & hashCode
     new 92d346e  [Refactoring] JPAProperty should not implement Property
     new d1dd6c5  [Refactoring] Replace mailbox-store SimpleProperty with mailbox-api one
     new 30161bb  [Refactoring] Property can be a POJO instead of an interface
     new 149ad8a  [Refactoring] Better naming in CassandraMessageDAO
     new 142d4e5  [Refactoring] MatcherMatch class is not used
     new 437710d  [Refactoring] MailStateNotEquals class is not used
     new 7bb9b65  [Refactoring] MailStateEquals class is not used
     new cb6d3ce  [Refactoring] DisposeProcessor class is not used
     new 56cbdba  [Refactoring] MailetConfigImpl::getInitAttribute is not used
     new 22d77dd  [Refactoring] AbstractStateCompositeProcessor: only addListener
     new c398e35  [Refactoring] Clean mailetcontainer-camel javadoc
     new e3a4d3b  [Refactoring] Clean mailetcontainer-api javadoc
     new 6ed21a0  [Refactoring] mailetcontainer-api: Remove not thrown exceptions
     new b335570  [Refactoring] MockMailProcessor shouldThrow is never used
     new dda56cc  [Refactoring] MockMailProcessor::newState can be final
     new 48b5a9f  [Refactoring] Rely on java Base64 in SMTP server test
     new 86862be  [Refactoring] MockMailetConfig & MockMatcherConfig are not used
     new 2aca38d  [Refactoring] Remove unused methods in SMTPTestConfiguration
     new 30d7a83  [Refactoring] UsersRepository should not rely on setter injections
     new d5f0072  [Refactoring] MockProtocolHandlerLoader should rely on Guice
     new a82bcf1  [Refactoring] protocols-smtp should rely on constructor injection
     new 7566c1d  [Refactoring] protocols-pop3 should rely on constructor injection
     new 9c6fddb  [Refactoring] protocols-library: remove unused code
     new f447459  [Refactoring] protocols-imap4: remove unused code
     new a53e12b  [Refactoring] ProtocolHandlerChainImpl::addHandler never throws
     new ae1ced3  [Refactoring] protocols-lmtp should rely on constructor injection
     new 0a6a86c  [Refactoring] protocols-* clean javaDoc
     new 078cf38  JAMES-2958 Domain length validation is done by the model
     new 3025514  JAMES-2870 Remove ZooKeeper Uid & ModSeq generators
     new 352d2bf  JAMES-2773 add glowroot plugin for mail spooler
     new caaed8b  JAMES-2773 add glowroot plugin to track put into blobstore

The 49 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../destination/glowroot/plugins/blobstore.json    |  26 +++
 .../destination/glowroot/plugins/spooler.json      |  19 ++
 .../destination/glowroot/plugins/blobstore.json    |  26 +++
 .../destination/glowroot/plugins/spooler.json      |  19 ++
 .../destination/glowroot/plugins/blobstore.json    |  26 +++
 .../destination/glowroot/plugins/spooler.json      |  19 ++
 .../destination/glowroot/plugins/blobstore.json    |  26 +++
 .../destination/glowroot/plugins/spooler.json      |  19 ++
 .../destination/glowroot/plugins/blobstore.json    |  26 +++
 .../destination/glowroot/plugins/spooler.json      |  19 ++
 .../destination/glowroot/plugins/blobstore.json    |  26 +++
 .../jpa/destination/glowroot/plugins/spooler.json  |  19 ++
 .../destination/glowroot/plugins/blobstore.json    |  26 +++
 .../destination/glowroot/plugins/spooler.json      |  19 ++
 mailbox/README.md                                  |   8 -
 .../cassandra/mail/CassandraMessageDAO.java        |  16 +-
 .../elasticsearch/json/IndexableMessage.java       |   4 +-
 .../elasticsearch/json/IndexableMessageTest.java   |   4 +-
 .../james/mailbox/jpa/mail/model/JPAMailbox.java   |  71 ++------
 .../james/mailbox/jpa/mail/model/JPAProperty.java  |  79 ++------
 .../model/openjpa/AbstractJPAMailboxMessage.java   |   5 +-
 .../QuotaThresholdListenersTestSystem.java         |   4 +-
 ...lasticSearchQuotaSearchTestSystemExtension.java |   4 +-
 .../MemoryQuotaSearchTestSystemExtension.java      |   4 +-
 mailbox/pom.xml                                    |   2 -
 .../james/mailbox/store/mail/model/Property.java   |  92 +++++++++-
 .../store/mail/model/impl/PropertyBuilder.java     |  28 +--
 .../store/mail/model/impl/SimpleProperty.java      | 116 ------------
 .../apache/james/mailbox/store/SimpleProperty.java |  54 ------
 .../model/ListMessagePropertiesAssertTest.java     |  24 +--
 .../mailbox/store/mail/model/PropertyTest.java     |   6 +-
 .../store/mail/model/impl/PropertyBuilderTest.java |   5 +-
 .../store/mail/model/impl/SimplePropertyTest.java  |  32 ----
 mailbox/zoo-seq-provider/pom.xml                   |  88 ---------
 .../james/mailbox/store/mail/ZooUidProvider.java   | 111 ------------
 .../mailbox/store/mail/ZooUidProviderTest.java     | 198 ---------------------
 .../apache/james/mpt/host/JamesImapHostSystem.java |   4 +-
 .../cassandra/host/CassandraHostSystem.java        |   6 +-
 .../mpt/managesieve/file/host/FileHostSystem.java  |   4 +-
 .../james/modules/data/MemoryDataModule.java       |  11 +-
 .../apache/james/domainlist/api/DomainList.java    |   4 +-
 .../sieverepository/api/SieveQuotaRepository.java  |   3 -
 .../james/sieverepository/api/SieveRepository.java |   6 -
 .../api/exception/DuplicateException.java          |  21 ---
 .../api/exception/DuplicateUserException.java      |  65 -------
 .../api/exception/IsActiveException.java           |  22 ---
 .../api/exception/QuotaExceededException.java      |  15 --
 .../api/exception/QuotaNotFoundException.java      |  25 ---
 .../api/exception/ScriptNotFoundException.java     |   8 -
 .../api/exception/SieveRepositoryException.java    |   8 -
 .../api/exception/StorageException.java            |  25 ---
 .../user/cassandra/CassandraUsersRepository.java   |   4 +-
 .../cassandra/CassandraUsersRepositoryTest.java    |   3 +-
 .../mailrepository/file/FileMailRepository.java    |   1 -
 .../apache/james/mailrepository/file}/Lock.java    |  16 +-
 .../apache/james/domainlist/jpa/JPADomainList.java |  21 +--
 .../james/rrt/jpa/JPARecipientRewriteTable.java    |  12 --
 .../apache/james/user/jpa/JPAUsersRepository.java  |  29 +--
 .../james/user/jpa/JpaUsersRepositoryTest.java     |   2 +-
 .../james/repository/api/ObjectRepository.java     |   2 +-
 .../apache/james/repository/api/Repository.java    |  25 ---
 .../james/repository/api/StreamRepository.java     |   2 +-
 .../repository/file/AbstractFileRepository.java    |  46 +----
 .../james/user/lib/AbstractUsersRepository.java    |  12 +-
 .../user/lib/AbstractUsersRepositoryTest.java      |   8 +-
 .../james/user/memory/MemoryUsersRepository.java   |  12 +-
 .../user/memory/MemoryUsersRepositoryTest.java     |  18 +-
 .../user/memory/UsersRepositoryManagementTest.java |   4 +-
 .../james/mailetcontainer/api/MailetLoader.java    |   3 +-
 .../james/mailetcontainer/api/MatcherLoader.java   |   3 +-
 .../api/jmx/MailProcessorManagementMBean.java      |  12 --
 .../mailetcontainer/api/jmx/MailSpoolerMBean.java  |   3 -
 .../api/jmx/MailetManagementMBean.java             |   4 -
 .../api/jmx/MatcherManagementMBean.java            |   8 -
 .../api/mock/ExceptionThrowingMailet.java          |   2 +-
 .../api/mock/ExceptionThrowingMatcher.java         |   2 +-
 .../api/mock/MockMailProcessor.java                |  20 +--
 .../james/mailetcontainer/api/mock/MockMailet.java |   6 +-
 .../mailetcontainer/api/mock/MockMatcher.java      |   6 +-
 .../mailetcontainer/impl/JamesMailSpooler.java     |   7 +-
 .../mailetcontainer/impl/MailetConfigImpl.java     |  12 --
 .../impl/camel/CamelMailetProcessor.java           |   2 -
 .../mailetcontainer/impl/camel/CamelProcessor.java |   6 -
 .../impl/camel/DisposeProcessor.java               |  43 -----
 .../impl/camel/MailStateEquals.java                |  42 -----
 .../impl/camel/MailStateNotEquals.java             |  42 -----
 .../mailetcontainer/impl/camel/MatcherMatch.java   |  38 ----
 .../impl/camel/MatcherSplitter.java                |   1 -
 .../jmx/JMXStateCompositeProcessorListener.java    |   9 -
 .../impl/jmx/JMXStateMailetProcessorListener.java  |  15 --
 .../impl/jmx/MailProcessorManagement.java          |   3 -
 .../james/mailetcontainer/impl/matchers/Not.java   |   6 +-
 .../james/mailetcontainer/impl/matchers/Or.java    |   7 +-
 .../james/mailetcontainer/impl/matchers/Xor.java   |   7 +-
 .../lib/AbstractStateCompositeProcessor.java       |  21 ---
 .../lib/AbstractStateMailetProcessor.java          |  39 +---
 .../impl/JamesMailetContextTest.java               |   3 +-
 .../lib/AbstractStateCompositeProcessorTest.java   |   8 +-
 .../mailets/remote/delivery/DeliveryRunnable.java  |   5 +-
 .../james/transport/mailets/SpamAssassinTest.java  |   4 +-
 .../mailets/WithStorageDirectiveTest.java          |   4 +-
 .../jmap/draft/JWTAuthenticationStrategyTest.java  |   4 +-
 .../jmap/draft/UserProvisioningFilterTest.java     |   4 +-
 .../draft/UserProvisioningFilterThreadTest.java    |   5 +-
 .../jmap/mailet/filter/JMAPFilteringExtension.java |   4 +-
 .../apache/james/imapserver/netty/IMAPServer.java  |   8 -
 .../james/imapserver/netty/NettyImapSession.java   |  10 --
 server/protocols/protocols-library/pom.xml         |   5 +
 .../protocols/lib/ProtocolHandlerChainImpl.java    |  19 +-
 .../protocols/lib/handler/HandlersPackage.java     |   2 -
 .../lib/handler/ProtocolHandlerLoader.java         |   5 -
 .../AbstractCommandHandlerResultJMXMonitor.java    |   4 -
 .../lib/jmx/AbstractCommandHandlerStats.java       |   4 -
 .../AbstractConnectHandlerResultJMXMonitor.java    |   4 -
 .../jmx/AbstractLineHandlerResultJMXMonitor.java   |   2 -
 .../lib/jmx/CommandHandlerStatsMBean.java          |   5 +-
 .../protocols/lib/jmx/ConnectHandlerStats.java     |   2 -
 .../james/protocols/lib/jmx/HandlerStatsMBean.java |   6 -
 .../james/protocols/lib/jmx/LineHandlerStats.java  |   2 -
 .../james/protocols/lib/jmx/ServerMBean.java       |  18 --
 .../lib/netty/AbstractConfigurableAsyncServer.java |  10 --
 ...bstractExecutorAwareChannelPipelineFactory.java |   7 -
 ...nabledOrderedMemoryAwareThreadPoolExecutor.java |   6 -
 .../org/apache/james/protocols/lib/PortUtil.java   |  87 ---------
 .../lib/mock/MockProtocolHandlerLoader.java        | 112 ++++--------
 .../hook/MailboxDeliverToRecipientHandler.java     |  14 +-
 .../james/lmtpserver/netty/LMTPServerMBean.java    |   6 -
 server/protocols/protocols-pop3/pom.xml            |   5 +
 .../james/pop3server/core/PassCmdHandler.java      |   4 +-
 .../jmx/POP3CommandHandlerStatsMBean.java          |   4 -
 .../james/pop3server/netty/OioPOP3Server.java      |   1 -
 .../apache/james/pop3server/netty/POP3Server.java  |   3 -
 .../apache/james/pop3server/POP3ServerTest.java    |  21 +--
 server/protocols/protocols-smtp/pom.xml            |   5 +
 .../smtpserver/AuthRequiredToRelayRcptHook.java    |   5 +-
 .../james/smtpserver/JamesMailCmdHandler.java      |  10 +-
 .../james/smtpserver/JamesRcptCmdHandler.java      |   9 +-
 .../apache/james/smtpserver/SendMailHandler.java   |   8 +-
 .../SenderAuthIdentifyVerificationRcptHook.java    |  13 +-
 .../james/smtpserver/UsersRepositoryAuthHook.java  |  19 +-
 .../james/smtpserver/fastfail/DNSRBLHandler.java   |   5 +-
 .../fastfail/ResolvableEhloHeloHandler.java        |   5 +-
 .../fastfail/ReverseEqualsEhloHeloHandler.java     |   5 +-
 .../james/smtpserver/fastfail/ValidRcptMX.java     |  21 +--
 .../fastfail/ValidSenderDomainHandler.java         |   5 +-
 .../james/smtpserver/jmx/HookStatsMBean.java       |  12 --
 .../jmx/SMTPCommandHandlerStatsMBean.java          |   6 -
 .../james/smtpserver/netty/OioSMTPServer.java      |   1 -
 .../netty/SMTPChannelUpstreamHandler.java          |   2 -
 .../apache/james/smtpserver/netty/SMTPServer.java  |   4 -
 .../james/smtpserver/netty/SMTPServerMBean.java    |  10 --
 .../java/org/apache/james/smtpserver/Base64.java   | 117 ------------
 .../apache/james/smtpserver/SMTPServerTest.java    |  57 +++---
 .../james/smtpserver/SMTPTestConfiguration.java    |  21 ---
 .../james/smtpserver/ValidRcptHandlerTest.java     |   5 +-
 .../apache/james/smtpserver/ValidRcptMXTest.java   |   3 +-
 .../smtpserver/mock/mailet/MockMailetConfig.java   |  78 --------
 .../smtpserver/mock/mailet/MockMatcherConfig.java  |  60 -------
 .../james/webadmin/routes/DomainsRoutes.java       |   1 -
 .../james/webadmin/routes/AliasRoutesTest.java     |   3 +-
 .../james/webadmin/routes/ForwardRoutesTest.java   |   3 +-
 .../james/webadmin/routes/GroupsRoutesTest.java    |   3 +-
 .../webadmin/routes/SieveQuotaRoutesTest.java      |   4 +-
 .../webadmin/routes/SieveScriptRoutesTest.java     |   4 +-
 .../james/webadmin/routes/UserRoutesTest.java      |  15 +-
 .../routes/DeletedMessagesVaultRoutesTest.java     |   3 +-
 .../DomainQuotaRoutesNoVirtualHostingTest.java     |   2 +-
 .../routes/ElasticSearchQuotaSearchExtension.java  |   3 +-
 .../routes/ScanningQuotaSearchExtension.java       |   3 +-
 169 files changed, 744 insertions(+), 2286 deletions(-)
 create mode 100644 dockerfiles/run/guice/cassandra-ldap/destination/glowroot/plugins/blobstore.json
 create mode 100644 dockerfiles/run/guice/cassandra-ldap/destination/glowroot/plugins/spooler.json
 create mode 100644 dockerfiles/run/guice/cassandra-rabbitmq-ldap/destination/glowroot/plugins/blobstore.json
 create mode 100644 dockerfiles/run/guice/cassandra-rabbitmq-ldap/destination/glowroot/plugins/spooler.json
 create mode 100644 dockerfiles/run/guice/cassandra-rabbitmq/destination/glowroot/plugins/blobstore.json
 create mode 100644 dockerfiles/run/guice/cassandra-rabbitmq/destination/glowroot/plugins/spooler.json
 create mode 100644 dockerfiles/run/guice/cassandra/destination/glowroot/plugins/blobstore.json
 create mode 100644 dockerfiles/run/guice/cassandra/destination/glowroot/plugins/spooler.json
 create mode 100644 dockerfiles/run/guice/jpa-smtp/destination/glowroot/plugins/blobstore.json
 create mode 100644 dockerfiles/run/guice/jpa-smtp/destination/glowroot/plugins/spooler.json
 create mode 100644 dockerfiles/run/guice/jpa/destination/glowroot/plugins/blobstore.json
 create mode 100644 dockerfiles/run/guice/jpa/destination/glowroot/plugins/spooler.json
 create mode 100644 dockerfiles/run/guice/memory/destination/glowroot/plugins/blobstore.json
 create mode 100644 dockerfiles/run/guice/memory/destination/glowroot/plugins/spooler.json
 delete mode 100644 mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleProperty.java
 delete mode 100644 mailbox/store/src/test/java/org/apache/james/mailbox/store/SimpleProperty.java
 copy protocols/imap/src/test/java/org/apache/james/imap/api/TagTest.java => mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/PropertyTest.java (91%)
 delete mode 100644 mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/impl/SimplePropertyTest.java
 delete mode 100644 mailbox/zoo-seq-provider/pom.xml
 delete mode 100644 mailbox/zoo-seq-provider/src/main/java/org/apache/james/mailbox/store/mail/ZooUidProvider.java
 delete mode 100644 mailbox/zoo-seq-provider/src/test/java/org/apache/james/mailbox/store/mail/ZooUidProviderTest.java
 delete mode 100644 server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/DuplicateUserException.java
 rename server/data/{data-library/src/main/java/org/apache/james/mailrepository/lib => data-file/src/main/java/org/apache/james/mailrepository/file}/Lock.java (88%)
 delete mode 100644 server/data/data-library/src/main/java/org/apache/james/repository/api/Repository.java
 delete mode 100644 server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/DisposeProcessor.java
 delete mode 100644 server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/MailStateEquals.java
 delete mode 100644 server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/MailStateNotEquals.java
 delete mode 100644 server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/MatcherMatch.java
 delete mode 100644 server/protocols/protocols-library/src/test/java/org/apache/james/protocols/lib/PortUtil.java
 delete mode 100644 server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/Base64.java
 delete mode 100644 server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/mock/mailet/MockMailetConfig.java
 delete mode 100644 server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/mock/mailet/MockMatcherConfig.java


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


[james-project] 15/49: [Refactoring] JPAMailbox inline generateAssociatedPath

Posted by bt...@apache.org.
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 92a00ae315b93ab623beaa0f90afffe785742d64
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sat Nov 16 10:43:04 2019 +0700

    [Refactoring] JPAMailbox inline generateAssociatedPath
---
 .../java/org/apache/james/mailbox/jpa/mail/model/JPAMailbox.java   | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailbox.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailbox.java
index 45922af..347a2c5 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailbox.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailbox.java
@@ -134,11 +134,8 @@ public class JPAMailbox {
     }
 
     public Mailbox toMailbox() {
-        return new Mailbox(generateAssociatedPath(), uidValidity, new JPAId(mailboxId));
-    }
-
-    public MailboxPath generateAssociatedPath() {
-        return new MailboxPath(namespace, Username.of(user), name);
+        MailboxPath path = new MailboxPath(namespace, Username.of(user), name);
+        return new Mailbox(path, uidValidity, new JPAId(mailboxId));
     }
 
     public void setMailboxId(long mailboxId) {


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


[james-project] 30/49: [Refactoring] Clean mailetcontainer-api javadoc

Posted by bt...@apache.org.
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 e3a4d3bec6f17d429e5fcea3f6b6a1952daf880c
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 15:23:53 2019 +0700

    [Refactoring] Clean mailetcontainer-api javadoc
---
 .../org/apache/james/mailetcontainer/api/MailetLoader.java   |  3 +--
 .../org/apache/james/mailetcontainer/api/MatcherLoader.java  |  3 +--
 .../api/jmx/MailProcessorManagementMBean.java                | 12 ------------
 .../james/mailetcontainer/api/jmx/MailSpoolerMBean.java      |  3 ---
 .../james/mailetcontainer/api/jmx/MailetManagementMBean.java |  4 ----
 .../mailetcontainer/api/jmx/MatcherManagementMBean.java      |  8 --------
 6 files changed, 2 insertions(+), 31 deletions(-)

diff --git a/server/mailet/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/MailetLoader.java b/server/mailet/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/MailetLoader.java
index 27bea5a..6abae37 100644
--- a/server/mailet/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/MailetLoader.java
+++ b/server/mailet/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/MailetLoader.java
@@ -34,8 +34,7 @@ public interface MailetLoader {
      * Get a new {@link Mailet} instance for the given {@link MailetConfig}. The
      * returned {@link Mailet} needs to be fully initialized, so the returned
      * instance is "read-to-use"
-     * 
-     * @param config
+     *
      * @throws MessagingException
      *             if an error occurs
      */
diff --git a/server/mailet/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/MatcherLoader.java b/server/mailet/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/MatcherLoader.java
index 5d4e084..64f5520 100644
--- a/server/mailet/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/MatcherLoader.java
+++ b/server/mailet/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/MatcherLoader.java
@@ -34,8 +34,7 @@ public interface MatcherLoader {
      * Get a new {@link Matcher} for the given {@link MatcherConfig}. The
      * returned {@link Matcher} needs to be fully initialized, so the returned
      * instance is "read-to-use"
-     * 
-     * @param config
+     *
      * @throws MessagingException
      *             if an error occurs
      */
diff --git a/server/mailet/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/jmx/MailProcessorManagementMBean.java b/server/mailet/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/jmx/MailProcessorManagementMBean.java
index 29eed47..b43a13a 100644
--- a/server/mailet/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/jmx/MailProcessorManagementMBean.java
+++ b/server/mailet/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/jmx/MailProcessorManagementMBean.java
@@ -26,44 +26,32 @@ public interface MailProcessorManagementMBean {
 
     /**
      * Return the count of handled mail
-     * 
-     * @return handledCount
      */
     long getHandledMailCount();
 
     /**
      * Return the time in ms of the fastest processing
-     * 
-     * @return fastest
      */
     long getFastestProcessing();
 
     /**
      * Return the time in ms of the slowest processing
-     * 
-     * @return slowest
      */
     long getSlowestProcessing();
 
     /**
      * Return the count of how many time the processing was done without and
      * error
-     * 
-     * @return successCount
      */
     long getSuccessCount();
 
     /**
      * Return the count of how many times an error was detected while processing
-     * 
-     * @return errorCount
      */
     long getErrorCount();
 
     /**
      * Return the time in ms of the last processing
-     * 
-     * @return last
      */
     long getLastProcessing();
 
diff --git a/server/mailet/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/jmx/MailSpoolerMBean.java b/server/mailet/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/jmx/MailSpoolerMBean.java
index 8347a0d..838f4a4 100644
--- a/server/mailet/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/jmx/MailSpoolerMBean.java
+++ b/server/mailet/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/jmx/MailSpoolerMBean.java
@@ -25,13 +25,10 @@ public interface MailSpoolerMBean {
 
     /**
      * Return the number of threads used for spooling
-     * 
-     * @return threadCount
      */
     int getThreadCount();
 
     /**
-     * 
      * @return current spool count
      */
     int getCurrentSpoolCount();
diff --git a/server/mailet/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/jmx/MailetManagementMBean.java b/server/mailet/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/jmx/MailetManagementMBean.java
index af986f5..d880798 100644
--- a/server/mailet/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/jmx/MailetManagementMBean.java
+++ b/server/mailet/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/jmx/MailetManagementMBean.java
@@ -26,15 +26,11 @@ public interface MailetManagementMBean extends MailProcessorManagementMBean {
 
     /**
      * Return the name of the mailet
-     * 
-     * @return mailet
      */
     String getMailetName();
 
     /**
      * Return the parameters which are configured for the mailet
-     * 
-     * @return params
      */
     String[] getMailetParameters();
 }
diff --git a/server/mailet/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/jmx/MatcherManagementMBean.java b/server/mailet/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/jmx/MatcherManagementMBean.java
index 1de758f..5dc23fc 100644
--- a/server/mailet/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/jmx/MatcherManagementMBean.java
+++ b/server/mailet/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/jmx/MatcherManagementMBean.java
@@ -26,29 +26,21 @@ public interface MatcherManagementMBean extends MailProcessorManagementMBean {
 
     /**
      * Return the name of the Matcher
-     * 
-     * @return name
      */
     String getMatcherName();
 
     /**
      * Return the matcher condition
-     * 
-     * @return condition
      */
     String getMatcherCondition();
 
     /**
      * Return the count of how many times the Matcher matched
-     * 
-     * @return matched
      */
     long getMatchedCount();
 
     /**
      * Return the count of how many times the Matcher not matches
-     * 
-     * @return notmatched
      */
     long getNotMatchedCount();
 


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


[james-project] 14/49: [Refactoring] JPAMailbox rewrite equals & hashCode

Posted by bt...@apache.org.
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 2478c5e174dc2dc48579d4a76d5d02a44a06a864
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sat Nov 16 10:41:58 2019 +0700

    [Refactoring] JPAMailbox rewrite equals & hashCode
---
 .../james/mailbox/jpa/mail/model/JPAMailbox.java   | 31 ++++++++--------------
 1 file changed, 11 insertions(+), 20 deletions(-)

diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailbox.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailbox.java
index 4770ae5..45922af 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailbox.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailbox.java
@@ -18,6 +18,8 @@
  ****************************************************************/
 package org.apache.james.mailbox.jpa.mail.model;
 
+import java.util.Objects;
+
 import javax.persistence.Basic;
 import javax.persistence.Column;
 import javax.persistence.Entity;
@@ -173,28 +175,17 @@ public class JPAMailbox {
     }
 
     @Override
-    public int hashCode() {
-        final int PRIME = 31;
-        int result = 1;
-        result = PRIME * result + (int) (mailboxId ^ (mailboxId >>> 32));
-        return result;
+    public final boolean equals(Object o) {
+        if (o instanceof JPAMailbox) {
+            JPAMailbox that = (JPAMailbox) o;
+
+            return Objects.equals(this.mailboxId, that.mailboxId);
+        }
+        return false;
     }
 
     @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        final JPAMailbox other = (JPAMailbox) obj;
-        if (mailboxId != other.mailboxId) {
-            return false;
-        }
-        return true;
+    public final int hashCode() {
+        return Objects.hash(mailboxId);
     }
 }


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


[james-project] 11/49: [Refactoring] JPAUsersRepository::getRealName is never called

Posted by bt...@apache.org.
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 66d51c93c43394ed432693ca884b9d17c3d8696a
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Nov 18 14:18:36 2019 +0700

    [Refactoring] JPAUsersRepository::getRealName is never called
---
 .../org/apache/james/user/jpa/JPAUsersRepository.java   | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/server/data/data-jpa/src/main/java/org/apache/james/user/jpa/JPAUsersRepository.java b/server/data/data-jpa/src/main/java/org/apache/james/user/jpa/JPAUsersRepository.java
index 369bb38..6304426 100644
--- a/server/data/data-jpa/src/main/java/org/apache/james/user/jpa/JPAUsersRepository.java
+++ b/server/data/data-jpa/src/main/java/org/apache/james/user/jpa/JPAUsersRepository.java
@@ -99,23 +99,6 @@ public class JPAUsersRepository extends AbstractUsersRepository {
     }
 
     /**
-     * Returns the user name of the user matching name on an equalsIgnoreCase
-     * basis. Returns null if no match.
-     * 
-     * @param name
-     *            the name to case-correct
-     * @return the case-correct name of the user, null if the user doesn't exist
-     * @throws UsersRepositoryException
-     */
-    public String getRealName(Username name) throws UsersRepositoryException {
-        User u = getUserByName(name);
-        if (u != null) {
-            u.getUserName();
-        }
-        return null;
-    }
-
-    /**
      * Update the repository with the specified user object. A user object with
      * this username must already exist.
      * 


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


[james-project] 39/49: [Refactoring] protocols-smtp should rely on constructor injection

Posted by bt...@apache.org.
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 a82bcf13eb597bd6799a30f7adaf87d8548ff974
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 21:03:59 2019 +0700

    [Refactoring] protocols-smtp should rely on constructor injection
---
 .../smtpserver/AuthRequiredToRelayRcptHook.java     |  5 ++---
 .../james/smtpserver/JamesMailCmdHandler.java       | 10 +++-------
 .../james/smtpserver/JamesRcptCmdHandler.java       |  9 ++-------
 .../apache/james/smtpserver/SendMailHandler.java    |  7 +++----
 .../SenderAuthIdentifyVerificationRcptHook.java     | 13 ++++---------
 .../james/smtpserver/UsersRepositoryAuthHook.java   | 19 ++-----------------
 .../james/smtpserver/fastfail/DNSRBLHandler.java    |  5 ++---
 .../fastfail/ResolvableEhloHeloHandler.java         |  5 ++---
 .../fastfail/ReverseEqualsEhloHeloHandler.java      |  5 ++---
 .../james/smtpserver/fastfail/ValidRcptMX.java      | 21 ++-------------------
 .../fastfail/ValidSenderDomainHandler.java          |  5 ++---
 .../james/smtpserver/ValidRcptHandlerTest.java      |  5 ++---
 .../apache/james/smtpserver/ValidRcptMXTest.java    |  3 +--
 13 files changed, 29 insertions(+), 83 deletions(-)

diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/AuthRequiredToRelayRcptHook.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/AuthRequiredToRelayRcptHook.java
index 5a17e0b..6cec91d 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/AuthRequiredToRelayRcptHook.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/AuthRequiredToRelayRcptHook.java
@@ -26,11 +26,10 @@ import org.apache.james.domainlist.api.DomainListException;
 import org.apache.james.protocols.smtp.core.AbstractAuthRequiredToRelayRcptHook;
 
 public class AuthRequiredToRelayRcptHook extends AbstractAuthRequiredToRelayRcptHook {
-
-    private DomainList domains;
+    private final DomainList domains;
 
     @Inject
-    public void setDomainList(DomainList domains) {
+    public AuthRequiredToRelayRcptHook(DomainList domains) {
         this.domains = domains;
     }
 
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/JamesMailCmdHandler.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/JamesMailCmdHandler.java
index 9ff0e71..ad5d057 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/JamesMailCmdHandler.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/JamesMailCmdHandler.java
@@ -26,19 +26,15 @@ import org.apache.james.metrics.api.MetricFactory;
 import org.apache.james.protocols.smtp.core.MailCmdHandler;
 
 public class JamesMailCmdHandler extends MailCmdHandler {
-
-    private DomainList domainList;
+    private final DomainList domainList;
 
     @Inject
-    public JamesMailCmdHandler(MetricFactory metricFactory) {
+    public JamesMailCmdHandler(MetricFactory metricFactory, DomainList domainList) {
         super(metricFactory);
-    }
-
-    @Inject
-    public final void setDomainList(DomainList domainList) {
         this.domainList = domainList;
     }
 
+
     @Override
     public String getDefaultDomain() {
         try {
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/JamesRcptCmdHandler.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/JamesRcptCmdHandler.java
index 1ec3a2f..129a832 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/JamesRcptCmdHandler.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/JamesRcptCmdHandler.java
@@ -27,16 +27,11 @@ import org.apache.james.metrics.api.MetricFactory;
 import org.apache.james.protocols.smtp.core.RcptCmdHandler;
 
 public class JamesRcptCmdHandler extends RcptCmdHandler {
-
-    private DomainList domainList;
+    private final DomainList domainList;
 
     @Inject
-    public JamesRcptCmdHandler(MetricFactory metricFactory) {
+    public JamesRcptCmdHandler(MetricFactory metricFactory, DomainList domainList) {
         super(metricFactory);
-    }
-
-    @Inject
-    public final void setDomainList(DomainList domainList) {
         this.domainList = domainList;
     }
 
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/SendMailHandler.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/SendMailHandler.java
index 90ddd4f..4de5cfe 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/SendMailHandler.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/SendMailHandler.java
@@ -23,7 +23,6 @@ import javax.inject.Inject;
 import javax.mail.MessagingException;
 
 import org.apache.commons.configuration2.Configuration;
-import org.apache.commons.configuration2.ex.ConfigurationException;
 import org.apache.james.protocols.smtp.SMTPSession;
 import org.apache.james.protocols.smtp.dsn.DSNStatus;
 import org.apache.james.protocols.smtp.hook.HookResult;
@@ -40,16 +39,16 @@ import org.slf4j.LoggerFactory;
 public class SendMailHandler implements JamesMessageHook {
     private static final Logger LOGGER = LoggerFactory.getLogger(SendMailHandler.class);
 
+    private final MailQueueFactory<?> queueFactory;
     private MailQueue queue;
-    private MailQueueFactory<?> queueFactory;
 
     @Inject
-    public void setMailQueueFactory(MailQueueFactory<?> queueFactory) {
+    public SendMailHandler(MailQueueFactory<?> queueFactory) {
         this.queueFactory = queueFactory;
     }
 
     @Override
-    public void init(Configuration config) throws ConfigurationException {
+    public void init(Configuration config) {
         queue = queueFactory.createQueue(MailQueueFactory.SPOOL);
     }
 
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/SenderAuthIdentifyVerificationRcptHook.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/SenderAuthIdentifyVerificationRcptHook.java
index 44b453f..5ed3567 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/SenderAuthIdentifyVerificationRcptHook.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/SenderAuthIdentifyVerificationRcptHook.java
@@ -39,18 +39,13 @@ import org.apache.james.user.api.UsersRepositoryException;
  * Handler which check if the authenticated user is incorrect
  */
 public class SenderAuthIdentifyVerificationRcptHook extends AbstractSenderAuthIdentifyVerificationRcptHook {
-
-    private DomainList domains;
-    private UsersRepository users;
-
-    @Inject
-    public final void setUsersRepository(UsersRepository users) {
-        this.users = users;
-    }
+    private final DomainList domains;
+    private final UsersRepository users;
 
     @Inject
-    public void setDomainList(DomainList domains) {
+    public SenderAuthIdentifyVerificationRcptHook(DomainList domains, UsersRepository users) {
         this.domains = domains;
+        this.users = users;
     }
 
     @Override
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/UsersRepositoryAuthHook.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/UsersRepositoryAuthHook.java
index 669e223..bf88b00 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/UsersRepositoryAuthHook.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/UsersRepositoryAuthHook.java
@@ -36,25 +36,10 @@ import org.slf4j.LoggerFactory;
 public class UsersRepositoryAuthHook implements AuthHook {
     private static final Logger LOGGER = LoggerFactory.getLogger(UsersRepositoryAuthHook.class);
 
-    private UsersRepository users;
+    private final UsersRepository users;
 
-    /**
-     * Gets the users repository.
-     * 
-     * @return the users
-     */
-    public final UsersRepository getUsers() {
-        return users;
-    }
-
-    /**
-     * Sets the users repository.
-     * 
-     * @param users
-     *            the users to set
-     */
     @Inject
-    public final void setUsersRepository(UsersRepository users) {
+    public UsersRepositoryAuthHook(UsersRepository users) {
         this.users = users;
     }
 
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/DNSRBLHandler.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/DNSRBLHandler.java
index a3dd178..0caac3b 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/DNSRBLHandler.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/DNSRBLHandler.java
@@ -33,11 +33,10 @@ import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.protocols.api.handler.ProtocolHandler;
 
 public class DNSRBLHandler extends org.apache.james.protocols.smtp.core.fastfail.DNSRBLHandler implements ProtocolHandler {
-
-    private DNSService dns;
+    private final DNSService dns;
 
     @Inject
-    public void setDNSService(DNSService dns) {
+    public DNSRBLHandler(DNSService dns) {
         this.dns = dns;
     }
 
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ResolvableEhloHeloHandler.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ResolvableEhloHeloHandler.java
index 9af6100..940e7ee 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ResolvableEhloHeloHandler.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ResolvableEhloHeloHandler.java
@@ -25,11 +25,10 @@ import javax.inject.Inject;
 import org.apache.james.dnsservice.api.DNSService;
 
 public class ResolvableEhloHeloHandler extends org.apache.james.protocols.smtp.core.fastfail.ResolvableEhloHeloHandler {
-
-    private DNSService dns;
+    private final DNSService dns;
 
     @Inject
-    public void setDNSService(DNSService dns) {
+    public ResolvableEhloHeloHandler(DNSService dns) {
         this.dns = dns;
     }
 
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ReverseEqualsEhloHeloHandler.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ReverseEqualsEhloHeloHandler.java
index 1d2ce4c..8090fad 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ReverseEqualsEhloHeloHandler.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ReverseEqualsEhloHeloHandler.java
@@ -25,11 +25,10 @@ import javax.inject.Inject;
 import org.apache.james.dnsservice.api.DNSService;
 
 public class ReverseEqualsEhloHeloHandler extends org.apache.james.protocols.smtp.core.fastfail.ReverseEqualsEhloHeloHandler {
-
-    private DNSService dns;
+    private final DNSService dns;
 
     @Inject
-    public void setDNSService(DNSService dns) {
+    public ReverseEqualsEhloHeloHandler(DNSService dns) {
         this.dns = dns;
     }
 
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptMX.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptMX.java
index e0684e1..dedbdcf 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptMX.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptMX.java
@@ -50,33 +50,16 @@ import com.github.steveash.guavate.Guavate;
  * authorized user or an authorized network.
  */
 public class ValidRcptMX implements RcptHook, ProtocolHandler {
-
     private static final Logger LOGGER = LoggerFactory.getLogger(ValidRcptMX.class);
 
-    private DNSService dnsService = null;
-
+    private  final DNSService dnsService;
     private NetMatcher bNetwork = null;
 
-    /**
-     * Gets the DNS service.
-     *
-     * @return the dnsService
-     */
-    public final DNSService getDNSService() {
-        return dnsService;
-    }
-
-    /**
-     * Sets the DNS service.
-     *
-     * @param dnsService the dnsService to set
-     */
     @Inject
-    public final void setDNSService(DNSService dnsService) {
+    public ValidRcptMX(DNSService dnsService) {
         this.dnsService = dnsService;
     }
 
-
     /**
      * Set the banned networks
      *
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidSenderDomainHandler.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidSenderDomainHandler.java
index c3e2236..2bdc60a 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidSenderDomainHandler.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidSenderDomainHandler.java
@@ -26,11 +26,10 @@ import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.protocols.smtp.SMTPSession;
 
 public class ValidSenderDomainHandler extends org.apache.james.protocols.smtp.core.fastfail.ValidSenderDomainHandler {
-    
-    private DNSService dnsService;
+    private final DNSService dnsService;
 
     @Inject
-    public void setDNSService(DNSService dnsService) {
+    public ValidSenderDomainHandler(DNSService dnsService) {
         this.dnsService = dnsService;
     }
 
diff --git a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java
index 72543f7..13adf0f 100644
--- a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java
+++ b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java
@@ -59,13 +59,12 @@ public class ValidRcptHandlerTest {
 
     @Before
     public void setUp() throws Exception {
-        UsersRepository users = MemoryUsersRepository.withoutVirtualHosting();
-        users.addUser(VALID_USER, PASSWORD);
-
         MemoryDomainList memoryDomainList = new MemoryDomainList(mock(DNSService.class));
         memoryDomainList.configure(DomainListConfiguration.builder()
             .defaultDomain(Domain.LOCALHOST)
             .build());
+        UsersRepository users = MemoryUsersRepository.withoutVirtualHosting(memoryDomainList);
+        users.addUser(VALID_USER, PASSWORD);
 
         memoryRecipientRewriteTable = new MemoryRecipientRewriteTable();
         memoryRecipientRewriteTable.setDomainList(memoryDomainList);
diff --git a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/ValidRcptMXTest.java b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/ValidRcptMXTest.java
index c7db08d..be784d7 100644
--- a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/ValidRcptMXTest.java
+++ b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/ValidRcptMXTest.java
@@ -81,8 +81,7 @@ public class ValidRcptMXTest {
         MailAddress mailAddress = new MailAddress("test@" + INVALID_HOST);
         SMTPSession session = setupMockedSMTPSession(mailAddress);
 
-        ValidRcptMX handler = new ValidRcptMX();
-        handler.setDNSService(dns);
+        ValidRcptMX handler = new ValidRcptMX(dns);
         handler.setBannedNetworks(ImmutableList.of(bannedAddress), dns);
         HookReturnCode rCode = handler.doRcpt(session, MaybeSender.nullSender(), mailAddress).getResult();
 


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


[james-project] 22/49: [Refactoring] Better naming in CassandraMessageDAO

Posted by bt...@apache.org.
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 149ad8a3be1bc53103ec0c8b3228b4ca47c335f0
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Nov 18 17:59:05 2019 +0700

    [Refactoring] Better naming in CassandraMessageDAO
---
 .../james/mailbox/cassandra/mail/CassandraMessageDAO.java  | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java
index e663b98..37976ab 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java
@@ -226,11 +226,11 @@ public class CassandraMessageDAO {
 
     private List<UDTValue> buildPropertiesUdt(MailboxMessage message) {
         return message.getProperties().stream()
-            .map(x -> typesProvider.getDefinedUserType(PROPERTIES)
+            .map(property -> typesProvider.getDefinedUserType(PROPERTIES)
                 .newValue()
-                .setString(Properties.NAMESPACE, x.getNamespace())
-                .setString(Properties.NAME, x.getLocalName())
-                .setString(Properties.VALUE, x.getValue()))
+                .setString(Properties.NAMESPACE, property.getNamespace())
+                .setString(Properties.NAME, property.getLocalName())
+                .setString(Properties.VALUE, property.getValue()))
             .collect(Guavate.toImmutableList());
     }
 
@@ -278,12 +278,16 @@ public class CassandraMessageDAO {
     private PropertyBuilder getPropertyBuilder(Row row) {
         PropertyBuilder property = new PropertyBuilder(
             row.getList(PROPERTIES, UDTValue.class).stream()
-                .map(x -> new Property(x.getString(Properties.NAMESPACE), x.getString(Properties.NAME), x.getString(Properties.VALUE)))
+                .map(this::toProperty)
                 .collect(Collectors.toList()));
         property.setTextualLineCount(row.getLong(TEXTUAL_LINE_COUNT));
         return property;
     }
 
+    private Property toProperty(UDTValue udtValue) {
+        return new Property(udtValue.getString(Properties.NAMESPACE), udtValue.getString(Properties.NAME), udtValue.getString(Properties.VALUE));
+    }
+
     private Stream<MessageAttachmentRepresentation> getAttachments(Row row, FetchType fetchType) {
         switch (fetchType) {
             case Full:


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


[james-project] 08/49: [Refactoring] Fix DomainList exceptions

Posted by bt...@apache.org.
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 8cd3907946d930ed6fdf7d33eadd188c13a2fe8b
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Nov 18 14:09:20 2019 +0700

    [Refactoring] Fix DomainList exceptions
---
 .../src/main/java/org/apache/james/domainlist/api/DomainList.java     | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/server/data/data-api/src/main/java/org/apache/james/domainlist/api/DomainList.java b/server/data/data-api/src/main/java/org/apache/james/domainlist/api/DomainList.java
index 5a97971..29cd268 100644
--- a/server/data/data-api/src/main/java/org/apache/james/domainlist/api/DomainList.java
+++ b/server/data/data-api/src/main/java/org/apache/james/domainlist/api/DomainList.java
@@ -29,10 +29,8 @@ import org.apache.james.core.Domain;
 public interface DomainList {
 
     /**
-     * Return array of domains which should be used as localdomains. Return null
+     * Return list of domains which should be used as localdomains. Return empty
      * if no domain is found.
-     * 
-     * @return domains
      */
     List<Domain> getDomains() throws DomainListException;
 


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


[james-project] 42/49: [Refactoring] protocols-imap4: remove unused code

Posted by bt...@apache.org.
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 f4474599c1064853fc0db6b793cd3974311353fd
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 21:13:33 2019 +0700

    [Refactoring] protocols-imap4: remove unused code
---
 .../java/org/apache/james/imapserver/netty/IMAPServer.java     |  8 --------
 .../org/apache/james/imapserver/netty/NettyImapSession.java    | 10 ----------
 2 files changed, 18 deletions(-)

diff --git a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/IMAPServer.java b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/IMAPServer.java
index b83b8e3..55dfc61 100644
--- a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/IMAPServer.java
+++ b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/IMAPServer.java
@@ -42,7 +42,6 @@ import org.jboss.netty.channel.ChannelPipeline;
 import org.jboss.netty.channel.ChannelPipelineFactory;
 import org.jboss.netty.channel.ChannelUpstreamHandler;
 import org.jboss.netty.channel.group.ChannelGroup;
-import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
 import org.jboss.netty.handler.execution.ExecutionHandler;
 import org.jboss.netty.handler.ssl.SslHandler;
 import org.jboss.netty.handler.stream.ChunkedWriteHandler;
@@ -213,13 +212,6 @@ public class IMAPServer extends AbstractConfigurableAsyncServer implements ImapC
         return coreHandler;
     }
 
-    /**
-     * Return null as we don't need this
-     */
-    protected OneToOneEncoder createEncoder() {
-        return null;
-    }
-
     @Override
     protected ChannelHandlerFactory createFrameHandlerFactory() {
         return new SwitchableLineBasedFrameDecoderFactory(maxLineLength);
diff --git a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/NettyImapSession.java b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/NettyImapSession.java
index f10fa1a..18b74bf 100644
--- a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/NettyImapSession.java
+++ b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/NettyImapSession.java
@@ -52,16 +52,6 @@ public class NettyImapSession implements ImapSession, NettyConstants {
         this.plainAuthDisallowed = plainAuthDisallowed;
     }
 
-    /**
-     * Return the wrapped {@link Channel} which this {@link ImapSession} is
-     * bound to
-     * 
-     * @return channel
-     */
-    public Channel getChannel() {
-        return channel;
-    }
-
     @Override
     public void logout() {
         closeMailbox();


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


[james-project] 29/49: [Refactoring] Clean mailetcontainer-camel javadoc

Posted by bt...@apache.org.
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 c398e35c5b6e8ac79f5875bddba614796c41974e
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 15:10:46 2019 +0700

    [Refactoring] Clean mailetcontainer-camel javadoc
---
 .../impl/camel/CamelMailetProcessor.java           |  2 --
 .../mailetcontainer/impl/camel/CamelProcessor.java |  6 ----
 .../impl/camel/MatcherSplitter.java                |  1 -
 .../jmx/JMXStateCompositeProcessorListener.java    |  9 ------
 .../impl/jmx/JMXStateMailetProcessorListener.java  | 15 ----------
 .../impl/jmx/MailProcessorManagement.java          |  3 --
 .../james/mailetcontainer/impl/matchers/Not.java   |  6 ++--
 .../james/mailetcontainer/impl/matchers/Or.java    |  7 ++---
 .../james/mailetcontainer/impl/matchers/Xor.java   |  7 ++---
 .../lib/AbstractStateCompositeProcessor.java       | 13 --------
 .../lib/AbstractStateMailetProcessor.java          | 35 ++--------------------
 11 files changed, 12 insertions(+), 92 deletions(-)

diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/CamelMailetProcessor.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/CamelMailetProcessor.java
index 16c0dab..2d221d8 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/CamelMailetProcessor.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/CamelMailetProcessor.java
@@ -90,8 +90,6 @@ public class CamelMailetProcessor extends AbstractStateMailetProcessor implement
      * Return the endpoint for the processorname.
      * 
      * This will return a "direct" endpoint.
-     * 
-     * @return endPoint
      */
     protected String getEndpoint() {
         return "direct:processor." + getState();
diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/CamelProcessor.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/CamelProcessor.java
index 779545c..346e738 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/CamelProcessor.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/CamelProcessor.java
@@ -47,12 +47,6 @@ public class CamelProcessor {
     private final Mailet mailet;
     private final CamelMailetProcessor processor;
 
-    /**
-     * Mailet to call on process
-     *  @param metricFactory
-     * @param processor
-     * @param mailet
-     */
     public CamelProcessor(MetricFactory metricFactory, CamelMailetProcessor processor, Mailet mailet) {
         this.metricFactory = metricFactory;
         this.processor = processor;
diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/MatcherSplitter.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/MatcherSplitter.java
index 03fe79a..044dcf2 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/MatcherSplitter.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/MatcherSplitter.java
@@ -82,7 +82,6 @@ public class MatcherSplitter {
      * @param mail
      *            Mail which is stored in the @Body of the MailMessage
      * @return mailMessageList
-     * @throws MessagingException
      */
     @Handler
     public List<Mail> split(@Body Mail mail) throws MessagingException {
diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/jmx/JMXStateCompositeProcessorListener.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/jmx/JMXStateCompositeProcessorListener.java
index 098cbe3..c3789b5 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/jmx/JMXStateCompositeProcessorListener.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/jmx/JMXStateCompositeProcessorListener.java
@@ -27,7 +27,6 @@ import java.util.Map;
 import javax.mail.MessagingException;
 import javax.management.JMException;
 import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 
 import org.apache.james.lifecycle.api.Disposable;
@@ -71,9 +70,6 @@ public class JMXStateCompositeProcessorListener implements CompositeProcessorLis
 
     /**
      * Register all JMX MBeans
-     * 
-     * @throws JMException
-     * @throws MalformedObjectNameException
      */
     private void registerMBeans() throws JMException {
 
@@ -87,11 +83,6 @@ public class JMXStateCompositeProcessorListener implements CompositeProcessorLis
 
     /**
      * Register a JMX MBean for a {@link MailProcessor}
-     * 
-     * @param baseObjectName
-     * @param processorName
-     * @throws JMException
-     * @throws MalformedObjectNameException
      */
     private void registerProcessorMBean(String baseObjectName, String processorName) throws JMException {
         String processorMBeanName = baseObjectName + "processor=" + processorName;
diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/jmx/JMXStateMailetProcessorListener.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/jmx/JMXStateMailetProcessorListener.java
index 4a07dba..38fe438 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/jmx/JMXStateMailetProcessorListener.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/jmx/JMXStateMailetProcessorListener.java
@@ -28,7 +28,6 @@ import java.util.Map;
 
 import javax.management.JMException;
 import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 
 import org.apache.james.core.MailAddress;
@@ -84,9 +83,6 @@ public class JMXStateMailetProcessorListener implements MailetProcessorListener,
 
     /**
      * Register all JMX MBeans
-     * 
-     * @throws JMException
-     * @throws MalformedObjectNameException
      */
     private void registerMBeans() throws JMException {
         String baseObjectName = "org.apache.james:type=component,component=mailetcontainer,name=processor,processor=" + name;
@@ -97,11 +93,6 @@ public class JMXStateMailetProcessorListener implements MailetProcessorListener,
 
     /**
      * Register the Mailets as JMX MBeans
-     * 
-     * @param parentMBeanName
-     * @param mailets
-     * @throws JMException
-     * @throws MalformedObjectNameException
      */
     private void registerMailets(String parentMBeanName, Iterator<Mailet> mailets) throws JMException {
         int i = 0;
@@ -118,12 +109,6 @@ public class JMXStateMailetProcessorListener implements MailetProcessorListener,
 
     /**
      * Register the {@link Matcher}'s as JMX MBeans
-     * 
-     * @param parentMBeanName
-     * @param matchers
-     * @param nestingLevel
-     * @throws JMException
-     * @throws MalformedObjectNameException
      */
     private void registerMatchers(String parentMBeanName, Iterator<Matcher> matchers, int nestingLevel) throws JMException {
         int i = 0;
diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/jmx/MailProcessorManagement.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/jmx/MailProcessorManagement.java
index 4e3f567..5719653 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/jmx/MailProcessorManagement.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/jmx/MailProcessorManagement.java
@@ -46,9 +46,6 @@ public class MailProcessorManagement extends StandardMBean implements MailProces
 
     /**
      * Update the stats
-     * 
-     * @param processTime
-     * @param success
      */
     public void update(long processTime, boolean success) {
         long fastest = fastestProcessing.get();
diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Not.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Not.java
index d39be52..245b23f 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Not.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Not.java
@@ -36,12 +36,12 @@ import com.google.common.collect.Lists;
  * of each child matcher. Of course it is easier to understand if it only
  * includes one matcher in the composition, the normal recommended use. @See
  * CompositeMatcher interface.
- *
- * @return Collection of Recipients from the Negated composition of the child
- *         Matcher(s).
  */
 public class Not extends GenericCompositeMatcher {
 
+    /**
+     * @return Collection of Recipients from the Negated composition of the child Matcher(s).
+     */
     @Override
     public Collection<MailAddress> match(Mail mail) throws MessagingException {
         Collection<MailAddress> finalResult = Optional.ofNullable(Lists.newArrayList(mail.getRecipients())).orElse(new ArrayList<>());
diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Or.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Or.java
index 8321dc8..36f5a9e 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Or.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Or.java
@@ -31,12 +31,11 @@ import org.apache.mailet.Matcher;
 /**
  * This is the Or CompositeMatcher - consider it to be a union of the
  * results.
- *
- * @return Collection of Recipients from the Or composition results of the
- *         child matchers.
  */
 public class Or extends GenericCompositeMatcher {
-
+    /**
+     * @return Collection of Recipients from the Or composition results of the child matchers.
+     */
     @Override
     public Collection<MailAddress> match(Mail mail) throws MessagingException {
         HashSet<MailAddress> result = new HashSet<>();
diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Xor.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Xor.java
index 3170b43..d2ba03d 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Xor.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Xor.java
@@ -36,12 +36,11 @@ import com.google.common.collect.Sets;
  * This is the Xor CompositeMatcher - consider it to be the inequality
  * operator for recipients. If any recipients match other matcher results
  * then the result does not include that recipient.
- *
- * @return Collection of Recipients from the Xor composition of the child
- *         matchers.
  */
 public class Xor extends GenericCompositeMatcher {
-
+    /**
+     * @return Collection of Recipients from the Xor composition of the child matchers.
+     */
     @Override
     public Collection<MailAddress> match(Mail mail) throws MessagingException {
         Collection<MailAddress> finalResult = null;
diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java
index b7a5bd9..0aeb08c 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java
@@ -109,9 +109,6 @@ public abstract class AbstractStateCompositeProcessor implements MailProcessor,
 
     /**
      * Return a {@link MailProcessor} for a given state
-     * 
-     * @param state
-     * @return processor
      */
     public MailProcessor getProcessor(String state) {
         return processors.get(state);
@@ -124,8 +121,6 @@ public abstract class AbstractStateCompositeProcessor implements MailProcessor,
     /**
      * Check if all needed Processors are configured and if not throw a
      * {@link ConfigurationException}
-     * 
-     * @throws ConfigurationException
      */
     private void checkProcessors() throws ConfigurationException {
         boolean errorProcessorFound = false;
@@ -189,11 +184,6 @@ public abstract class AbstractStateCompositeProcessor implements MailProcessor,
 
     /**
      * Create a new {@link MailProcessor}
-     * 
-     * @param state
-     * @param config
-     * @return container
-     * @throws Exception
      */
     protected abstract MailProcessor createMailProcessor(String state, HierarchicalConfiguration<ImmutableNode> config) throws Exception;
 
@@ -206,9 +196,6 @@ public abstract class AbstractStateCompositeProcessor implements MailProcessor,
         /**
          * Get called after the processing via a {@link MailProcessor} was
          * complete
-         * 
-         * @param processor
-         * @param mailName
          * @param processTime
          *            in ms
          * @param e
diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java
index 1e55d80..adbea53 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java
@@ -29,7 +29,6 @@ import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
 import javax.inject.Inject;
 import javax.mail.MessagingException;
-import javax.management.NotCompliantMBeanException;
 
 import org.apache.commons.configuration2.HierarchicalConfiguration;
 import org.apache.commons.configuration2.ex.ConfigurationException;
@@ -111,8 +110,6 @@ public abstract class AbstractStateMailetProcessor implements MailProcessor, Con
 
     /**
      * Init the container
-     * 
-     * @throws Exception
      */
     @PostConstruct
     public void init() throws Exception {
@@ -149,9 +146,6 @@ public abstract class AbstractStateMailetProcessor implements MailProcessor, Con
 
     /**
      * Hand the mail over to another processor
-     * 
-     * @param mail
-     * @throws MessagingException
      */
     protected void toProcessor(Mail mail) throws MessagingException {
         rootMailProcessor.service(mail);
@@ -163,8 +157,6 @@ public abstract class AbstractStateMailetProcessor implements MailProcessor, Con
 
     /**
      * Return a unmodifiable {@link List} of the configured {@link Mailet}'s
-     * 
-     * @return mailets
      */
     public List<Mailet> getMailets() {
         return pairs.stream()
@@ -174,8 +166,6 @@ public abstract class AbstractStateMailetProcessor implements MailProcessor, Con
 
     /**
      * Return a unmodifiable {@link List} of the configured {@link Matcher}'s
-     * 
-     * @return matchers
      */
     public List<Matcher> getMatchers() {
         return pairs.stream()
@@ -193,10 +183,6 @@ public abstract class AbstractStateMailetProcessor implements MailProcessor, Con
 
     /**
      * Create a {@link MailetConfig} for the given mailetname and configuration
-     * 
-     * @param mailetName
-     * @param configuration
-     * @return mailetConfig
      */
     private MailetConfig createMailetConfig(String mailetName, HierarchicalConfiguration<ImmutableNode> configuration) {
 
@@ -209,9 +195,6 @@ public abstract class AbstractStateMailetProcessor implements MailProcessor, Con
 
     /**
      * Create a {@link MatcherConfig} for the given "match=" attribute.
-     * 
-     * @param matchName
-     * @return matcherConfig
      */
     private MatcherConfig createMatcherConfig(String matchName) {
         String condition = null;
@@ -233,13 +216,8 @@ public abstract class AbstractStateMailetProcessor implements MailProcessor, Con
      * {@link Matcher}'s
      * 
      * CompositeMatcher were added by JAMES-948
-     * 
-     * @param compMap
-     * @param compMatcherConfs
+     *
      * @return compositeMatchers
-     * @throws ConfigurationException
-     * @throws MessagingException
-     * @throws NotCompliantMBeanException
      */
     private List<Matcher> loadCompositeMatchers(String state, Map<String, Matcher> compMap, List<HierarchicalConfiguration<ImmutableNode>> compMatcherConfs) throws ConfigurationException, MessagingException {
         List<Matcher> matchers = new ArrayList<>();
@@ -426,10 +404,7 @@ public abstract class AbstractStateMailetProcessor implements MailProcessor, Con
 
         /**
          * Get called after each {@link Mailet} call was complete
-         * 
-         * @param m
-         * @param mailName
-         * @param state
+         *
          * @param processTime
          *            in ms
          * @param e
@@ -439,11 +414,7 @@ public abstract class AbstractStateMailetProcessor implements MailProcessor, Con
 
         /**
          * Get called after each {@link Matcher} call was complete
-         * 
-         * @param m
-         * @param mailName
-         * @param recipients
-         * @param matches
+         *
          * @param processTime
          *            in ms
          * @param e


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


[james-project] 09/49: [Refactoring] JPADomainList should not open transactions upon read

Posted by bt...@apache.org.
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 a01d4499387092fd5e2873cd71285145f73fc346
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Nov 18 14:15:17 2019 +0700

    [Refactoring] JPADomainList should not open transactions upon read
---
 .../apache/james/domainlist/jpa/JPADomainList.java  | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/server/data/data-jpa/src/main/java/org/apache/james/domainlist/jpa/JPADomainList.java b/server/data/data-jpa/src/main/java/org/apache/james/domainlist/jpa/JPADomainList.java
index 40cd999..0aaca0d 100644
--- a/server/data/data-jpa/src/main/java/org/apache/james/domainlist/jpa/JPADomainList.java
+++ b/server/data/data-jpa/src/main/java/org/apache/james/domainlist/jpa/JPADomainList.java
@@ -18,7 +18,6 @@
  ****************************************************************/
 package org.apache.james.domainlist.jpa;
 
-import java.util.ArrayList;
 import java.util.List;
 
 import javax.annotation.PostConstruct;
@@ -39,7 +38,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.github.steveash.guavate.Guavate;
-import com.google.common.collect.ImmutableList;
 
 /**
  * JPA implementation of the DomainList.<br>
@@ -62,8 +60,6 @@ public class JPADomainList extends AbstractDomainList {
 
     /**
      * Set the entity manager to use.
-     *
-     * @param entityManagerFactory
      */
     @Inject
     @PersistenceUnit(unitName = "James")
@@ -79,41 +75,30 @@ public class JPADomainList extends AbstractDomainList {
     @SuppressWarnings("unchecked")
     @Override
     protected List<Domain> getDomainListInternal() throws DomainListException {
-        List<Domain> domains = new ArrayList<>();
         EntityManager entityManager = entityManagerFactory.createEntityManager();
-        final EntityTransaction transaction = entityManager.getTransaction();
         try {
-            transaction.begin();
             List<String> resultList = entityManager
                     .createNamedQuery("listDomainNames")
                     .getResultList();
-            domains = resultList
+            return resultList
                     .stream()
-                    .map(domainAsString -> Domain.of(domainAsString))
+                    .map(Domain::of)
                     .collect(Guavate.toImmutableList());
-            transaction.commit();
         } catch (PersistenceException e) {
             LOGGER.error("Failed to list domains", e);
-            rollback(transaction);
             throw new DomainListException("Unable to retrieve domains", e);
         } finally {
             entityManager.close();
         }
-        return ImmutableList.copyOf(domains);
     }
 
     @Override
     protected boolean containsDomainInternal(Domain domain) throws DomainListException {
         EntityManager entityManager = entityManagerFactory.createEntityManager();
-        final EntityTransaction transaction = entityManager.getTransaction();
         try {
-            transaction.begin();
-            boolean result = containsDomainInternal(domain, entityManager);
-            transaction.commit();
-            return result;
+            return containsDomainInternal(domain, entityManager);
         } catch (PersistenceException e) {
             LOGGER.error("Failed to find domain", e);
-            rollback(transaction);
             throw new DomainListException("Unable to retrieve domains", e);
         } finally {
             entityManager.close();


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


[james-project] 48/49: JAMES-2773 add glowroot plugin for mail spooler

Posted by bt...@apache.org.
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 352d2bfbf94ccc5dc2aeb7b8d7c760de3535262b
Author: RĂ©mi KOWALSKI <rk...@linagora.com>
AuthorDate: Tue Nov 19 15:18:19 2019 +0100

    JAMES-2773 add glowroot plugin for mail spooler
---
 .../destination/glowroot/plugins/spooler.json         | 19 +++++++++++++++++++
 .../destination/glowroot/plugins/spooler.json         | 19 +++++++++++++++++++
 .../destination/glowroot/plugins/spooler.json         | 19 +++++++++++++++++++
 .../destination/glowroot/plugins/spooler.json         | 19 +++++++++++++++++++
 .../destination/glowroot/plugins/spooler.json         | 19 +++++++++++++++++++
 .../jpa/destination/glowroot/plugins/spooler.json     | 19 +++++++++++++++++++
 .../memory/destination/glowroot/plugins/spooler.json  | 19 +++++++++++++++++++
 7 files changed, 133 insertions(+)

diff --git a/dockerfiles/run/guice/cassandra-ldap/destination/glowroot/plugins/spooler.json b/dockerfiles/run/guice/cassandra-ldap/destination/glowroot/plugins/spooler.json
new file mode 100644
index 0000000..b9623a0
--- /dev/null
+++ b/dockerfiles/run/guice/cassandra-ldap/destination/glowroot/plugins/spooler.json
@@ -0,0 +1,19 @@
+{
+  "name": "Spooler Plugin",
+  "id": "spooler",
+  "instrumentation": [
+    {
+      "className": "org.apache.james.mailetcontainer.api.MailProcessor",
+      "methodName": "service",
+      "methodParameterTypes": [
+        ".."
+      ],
+      "captureKind": "transaction",
+      "transactionType": "Spooler",
+      "transactionNameTemplate": "Mailet processor : {{this.class.name}}",
+      "alreadyInTransactionBehavior": "capture-trace-entry",
+      "traceEntryMessageTemplate": "{{this.class.name}}.{{methodName}}",
+      "timerName": "mailetProcessor"
+    }
+  ]
+}
\ No newline at end of file
diff --git a/dockerfiles/run/guice/cassandra-rabbitmq-ldap/destination/glowroot/plugins/spooler.json b/dockerfiles/run/guice/cassandra-rabbitmq-ldap/destination/glowroot/plugins/spooler.json
new file mode 100644
index 0000000..b9623a0
--- /dev/null
+++ b/dockerfiles/run/guice/cassandra-rabbitmq-ldap/destination/glowroot/plugins/spooler.json
@@ -0,0 +1,19 @@
+{
+  "name": "Spooler Plugin",
+  "id": "spooler",
+  "instrumentation": [
+    {
+      "className": "org.apache.james.mailetcontainer.api.MailProcessor",
+      "methodName": "service",
+      "methodParameterTypes": [
+        ".."
+      ],
+      "captureKind": "transaction",
+      "transactionType": "Spooler",
+      "transactionNameTemplate": "Mailet processor : {{this.class.name}}",
+      "alreadyInTransactionBehavior": "capture-trace-entry",
+      "traceEntryMessageTemplate": "{{this.class.name}}.{{methodName}}",
+      "timerName": "mailetProcessor"
+    }
+  ]
+}
\ No newline at end of file
diff --git a/dockerfiles/run/guice/cassandra-rabbitmq/destination/glowroot/plugins/spooler.json b/dockerfiles/run/guice/cassandra-rabbitmq/destination/glowroot/plugins/spooler.json
new file mode 100644
index 0000000..b9623a0
--- /dev/null
+++ b/dockerfiles/run/guice/cassandra-rabbitmq/destination/glowroot/plugins/spooler.json
@@ -0,0 +1,19 @@
+{
+  "name": "Spooler Plugin",
+  "id": "spooler",
+  "instrumentation": [
+    {
+      "className": "org.apache.james.mailetcontainer.api.MailProcessor",
+      "methodName": "service",
+      "methodParameterTypes": [
+        ".."
+      ],
+      "captureKind": "transaction",
+      "transactionType": "Spooler",
+      "transactionNameTemplate": "Mailet processor : {{this.class.name}}",
+      "alreadyInTransactionBehavior": "capture-trace-entry",
+      "traceEntryMessageTemplate": "{{this.class.name}}.{{methodName}}",
+      "timerName": "mailetProcessor"
+    }
+  ]
+}
\ No newline at end of file
diff --git a/dockerfiles/run/guice/cassandra/destination/glowroot/plugins/spooler.json b/dockerfiles/run/guice/cassandra/destination/glowroot/plugins/spooler.json
new file mode 100644
index 0000000..b9623a0
--- /dev/null
+++ b/dockerfiles/run/guice/cassandra/destination/glowroot/plugins/spooler.json
@@ -0,0 +1,19 @@
+{
+  "name": "Spooler Plugin",
+  "id": "spooler",
+  "instrumentation": [
+    {
+      "className": "org.apache.james.mailetcontainer.api.MailProcessor",
+      "methodName": "service",
+      "methodParameterTypes": [
+        ".."
+      ],
+      "captureKind": "transaction",
+      "transactionType": "Spooler",
+      "transactionNameTemplate": "Mailet processor : {{this.class.name}}",
+      "alreadyInTransactionBehavior": "capture-trace-entry",
+      "traceEntryMessageTemplate": "{{this.class.name}}.{{methodName}}",
+      "timerName": "mailetProcessor"
+    }
+  ]
+}
\ No newline at end of file
diff --git a/dockerfiles/run/guice/jpa-smtp/destination/glowroot/plugins/spooler.json b/dockerfiles/run/guice/jpa-smtp/destination/glowroot/plugins/spooler.json
new file mode 100644
index 0000000..b9623a0
--- /dev/null
+++ b/dockerfiles/run/guice/jpa-smtp/destination/glowroot/plugins/spooler.json
@@ -0,0 +1,19 @@
+{
+  "name": "Spooler Plugin",
+  "id": "spooler",
+  "instrumentation": [
+    {
+      "className": "org.apache.james.mailetcontainer.api.MailProcessor",
+      "methodName": "service",
+      "methodParameterTypes": [
+        ".."
+      ],
+      "captureKind": "transaction",
+      "transactionType": "Spooler",
+      "transactionNameTemplate": "Mailet processor : {{this.class.name}}",
+      "alreadyInTransactionBehavior": "capture-trace-entry",
+      "traceEntryMessageTemplate": "{{this.class.name}}.{{methodName}}",
+      "timerName": "mailetProcessor"
+    }
+  ]
+}
\ No newline at end of file
diff --git a/dockerfiles/run/guice/jpa/destination/glowroot/plugins/spooler.json b/dockerfiles/run/guice/jpa/destination/glowroot/plugins/spooler.json
new file mode 100644
index 0000000..b9623a0
--- /dev/null
+++ b/dockerfiles/run/guice/jpa/destination/glowroot/plugins/spooler.json
@@ -0,0 +1,19 @@
+{
+  "name": "Spooler Plugin",
+  "id": "spooler",
+  "instrumentation": [
+    {
+      "className": "org.apache.james.mailetcontainer.api.MailProcessor",
+      "methodName": "service",
+      "methodParameterTypes": [
+        ".."
+      ],
+      "captureKind": "transaction",
+      "transactionType": "Spooler",
+      "transactionNameTemplate": "Mailet processor : {{this.class.name}}",
+      "alreadyInTransactionBehavior": "capture-trace-entry",
+      "traceEntryMessageTemplate": "{{this.class.name}}.{{methodName}}",
+      "timerName": "mailetProcessor"
+    }
+  ]
+}
\ No newline at end of file
diff --git a/dockerfiles/run/guice/memory/destination/glowroot/plugins/spooler.json b/dockerfiles/run/guice/memory/destination/glowroot/plugins/spooler.json
new file mode 100644
index 0000000..b9623a0
--- /dev/null
+++ b/dockerfiles/run/guice/memory/destination/glowroot/plugins/spooler.json
@@ -0,0 +1,19 @@
+{
+  "name": "Spooler Plugin",
+  "id": "spooler",
+  "instrumentation": [
+    {
+      "className": "org.apache.james.mailetcontainer.api.MailProcessor",
+      "methodName": "service",
+      "methodParameterTypes": [
+        ".."
+      ],
+      "captureKind": "transaction",
+      "transactionType": "Spooler",
+      "transactionNameTemplate": "Mailet processor : {{this.class.name}}",
+      "alreadyInTransactionBehavior": "capture-trace-entry",
+      "traceEntryMessageTemplate": "{{this.class.name}}.{{methodName}}",
+      "timerName": "mailetProcessor"
+    }
+  ]
+}
\ No newline at end of file


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


[james-project] 04/49: [Refactoring] Repository::getChildRepository is never used

Posted by bt...@apache.org.
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 282d1e7cb8dd15bafb7e5da306f970b90a7a2fb9
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Nov 18 13:56:59 2019 +0700

    [Refactoring] Repository::getChildRepository is never used
---
 .../james/repository/api/ObjectRepository.java     |  2 +-
 .../apache/james/repository/api/Repository.java    | 25 ----------------
 .../james/repository/api/StreamRepository.java     |  2 +-
 .../repository/file/AbstractFileRepository.java    | 34 +---------------------
 4 files changed, 3 insertions(+), 60 deletions(-)

diff --git a/server/data/data-library/src/main/java/org/apache/james/repository/api/ObjectRepository.java b/server/data/data-library/src/main/java/org/apache/james/repository/api/ObjectRepository.java
index d4631bd..2a9c372 100644
--- a/server/data/data-library/src/main/java/org/apache/james/repository/api/ObjectRepository.java
+++ b/server/data/data-library/src/main/java/org/apache/james/repository/api/ObjectRepository.java
@@ -21,7 +21,7 @@ package org.apache.james.repository.api;
 
 import java.util.stream.Stream;
 
-public interface ObjectRepository extends Repository {
+public interface ObjectRepository {
 
     boolean containsKey(String key);
 
diff --git a/server/data/data-library/src/main/java/org/apache/james/repository/api/Repository.java b/server/data/data-library/src/main/java/org/apache/james/repository/api/Repository.java
deleted file mode 100644
index b33bdc6..0000000
--- a/server/data/data-library/src/main/java/org/apache/james/repository/api/Repository.java
+++ /dev/null
@@ -1,25 +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.repository.api;
-
-public interface Repository {
-
-    Repository getChildRepository(String childName);
-}
diff --git a/server/data/data-library/src/main/java/org/apache/james/repository/api/StreamRepository.java b/server/data/data-library/src/main/java/org/apache/james/repository/api/StreamRepository.java
index 4358aa9..6c3b449 100644
--- a/server/data/data-library/src/main/java/org/apache/james/repository/api/StreamRepository.java
+++ b/server/data/data-library/src/main/java/org/apache/james/repository/api/StreamRepository.java
@@ -23,7 +23,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.stream.Stream;
 
-public interface StreamRepository extends Repository {
+public interface StreamRepository {
 
     InputStream get(String key);
 
diff --git a/server/data/data-library/src/main/java/org/apache/james/repository/file/AbstractFileRepository.java b/server/data/data-library/src/main/java/org/apache/james/repository/file/AbstractFileRepository.java
index 23486c9..a2185ff 100644
--- a/server/data/data-library/src/main/java/org/apache/james/repository/file/AbstractFileRepository.java
+++ b/server/data/data-library/src/main/java/org/apache/james/repository/file/AbstractFileRepository.java
@@ -39,14 +39,13 @@ import org.apache.commons.configuration2.tree.ImmutableNode;
 import org.apache.commons.io.FileUtils;
 import org.apache.james.filesystem.api.FileSystem;
 import org.apache.james.lifecycle.api.Configurable;
-import org.apache.james.repository.api.Repository;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * This an abstract class implementing functionality for creating a file-store.
  */
-public abstract class AbstractFileRepository implements Repository, Configurable {
+public abstract class AbstractFileRepository implements Configurable {
     private static final Logger LOGGER = LoggerFactory.getLogger(AbstractFileRepository.class);
 
     protected static final boolean DEBUG = false;
@@ -166,37 +165,6 @@ public abstract class AbstractFileRepository implements Repository, Configurable
         return getClass().newInstance();
     }
 
-    @Override
-    public Repository getChildRepository(String childName) {
-        AbstractFileRepository child;
-
-        try {
-            child = createChildRepository();
-        } catch (Exception e) {
-            throw new RuntimeException("Cannot create child repository " + childName, e);
-        }
-
-        child.setFileSystem(fileSystem);
-
-        try {
-            child.setDestination(baseDirectory.getAbsolutePath() + File.pathSeparatorChar + childName + File.pathSeparator);
-        } catch (ConfigurationException ce) {
-            throw new RuntimeException("Cannot set destination for child child " + "repository " + childName + " : " + ce);
-        }
-
-        try {
-            child.init();
-        } catch (Exception e) {
-            throw new RuntimeException("Cannot initialize child " + "repository " + childName, e);
-        }
-
-        if (LOGGER.isDebugEnabled()) {
-            LOGGER.debug("Child repository of " + name + " created in " + baseDirectory + File.pathSeparatorChar + childName + File.pathSeparator);
-        }
-
-        return child;
-    }
-
     /**
      * Return the File Object which belongs to the given key
      * 


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


[james-project] 17/49: [Refactoring] JPAProperty remove unused methods

Posted by bt...@apache.org.
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 228aad412a9e9d10b443673a2c3c9958aa34e5b6
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sat Nov 16 10:53:54 2019 +0700

    [Refactoring] JPAProperty remove unused methods
---
 .../james/mailbox/jpa/mail/model/JPAProperty.java      | 18 ------------------
 1 file changed, 18 deletions(-)

diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAProperty.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAProperty.java
index 67583f0..c96cc67 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAProperty.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAProperty.java
@@ -95,24 +95,6 @@ public class JPAProperty implements Property {
     }
 
     /**
-     * Create a copy of the give JPAProperty
-     * 
-     * @param property
-     */
-    public JPAProperty(JPAProperty property) {
-        this(property.getNamespace(), property.getLocalName(), property.getValue(), property.getOrder());
-    }
-
-    /**
-     * Gets the order of this property.
-     * 
-     * @return order of this property
-     */
-    public int getOrder() {
-        return line;
-    }
-
-    /**
      * Gets the local part of the name of the property.
      * 
      * @return not null


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


[james-project] 36/49: [Refactoring] Remove unused methods in SMTPTestConfiguration

Posted by bt...@apache.org.
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 2aca38d89b69be642177be61426e2fd83a339912
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 20:02:32 2019 +0700

    [Refactoring] Remove unused methods in SMTPTestConfiguration
---
 .../james/smtpserver/SMTPTestConfiguration.java     | 21 ---------------------
 1 file changed, 21 deletions(-)

diff --git a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPTestConfiguration.java b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPTestConfiguration.java
index 1899ac8..cb695a6 100644
--- a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPTestConfiguration.java
+++ b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPTestConfiguration.java
@@ -54,27 +54,10 @@ public class SMTPTestConfiguration extends BaseHierarchicalConfiguration {
         maxMessageSizeKB = kilobytes;
     }
 
-    public int getMaxMessageSize() {
-        return maxMessageSizeKB;
-    }
-
-    public String getAuthorizedAddresses() {
-        return authorizedAddresses;
-    }
-
     public void setAuthorizedAddresses(String authorizedAddresses) {
         this.authorizedAddresses = authorizedAddresses;
     }
 
-    public void setAuthorizingNotRequired() {
-        authorizingMode = "false";
-        verifyIdentity = false;
-    }
-
-    public void setAuthorizingRequired() {
-        authorizingMode = "true";
-        verifyIdentity = true;
-    }
 
     public void setAuthorizingAnnounce() {
         authorizingMode = "announce";
@@ -85,10 +68,6 @@ public class SMTPTestConfiguration extends BaseHierarchicalConfiguration {
         connectionLimit = iConnectionLimit;
     }
 
-    public void setConnectionBacklog(int iConnectionBacklog) {
-        connectionBacklog = iConnectionBacklog;
-    }
-
     public void setHeloResolv() {
         heloResolv = true;
     }


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


[james-project] 34/49: [Refactoring] Rely on java Base64 in SMTP server test

Posted by bt...@apache.org.
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 48b5a9f4ad32744694bdd0e81bf62a0584834da1
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 19:59:16 2019 +0700

    [Refactoring] Rely on java Base64 in SMTP server test
---
 .../java/org/apache/james/smtpserver/Base64.java   | 117 ---------------------
 .../apache/james/smtpserver/SMTPServerTest.java    |  24 +++--
 2 files changed, 13 insertions(+), 128 deletions(-)

diff --git a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/Base64.java b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/Base64.java
deleted file mode 100644
index 7e46a26..0000000
--- a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/Base64.java
+++ /dev/null
@@ -1,117 +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.smtpserver;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-
-import javax.mail.MessagingException;
-import javax.mail.internet.MimeUtility;
-
-/**
- * Performs simple Base64 encoding and decode suitable for authentication. Note
- * that this is not a general purpose codec.
- */
-public class Base64 {
-
-    /**
-     * Decode base64 encoded String
-     * 
-     * @param b64string
-     *            base64 String
-     * @return reader the BufferedReader which holds the decoded base64 text
-     * @throws MessagingException
-     *             get thrown when an error was detected while trying to decode
-     *             the String
-     */
-    public static BufferedReader decode(String b64string) throws MessagingException {
-        return new BufferedReader(new InputStreamReader(MimeUtility.decode(
-                new ByteArrayInputStream(b64string.getBytes()), "base64")));
-    }
-
-    /**
-     * Decode base64 encoded String
-     * 
-     * @param b64string
-     *            base64 Sting
-     * @return returnString the String which holds the docoded base64 text
-     * @throws MessagingException
-     *             get thrown when an error was detected while trying to decode
-     *             the String
-     * @throws IOException
-     *             get thrown when I/O error was detected
-     */
-    public static String decodeAsString(String b64string) throws IOException, MessagingException {
-        if (b64string == null) {
-            return b64string;
-        }
-        String returnString = decode(b64string).readLine();
-        if (returnString == null) {
-            return returnString;
-        }
-        return returnString.trim();
-    }
-
-    /**
-     * Encode String to base64
-     * 
-     * @param plaintext
-     *            the plaintext to encode
-     * @return out the ByteArrayOutputStream holding the encoded given text
-     * @throws IOException
-     *             get thrown when I/O error was detected
-     * @throws MessagingException
-     *             get thrown when an error was detected while trying to encode
-     *             the String
-     */
-    public static ByteArrayOutputStream encode(String plaintext) throws IOException, MessagingException {
-        ByteArrayOutputStream out = new ByteArrayOutputStream();
-        byte[] in = plaintext.getBytes();
-        ByteArrayOutputStream inStream = new ByteArrayOutputStream();
-        inStream.write(in, 0, in.length);
-        // pad
-        if ((in.length % 3) == 1) {
-            inStream.write(0);
-            inStream.write(0);
-        } else if ((in.length % 3) == 2) {
-            inStream.write(0);
-        }
-        inStream.writeTo(MimeUtility.encode(out, "base64"));
-        return out;
-    }
-
-    /**
-     * Encode String to base64
-     * 
-     * @param plaintext
-     *            the plaintext to decode
-     * @return base64String the encoded String
-     * @throws IOException
-     *             get thrown when I/O error was detected
-     * @throws MessagingException
-     *             get thrown when an error was detected while trying to encode
-     *             the String
-     */
-    public static String encodeAsString(String plaintext) throws IOException, MessagingException {
-        return encode(plaintext).toString();
-    }
-}
diff --git a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java
index 9c75008..b0c094d 100644
--- a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java
+++ b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java
@@ -18,6 +18,7 @@
  ****************************************************************/
 package org.apache.james.smtpserver;
 
+import static java.nio.charset.StandardCharsets.UTF_8;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Fail.fail;
 import static org.mockito.Mockito.mock;
@@ -34,6 +35,7 @@ import java.net.InetSocketAddress;
 import java.net.Socket;
 import java.net.UnknownHostException;
 import java.util.ArrayList;
+import java.util.Base64;
 import java.util.Collection;
 import java.util.List;
 
@@ -384,7 +386,7 @@ public class SMTPServerTest {
         // no message there, yet
         assertThat(queue.getLastMail())
             .as("no mail received by mail server")
-            .isNull();;
+            .isNull();
 
         smtpProtocol.sendCommand("EHLO " + InetAddress.getLocalHost());
         String[] capabilityRes = smtpProtocol.getReplyStrings();
@@ -500,7 +502,7 @@ public class SMTPServerTest {
         // no message there, yet
         assertThat(queue.getLastMail())
             .as("no mail received by mail server")
-            .isNull();;
+            .isNull();
 
         smtpProtocol.sendCommand("EHLO " + InetAddress.getLocalHost());
         String[] capabilityRes = smtpProtocol.getReplyStrings();
@@ -534,7 +536,7 @@ public class SMTPServerTest {
         // no message there, yet
         assertThat(queue.getLastMail())
             .as("no mail received by mail server")
-            .isNull();;
+            .isNull();
 
         smtpProtocol.sendCommand("EHLO " + InetAddress.getLocalHost());
         smtpProtocol.sendCommand("STARTTLS");
@@ -555,7 +557,7 @@ public class SMTPServerTest {
         // no message there, yet
         assertThat(queue.getLastMail())
             .as("no mail received by mail server")
-            .isNull();;
+            .isNull();
 
         smtpProtocol.sendCommand("EHLO " + InetAddress.getLocalHost());
         smtpProtocol.sendCommand("STARTTLS\r\nAUTH PLAIN");
@@ -594,7 +596,7 @@ public class SMTPServerTest {
         // no message there, yet
         assertThat(queue.getLastMail())
             .as("no mail received by mail server")
-            .isNull();;
+            .isNull();
 
         smtp.helo(InetAddress.getLocalHost().toString());
         smtp.setSender("mail@localhost");
@@ -620,7 +622,7 @@ public class SMTPServerTest {
         // no message there, yet
         assertThat(queue.getLastMail())
             .as("no mail received by mail server")
-            .isNull();;
+            .isNull();
 
         smtp.helo(InetAddress.getLocalHost().toString());
         smtp.setSender("mail@localhost");
@@ -1285,7 +1287,7 @@ public class SMTPServerTest {
             .isFalse();
 
         smtpProtocol.sendCommand("AUTH PLAIN");
-        smtpProtocol.sendCommand(Base64.encodeAsString("\0" + noexistUserName + "\0pwd\0"));
+        smtpProtocol.sendCommand(Base64.getEncoder().encodeToString(("\0" + noexistUserName + "\0pwd\0").getBytes(UTF_8)));
         // smtpProtocol.sendCommand(noexistUserName+"pwd".toCharArray());
         assertThat(smtpProtocol.getReplyCode())
             .as("expected error")
@@ -1294,13 +1296,13 @@ public class SMTPServerTest {
         usersRepository.addUser(Username.of(userName), "pwd");
 
         smtpProtocol.sendCommand("AUTH PLAIN");
-        smtpProtocol.sendCommand(Base64.encodeAsString("\0" + userName + "\0wrongpwd\0"));
+        smtpProtocol.sendCommand(Base64.getEncoder().encodeToString(("\0" + userName + "\0wrongpwd\0").getBytes(UTF_8)));
         assertThat(smtpProtocol.getReplyCode())
             .as("expected error")
             .isEqualTo(535);
 
         smtpProtocol.sendCommand("AUTH PLAIN");
-        smtpProtocol.sendCommand(Base64.encodeAsString("\0" + userName + "\0pwd\0"));
+        smtpProtocol.sendCommand(Base64.getEncoder().encodeToString(("\0" + userName + "\0pwd\0").getBytes(UTF_8)));
         assertThat(smtpProtocol.getReplyCode())
             .as("authenticated")
             .isEqualTo(235);
@@ -1339,7 +1341,7 @@ public class SMTPServerTest {
         smtpProtocol.setSender("");
 
         smtpProtocol.sendCommand("AUTH PLAIN");
-        smtpProtocol.sendCommand(Base64.encodeAsString("\0" + userName + "\0pwd\0"));
+        smtpProtocol.sendCommand(Base64.getEncoder().encodeToString(("\0" + userName + "\0pwd\0").getBytes(UTF_8)));
         assertThat(smtpProtocol.getReplyCode())
             .as("authenticated")
             .isEqualTo(235);
@@ -1558,7 +1560,7 @@ public class SMTPServerTest {
         usersRepository.addUser(Username.of(userName), "pwd");
 
         smtpProtocol.sendCommand("AUTH PLAIN");
-        smtpProtocol.sendCommand(Base64.encodeAsString("\0" + userName + "\0pwd\0"));
+        smtpProtocol.sendCommand(Base64.getEncoder().encodeToString(("\0" + userName + "\0pwd\0").getBytes(UTF_8)));
         assertThat(smtpProtocol.getReplyCode())
             .as("authenticated")
             .isEqualTo(235);


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


[james-project] 18/49: [Refactoring] JPAProperty equals & hashCode

Posted by bt...@apache.org.
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 c8341a7b4053e1ba9260682be83c900cbee64128
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sat Nov 16 10:54:44 2019 +0700

    [Refactoring] JPAProperty equals & hashCode
---
 .../james/mailbox/jpa/mail/model/JPAProperty.java  | 31 ++++++++--------------
 1 file changed, 11 insertions(+), 20 deletions(-)

diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAProperty.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAProperty.java
index c96cc67..1f07100 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAProperty.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAProperty.java
@@ -18,6 +18,8 @@
  ****************************************************************/
 package org.apache.james.mailbox.jpa.mail.model;
 
+import java.util.Objects;
+
 import javax.persistence.Basic;
 import javax.persistence.Column;
 import javax.persistence.Entity;
@@ -125,29 +127,18 @@ public class JPAProperty implements Property {
     }
 
     @Override
-    public int hashCode() {
-        final int PRIME = 31;
-        int result = 1;
-        result = PRIME * result + (int) (id ^ (id >>> 32));
-        return result;
+    public final boolean equals(Object o) {
+        if (o instanceof JPAProperty) {
+            JPAProperty that = (JPAProperty) o;
+
+            return Objects.equals(this.id, that.id);
+        }
+        return false;
     }
 
     @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        final JPAProperty other = (JPAProperty) obj;
-        if (id != other.id) {
-            return false;
-        }
-        return true;
+    public final int hashCode() {
+        return Objects.hash(id);
     }
 
     /**


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


[james-project] 27/49: [Refactoring] MailetConfigImpl::getInitAttribute is not used

Posted by bt...@apache.org.
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 56cbdbab7443ed199633d439c4fb380c55bfd854
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 15:01:09 2019 +0700

    [Refactoring] MailetConfigImpl::getInitAttribute is not used
    
    Not defined in the API either...
---
 .../apache/james/mailetcontainer/impl/MailetConfigImpl.java  | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/MailetConfigImpl.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/MailetConfigImpl.java
index db29116..e5b30ab 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/MailetConfigImpl.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/MailetConfigImpl.java
@@ -89,18 +89,6 @@ public class MailetConfigImpl implements MailetConfig {
         return params.iterator();
     }
 
-    /**
-     * Get the value of an (XML) attribute stored in this MailetConfig.
-     * 
-     * @param name
-     *            the name of the attribute whose value is to be retrieved.
-     * 
-     * @return the attribute value or null if missing
-     */
-    public String getInitAttribute(String name) {
-        return configuration.getString("[@" + name + "]", null);
-    }
-
     @Override
     public MailetContext getMailetContext() {
         return mailetContext;


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


[james-project] 24/49: [Refactoring] MailStateNotEquals class is not used

Posted by bt...@apache.org.
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 437710d434fa48079c23a72ebc1164125b85dbcb
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 14:58:37 2019 +0700

    [Refactoring] MailStateNotEquals class is not used
---
 .../impl/camel/MailStateNotEquals.java             | 42 ----------------------
 1 file changed, 42 deletions(-)

diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/MailStateNotEquals.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/MailStateNotEquals.java
deleted file mode 100644
index 11b124e..0000000
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/MailStateNotEquals.java
+++ /dev/null
@@ -1,42 +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.mailetcontainer.impl.camel;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Predicate;
-import org.apache.mailet.Mail;
-
-/**
- * Check if the Mail state is NOT equal to the one given on the constructor
- */
-public class MailStateNotEquals implements Predicate {
-
-    private final String state;
-
-    public MailStateNotEquals(String state) {
-        this.state = state;
-    }
-
-    @Override
-    public boolean matches(Exchange ex) {
-        Mail m = ex.getIn().getBody(Mail.class);
-        return !state.equals(m.getState());
-    }
-
-}


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


[james-project] 05/49: [Refactoring] AbstractFileRepository::createChildRepository is never used

Posted by bt...@apache.org.
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 316bad3fec352d861b44238f5d7ef367eb40f41f
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Nov 18 13:59:40 2019 +0700

    [Refactoring] AbstractFileRepository::createChildRepository is never used
---
 .../apache/james/repository/file/AbstractFileRepository.java | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/server/data/data-library/src/main/java/org/apache/james/repository/file/AbstractFileRepository.java b/server/data/data-library/src/main/java/org/apache/james/repository/file/AbstractFileRepository.java
index a2185ff..d3e4ab1 100644
--- a/server/data/data-library/src/main/java/org/apache/james/repository/file/AbstractFileRepository.java
+++ b/server/data/data-library/src/main/java/org/apache/james/repository/file/AbstractFileRepository.java
@@ -154,18 +154,6 @@ public abstract class AbstractFileRepository implements Configurable {
     }
 
     /**
-     * Return a new instance of this class
-     * 
-     * @return class a new instance of AbstractFileRepository
-     * @throws Exception
-     *             get thrown if an error is detected while create the new
-     *             instance
-     */
-    protected AbstractFileRepository createChildRepository() throws Exception {
-        return getClass().newInstance();
-    }
-
-    /**
      * Return the File Object which belongs to the given key
      * 
      * @param key


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


[james-project] 12/49: [Refactoring] Cleanup JPAUsersRepository javadoc

Posted by bt...@apache.org.
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 728cd9526328d53ea4cecda09eddcb562672ac39
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Nov 18 14:19:48 2019 +0700

    [Refactoring] Cleanup JPAUsersRepository javadoc
---
 .../src/main/java/org/apache/james/user/jpa/JPAUsersRepository.java | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/server/data/data-jpa/src/main/java/org/apache/james/user/jpa/JPAUsersRepository.java b/server/data/data-jpa/src/main/java/org/apache/james/user/jpa/JPAUsersRepository.java
index 6304426..6308bfe 100644
--- a/server/data/data-jpa/src/main/java/org/apache/james/user/jpa/JPAUsersRepository.java
+++ b/server/data/data-jpa/src/main/java/org/apache/james/user/jpa/JPAUsersRepository.java
@@ -101,8 +101,6 @@ public class JPAUsersRepository extends AbstractUsersRepository {
     /**
      * Update the repository with the specified user object. A user object with
      * this username must already exist.
-     * 
-     * @throws UsersRepositoryException
      */
     @Override
     public void updateUser(User user) throws UsersRepositoryException {
@@ -134,7 +132,6 @@ public class JPAUsersRepository extends AbstractUsersRepository {
      * 
      * @param name
      *            the user to remove from the repository
-     * @throws UsersRepositoryException
      */
     @Override
     public void removeUser(Username name) throws UsersRepositoryException {
@@ -166,7 +163,6 @@ public class JPAUsersRepository extends AbstractUsersRepository {
      * @param name
      *            the name to check in the repository
      * @return whether the user is in the repository
-     * @throws UsersRepositoryException
      */
     @Override
     public boolean contains(Username name) throws UsersRepositoryException {
@@ -209,7 +205,6 @@ public class JPAUsersRepository extends AbstractUsersRepository {
      * Returns a count of the users in the repository.
      * 
      * @return the number of users in the repository
-     * @throws UsersRepositoryException
      */
     @Override
     public int countUsers() throws UsersRepositoryException {
@@ -230,7 +225,6 @@ public class JPAUsersRepository extends AbstractUsersRepository {
      * 
      * @return Iterator over a collection of Strings, each being one user in the
      *         repository.
-     * @throws UsersRepositoryException
      */
     @Override
     @SuppressWarnings("unchecked")


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


[james-project] 07/49: [Refactoring] Cleanup SieveRepository exceptions

Posted by bt...@apache.org.
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 c7732f08fe7a6cb7be9b00b8bc98175c0a2e10ef
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Nov 18 14:06:07 2019 +0700

    [Refactoring] Cleanup SieveRepository exceptions
---
 .../sieverepository/api/SieveQuotaRepository.java  |  3 ---
 .../james/sieverepository/api/SieveRepository.java |  6 ------
 .../api/exception/DuplicateException.java          | 21 ------------------
 .../api/exception/IsActiveException.java           | 22 -------------------
 .../api/exception/QuotaExceededException.java      | 15 -------------
 .../api/exception/QuotaNotFoundException.java      | 25 ----------------------
 .../api/exception/ScriptNotFoundException.java     |  8 -------
 .../api/exception/SieveRepositoryException.java    |  8 -------
 .../api/exception/StorageException.java            | 25 ----------------------
 9 files changed, 133 deletions(-)

diff --git a/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/SieveQuotaRepository.java b/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/SieveQuotaRepository.java
index a2f316b..72e8cd9 100644
--- a/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/SieveQuotaRepository.java
+++ b/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/SieveQuotaRepository.java
@@ -25,9 +25,6 @@ import org.apache.james.core.quota.QuotaSizeLimit;
 import org.apache.james.sieverepository.api.exception.QuotaNotFoundException;
 import org.apache.james.sieverepository.api.exception.StorageException;
 
-/**
- * SieveQuotaRepository
- */
 public interface SieveQuotaRepository {
 
     boolean hasDefaultQuota() throws StorageException;
diff --git a/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/SieveRepository.java b/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/SieveRepository.java
index e08af0e..31c67bd 100644
--- a/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/SieveRepository.java
+++ b/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/SieveRepository.java
@@ -45,12 +45,6 @@ public interface SieveRepository extends SieveQuotaRepository {
      * PutScript.
      *
      * <p><strong>Note:</strong> It is the responsibility of the caller to validate the script to be put.
-     *
-     * @param username
-     * @param name
-     * @param content
-     * @throws StorageException
-     * @throws QuotaExceededException
      */
     void putScript(Username username, ScriptName name, ScriptContent content) throws StorageException, QuotaExceededException;
     
diff --git a/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/DuplicateException.java b/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/DuplicateException.java
index 5c96bac..dc10f78 100644
--- a/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/DuplicateException.java
+++ b/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/DuplicateException.java
@@ -31,31 +31,10 @@ public class DuplicateException extends SieveRepositoryException {
 
     /**
      * Creates a new instance of DuplicateException.
-     *
-     * @param message
-     * @param cause
-     */
-    public DuplicateException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-    /**
-     * Creates a new instance of DuplicateException.
-     *
-     * @param message
      */
     public DuplicateException(String message) {
         super(message);
     }
 
-    /**
-     * Creates a new instance of DuplicateException.
-     *
-     * @param cause
-     */
-    public DuplicateException(Throwable cause) {
-        super(cause);
-    }
-
     private static final long serialVersionUID = 7384835765215418347L;
 }
\ No newline at end of file
diff --git a/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/IsActiveException.java b/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/IsActiveException.java
index 4efd03d..44cd09f 100644
--- a/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/IsActiveException.java
+++ b/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/IsActiveException.java
@@ -23,7 +23,6 @@ package org.apache.james.sieverepository.api.exception;
 public class IsActiveException extends SieveRepositoryException {
     /**
      * Creates a new instance of IsActiveException.
-     *
      */
     public IsActiveException() {
         super();
@@ -31,31 +30,10 @@ public class IsActiveException extends SieveRepositoryException {
 
     /**
      * Creates a new instance of IsActiveException.
-     *
-     * @param message
-     * @param cause
-     */
-    public IsActiveException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-    /**
-     * Creates a new instance of IsActiveException.
-     *
-     * @param message
      */
     public IsActiveException(String message) {
         super(message);
     }
 
-    /**
-     * Creates a new instance of IsActiveException.
-     *
-     * @param cause
-     */
-    public IsActiveException(Throwable cause) {
-        super(cause);
-    }
-
     private static final long serialVersionUID = 7472385325048232256L;
 }
\ No newline at end of file
diff --git a/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/QuotaExceededException.java b/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/QuotaExceededException.java
index 02508d7..f3bbcec 100644
--- a/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/QuotaExceededException.java
+++ b/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/QuotaExceededException.java
@@ -23,7 +23,6 @@ package org.apache.james.sieverepository.api.exception;
 public class QuotaExceededException extends SieveRepositoryException {
     /**
      * Creates a new instance of QuotaExceededException.
-     *
      */
     public QuotaExceededException() {
         super();
@@ -31,9 +30,6 @@ public class QuotaExceededException extends SieveRepositoryException {
 
     /**
      * Creates a new instance of QuotaExceededException.
-     *
-     * @param message
-     * @param cause
      */
     public QuotaExceededException(String message, Throwable cause) {
         super(message, cause);
@@ -41,21 +37,10 @@ public class QuotaExceededException extends SieveRepositoryException {
 
     /**
      * Creates a new instance of QuotaExceededException.
-     *
-     * @param message
      */
     public QuotaExceededException(String message) {
         super(message);
     }
 
-    /**
-     * Creates a new instance of QuotaExceededException.
-     *
-     * @param cause
-     */
-    public QuotaExceededException(Throwable cause) {
-        super(cause);
-    }
-
     private static final long serialVersionUID = -3966867419152420878L;
 }
\ No newline at end of file
diff --git a/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/QuotaNotFoundException.java b/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/QuotaNotFoundException.java
index 6defb85..d36906d 100644
--- a/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/QuotaNotFoundException.java
+++ b/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/QuotaNotFoundException.java
@@ -20,45 +20,20 @@
 
 package org.apache.james.sieverepository.api.exception;
 
-/**
- * <code>QuotaNotFoundException</code>
- */
 public class QuotaNotFoundException extends SieveRepositoryException {
     private static final long serialVersionUID = 6523546952593451503L;
 
     /**
      * Creates a new instance of QuotaNotFoundException.
-     *
      */
     public QuotaNotFoundException() {
     }
 
     /**
      * Creates a new instance of QuotaNotFoundException.
-     *
-     * @param message
-     * @param cause
-     */
-    public QuotaNotFoundException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-    /**
-     * Creates a new instance of QuotaNotFoundException.
-     *
-     * @param message
      */
     public QuotaNotFoundException(String message) {
         super(message);
     }
 
-    /**
-     * Creates a new instance of QuotaNotFoundException.
-     *
-     * @param cause
-     */
-    public QuotaNotFoundException(Throwable cause) {
-        super(cause);
-    }
-
 }
diff --git a/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/ScriptNotFoundException.java b/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/ScriptNotFoundException.java
index 5738186..2efac09 100644
--- a/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/ScriptNotFoundException.java
+++ b/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/ScriptNotFoundException.java
@@ -23,7 +23,6 @@ package org.apache.james.sieverepository.api.exception;
 public class ScriptNotFoundException extends SieveRepositoryException {
     /**
      * Creates a new instance of ScriptNotFoundException.
-     *
      */
     public ScriptNotFoundException() {
         super();
@@ -31,9 +30,6 @@ public class ScriptNotFoundException extends SieveRepositoryException {
 
     /**
      * Creates a new instance of ScriptNotFoundException.
-     *
-     * @param message
-     * @param cause
      */
     public ScriptNotFoundException(String message, Throwable cause) {
         super(message, cause);
@@ -41,8 +37,6 @@ public class ScriptNotFoundException extends SieveRepositoryException {
 
     /**
      * Creates a new instance of ScriptNotFoundException.
-     *
-     * @param message
      */
     public ScriptNotFoundException(String message) {
         super(message);
@@ -50,8 +44,6 @@ public class ScriptNotFoundException extends SieveRepositoryException {
 
     /**
      * Creates a new instance of ScriptNotFoundException.
-     *
-     * @param cause
      */
     public ScriptNotFoundException(Throwable cause) {
         super(cause);
diff --git a/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/SieveRepositoryException.java b/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/SieveRepositoryException.java
index c11227a..25162cc 100644
--- a/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/SieveRepositoryException.java
+++ b/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/SieveRepositoryException.java
@@ -23,7 +23,6 @@ package org.apache.james.sieverepository.api.exception;
 public class SieveRepositoryException extends Exception {
     /**
      * Creates a new instance of SieveRepositoryException.
-     *
      */
     public SieveRepositoryException() {
         super();
@@ -31,9 +30,6 @@ public class SieveRepositoryException extends Exception {
 
     /**
      * Creates a new instance of SieveRepositoryException.
-     *
-     * @param message
-     * @param cause
      */
     public SieveRepositoryException(String message, Throwable cause) {
         super(message, cause);
@@ -41,8 +37,6 @@ public class SieveRepositoryException extends Exception {
 
     /**
      * Creates a new instance of SieveRepositoryException.
-     *
-     * @param message
      */
     public SieveRepositoryException(String message) {
         super(message);
@@ -50,8 +44,6 @@ public class SieveRepositoryException extends Exception {
 
     /**
      * Creates a new instance of SieveRepositoryException.
-     *
-     * @param cause
      */
     public SieveRepositoryException(Throwable cause) {
         super(cause);
diff --git a/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/StorageException.java b/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/StorageException.java
index 6fbac3b..ace33f9 100644
--- a/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/StorageException.java
+++ b/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/StorageException.java
@@ -20,26 +20,12 @@
 
 package org.apache.james.sieverepository.api.exception;
 
-/**
- * <code>StorageException</code>
- */
 public class StorageException extends SieveRepositoryException {
 
     private static final long serialVersionUID = 7374111339714642386L;
 
     /**
      * Creates a new instance of StorageException.
-     *
-     */
-    public StorageException() {
-        super();
-    }
-
-    /**
-     * Creates a new instance of StorageException.
-     *
-     * @param message
-     * @param cause
      */
     public StorageException(String message, Throwable cause) {
         super(message, cause);
@@ -47,17 +33,6 @@ public class StorageException extends SieveRepositoryException {
 
     /**
      * Creates a new instance of StorageException.
-     *
-     * @param message
-     */
-    public StorageException(String message) {
-        super(message);
-    }
-
-    /**
-     * Creates a new instance of StorageException.
-     *
-     * @param cause
      */
     public StorageException(Throwable cause) {
         super(cause);


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


[james-project] 20/49: [Refactoring] Replace mailbox-store SimpleProperty with mailbox-api one

Posted by bt...@apache.org.
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 d1dd6c5cddfe4d32f0978aac1a56772422fee95d
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sat Nov 16 11:00:49 2019 +0700

    [Refactoring] Replace mailbox-store SimpleProperty with mailbox-api one
---
 .../apache/james/mailbox/store/SimpleProperty.java | 54 ----------------------
 .../model/ListMessagePropertiesAssertTest.java     |  2 +-
 2 files changed, 1 insertion(+), 55 deletions(-)

diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/SimpleProperty.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/SimpleProperty.java
deleted file mode 100644
index 4958d43..0000000
--- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/SimpleProperty.java
+++ /dev/null
@@ -1,54 +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.mailbox.store;
-
-import org.apache.james.mailbox.store.mail.model.Property;
-
-/**
- * Simple implementation suitable for testing.
- */
-public class SimpleProperty implements Property {
-
-    public String localName;
-    public String namespace;
-    public String value;
-    
-    public SimpleProperty(String namespace, String localName, String value) {
-        super();
-        this.localName = localName;
-        this.namespace = namespace;
-        this.value = value;
-    }
-
-    @Override
-    public String getLocalName() {
-        return localName;
-    }
-
-    @Override
-    public String getNamespace() {
-        return namespace;
-    }
-
-    @Override
-    public String getValue() {
-        return value;
-    }
-
-}
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/ListMessagePropertiesAssertTest.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/ListMessagePropertiesAssertTest.java
index ba33af8..2228d00 100644
--- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/ListMessagePropertiesAssertTest.java
+++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/ListMessagePropertiesAssertTest.java
@@ -23,7 +23,7 @@ import static org.apache.james.mailbox.store.mail.model.ListMessagePropertiesAss
 
 import java.util.List;
 
-import org.apache.james.mailbox.store.SimpleProperty;
+import org.apache.james.mailbox.store.mail.model.impl.SimpleProperty;
 import org.junit.Before;
 import org.junit.Test;
 


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


[james-project] 43/49: [Refactoring] ProtocolHandlerChainImpl::addHandler never throws

Posted by bt...@apache.org.
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 a53e12bbf148354a7954193d213ce2caccfe6920
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 21:16:10 2019 +0700

    [Refactoring] ProtocolHandlerChainImpl::addHandler never throws
---
 .../james/protocols/lib/ProtocolHandlerChainImpl.java | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/ProtocolHandlerChainImpl.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/ProtocolHandlerChainImpl.java
index ca3542c..e1a0712 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/ProtocolHandlerChainImpl.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/ProtocolHandlerChainImpl.java
@@ -110,17 +110,13 @@ public class ProtocolHandlerChainImpl implements ProtocolHandlerChain {
         List<String> c = handlersPackage.getHandlers();
 
         for (String cName : c) {
-            try {
-                CombinedConfiguration conf = new CombinedConfiguration();
-                HierarchicalConfiguration<ImmutableNode> cmdConf = addHandler(cName);
-                conf.addConfiguration(cmdConf);
-                if (handlerConfig != null) {
-                    conf.addConfiguration(handlerConfig);
-                }
-                children.add(conf);
-            } catch (ConfigurationException e) {
-                throw new ConfigurationException("Unable to create configuration for handler " + cName, e);
+            CombinedConfiguration conf = new CombinedConfiguration();
+            HierarchicalConfiguration<ImmutableNode> cmdConf = addHandler(cName);
+            conf.addConfiguration(cmdConf);
+            if (handlerConfig != null) {
+                conf.addConfiguration(handlerConfig);
             }
+            children.add(conf);
         }
     }
 
@@ -130,9 +126,8 @@ public class ProtocolHandlerChainImpl implements ProtocolHandlerChain {
      *
      * @param className The class name
      * @return DefaultConfiguration
-     * @throws ConfigurationException
      */
-    private HierarchicalConfiguration<ImmutableNode> addHandler(String className) throws ConfigurationException {
+    private HierarchicalConfiguration<ImmutableNode> addHandler(String className) {
         HierarchicalConfiguration<ImmutableNode> hConf = new BaseHierarchicalConfiguration();
         hConf.addProperty("[@class]", className);
         return hConf;


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


[james-project] 33/49: [Refactoring] MockMailProcessor::newState can be final

Posted by bt...@apache.org.
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 dda56cc95205afdf138ef2fa35604becf7bae7d8
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Nov 18 17:16:25 2019 +0700

    [Refactoring] MockMailProcessor::newState can be final
---
 .../org/apache/james/mailetcontainer/api/mock/MockMailProcessor.java   | 2 +-
 .../james/mailetcontainer/lib/AbstractStateCompositeProcessorTest.java | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/server/mailet/mailetcontainer-api/src/test/java/org/apache/james/mailetcontainer/api/mock/MockMailProcessor.java b/server/mailet/mailetcontainer-api/src/test/java/org/apache/james/mailetcontainer/api/mock/MockMailProcessor.java
index 507a3bc..c1e9cbc 100644
--- a/server/mailet/mailetcontainer-api/src/test/java/org/apache/james/mailetcontainer/api/mock/MockMailProcessor.java
+++ b/server/mailet/mailetcontainer-api/src/test/java/org/apache/james/mailetcontainer/api/mock/MockMailProcessor.java
@@ -22,7 +22,7 @@ import org.apache.james.mailetcontainer.api.MailProcessor;
 import org.apache.mailet.Mail;
 
 public class MockMailProcessor implements MailProcessor {
-    private String newState;
+    private final String newState;
 
     protected MockMailProcessor(String newState) {
         this.newState = newState;
diff --git a/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessorTest.java b/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessorTest.java
index fbe8000..ffa1258 100644
--- a/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessorTest.java
+++ b/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessorTest.java
@@ -48,8 +48,7 @@ public abstract class AbstractStateCompositeProcessorTest {
         AbstractStateCompositeProcessor processor = new AbstractStateCompositeProcessor() {
 
             @Override
-            protected MailProcessor createMailProcessor(final String state, HierarchicalConfiguration<ImmutableNode> config) throws
-                Exception {
+            protected MailProcessor createMailProcessor(String state, HierarchicalConfiguration<ImmutableNode> config) {
                 return new MockMailProcessor("") {
                     @Override
                     public void service(Mail mail) {


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


[james-project] 16/49: [Refactoring] JPAMailbox remove setMailboxId

Posted by bt...@apache.org.
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 680194530d9c58441ba5a513c4364565facd2add
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sat Nov 16 10:53:23 2019 +0700

    [Refactoring] JPAMailbox remove setMailboxId
---
 .../java/org/apache/james/mailbox/jpa/mail/model/JPAMailbox.java     | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailbox.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailbox.java
index 347a2c5..0e533e8 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailbox.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailbox.java
@@ -32,7 +32,6 @@ import javax.persistence.Table;
 import org.apache.james.core.Username;
 import org.apache.james.mailbox.jpa.JPAId;
 import org.apache.james.mailbox.model.Mailbox;
-import org.apache.james.mailbox.model.MailboxId;
 import org.apache.james.mailbox.model.MailboxPath;
 
 @Entity(name = "Mailbox")
@@ -121,10 +120,6 @@ public class JPAMailbox {
         return JPAId.of(mailboxId);
     }
 
-    public void setMailboxId(MailboxId mailboxId) {
-        this.mailboxId = ((JPAId)mailboxId).getRawId();
-    }
-
     public long consumeUid() {
         return ++lastUid;
     }


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


[james-project] 23/49: [Refactoring] MatcherMatch class is not used

Posted by bt...@apache.org.
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 142d4e587ad4e93dfe9112ef235c21ff01b80be1
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 14:57:40 2019 +0700

    [Refactoring] MatcherMatch class is not used
---
 .../mailetcontainer/impl/camel/MatcherMatch.java   | 38 ----------------------
 1 file changed, 38 deletions(-)

diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/MatcherMatch.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/MatcherMatch.java
deleted file mode 100644
index 41c61ad..0000000
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/MatcherMatch.java
+++ /dev/null
@@ -1,38 +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.mailetcontainer.impl.camel;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Predicate;
-import org.apache.mailet.Mail;
-
-/**
- * Check if the previous called Matcher matched. This is done be checking for
- * the present of MatcherSplitter.MATCHER_MATCHED_ATTRIBUTE attribute in the
- * Mail
- */
-public class MatcherMatch implements Predicate {
-
-    @Override
-    public boolean matches(Exchange arg0) {
-        Mail m = arg0.getIn().getBody(Mail.class);
-        return m.removeAttribute(MatcherSplitter.MATCHER_MATCHED_ATTRIBUTE).isPresent();
-    }
-}


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


[james-project] 19/49: [Refactoring] JPAProperty should not implement Property

Posted by bt...@apache.org.
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 92d346e139df717ea7e8156d7b5617a98d2752ff
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sat Nov 16 10:58:31 2019 +0700

    [Refactoring] JPAProperty should not implement Property
---
 .../james/mailbox/jpa/mail/model/JPAProperty.java  | 33 +++-------------------
 .../model/openjpa/AbstractJPAMailboxMessage.java   |  5 +++-
 2 files changed, 8 insertions(+), 30 deletions(-)

diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAProperty.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAProperty.java
index 1f07100..0eba4df 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAProperty.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAProperty.java
@@ -28,11 +28,12 @@ import javax.persistence.Id;
 import javax.persistence.Table;
 
 import org.apache.james.mailbox.store.mail.model.Property;
+import org.apache.james.mailbox.store.mail.model.impl.SimpleProperty;
 import org.apache.openjpa.persistence.jdbc.Index;
 
 @Entity(name = "Property")
 @Table(name = "JAMES_MAIL_PROPERTY")
-public class JPAProperty implements Property {
+public class JPAProperty {
 
     /** The system unique key */
     @Id
@@ -96,34 +97,8 @@ public class JPAProperty implements Property {
         this(property.getNamespace(), property.getLocalName(), property.getValue(), order);
     }
 
-    /**
-     * Gets the local part of the name of the property.
-     * 
-     * @return not null
-     */
-    @Override
-    public String getLocalName() {
-        return localName;
-    }
-
-    /**
-     * Gets the namespace for the name.
-     * 
-     * @return not null
-     */
-    @Override
-    public String getNamespace() {
-        return namespace;
-    }
-
-    /**
-     * Gets the value for this property.
-     * 
-     * @return not null
-     */
-    @Override
-    public String getValue() {
-        return value;
+    public Property toProperty() {
+        return new SimpleProperty(namespace, localName, value);
     }
 
     @Override
diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/AbstractJPAMailboxMessage.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/AbstractJPAMailboxMessage.java
index ebf69f9..6277c72 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/AbstractJPAMailboxMessage.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/AbstractJPAMailboxMessage.java
@@ -63,6 +63,7 @@ import org.apache.openjpa.persistence.jdbc.ElementJoinColumn;
 import org.apache.openjpa.persistence.jdbc.ElementJoinColumns;
 import org.apache.openjpa.persistence.jdbc.Index;
 
+import com.github.steveash.guavate.Guavate;
 import com.google.common.base.Objects;
 
 /**
@@ -356,7 +357,9 @@ public abstract class AbstractJPAMailboxMessage implements MailboxMessage {
      */
     @Override
     public List<Property> getProperties() {
-        return new ArrayList<>(properties);
+        return properties.stream()
+            .map(JPAProperty::toProperty)
+            .collect(Guavate.toImmutableList());
     }
 
     @Override


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


[james-project] 37/49: [Refactoring] UsersRepository should not rely on setter injections

Posted by bt...@apache.org.
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 30d7a837279a48a8d60f2cc5f5dfbfb8d02f05e5
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 20:46:26 2019 +0700

    [Refactoring] UsersRepository should not rely on setter injections
    
    This causes issues while binding it as a constant with guice
---
 .../listeners/QuotaThresholdListenersTestSystem.java   |  4 +++-
 .../ElasticSearchQuotaSearchTestSystemExtension.java   |  4 +---
 .../scanning/MemoryQuotaSearchTestSystemExtension.java |  4 +---
 .../org/apache/james/mpt/host/JamesImapHostSystem.java |  4 +++-
 .../cassandra/host/CassandraHostSystem.java            |  6 +++++-
 .../mpt/managesieve/file/host/FileHostSystem.java      |  4 +++-
 .../apache/james/modules/data/MemoryDataModule.java    | 11 ++++++++---
 .../james/user/cassandra/CassandraUsersRepository.java |  4 +++-
 .../user/cassandra/CassandraUsersRepositoryTest.java   |  3 +--
 .../org/apache/james/user/jpa/JPAUsersRepository.java  |  6 ++++++
 .../apache/james/user/jpa/JpaUsersRepositoryTest.java  |  2 +-
 .../apache/james/user/lib/AbstractUsersRepository.java | 12 ++++++------
 .../james/user/lib/AbstractUsersRepositoryTest.java    |  8 +++-----
 .../james/user/memory/MemoryUsersRepository.java       | 12 +++++++-----
 .../james/user/memory/MemoryUsersRepositoryTest.java   | 18 ++++++++----------
 .../user/memory/UsersRepositoryManagementTest.java     |  4 +++-
 .../mailetcontainer/impl/JamesMailetContextTest.java   |  3 +--
 .../james/transport/mailets/SpamAssassinTest.java      |  4 +++-
 .../transport/mailets/WithStorageDirectiveTest.java    |  4 +++-
 .../jmap/draft/JWTAuthenticationStrategyTest.java      |  4 +++-
 .../james/jmap/draft/UserProvisioningFilterTest.java   |  4 +++-
 .../jmap/draft/UserProvisioningFilterThreadTest.java   |  5 +++--
 .../jmap/mailet/filter/JMAPFilteringExtension.java     |  4 +++-
 .../org/apache/james/pop3server/POP3ServerTest.java    |  5 +++--
 .../org/apache/james/smtpserver/SMTPServerTest.java    |  3 ++-
 .../apache/james/webadmin/routes/AliasRoutesTest.java  |  3 +--
 .../james/webadmin/routes/ForwardRoutesTest.java       |  3 +--
 .../apache/james/webadmin/routes/GroupsRoutesTest.java |  3 +--
 .../james/webadmin/routes/SieveQuotaRoutesTest.java    |  4 +++-
 .../james/webadmin/routes/SieveScriptRoutesTest.java   |  4 +++-
 .../apache/james/webadmin/routes/UserRoutesTest.java   | 15 +++++++++------
 .../vault/routes/DeletedMessagesVaultRoutesTest.java   |  3 +--
 .../routes/DomainQuotaRoutesNoVirtualHostingTest.java  |  2 +-
 .../routes/ElasticSearchQuotaSearchExtension.java      |  3 +--
 .../webadmin/routes/ScanningQuotaSearchExtension.java  |  3 +--
 35 files changed, 108 insertions(+), 77 deletions(-)

diff --git a/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/listeners/QuotaThresholdListenersTestSystem.java b/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/listeners/QuotaThresholdListenersTestSystem.java
index 14b4ab9..2ba6e93 100644
--- a/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/listeners/QuotaThresholdListenersTestSystem.java
+++ b/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/listeners/QuotaThresholdListenersTestSystem.java
@@ -19,6 +19,7 @@
 
 package org.apache.james.mailbox.quota.mailing.listeners;
 
+import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.eventsourcing.eventstore.EventStore;
 import org.apache.james.filesystem.api.FileSystem;
 import org.apache.james.mailbox.events.Event;
@@ -38,6 +39,7 @@ import com.google.common.collect.ImmutableSet;
 
 class QuotaThresholdListenersTestSystem {
     private static final ImmutableSet<RegistrationKey> NO_KEYS = ImmutableSet.of();
+    private static final DomainList NO_DOMAIN_LIST = null;
 
     private final EventBus eventBus;
 
@@ -47,7 +49,7 @@ class QuotaThresholdListenersTestSystem {
         FileSystem fileSystem = new FileSystemImpl(new JamesServerResourceLoader("."));
 
         QuotaThresholdCrossingListener thresholdCrossingListener =
-            new QuotaThresholdCrossingListener(mailetContext, MemoryUsersRepository.withVirtualHosting(), fileSystem, eventStore, configuration);
+            new QuotaThresholdCrossingListener(mailetContext, MemoryUsersRepository.withVirtualHosting(NO_DOMAIN_LIST), fileSystem, eventStore, configuration);
 
         eventBus.register(thresholdCrossingListener);
     }
diff --git a/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/ElasticSearchQuotaSearchTestSystemExtension.java b/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/ElasticSearchQuotaSearchTestSystemExtension.java
index 9af1dc6..cc7d8b2 100644
--- a/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/ElasticSearchQuotaSearchTestSystemExtension.java
+++ b/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/ElasticSearchQuotaSearchTestSystemExtension.java
@@ -61,11 +61,9 @@ public class ElasticSearchQuotaSearchTestSystemExtension implements ParameterRes
 
             InMemoryIntegrationResources resources = InMemoryIntegrationResources.defaultResources();
 
-            MemoryUsersRepository usersRepository = MemoryUsersRepository.withVirtualHosting();
-
             DNSService dnsService = mock(DNSService.class);
             MemoryDomainList domainList = new MemoryDomainList(dnsService);
-            usersRepository.setDomainList(domainList);
+            MemoryUsersRepository usersRepository = MemoryUsersRepository.withVirtualHosting(domainList);
 
             ElasticSearchQuotaMailboxListener listener = new ElasticSearchQuotaMailboxListener(
                 new ElasticSearchIndexer(client,
diff --git a/mailbox/plugin/quota-search-scanning/src/test/java/org/apache/james/quota/search/scanning/MemoryQuotaSearchTestSystemExtension.java b/mailbox/plugin/quota-search-scanning/src/test/java/org/apache/james/quota/search/scanning/MemoryQuotaSearchTestSystemExtension.java
index 325a237..23eb317 100644
--- a/mailbox/plugin/quota-search-scanning/src/test/java/org/apache/james/quota/search/scanning/MemoryQuotaSearchTestSystemExtension.java
+++ b/mailbox/plugin/quota-search-scanning/src/test/java/org/apache/james/quota/search/scanning/MemoryQuotaSearchTestSystemExtension.java
@@ -46,11 +46,9 @@ public class MemoryQuotaSearchTestSystemExtension implements ParameterResolver {
         try {
             InMemoryIntegrationResources resources = InMemoryIntegrationResources.defaultResources();
 
-            MemoryUsersRepository usersRepository = MemoryUsersRepository.withVirtualHosting();
-
             DNSService dnsService = mock(DNSService.class);
             MemoryDomainList domainList = new MemoryDomainList(dnsService);
-            usersRepository.setDomainList(domainList);
+            MemoryUsersRepository usersRepository = MemoryUsersRepository.withVirtualHosting(domainList);
 
             QuotaComponents quotaComponents = resources.getMailboxManager().getQuotaComponents();
 
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/host/JamesImapHostSystem.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/host/JamesImapHostSystem.java
index 1f5a3b9..d2a2270 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/host/JamesImapHostSystem.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/host/JamesImapHostSystem.java
@@ -26,6 +26,7 @@ import org.apache.commons.configuration2.tree.ImmutableNode;
 import org.apache.james.adapter.mailbox.store.UserRepositoryAuthenticator;
 import org.apache.james.adapter.mailbox.store.UserRepositoryAuthorizator;
 import org.apache.james.core.Username;
+import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.imap.api.ImapConfiguration;
 import org.apache.james.imap.api.process.ImapProcessor;
 import org.apache.james.imap.decode.ImapDecoder;
@@ -46,6 +47,7 @@ import org.apache.james.mpt.imapmailbox.GrantRightsOnHost;
 import org.apache.james.user.memory.MemoryUsersRepository;
 
 public abstract class JamesImapHostSystem implements ImapHostSystem, GrantRightsOnHost {
+    private static final DomainList NO_DOMAIN_LIST = null;
 
     private MemoryUsersRepository memoryUsersRepository;
     protected Authorizator authorizator;
@@ -58,7 +60,7 @@ public abstract class JamesImapHostSystem implements ImapHostSystem, GrantRights
 
     @Override
     public void beforeTest() throws Exception {
-        memoryUsersRepository = MemoryUsersRepository.withoutVirtualHosting();
+        memoryUsersRepository = MemoryUsersRepository.withoutVirtualHosting(NO_DOMAIN_LIST);
         try {
             memoryUsersRepository.configure(userRepositoryConfiguration());
         } catch (ConfigurationException e) {
diff --git a/mpt/impl/managesieve/cassandra/src/test/java/org/apache/james/mpt/managesieve/cassandra/host/CassandraHostSystem.java b/mpt/impl/managesieve/cassandra/src/test/java/org/apache/james/mpt/managesieve/cassandra/host/CassandraHostSystem.java
index cdbbb82..882eb3b 100644
--- a/mpt/impl/managesieve/cassandra/src/test/java/org/apache/james/mpt/managesieve/cassandra/host/CassandraHostSystem.java
+++ b/mpt/impl/managesieve/cassandra/src/test/java/org/apache/james/mpt/managesieve/cassandra/host/CassandraHostSystem.java
@@ -21,6 +21,8 @@ package org.apache.james.mpt.managesieve.cassandra.host;
 
 import org.apache.james.backends.cassandra.CassandraCluster;
 import org.apache.james.backends.cassandra.components.CassandraModule;
+import org.apache.james.domainlist.api.DomainList;
+import org.apache.james.domainlist.cassandra.CassandraDomainListModule;
 import org.apache.james.mpt.host.JamesManageSieveHostSystem;
 import org.apache.james.sieve.cassandra.CassandraActiveScriptDAO;
 import org.apache.james.sieve.cassandra.CassandraSieveDAO;
@@ -34,6 +36,7 @@ import org.apache.james.user.cassandra.CassandraUsersRepositoryModule;
 import org.apache.james.util.Host;
 
 public class CassandraHostSystem extends JamesManageSieveHostSystem {
+    private static final DomainList NO_DOMAIN_LIST = null;
     private final Host cassandraHost;
     private CassandraCluster cassandra;
 
@@ -44,6 +47,7 @@ public class CassandraHostSystem extends JamesManageSieveHostSystem {
     @Override
     public void beforeTest() throws Exception {
         CassandraModule modules = CassandraModule.aggregateModules(
+            CassandraDomainListModule.MODULE,
             CassandraSieveRepositoryModule.MODULE,
             CassandraUsersRepositoryModule.MODULE);
         cassandra = CassandraCluster.create(modules, cassandraHost);
@@ -60,7 +64,7 @@ public class CassandraHostSystem extends JamesManageSieveHostSystem {
 
     @Override
     protected UsersRepository createUsersRepository() {
-        CassandraUsersRepository cassandraUsersRepository = new CassandraUsersRepository(cassandra.getConf());
+        CassandraUsersRepository cassandraUsersRepository = new CassandraUsersRepository(NO_DOMAIN_LIST, cassandra.getConf());
         cassandraUsersRepository.setEnableVirtualHosting(false);
         return cassandraUsersRepository;
     }
diff --git a/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/host/FileHostSystem.java b/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/host/FileHostSystem.java
index 384c454..f1ee12e 100644
--- a/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/host/FileHostSystem.java
+++ b/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/host/FileHostSystem.java
@@ -26,6 +26,7 @@ import java.io.IOException;
 import java.io.InputStream;
 
 import org.apache.commons.io.FileUtils;
+import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.filesystem.api.FileSystem;
 import org.apache.james.mpt.host.JamesManageSieveHostSystem;
 import org.apache.james.sieverepository.api.SieveRepository;
@@ -37,6 +38,7 @@ public class FileHostSystem extends JamesManageSieveHostSystem {
 
     private static final String SIEVE_ROOT = FileSystem.FILE_PROTOCOL + "sieve";
     private static final FileSystem fileSystem = getFileSystem();
+    private static final DomainList NO_DOMAIN_LIST = null;
 
     private static FileSystem getFileSystem() {
         return new FileSystem() {
@@ -59,7 +61,7 @@ public class FileHostSystem extends JamesManageSieveHostSystem {
 
     @Override
     protected UsersRepository createUsersRepository() {
-        return MemoryUsersRepository.withoutVirtualHosting();
+        return MemoryUsersRepository.withoutVirtualHosting(NO_DOMAIN_LIST);
     }
 
     @Override
diff --git a/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/data/MemoryDataModule.java b/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/data/MemoryDataModule.java
index 5914a08..7daf4b5 100644
--- a/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/data/MemoryDataModule.java
+++ b/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/data/MemoryDataModule.java
@@ -69,17 +69,22 @@ public class MemoryDataModule extends AbstractModule {
         bind(MemoryMailRepositoryUrlStore.class).in(Scopes.SINGLETON);
         bind(MailRepositoryUrlStore.class).to(MemoryMailRepositoryUrlStore.class);
 
-        bind(MemoryUsersRepository.class).toInstance(MemoryUsersRepository.withVirtualHosting());
-        bind(UsersRepository.class).to(MemoryUsersRepository.class);
-
         bind(EventSourcingDLPConfigurationStore.class).in(Scopes.SINGLETON);
         bind(DLPConfigurationStore.class).to(EventSourcingDLPConfigurationStore.class);
 
+        bind(UsersRepository.class).to(MemoryUsersRepository.class);
+
         bind(MailStoreRepositoryModule.DefaultItemSupplier.class).toInstance(() -> MEMORY_MAILREPOSITORY_DEFAULT_DECLARATION);
     }
 
     @Provides
     @Singleton
+    public MemoryUsersRepository providesUsersRepository(DomainList domainList) {
+        return MemoryUsersRepository.withVirtualHosting(domainList);
+    }
+
+    @Provides
+    @Singleton
     public DomainListConfiguration provideDomainListConfiguration(ConfigurationProvider configurationProvider) {
         try {
             return DomainListConfiguration.from(configurationProvider.getConfiguration("domainlist"));
diff --git a/server/data/data-cassandra/src/main/java/org/apache/james/user/cassandra/CassandraUsersRepository.java b/server/data/data-cassandra/src/main/java/org/apache/james/user/cassandra/CassandraUsersRepository.java
index 2cdcc7c..f1ac2a8 100644
--- a/server/data/data-cassandra/src/main/java/org/apache/james/user/cassandra/CassandraUsersRepository.java
+++ b/server/data/data-cassandra/src/main/java/org/apache/james/user/cassandra/CassandraUsersRepository.java
@@ -39,6 +39,7 @@ import javax.inject.Inject;
 
 import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor;
 import org.apache.james.core.Username;
+import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.user.api.AlreadyExistInUsersRepositoryException;
 import org.apache.james.user.api.UsersRepositoryException;
 import org.apache.james.user.api.model.User;
@@ -66,7 +67,8 @@ public class CassandraUsersRepository extends AbstractUsersRepository {
     private final PreparedStatement insertStatement;
 
     @Inject
-    public CassandraUsersRepository(Session session) {
+    public CassandraUsersRepository(DomainList domainList, Session session) {
+        super(domainList);
         this.executor = new CassandraAsyncExecutor(session);
         this.getUserStatement = prepareGetUserStatement(session);
         this.updateUserStatement = prepareUpdateUserStatement(session);
diff --git a/server/data/data-cassandra/src/test/java/org/apache/james/user/cassandra/CassandraUsersRepositoryTest.java b/server/data/data-cassandra/src/test/java/org/apache/james/user/cassandra/CassandraUsersRepositoryTest.java
index a77e80c..0341928 100644
--- a/server/data/data-cassandra/src/test/java/org/apache/james/user/cassandra/CassandraUsersRepositoryTest.java
+++ b/server/data/data-cassandra/src/test/java/org/apache/james/user/cassandra/CassandraUsersRepositoryTest.java
@@ -28,7 +28,6 @@ import org.junit.Before;
 import org.junit.Rule;
 
 public class CassandraUsersRepositoryTest extends AbstractUsersRepositoryTest {
-
     @Rule
     public DockerCassandraRule cassandraServer = new DockerCassandraRule();
     
@@ -51,6 +50,6 @@ public class CassandraUsersRepositoryTest extends AbstractUsersRepositoryTest {
 
     @Override
     protected AbstractUsersRepository getUsersRepository() {
-        return new CassandraUsersRepository(cassandra.getConf());
+        return new CassandraUsersRepository(domainList, cassandra.getConf());
     }
 }
diff --git a/server/data/data-jpa/src/main/java/org/apache/james/user/jpa/JPAUsersRepository.java b/server/data/data-jpa/src/main/java/org/apache/james/user/jpa/JPAUsersRepository.java
index 6308bfe..9eed717 100644
--- a/server/data/data-jpa/src/main/java/org/apache/james/user/jpa/JPAUsersRepository.java
+++ b/server/data/data-jpa/src/main/java/org/apache/james/user/jpa/JPAUsersRepository.java
@@ -36,6 +36,7 @@ import org.apache.commons.configuration2.HierarchicalConfiguration;
 import org.apache.commons.configuration2.ex.ConfigurationException;
 import org.apache.commons.configuration2.tree.ImmutableNode;
 import org.apache.james.core.Username;
+import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.user.api.UsersRepositoryException;
 import org.apache.james.user.api.model.User;
 import org.apache.james.user.jpa.model.JPAUser;
@@ -55,6 +56,11 @@ public class JPAUsersRepository extends AbstractUsersRepository {
 
     private String algo;
 
+    @Inject
+    public JPAUsersRepository(DomainList domainList) {
+        super(domainList);
+    }
+
     /**
      * Sets entity manager.
      * 
diff --git a/server/data/data-jpa/src/test/java/org/apache/james/user/jpa/JpaUsersRepositoryTest.java b/server/data/data-jpa/src/test/java/org/apache/james/user/jpa/JpaUsersRepositoryTest.java
index acdf0a1..f81f3e2 100644
--- a/server/data/data-jpa/src/test/java/org/apache/james/user/jpa/JpaUsersRepositoryTest.java
+++ b/server/data/data-jpa/src/test/java/org/apache/james/user/jpa/JpaUsersRepositoryTest.java
@@ -45,7 +45,7 @@ public class JpaUsersRepositoryTest extends AbstractUsersRepositoryTest {
 
     @Override
     protected AbstractUsersRepository getUsersRepository() throws Exception {
-        JPAUsersRepository repos = new JPAUsersRepository();
+        JPAUsersRepository repos = new JPAUsersRepository(domainList);
         repos.setEntityManagerFactory(JPA_TEST_CLUSTER.getEntityManagerFactory());
         repos.configure(new BaseHierarchicalConfiguration());
         return repos;
diff --git a/server/data/data-library/src/main/java/org/apache/james/user/lib/AbstractUsersRepository.java b/server/data/data-library/src/main/java/org/apache/james/user/lib/AbstractUsersRepository.java
index 58d17a5..7dfcd17 100644
--- a/server/data/data-library/src/main/java/org/apache/james/user/lib/AbstractUsersRepository.java
+++ b/server/data/data-library/src/main/java/org/apache/james/user/lib/AbstractUsersRepository.java
@@ -41,10 +41,15 @@ import com.google.common.annotations.VisibleForTesting;
 
 public abstract class AbstractUsersRepository implements UsersRepository, Configurable {
 
-    private DomainList domainList;
+    private final DomainList domainList;
     private boolean virtualHosting;
     private Optional<Username> administratorId;
 
+    @Inject
+    protected AbstractUsersRepository(DomainList domainList) {
+        this.domainList = domainList;
+    }
+
     @Override
     public void configure(HierarchicalConfiguration<ImmutableNode> configuration) throws ConfigurationException {
 
@@ -66,11 +71,6 @@ public abstract class AbstractUsersRepository implements UsersRepository, Config
         this.virtualHosting = virtualHosting;
     }
 
-    @Inject
-    public void setDomainList(DomainList domainList) {
-        this.domainList = domainList;
-    }
-
     @Override
     public void assertValid(Username username) throws UsersRepositoryException {
         if (supportVirtualHosting()) {
diff --git a/server/data/data-library/src/test/java/org/apache/james/user/lib/AbstractUsersRepositoryTest.java b/server/data/data-library/src/test/java/org/apache/james/user/lib/AbstractUsersRepositoryTest.java
index 3919ea3..0503efb 100644
--- a/server/data/data-library/src/test/java/org/apache/james/user/lib/AbstractUsersRepositoryTest.java
+++ b/server/data/data-library/src/test/java/org/apache/james/user/lib/AbstractUsersRepositoryTest.java
@@ -41,7 +41,7 @@ public abstract class AbstractUsersRepositoryTest {
     private static final Domain DOMAIN = Domain.of("domain");
 
     protected AbstractUsersRepository usersRepository;
-    private SimpleDomainList domainList;
+    protected SimpleDomainList domainList;
 
     /**
      * Create the repository to be tested.
@@ -56,11 +56,10 @@ public abstract class AbstractUsersRepositoryTest {
     private Username user3;
     private Username admin;
     
-    public void setUp() throws Exception { 
-        this.usersRepository = getUsersRepository();
+    public void setUp() throws Exception {
         domainList = new SimpleDomainList();
         domainList.addDomain(DOMAIN);
-        usersRepository.setDomainList(domainList);
+        this.usersRepository = getUsersRepository();
         user1 = login("username");
         user2 = login("username2");
         user3 = login("username3");
@@ -382,7 +381,6 @@ public abstract class AbstractUsersRepositoryTest {
     @Test
     public void getMailAddressForShouldAppendDefaultDomainWhenNoVirtualHosting() throws Exception {
         usersRepository.setEnableVirtualHosting(false);
-        usersRepository.setDomainList(domainList);
 
         // Some implementations do not support changing virtual hosting value
         Assume.assumeFalse(usersRepository.supportVirtualHosting());
diff --git a/server/data/data-memory/src/main/java/org/apache/james/user/memory/MemoryUsersRepository.java b/server/data/data-memory/src/main/java/org/apache/james/user/memory/MemoryUsersRepository.java
index f7d74c2..7a4de59 100644
--- a/server/data/data-memory/src/main/java/org/apache/james/user/memory/MemoryUsersRepository.java
+++ b/server/data/data-memory/src/main/java/org/apache/james/user/memory/MemoryUsersRepository.java
@@ -28,6 +28,7 @@ import org.apache.commons.configuration2.HierarchicalConfiguration;
 import org.apache.commons.configuration2.ex.ConfigurationException;
 import org.apache.commons.configuration2.tree.ImmutableNode;
 import org.apache.james.core.Username;
+import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.user.api.UsersRepositoryException;
 import org.apache.james.user.api.model.User;
 import org.apache.james.user.lib.AbstractUsersRepository;
@@ -35,19 +36,20 @@ import org.apache.james.user.lib.model.DefaultUser;
 
 public class MemoryUsersRepository extends AbstractUsersRepository {
 
-    public static MemoryUsersRepository withVirtualHosting() {
-        return new MemoryUsersRepository(true);
+    public static MemoryUsersRepository withVirtualHosting(DomainList domainList) {
+        return new MemoryUsersRepository(domainList, true);
     }
 
-    public static MemoryUsersRepository withoutVirtualHosting() {
-        return new MemoryUsersRepository(false);
+    public static MemoryUsersRepository withoutVirtualHosting(DomainList domainList) {
+        return new MemoryUsersRepository(domainList, false);
     }
     
     private final Map<String, User> userByName;
     private final boolean supportVirtualHosting;
     private String algo;
 
-    private MemoryUsersRepository(boolean supportVirtualHosting) {
+    private MemoryUsersRepository(DomainList domainList, boolean supportVirtualHosting) {
+        super(domainList);
         this.userByName = new HashMap<>();
         this.algo = "MD5";
         this.supportVirtualHosting = supportVirtualHosting;
diff --git a/server/data/data-memory/src/test/java/org/apache/james/user/memory/MemoryUsersRepositoryTest.java b/server/data/data-memory/src/test/java/org/apache/james/user/memory/MemoryUsersRepositoryTest.java
index c0a0aa6..3ac57c5 100644
--- a/server/data/data-memory/src/test/java/org/apache/james/user/memory/MemoryUsersRepositoryTest.java
+++ b/server/data/data-memory/src/test/java/org/apache/james/user/memory/MemoryUsersRepositoryTest.java
@@ -42,12 +42,12 @@ public class MemoryUsersRepositoryTest extends AbstractUsersRepositoryTest {
     
     @Override
     protected AbstractUsersRepository getUsersRepository() {
-        return MemoryUsersRepository.withVirtualHosting();
+        return MemoryUsersRepository.withVirtualHosting(domainList);
     }
 
     @Test
     public void assertValidShouldThrowWhenDomainPartAndNoVirtualHosting() {
-        MemoryUsersRepository memoryUsersRepository = MemoryUsersRepository.withoutVirtualHosting();
+        MemoryUsersRepository memoryUsersRepository = MemoryUsersRepository.withoutVirtualHosting(domainList);
 
         assertThatThrownBy(() -> memoryUsersRepository.assertValid(Username.of("user@domain.tld")))
             .isInstanceOf(UsersRepositoryException.class);
@@ -55,7 +55,7 @@ public class MemoryUsersRepositoryTest extends AbstractUsersRepositoryTest {
 
     @Test
     public void assertValidShouldThrowWhenNoDomainPartAndVirtualHosting() {
-        MemoryUsersRepository memoryUsersRepository = MemoryUsersRepository.withVirtualHosting();
+        MemoryUsersRepository memoryUsersRepository = MemoryUsersRepository.withVirtualHosting(domainList);
 
         assertThatThrownBy(() -> memoryUsersRepository.assertValid(Username.of("user")))
             .isInstanceOf(UsersRepositoryException.class);
@@ -63,15 +63,14 @@ public class MemoryUsersRepositoryTest extends AbstractUsersRepositoryTest {
 
     @Test
     public void assertValidShouldNotThrowWhenDomainPartAndVirtualHosting() throws Exception {
-        MemoryUsersRepository memoryUsersRepository = MemoryUsersRepository.withVirtualHosting();
-
         MemoryDomainList domainList = new MemoryDomainList(new InMemoryDNSService()
             .registerMxRecord("localhost", "127.0.0.1")
             .registerMxRecord("127.0.0.1", "127.0.0.1"));
         domainList.setAutoDetect(false);
         domainList.setAutoDetectIP(false);
         domainList.addDomain(Domain.of("domain.tld"));
-        memoryUsersRepository.setDomainList(domainList);
+
+        MemoryUsersRepository memoryUsersRepository = MemoryUsersRepository.withVirtualHosting(domainList);
 
         assertThatCode(() -> memoryUsersRepository.assertValid(Username.of("user@domain.tld")))
             .doesNotThrowAnyException();
@@ -79,14 +78,13 @@ public class MemoryUsersRepositoryTest extends AbstractUsersRepositoryTest {
 
     @Test
     public void assertValidShouldNotThrowWhenDomainPartAndDomainNotFound() throws Exception {
-        MemoryUsersRepository memoryUsersRepository = MemoryUsersRepository.withVirtualHosting();
-
         MemoryDomainList domainList = new MemoryDomainList(new InMemoryDNSService()
             .registerMxRecord("localhost", "127.0.0.1")
             .registerMxRecord("127.0.0.1", "127.0.0.1"));
         domainList.setAutoDetect(false);
         domainList.setAutoDetectIP(false);
-        memoryUsersRepository.setDomainList(domainList);
+
+        MemoryUsersRepository memoryUsersRepository = MemoryUsersRepository.withVirtualHosting(domainList);
 
         assertThatThrownBy(() -> memoryUsersRepository.assertValid(Username.of("user@domain.tld")))
             .isInstanceOf(UsersRepositoryException.class);
@@ -94,7 +92,7 @@ public class MemoryUsersRepositoryTest extends AbstractUsersRepositoryTest {
 
     @Test
     public void assertValidShouldNotThrowWhenNoDomainPartAndNoVirtualHosting() {
-        MemoryUsersRepository memoryUsersRepository = MemoryUsersRepository.withoutVirtualHosting();
+        MemoryUsersRepository memoryUsersRepository = MemoryUsersRepository.withoutVirtualHosting(domainList);
 
         assertThatCode(() -> memoryUsersRepository.assertValid(Username.of("user")))
             .doesNotThrowAnyException();
diff --git a/server/data/data-memory/src/test/java/org/apache/james/user/memory/UsersRepositoryManagementTest.java b/server/data/data-memory/src/test/java/org/apache/james/user/memory/UsersRepositoryManagementTest.java
index a99091b..fb7fa30 100644
--- a/server/data/data-memory/src/test/java/org/apache/james/user/memory/UsersRepositoryManagementTest.java
+++ b/server/data/data-memory/src/test/java/org/apache/james/user/memory/UsersRepositoryManagementTest.java
@@ -25,19 +25,21 @@ import java.util.Arrays;
 import java.util.List;
 
 import org.apache.james.core.Username;
+import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.user.api.UsersRepository;
 import org.apache.james.user.lib.UsersRepositoryManagement;
 import org.junit.Before;
 import org.junit.Test;
 
 public class UsersRepositoryManagementTest {
+    private static final DomainList NO_DOMAIN_LIST = null;
 
     private UsersRepository usersRepository;
     private UsersRepositoryManagement userManagement;
 
     @Before
     public void setUp() throws Exception {
-        usersRepository = MemoryUsersRepository.withoutVirtualHosting();
+        usersRepository = MemoryUsersRepository.withoutVirtualHosting(NO_DOMAIN_LIST);
 
         userManagement = new UsersRepositoryManagement();
         userManagement.setUsersRepository(usersRepository);
diff --git a/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/JamesMailetContextTest.java b/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/JamesMailetContextTest.java
index 42c3dee..6dccf9c 100644
--- a/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/JamesMailetContextTest.java
+++ b/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/JamesMailetContextTest.java
@@ -79,8 +79,7 @@ public class JamesMailetContextTest {
             .autoDetectIp(false)
             .build());
 
-        usersRepository = MemoryUsersRepository.withVirtualHosting();
-        usersRepository.setDomainList(domainList);
+        usersRepository = MemoryUsersRepository.withVirtualHosting(domainList);
         MailQueueFactory<MailQueue> mailQueueFactory = mock(MailQueueFactory.class);
         spoolMailQueue = mock(MailQueue.class);
         when(mailQueueFactory.createQueue(MailQueueFactory.SPOOL)).thenReturn(spoolMailQueue);
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/SpamAssassinTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/SpamAssassinTest.java
index 0d9c776..ba840fc 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/SpamAssassinTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/SpamAssassinTest.java
@@ -26,6 +26,7 @@ import javax.mail.MessagingException;
 
 import org.apache.james.core.MailAddress;
 import org.apache.james.core.builder.MimeMessageBuilder;
+import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.metrics.api.NoopMetricFactory;
 import org.apache.james.spamassassin.SpamAssassinResult;
 import org.apache.james.spamassassin.mock.MockSpamd;
@@ -43,10 +44,11 @@ import com.github.steveash.guavate.Guavate;
 
 public class SpamAssassinTest {
 
+    public static final DomainList NO_DOMAIN_LIST = null;
     @Rule
     public MockSpamdTestRule spamd = new MockSpamdTestRule();
 
-    private SpamAssassin mailet = new SpamAssassin(new NoopMetricFactory(), MemoryUsersRepository.withVirtualHosting());
+    private SpamAssassin mailet = new SpamAssassin(new NoopMetricFactory(), MemoryUsersRepository.withVirtualHosting(NO_DOMAIN_LIST));
 
     @Test
     public void initShouldSetDefaultSpamdHostWhenNone() throws Exception {
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/WithStorageDirectiveTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/WithStorageDirectiveTest.java
index 518baab..e2a6a36 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/WithStorageDirectiveTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/WithStorageDirectiveTest.java
@@ -22,6 +22,7 @@ package org.apache.james.transport.mailets;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
+import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.user.memory.MemoryUsersRepository;
 import org.apache.mailet.Attribute;
 import org.apache.mailet.AttributeName;
@@ -35,6 +36,7 @@ import org.junit.Rule;
 import org.junit.Test;
 
 public class WithStorageDirectiveTest {
+    private static final DomainList NO_DOMAIN_LIST = null;
 
     private WithStorageDirective testee;
 
@@ -43,7 +45,7 @@ public class WithStorageDirectiveTest {
 
     @Before
     public void setUp() {
-        testee = new WithStorageDirective(MemoryUsersRepository.withVirtualHosting());
+        testee = new WithStorageDirective(MemoryUsersRepository.withVirtualHosting(NO_DOMAIN_LIST));
     }
 
     @Test
diff --git a/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/JWTAuthenticationStrategyTest.java b/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/JWTAuthenticationStrategyTest.java
index 08110c0..733b626 100644
--- a/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/JWTAuthenticationStrategyTest.java
+++ b/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/JWTAuthenticationStrategyTest.java
@@ -29,6 +29,7 @@ import java.util.stream.Stream;
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.james.core.Username;
+import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.jmap.draft.exceptions.MailboxSessionCreationException;
 import org.apache.james.jmap.draft.exceptions.NoValidAuthHeaderException;
 import org.apache.james.jmap.draft.utils.HeadersAuthenticationExtractor;
@@ -41,6 +42,7 @@ import org.junit.Before;
 import org.junit.Test;
 
 public class JWTAuthenticationStrategyTest {
+    private static final DomainList NO_DOMAIN_LIST = null;
 
     private JWTAuthenticationStrategy testee;
     private MailboxManager mockedMailboxManager;
@@ -54,7 +56,7 @@ public class JWTAuthenticationStrategyTest {
         mockedMailboxManager = mock(MailboxManager.class);
         mockAuthenticationExtractor = mock(HeadersAuthenticationExtractor.class);
         request = mock(HttpServletRequest.class);
-        MemoryUsersRepository usersRepository = MemoryUsersRepository.withoutVirtualHosting();
+        MemoryUsersRepository usersRepository = MemoryUsersRepository.withoutVirtualHosting(NO_DOMAIN_LIST);
 
         testee = new JWTAuthenticationStrategy(stubTokenVerifier, mockedMailboxManager, mockAuthenticationExtractor, usersRepository);
     }
diff --git a/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/UserProvisioningFilterTest.java b/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/UserProvisioningFilterTest.java
index 5b03808..3fec2ca 100644
--- a/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/UserProvisioningFilterTest.java
+++ b/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/UserProvisioningFilterTest.java
@@ -35,6 +35,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.james.core.Username;
+import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MailboxSessionUtil;
 import org.apache.james.metrics.api.NoopMetricFactory;
@@ -47,6 +48,7 @@ import org.junit.Test;
 public class UserProvisioningFilterTest {
     private static final Username USERNAME = Username.of("username");
     private static final Username USERNAME_WITH_DOMAIN = Username.of("username@james.org");
+    private static final DomainList NO_DOMAIN_LIST = null;
 
     private UserProvisioningFilter sut;
     private MemoryUsersRepository usersRepository;
@@ -56,7 +58,7 @@ public class UserProvisioningFilterTest {
 
     @Before
     public void setup() throws Exception {
-        usersRepository = MemoryUsersRepository.withoutVirtualHosting();
+        usersRepository = MemoryUsersRepository.withoutVirtualHosting(NO_DOMAIN_LIST);
         sut = new UserProvisioningFilter(usersRepository, new NoopMetricFactory());
         request = mock(HttpServletRequest.class);
         response = mock(HttpServletResponse.class);
diff --git a/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/UserProvisioningFilterThreadTest.java b/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/UserProvisioningFilterThreadTest.java
index ce96d1d..43b3984 100644
--- a/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/UserProvisioningFilterThreadTest.java
+++ b/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/UserProvisioningFilterThreadTest.java
@@ -22,7 +22,7 @@ import java.time.Duration;
 import java.util.concurrent.ExecutionException;
 
 import org.apache.james.core.Username;
-import org.apache.james.jmap.draft.UserProvisioningFilter;
+import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MailboxSessionUtil;
 import org.apache.james.metrics.api.NoopMetricFactory;
@@ -32,6 +32,7 @@ import org.junit.Before;
 import org.junit.Test;
 
 public class UserProvisioningFilterThreadTest {
+    private static final DomainList NO_DOMAIN_LIST = null;
 
     private UserProvisioningFilter sut;
     private MemoryUsersRepository usersRepository;
@@ -39,7 +40,7 @@ public class UserProvisioningFilterThreadTest {
 
     @Before
     public void before() {
-        usersRepository = MemoryUsersRepository.withoutVirtualHosting();
+        usersRepository = MemoryUsersRepository.withoutVirtualHosting(NO_DOMAIN_LIST);
         session = MailboxSessionUtil.create(Username.of("username"));
         sut = new UserProvisioningFilter(usersRepository, new NoopMetricFactory());
     }
diff --git a/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/mailet/filter/JMAPFilteringExtension.java b/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/mailet/filter/JMAPFilteringExtension.java
index 72da3c9..4232100 100644
--- a/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/mailet/filter/JMAPFilteringExtension.java
+++ b/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/mailet/filter/JMAPFilteringExtension.java
@@ -32,6 +32,7 @@ import javax.mail.MessagingException;
 
 import org.apache.james.core.Username;
 import org.apache.james.core.builder.MimeMessageBuilder;
+import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.eventsourcing.eventstore.memory.InMemoryEventStore;
 import org.apache.james.jmap.api.filtering.FilteringManagement;
 import org.apache.james.jmap.api.filtering.Rule;
@@ -53,6 +54,7 @@ import org.junit.jupiter.api.extension.ParameterResolver;
 import com.google.common.collect.ImmutableList;
 
 public class JMAPFilteringExtension implements BeforeEachCallback, ParameterResolver {
+    private static final DomainList NO_DOMAIN_LIST = null;
 
     class JMAPFilteringTestSystem {
 
@@ -130,7 +132,7 @@ public class JMAPFilteringExtension implements BeforeEachCallback, ParameterReso
     @Override
     public void beforeEach(ExtensionContext extensionContext) {
         FilteringManagement filteringManagement = new EventSourcingFilteringManagement(new InMemoryEventStore());
-        MemoryUsersRepository usersRepository = MemoryUsersRepository.withoutVirtualHosting();
+        MemoryUsersRepository usersRepository = MemoryUsersRepository.withoutVirtualHosting(NO_DOMAIN_LIST);
         InMemoryMailboxManager mailboxManager = InMemoryIntegrationResources.defaultResources().getMailboxManager();
         ActionApplier.Factory actionApplierFactory = ActionApplier.factory(mailboxManager, new InMemoryId.Factory());
 
diff --git a/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java b/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
index 6e7083c..00d6d96 100644
--- a/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
+++ b/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
@@ -31,6 +31,7 @@ import org.apache.commons.net.pop3.POP3Client;
 import org.apache.commons.net.pop3.POP3MessageInfo;
 import org.apache.commons.net.pop3.POP3Reply;
 import org.apache.james.core.Username;
+import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.filesystem.api.FileSystem;
 import org.apache.james.filesystem.api.mock.MockFileSystem;
 import org.apache.james.mailbox.MailboxManager;
@@ -48,7 +49,6 @@ import org.apache.james.protocols.lib.mock.MockProtocolHandlerLoader;
 import org.apache.james.user.api.UsersRepository;
 import org.apache.james.user.api.UsersRepositoryException;
 import org.apache.james.user.memory.MemoryUsersRepository;
-
 import org.jboss.netty.util.HashedWheelTimer;
 import org.junit.After;
 import org.junit.Before;
@@ -56,9 +56,10 @@ import org.junit.Ignore;
 import org.junit.Test;
 
 public class POP3ServerTest {
+    private static final DomainList NO_DOMAIN_LIST = null;
 
     private POP3TestConfiguration pop3Configuration;
-    private final MemoryUsersRepository usersRepository = MemoryUsersRepository.withoutVirtualHosting();
+    private final MemoryUsersRepository usersRepository = MemoryUsersRepository.withoutVirtualHosting(NO_DOMAIN_LIST);
     private POP3Client pop3Client = null;
     protected MockFileSystem fileSystem;
     protected MockProtocolHandlerLoader protocolHandlerChain;
diff --git a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java
index b0c094d..2bed383 100644
--- a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java
+++ b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java
@@ -171,11 +171,12 @@ public class SMTPServerTest {
 
     private static final long HALF_SECOND = 500;
     private static final int MAX_ITERATIONS = 10;
+    private static final DomainList NO_DOMAIN_LIST = null;
     private static final Logger LOGGER = LoggerFactory.getLogger(SMTPServerTest.class);
 
     protected SMTPTestConfiguration smtpConfiguration;
     protected HashedWheelTimer hashedWheelTimer;
-    protected final MemoryUsersRepository usersRepository = MemoryUsersRepository.withoutVirtualHosting();
+    protected final MemoryUsersRepository usersRepository = MemoryUsersRepository.withoutVirtualHosting(NO_DOMAIN_LIST);
     protected AlterableDNSServer dnsServer;
     protected MemoryMailRepositoryStore mailRepositoryStore;
     protected FileSystemImpl fileSystem;
diff --git a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/AliasRoutesTest.java b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/AliasRoutesTest.java
index 57f6809..64ebf18 100644
--- a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/AliasRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/AliasRoutesTest.java
@@ -116,8 +116,7 @@ class AliasRoutesTest {
             MappingSourceModule module = new MappingSourceModule();
             memoryRecipientRewriteTable.setDomainList(domainList);
 
-            usersRepository = MemoryUsersRepository.withVirtualHosting();
-            usersRepository.setDomainList(domainList);
+            usersRepository = MemoryUsersRepository.withVirtualHosting(domainList);
             usersRepository.configure(new BaseHierarchicalConfiguration());
 
             usersRepository.addUser(Username.of(BOB), BOB_PASSWORD);
diff --git a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/ForwardRoutesTest.java b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/ForwardRoutesTest.java
index 51b18b2..27c8ec9 100644
--- a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/ForwardRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/ForwardRoutesTest.java
@@ -115,8 +115,7 @@ class ForwardRoutesTest {
             memoryRecipientRewriteTable.setDomainList(domainList);
             MappingSourceModule mappingSourceModule = new MappingSourceModule();
 
-            usersRepository = MemoryUsersRepository.withVirtualHosting();
-            usersRepository.setDomainList(domainList);
+            usersRepository = MemoryUsersRepository.withVirtualHosting(domainList);
             usersRepository.configure(new BaseHierarchicalConfiguration());
 
             usersRepository.addUser(Username.of(BOB), BOB_PASSWORD);
diff --git a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/GroupsRoutesTest.java b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/GroupsRoutesTest.java
index 910121f..6c2f9c7 100644
--- a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/GroupsRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/GroupsRoutesTest.java
@@ -107,8 +107,7 @@ class GroupsRoutesTest {
             domainList.addDomain(DOMAIN);
             domainList.addDomain(ALIAS_DOMAIN);
             memoryRecipientRewriteTable.setDomainList(domainList);
-            usersRepository = MemoryUsersRepository.withVirtualHosting();
-            usersRepository.setDomainList(domainList);
+            usersRepository = MemoryUsersRepository.withVirtualHosting(domainList);
             MappingSourceModule mappingSourceModule = new MappingSourceModule();
             createServer(new GroupsRoutes(memoryRecipientRewriteTable, usersRepository, new JsonTransformer(mappingSourceModule)));
         }
diff --git a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/SieveQuotaRoutesTest.java b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/SieveQuotaRoutesTest.java
index 759b556..d256947 100644
--- a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/SieveQuotaRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/SieveQuotaRoutesTest.java
@@ -25,6 +25,7 @@ import static org.hamcrest.Matchers.is;
 
 import org.apache.james.core.Username;
 import org.apache.james.core.quota.QuotaSizeLimit;
+import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.sieverepository.api.SieveQuotaRepository;
 import org.apache.james.sieverepository.memory.InMemorySieveQuotaRepository;
 import org.apache.james.user.api.UsersRepositoryException;
@@ -45,6 +46,7 @@ class SieveQuotaRoutesTest {
     private static final String USER_NAME_A = "userA";
     private static final String PASSWORD_A = "123456";
     private static final Username USERNAME_A = Username.of(USER_NAME_A);
+    private static final DomainList NO_DOMAIN_LIST = null;
 
     private WebAdminServer webAdminServer;
     private SieveQuotaRepository sieveRepository;
@@ -53,7 +55,7 @@ class SieveQuotaRoutesTest {
     void setUp() throws UsersRepositoryException {
         sieveRepository = new InMemorySieveQuotaRepository();
 
-        MemoryUsersRepository usersRepository = MemoryUsersRepository.withoutVirtualHosting();
+        MemoryUsersRepository usersRepository = MemoryUsersRepository.withoutVirtualHosting(NO_DOMAIN_LIST);
         usersRepository.addUser(Username.of(USER_NAME_A), PASSWORD_A);
 
         webAdminServer = WebAdminUtils.createWebAdminServer(new SieveQuotaRoutes(sieveRepository, usersRepository, new JsonTransformer()))
diff --git a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/SieveScriptRoutesTest.java b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/SieveScriptRoutesTest.java
index 7570b23..f103643 100644
--- a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/SieveScriptRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/SieveScriptRoutesTest.java
@@ -34,6 +34,7 @@ import java.nio.charset.StandardCharsets;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.james.core.Username;
+import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.filesystem.api.FileSystem;
 import org.apache.james.junit.TemporaryFolderExtension;
 import org.apache.james.sieverepository.api.ScriptContent;
@@ -55,6 +56,7 @@ import io.restassured.RestAssured;
 
 @ExtendWith(TemporaryFolderExtension.class)
 class SieveScriptRoutesTest {
+    private static final DomainList NO_DOMAIN_LIST = null;
 
     private WebAdminServer webAdminServer;
     private SieveRepository sieveRepository;
@@ -80,7 +82,7 @@ class SieveScriptRoutesTest {
         };
 
         sieveRepository = new SieveFileRepository(fileSystem);
-        UsersRepository usersRepository = MemoryUsersRepository.withoutVirtualHosting();
+        UsersRepository usersRepository = MemoryUsersRepository.withoutVirtualHosting(NO_DOMAIN_LIST);
         usersRepository.addUser(Username.of("userA"), "password");
 
         URL sieveResource = ClassLoader.getSystemResource("sieve/my_sieve");
diff --git a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/UserRoutesTest.java b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/UserRoutesTest.java
index 34a59a2..fc83f11 100644
--- a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/UserRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/UserRoutesTest.java
@@ -68,31 +68,34 @@ class UserRoutesTest {
     private static class UserRoutesExtension implements BeforeEachCallback, AfterEachCallback, ParameterResolver {
 
         static UserRoutesExtension withVirtualHosting() {
-            return new UserRoutesExtension(MemoryUsersRepository.withVirtualHosting());
+            SimpleDomainList domainList = new SimpleDomainList();
+            return new UserRoutesExtension(MemoryUsersRepository.withVirtualHosting(domainList), domainList);
         }
+
         static UserRoutesExtension withoutVirtualHosting() {
-            return new UserRoutesExtension(MemoryUsersRepository.withoutVirtualHosting());
+            SimpleDomainList domainList = new SimpleDomainList();
+            return new UserRoutesExtension(MemoryUsersRepository.withoutVirtualHosting(domainList), domainList);
         }
 
         final MemoryUsersRepository usersRepository;
+        final SimpleDomainList domainList;
 
         WebAdminServer webAdminServer;
 
-        UserRoutesExtension(MemoryUsersRepository usersRepository) {
+        UserRoutesExtension(MemoryUsersRepository usersRepository, SimpleDomainList domainList) {
             this.usersRepository = spy(usersRepository);
+            this.domainList = domainList;
         }
 
         @Override
         public void beforeEach(ExtensionContext extensionContext) throws Exception {
-            DomainList domainList = new SimpleDomainList();
             domainList.addDomain(DOMAIN);
-            usersRepository.setDomainList(domainList);
 
             webAdminServer = startServer(usersRepository);
         }
 
         @Override
-        public void afterEach(ExtensionContext extensionContext) throws Exception {
+        public void afterEach(ExtensionContext extensionContext) {
             webAdminServer.destroy();
         }
 
diff --git a/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/test/java/org/apache/james/webadmin/vault/routes/DeletedMessagesVaultRoutesTest.java b/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/test/java/org/apache/james/webadmin/vault/routes/DeletedMessagesVaultRoutesTest.java
index 1049075..6cb20b1 100644
--- a/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/test/java/org/apache/james/webadmin/vault/routes/DeletedMessagesVaultRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/test/java/org/apache/james/webadmin/vault/routes/DeletedMessagesVaultRoutesTest.java
@@ -210,8 +210,7 @@ class DeletedMessagesVaultRoutesTest {
             .autoDetectIp(false));
         domainList.addDomain(DOMAIN);
 
-        MemoryUsersRepository usersRepository = MemoryUsersRepository.withVirtualHosting();
-        usersRepository.setDomainList(domainList);
+        MemoryUsersRepository usersRepository = MemoryUsersRepository.withVirtualHosting(domainList);
         usersRepository.configure(new BaseHierarchicalConfiguration());
 
         usersRepository.addUser(USERNAME, "userPassword");
diff --git a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/DomainQuotaRoutesNoVirtualHostingTest.java b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/DomainQuotaRoutesNoVirtualHostingTest.java
index 1fc9ffc..1d77722 100644
--- a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/DomainQuotaRoutesNoVirtualHostingTest.java
+++ b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/DomainQuotaRoutesNoVirtualHostingTest.java
@@ -57,7 +57,7 @@ class DomainQuotaRoutesNoVirtualHostingTest {
         memoryDomainList.addDomain(Domain.of(FOUND_LOCAL));
         DomainQuotaService domainQuotaService = new DomainQuotaService(maxQuotaManager);
         QuotaModule quotaModule = new QuotaModule();
-        MemoryUsersRepository usersRepository = MemoryUsersRepository.withoutVirtualHosting();
+        MemoryUsersRepository usersRepository = MemoryUsersRepository.withoutVirtualHosting(memoryDomainList);
         DomainQuotaRoutes domainQuotaRoutes = new DomainQuotaRoutes(memoryDomainList, domainQuotaService, usersRepository, new JsonTransformer(quotaModule), ImmutableSet.of(quotaModule));
         webAdminServer = WebAdminUtils.createWebAdminServer(domainQuotaRoutes)
             .start();
diff --git a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/ElasticSearchQuotaSearchExtension.java b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/ElasticSearchQuotaSearchExtension.java
index 5cbe210..e57771f 100644
--- a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/ElasticSearchQuotaSearchExtension.java
+++ b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/ElasticSearchQuotaSearchExtension.java
@@ -69,11 +69,10 @@ public class ElasticSearchQuotaSearchExtension implements ParameterResolver, Bef
 
             InMemoryIntegrationResources resources = InMemoryIntegrationResources.defaultResources();
 
-            MemoryUsersRepository usersRepository = MemoryUsersRepository.withVirtualHosting();
 
             DNSService dnsService = mock(DNSService.class);
             MemoryDomainList domainList = new MemoryDomainList(dnsService);
-            usersRepository.setDomainList(domainList);
+            MemoryUsersRepository usersRepository = MemoryUsersRepository.withVirtualHosting(domainList);
 
             ElasticSearchQuotaMailboxListener listener = new ElasticSearchQuotaMailboxListener(
                 new ElasticSearchIndexer(client, QuotaRatioElasticSearchConstants.DEFAULT_QUOTA_RATIO_WRITE_ALIAS),
diff --git a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/ScanningQuotaSearchExtension.java b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/ScanningQuotaSearchExtension.java
index 51bddb4..997476c 100644
--- a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/ScanningQuotaSearchExtension.java
+++ b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/ScanningQuotaSearchExtension.java
@@ -47,14 +47,13 @@ public class ScanningQuotaSearchExtension implements ParameterResolver, BeforeEa
         try {
             InMemoryIntegrationResources resources = InMemoryIntegrationResources.defaultResources();
 
-            MemoryUsersRepository usersRepository = MemoryUsersRepository.withVirtualHosting();
 
             DNSService dnsService = mock(DNSService.class);
             MemoryDomainList domainList = new MemoryDomainList(dnsService);
             domainList.configure(DomainListConfiguration.builder()
                 .autoDetect(false)
                 .autoDetectIp(false));
-            usersRepository.setDomainList(domainList);
+            MemoryUsersRepository usersRepository = MemoryUsersRepository.withVirtualHosting(domainList);
 
 
             QuotaComponents quotaComponents = resources.getMailboxManager().getQuotaComponents();


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


[james-project] 47/49: JAMES-2870 Remove ZooKeeper Uid & ModSeq generators

Posted by bt...@apache.org.
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 30255146fc0af9f394c218648a7168d5a5a7f944
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 11:01:31 2019 +0700

    JAMES-2870 Remove ZooKeeper Uid & ModSeq generators
    
    This module allows to generate sequence numbers for things like IMAP
    modseq or uid. It has been implemented to fulfil the lack of support
    for this kind of feature in HBase.
    
    Cassandra has the same kind of problems, as most distributed
    database, but we solved the problem without requiring yet another
    complex middleware.
    
    As HBase is no longer part of the codebase and to my knowledge the
    component is not used anywhere else, I propose to mark it as
    deprecated for 3.4 in order to target a removal for 3.5
---
 mailbox/README.md                                  |   8 -
 mailbox/pom.xml                                    |   2 -
 mailbox/zoo-seq-provider/pom.xml                   |  88 ---------
 .../james/mailbox/store/mail/ZooUidProvider.java   | 111 ------------
 .../mailbox/store/mail/ZooUidProviderTest.java     | 198 ---------------------
 5 files changed, 407 deletions(-)

diff --git a/mailbox/README.md b/mailbox/README.md
index e76ce0a..0d3c7ea 100644
--- a/mailbox/README.md
+++ b/mailbox/README.md
@@ -20,7 +20,6 @@ Apache James Mailbox has the following project (Maven) structure:
 |-- spring          -- Spring module - starts a specific mailbox implementation
 |-- store           -- Common base/utility classes used in all mailbox implementations
 |-- tool            -- Database migration/mailbox export tool
-|-- zoo-seq-provider -- Distributed unique ID generator using Zookeeper and Curator (Clustering James Mailbox)
 ~~~
 
 Mailbox JPA
@@ -43,13 +42,6 @@ Implements the Maildir standard for email storage (http://en.wikipedia.org/wiki/
 *Nix systems.
 
 
-Zookeeper Sequence Provider
-==========================
-
-Uses Zookeeper and Curator Framework for generating distributed unique ID's, needed for mailbox management from multiple
-instances of James (IMAP) servers.
-
-
 Building
 ========
 
diff --git a/mailbox/pom.xml b/mailbox/pom.xml
index d2d85a8..39410b4 100644
--- a/mailbox/pom.xml
+++ b/mailbox/pom.xml
@@ -72,8 +72,6 @@
         <module>tools/indexer</module>
         <module>tools/jpa-migrator</module>
         <module>tools/maildir-utils</module>
-
-        <module>zoo-seq-provider</module>
     </modules>
 
     <issueManagement>
diff --git a/mailbox/zoo-seq-provider/pom.xml b/mailbox/zoo-seq-provider/pom.xml
deleted file mode 100644
index df23980..0000000
--- a/mailbox/zoo-seq-provider/pom.xml
+++ /dev/null
@@ -1,88 +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-mailbox</artifactId>
-        <version>3.5.0-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-
-    <artifactId>zookeeper-sequence-provider</artifactId>
-    <packaging>jar</packaging>
-    <name>Apache James :: Mailbox :: Zookeeper Sequence Provider</name>
-    <description>Deprecated sequence provider based on ZooKeeper</description>
-
-    <properties>
-        <curator.version>4.0.1</curator.version>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>${james.groupId}</groupId>
-            <artifactId>apache-james-mailbox-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>${james.groupId}</groupId>
-            <artifactId>apache-james-mailbox-store</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>${james.groupId}</groupId>
-            <artifactId>testing-base</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>com.google.guava</groupId>
-            <artifactId>guava</artifactId>
-            <version>13.0</version><!--$NO-MVN-MAN-VER$-->
-        </dependency>
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-lang3</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.curator</groupId>
-            <artifactId>curator-client</artifactId>
-            <version>${curator.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.curator</groupId>
-            <artifactId>curator-framework</artifactId>
-            <version>${curator.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.curator</groupId>
-            <artifactId>curator-recipes</artifactId>
-            <version>${curator.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.curator</groupId>
-            <artifactId>curator-test</artifactId>
-            <version>${curator.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-    </dependencies>
-</project>
diff --git a/mailbox/zoo-seq-provider/src/main/java/org/apache/james/mailbox/store/mail/ZooUidProvider.java b/mailbox/zoo-seq-provider/src/main/java/org/apache/james/mailbox/store/mail/ZooUidProvider.java
deleted file mode 100644
index 05df63c..0000000
--- a/mailbox/zoo-seq-provider/src/main/java/org/apache/james/mailbox/store/mail/ZooUidProvider.java
+++ /dev/null
@@ -1,111 +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.mailbox.store.mail;
-
-import java.util.Optional;
-
-import org.apache.commons.lang3.NotImplementedException;
-import org.apache.curator.RetryPolicy;
-import org.apache.curator.framework.CuratorFramework;
-import org.apache.curator.framework.imps.CuratorFrameworkState;
-import org.apache.curator.framework.recipes.atomic.AtomicValue;
-import org.apache.curator.framework.recipes.atomic.DistributedAtomicLong;
-import org.apache.curator.retry.RetryOneTime;
-import org.apache.james.mailbox.MailboxSession;
-import org.apache.james.mailbox.MessageUid;
-import org.apache.james.mailbox.exception.MailboxException;
-import org.apache.james.mailbox.model.Mailbox;
-import org.apache.james.mailbox.model.MailboxId;
-
-import com.google.common.base.Preconditions;
-
-/**
- * ZooKeeper based implementation of a distributed sequential UID generator.
- *
- * This component is deprecated since 3.4. It way initially implemented for HBase backend that is now gone.
- * As Others backends have their own solutions to generate sequential ids, we decided to deprecate then remove
- * this implementation.
- */
-@Deprecated
-public class ZooUidProvider implements UidProvider {
-    // TODO: use ZK paths to store uid and modSeq, etc.
-
-    public static final String UID_PATH_SUFFIX = "-uid";
-    public static final String PATH_PREFIX = "/";
-
-    private final CuratorFramework client;
-    private final RetryPolicy retryPolicy;
-
-    public ZooUidProvider(CuratorFramework client) {
-        this(client, new RetryOneTime(1));
-    }
-
-    public ZooUidProvider(CuratorFramework client, RetryPolicy retryPolicy) {
-        Preconditions.checkNotNull(client, "Curator client is null");
-        Preconditions.checkNotNull(retryPolicy, "Retry policy is null");
-        this.client = client;
-        this.retryPolicy = retryPolicy;
-    }
-
-    @Override
-    public MessageUid nextUid(MailboxSession session, Mailbox mailbox) throws MailboxException {
-        if (client.getState() == CuratorFrameworkState.STARTED) {
-            DistributedAtomicLong uid = new DistributedAtomicLong(client, pathForMailbox(mailbox), retryPolicy);
-            try {
-                uid.increment();
-                AtomicValue<Long> value = uid.get();
-                if (value.succeeded()) {
-                    return MessageUid.of(value.postValue());
-                }
-            } catch (Exception e) {
-                throw new MailboxException("Exception incrementing UID for session " + session, e);
-            }
-        }
-        throw new MailboxException("Curator client is closed.");
-    }
-
-    @Override
-    public Optional<MessageUid> lastUid(MailboxSession session, Mailbox mailbox) throws MailboxException {
-        if (client.getState() == CuratorFrameworkState.STARTED) {
-            DistributedAtomicLong uid = new DistributedAtomicLong(client, pathForMailbox(mailbox), retryPolicy);
-            try {
-                AtomicValue<Long> value = uid.get();
-                if (value.succeeded()) {
-                    Long postValue = value.postValue();
-                    if (postValue == 0) {
-                        return Optional.empty();
-                    }
-                    return Optional.of(MessageUid.of(value.postValue()));
-                }
-            } catch (Exception e) {
-                throw new MailboxException("Exception getting last UID for session " + session, e);
-            }
-        }
-        throw new MailboxException("Curator client is closed.");
-    }
-
-    @Override
-    public MessageUid nextUid(MailboxSession session, MailboxId mailboxId) throws MailboxException {
-        throw new NotImplementedException("Not implemented");
-    }
-
-    public static <E extends MailboxId> String pathForMailbox(Mailbox mailbox) {
-        return PATH_PREFIX + mailbox.getMailboxId().serialize() + UID_PATH_SUFFIX;
-    }
-}
diff --git a/mailbox/zoo-seq-provider/src/test/java/org/apache/james/mailbox/store/mail/ZooUidProviderTest.java b/mailbox/zoo-seq-provider/src/test/java/org/apache/james/mailbox/store/mail/ZooUidProviderTest.java
deleted file mode 100644
index 9ef11eb..0000000
--- a/mailbox/zoo-seq-provider/src/test/java/org/apache/james/mailbox/store/mail/ZooUidProviderTest.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.mailbox.store.mail;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.io.Serializable;
-import java.util.Optional;
-import java.util.UUID;
-
-import org.apache.curator.RetryPolicy;
-import org.apache.curator.framework.CuratorFramework;
-import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.retry.RetryOneTime;
-import org.apache.curator.test.TestingServer;
-import org.apache.james.core.Username;
-import org.apache.james.mailbox.MessageUid;
-import org.apache.james.mailbox.model.Mailbox;
-import org.apache.james.mailbox.model.MailboxId;
-import org.apache.james.mailbox.model.MailboxPath;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-
-/**
- * Test for UID provider.
- */
-public class ZooUidProviderTest {
-
-    public static class LongId implements MailboxId, Serializable {
-
-        public final Long id;
-
-        public LongId(long id) {
-            this.id = id;
-        }
-
-        @Override
-        public String serialize() {
-            return String.valueOf(id);
-        }
-
-        @Override
-        public int hashCode() {
-            final int prime = 31;
-            int result = 1;
-            result = prime * result + ((id == null) ? 0 : id.hashCode());
-            return result;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj == null) {
-                return false;
-            }
-            if (getClass() != obj.getClass()) {
-                return false;
-            }
-            LongId other = (LongId) obj;
-            if (id == null) {
-                if (other.id != null) {
-                    return false;
-                }
-            } else if (!id.equals(other.id)) {
-                return false;
-            }
-            return true;
-        }
-
-    }
-
-    public static class UUIDId implements MailboxId, Serializable {
-
-        private final UUID id;
-
-        public static UUIDId of(UUID id) {
-            return new UUIDId(id);
-        }
-
-        public UUIDId(UUID id) {
-            this.id = id;
-        }
-
-        @Override
-        public String serialize() {
-            return id.toString();
-        }
-
-        @Override
-        public int hashCode() {
-            final int prime = 31;
-            int result = 1;
-            result = prime * result + ((id == null) ? 0 : id.hashCode());
-            return result;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj == null) {
-                return false;
-            }
-            if (getClass() != obj.getClass()) {
-                return false;
-            }
-            UUIDId other = (UUIDId) obj;
-            if (id == null) {
-                if (other.id != null) {
-                    return false;
-                }
-            } else if (!id.equals(other.id)) {
-                return false;
-            }
-            return true;
-        }
-
-    }
-
-    private static TestingServer testServer;
-    private static final int ZOO_TEST_PORT = 3123;
-    private final RetryPolicy retryPolicy = new RetryOneTime(1);
-    private CuratorFramework client;
-    private ZooUidProvider uuidProvider;
-    private ZooUidProvider longProvider;
-    private Mailbox mailboxUUID;
-    private Mailbox mailboxLong;
-    private UUID randomUUID = UUID.randomUUID();
-
-    @Before
-    public void setUp() throws Exception {
-        testServer = new TestingServer(ZOO_TEST_PORT);
-        client = CuratorFrameworkFactory.builder().connectString("localhost:" + ZOO_TEST_PORT)
-                .retryPolicy(retryPolicy)
-                .namespace("JAMES").build();
-        client.start();
-        uuidProvider = new ZooUidProvider(client, retryPolicy);
-        longProvider = new ZooUidProvider(client, retryPolicy);
-        Username namespaceuser = Username.of("namespaceuser");
-        MailboxPath path1 = new MailboxPath("namespacetest", namespaceuser, "UUID");
-        MailboxPath path2 = new MailboxPath("namespacetest", namespaceuser, "Long");
-        mailboxUUID = new Mailbox(path1, 1L);
-        mailboxUUID.setMailboxId(UUIDId.of(randomUUID));
-        mailboxLong = new Mailbox(path2, 2L);
-        mailboxLong.setMailboxId(new LongId(123L));
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        client.close();
-        testServer.close();
-    }
-
-    @Test
-    public void testNextUid() throws Exception {
-        MessageUid result = uuidProvider.nextUid(null, mailboxUUID);
-        assertThat(result.asLong()).describedAs("Next UID is 1").isEqualTo(1);
-        result = longProvider.nextUid(null, mailboxLong);
-        assertThat(result.asLong()).describedAs("Next UID is 1").isEqualTo(1);
-    }
-
-    @Test
-    public void testLastUid() throws Exception {
-        Optional<MessageUid> result = uuidProvider.lastUid(null, mailboxUUID);
-        assertThat(result).describedAs("Next UID is empty").isEqualTo(Optional.empty());
-        MessageUid nextResult = uuidProvider.nextUid(null, mailboxUUID);
-        assertThat(nextResult.asLong()).describedAs("Next UID is 1").isEqualTo(1);
-    }
-
-    @Test
-    public void testLongLastUid() throws Exception {
-        Optional<MessageUid> result = longProvider.lastUid(null, mailboxLong);
-        assertThat(result).describedAs("Next UID is empty").isEqualTo(Optional.empty());
-        MessageUid nextResult = longProvider.nextUid(null, mailboxLong);
-        assertThat(nextResult.asLong()).describedAs("Next UID is 1").isEqualTo(1);
-    }
-}


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


[james-project] 44/49: [Refactoring] protocols-lmtp should rely on constructor injection

Posted by bt...@apache.org.
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 ae1ced3e0ded480e4492b96d5d486718b03495f8
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 21:21:43 2019 +0700

    [Refactoring] protocols-lmtp should rely on constructor injection
---
 .../lmtpserver/hook/MailboxDeliverToRecipientHandler.java  | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/hook/MailboxDeliverToRecipientHandler.java b/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/hook/MailboxDeliverToRecipientHandler.java
index bd0205b..74f7d7d 100644
--- a/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/hook/MailboxDeliverToRecipientHandler.java
+++ b/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/hook/MailboxDeliverToRecipientHandler.java
@@ -47,25 +47,19 @@ import org.slf4j.LoggerFactory;
 
 /**
  * {@link DeliverToRecipientHook} which deliver the message directly to the recipients mailbox.
- * 
- *
  */
 public class MailboxDeliverToRecipientHandler implements DeliverToRecipientHook {
     private static final Logger LOGGER = LoggerFactory.getLogger(MailboxDeliverToRecipientHandler.class);
   
-    private UsersRepository users;
-    private MailboxManager mailboxManager;
+    private final UsersRepository users;
+    private final MailboxManager mailboxManager;
 
     @Inject
-    public final void setUsersRepository(UsersRepository users) {
+    public MailboxDeliverToRecipientHandler(UsersRepository users, @Named("mailboxmanager") MailboxManager mailboxManager) {
         this.users = users;
-    }
-
-    @Inject
-    public final void setMailboxManager(@Named("mailboxmanager") MailboxManager mailboxManager) {
         this.mailboxManager = mailboxManager;
     }
-    
+
     @Override
     public HookResult deliver(SMTPSession session, MailAddress recipient, MailEnvelope envelope) {
         try {


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


[james-project] 13/49: [Refactoring] JPAMailbox remove uneeded methods

Posted by bt...@apache.org.
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 6c9f76a4f690fb2df2f9ac9b2bd99d45fa2701aa
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sat Nov 16 10:41:02 2019 +0700

    [Refactoring] JPAMailbox remove uneeded methods
---
 .../james/mailbox/jpa/mail/model/JPAMailbox.java   | 28 ----------------------
 1 file changed, 28 deletions(-)

diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailbox.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailbox.java
index 0b795a2..4770ae5 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailbox.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailbox.java
@@ -151,14 +151,6 @@ public class JPAMailbox {
         this.name = name;
     }
 
-    public long getUidValidity() {
-        return uidValidity;
-    }
-
-    public void setUidValidity(long uidValidity) {
-        this.uidValidity = uidValidity;
-    }
-
     public String getUser() {
         return user;
     }
@@ -167,30 +159,10 @@ public class JPAMailbox {
         this.user = user;
     }
 
-    public String getNamespace() {
-        return namespace;
-    }
-
     public void setNamespace(String namespace) {
         this.namespace = namespace;
     }
 
-    public long getLastUid() {
-        return lastUid;
-    }
-
-    public void setLastUid(long lastUid) {
-        this.lastUid = lastUid;
-    }
-
-    public long getHighestModSeq() {
-        return highestModSeq;
-    }
-
-    public void setHighestModSeq(long highestModSeq) {
-        this.highestModSeq = highestModSeq;
-    }
-
     @Override
     public String toString() {
         return "Mailbox ( "


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


[james-project] 38/49: [Refactoring] MockProtocolHandlerLoader should rely on Guice

Posted by bt...@apache.org.
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 d5f0072f5de20a986cdb70cbecb7c91ed6b1b16d
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 21:02:51 2019 +0700

    [Refactoring] MockProtocolHandlerLoader should rely on Guice
---
 server/protocols/protocols-library/pom.xml         |   5 +
 .../lib/mock/MockProtocolHandlerLoader.java        | 112 +++++++--------------
 server/protocols/protocols-pop3/pom.xml            |   5 +
 .../apache/james/pop3server/POP3ServerTest.java    |  16 +--
 server/protocols/protocols-smtp/pom.xml            |   5 +
 .../apache/james/smtpserver/SMTPServerTest.java    |  30 +++---
 6 files changed, 72 insertions(+), 101 deletions(-)

diff --git a/server/protocols/protocols-library/pom.xml b/server/protocols/protocols-library/pom.xml
index f5f8692..1ba9320 100644
--- a/server/protocols/protocols-library/pom.xml
+++ b/server/protocols/protocols-library/pom.xml
@@ -62,6 +62,11 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>com.google.inject</groupId>
+            <artifactId>guice</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>io.netty</groupId>
             <artifactId>netty</artifactId>
         </dependency>
diff --git a/server/protocols/protocols-library/src/test/java/org/apache/james/protocols/lib/mock/MockProtocolHandlerLoader.java b/server/protocols/protocols-library/src/test/java/org/apache/james/protocols/lib/mock/MockProtocolHandlerLoader.java
index d0fa6fe..cb56515 100644
--- a/server/protocols/protocols-library/src/test/java/org/apache/james/protocols/lib/mock/MockProtocolHandlerLoader.java
+++ b/server/protocols/protocols-library/src/test/java/org/apache/james/protocols/lib/mock/MockProtocolHandlerLoader.java
@@ -1,31 +1,57 @@
 package org.apache.james.protocols.lib.mock;
 
-import java.lang.annotation.Annotation;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
-import javax.inject.Inject;
-import javax.inject.Named;
 
 import org.apache.commons.configuration2.Configuration;
-import org.apache.james.metrics.api.MetricFactory;
-import org.apache.james.metrics.api.NoopMetricFactory;
 import org.apache.james.protocols.api.handler.ProtocolHandler;
 import org.apache.james.protocols.lib.handler.ProtocolHandlerLoader;
 
+import com.google.common.collect.ImmutableList;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Module;
+
 public class MockProtocolHandlerLoader implements ProtocolHandlerLoader {
 
+    public static class Builder {
+        private final ImmutableList.Builder<Module> modules;
+
+        private Builder() {
+            modules = ImmutableList.builder();
+        }
+
+        public <T, U extends T> Builder put(Module module) {
+            modules.add(module);
+            return this;
+        }
+
+        public MockProtocolHandlerLoader build() {
+            return new MockProtocolHandlerLoader(Guice.createInjector(modules.build()));
+        }
+    }
+
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    private final Injector injector;
+    private final List<Object> loaderRegistry = new ArrayList<>();
+
+    private MockProtocolHandlerLoader(Injector injector) {
+        this.injector = injector;
+    }
+
     @Override
     public ProtocolHandler load(String name, Configuration config) throws LoadingException {
         try {
-            ProtocolHandler obj = create(name);
-            injectResources(obj);
+            Class<?> aClass = Thread.currentThread().getContextClassLoader().loadClass(name);
+            ProtocolHandler obj = (ProtocolHandler) injector.getInstance(aClass);
             postConstruct(obj);
             init(obj, config);
             synchronized (this) {
@@ -37,32 +63,6 @@ public class MockProtocolHandlerLoader implements ProtocolHandlerLoader {
         }
     }
 
-    private final Map<String, Object> servicesByName = new HashMap<>();
-    private final Map<Class<?>, Object> servicesByType = new HashMap<>();
-    
-    public Object get(String name) {
-        return servicesByName.get(name);
-    }
-
-    public Object get(Class<?> type) {
-        return servicesByType.get(type);
-    }
-    
-    public <T, U extends T> void put(String role, Class<T> serviceType, U instance) {
-        servicesByName.put(role, instance);
-        servicesByType.put(serviceType, instance);
-    }
-
-    private final List<Object> loaderRegistry = new ArrayList<>();
-
-    protected ProtocolHandler create(String className) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
-        try {
-            return (ProtocolHandler) Thread.currentThread().getContextClassLoader().loadClass(className).newInstance();
-        } catch (InstantiationException e) {
-            return (ProtocolHandler) Thread.currentThread().getContextClassLoader().loadClass(className).getConstructor(MetricFactory.class).newInstance(new NoopMetricFactory());
-        }
-    }
-
     /**
      * Dispose all loaded instances by calling the method of the instances which
      * is annotated with @PreDestroy
@@ -102,43 +102,6 @@ public class MockProtocolHandlerLoader implements ProtocolHandlerLoader {
         }
     }
 
-    private void injectResources(Object resource) {
-        final Method[] methods = resource.getClass().getMethods();
-        for (Method method : methods) {
-            final Inject injectAnnotation = method.getAnnotation(Inject.class);
-            if (injectAnnotation != null) {
-                Object service = null;
-                String name = null;
-                Annotation[][] paramAnnotations = method.getParameterAnnotations();
-                if (paramAnnotations.length == 1) {
-                    if (paramAnnotations[0].length == 1) {
-                        if (paramAnnotations[0][0].annotationType().equals(Named.class)) {
-                            name = ((Named) paramAnnotations[0][0]).value();
-                        }
-                    }
-                }
-                if (name != null) {
-                    // Name indicates a service
-                    service = get(name);
-                }
-                Class<?>[] parameterTypes = method.getParameterTypes();
-                if (parameterTypes.length == 1) {
-                    service = get(parameterTypes[0]);
-                }
-                if (service != null) {
-                    try {
-                        Object[] args = { service };
-                        method.invoke(resource, args);
-                    } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
-                        throw new RuntimeException("Injection failed for object " + resource + " on method " + method + " with resource " + service, e);
-                    }
-                } else {
-                    throw new RuntimeException("Injection failed for object " + resource + " on method " + method + " with resource name " + name + ", because no mapping was found");
-                }
-            }
-        }
-    }
-
     private void init(Object resource, Configuration config) throws IllegalAccessException, InvocationTargetException {
         Method[] methods = resource.getClass().getMethods();
         for (Method method : methods) {
@@ -154,9 +117,4 @@ public class MockProtocolHandlerLoader implements ProtocolHandlerLoader {
             && method.getParameterTypes().length == 1
             && method.getParameterTypes()[0].equals(Configuration.class);
     }
-    
-    public Object getObjectForName(String name) {
-        return get(name);
-    }
-
 }
diff --git a/server/protocols/protocols-pop3/pom.xml b/server/protocols/protocols-pop3/pom.xml
index c0a384b..60c797e 100644
--- a/server/protocols/protocols-pop3/pom.xml
+++ b/server/protocols/protocols-pop3/pom.xml
@@ -94,6 +94,11 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>com.google.inject</groupId>
+            <artifactId>guice</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>commons-net</groupId>
             <artifactId>commons-net</artifactId>
             <scope>test</scope>
diff --git a/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java b/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
index 00d6d96..b07fee9 100644
--- a/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
+++ b/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
@@ -55,6 +55,8 @@ import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 
+import com.google.inject.name.Names;
+
 public class POP3ServerTest {
     private static final DomainList NO_DOMAIN_LIST = null;
 
@@ -716,9 +718,6 @@ public class POP3ServerTest {
     }
 
     protected void setUpServiceManager() throws Exception {
-        protocolHandlerChain = new MockProtocolHandlerLoader();
-        protocolHandlerChain.put("usersrepository", UsersRepository.class, usersRepository);
-
         mailboxManager = InMemoryIntegrationResources.builder()
             .authenticator((userid, passwd) -> {
                 try {
@@ -737,12 +736,13 @@ public class POP3ServerTest {
             .storeQuotaManager()
             .build()
             .getMailboxManager();
-
-        protocolHandlerChain.put("mailboxmanager", MailboxManager.class, mailboxManager);
-    
         fileSystem = new MockFileSystem();
-        protocolHandlerChain.put("fileSystem", FileSystem.class, fileSystem);
-    
+
+        protocolHandlerChain = MockProtocolHandlerLoader.builder()
+            .put(binder -> binder.bind(UsersRepository.class).toInstance(usersRepository))
+            .put(binder -> binder.bind(MailboxManager.class).annotatedWith(Names.named("mailboxmanager")).toInstance(mailboxManager))
+            .put(binder -> binder.bind(FileSystem.class).toInstance(fileSystem))
+            .build();
     }
 
     private void setupTestMails(MailboxSession session, MessageManager mailbox) throws MailboxException {
diff --git a/server/protocols/protocols-smtp/pom.xml b/server/protocols/protocols-smtp/pom.xml
index bf3968b..125125e 100644
--- a/server/protocols/protocols-smtp/pom.xml
+++ b/server/protocols/protocols-smtp/pom.xml
@@ -130,6 +130,11 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>com.google.inject</groupId>
+            <artifactId>guice</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>com.sun.mail</groupId>
             <artifactId>javax.mail</artifactId>
         </dependency>
diff --git a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java
index 2bed383..ac5f4f9 100644
--- a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java
+++ b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java
@@ -61,6 +61,8 @@ import org.apache.james.mailrepository.memory.MemoryMailRepositoryStore;
 import org.apache.james.mailrepository.memory.MemoryMailRepositoryUrlStore;
 import org.apache.james.mailrepository.memory.TestingMailRepositoryLoader;
 import org.apache.james.metrics.api.Metric;
+import org.apache.james.metrics.api.MetricFactory;
+import org.apache.james.metrics.api.NoopMetricFactory;
 import org.apache.james.protocols.api.utils.ProtocolServerUtils;
 import org.apache.james.protocols.lib.mock.MockProtocolHandlerLoader;
 import org.apache.james.protocols.netty.AbstractChannelPipelineFactory;
@@ -85,6 +87,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.google.common.collect.ImmutableList;
+import com.google.inject.TypeLiteral;
 
 public class SMTPServerTest {
 
@@ -244,28 +247,23 @@ public class SMTPServerTest {
     }
 
     protected void setUpFakeLoader() throws Exception {
-
-        chain = new MockProtocolHandlerLoader();
-    
-        chain.put("usersrepository", UsersRepository.class, usersRepository);
-    
         dnsServer = new AlterableDNSServer();
-        chain.put("dnsservice", DNSService.class, dnsServer);
-    
-        chain.put("mailStore", MailRepositoryStore.class, mailRepositoryStore);
-
-        chain.put("fileSystem", FileSystem.class, fileSystem);
-
         MemoryRecipientRewriteTable rewriteTable = new MemoryRecipientRewriteTable();
-        chain.put("recipientrewritetable", RecipientRewriteTable.class, rewriteTable);
-
         queueFactory = new MemoryMailQueueFactory(new RawMailQueueItemDecoratorFactory());
         queue = queueFactory.createQueue(MailQueueFactory.SPOOL);
-        chain.put("mailqueuefactory", MailQueueFactory.class, queueFactory);
         MemoryDomainList domainList = new MemoryDomainList(mock(DNSService.class));
         domainList.addDomain(Domain.LOCALHOST);
-        chain.put("domainlist", DomainList.class, domainList);
-        
+
+        chain = MockProtocolHandlerLoader.builder()
+            .put(binder -> binder.bind(DomainList.class).toInstance(domainList))
+            .put(binder -> binder.bind(new TypeLiteral<MailQueueFactory<?>>() {}).toInstance(queueFactory))
+            .put(binder -> binder.bind(RecipientRewriteTable.class).toInstance(rewriteTable))
+            .put(binder -> binder.bind(FileSystem.class).toInstance(fileSystem))
+            .put(binder -> binder.bind(MailRepositoryStore.class).toInstance(mailRepositoryStore))
+            .put(binder -> binder.bind(DNSService.class).toInstance(dnsServer))
+            .put(binder -> binder.bind(UsersRepository.class).toInstance(usersRepository))
+            .put(binder -> binder.bind(MetricFactory.class).to(NoopMetricFactory.class))
+            .build();
     }
 
     @Test


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


[james-project] 10/49: [Refactoring] JPARecipientRewriteTable should not open transactions upon read

Posted by bt...@apache.org.
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 56ff7c97ccef3e6fbe66108243b08b480c8aee49
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Nov 18 14:17:41 2019 +0700

    [Refactoring] JPARecipientRewriteTable should not open transactions upon read
---
 .../org/apache/james/rrt/jpa/JPARecipientRewriteTable.java   | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/server/data/data-jpa/src/main/java/org/apache/james/rrt/jpa/JPARecipientRewriteTable.java b/server/data/data-jpa/src/main/java/org/apache/james/rrt/jpa/JPARecipientRewriteTable.java
index 0df606d..83c364b 100644
--- a/server/data/data-jpa/src/main/java/org/apache/james/rrt/jpa/JPARecipientRewriteTable.java
+++ b/server/data/data-jpa/src/main/java/org/apache/james/rrt/jpa/JPARecipientRewriteTable.java
@@ -88,24 +88,18 @@ public class JPARecipientRewriteTable extends AbstractRecipientRewriteTable {
     @Override
     public Mappings getStoredMappings(MappingSource source) throws RecipientRewriteTableException {
         EntityManager entityManager = entityManagerFactory.createEntityManager();
-        final EntityTransaction transaction = entityManager.getTransaction();
         try {
-            transaction.begin();
             @SuppressWarnings("unchecked")
             List<JPARecipientRewrite> virtualUsers = entityManager.createNamedQuery("selectUserDomainMapping")
                 .setParameter("user", source.getFixedUser())
                 .setParameter("domain", source.getFixedDomain())
                 .getResultList();
-            transaction.commit();
             if (virtualUsers.size() > 0) {
                 return MappingsImpl.fromRawString(virtualUsers.get(0).getTargetAddress());
             }
             return MappingsImpl.empty();
         } catch (PersistenceException e) {
             LOGGER.debug("Failed to get user domain mappings", e);
-            if (transaction.isActive()) {
-                transaction.rollback();
-            }
             throw new RecipientRewriteTableException("Error while retrieve mappings", e);
         } finally {
             entityManager.close();
@@ -115,22 +109,16 @@ public class JPARecipientRewriteTable extends AbstractRecipientRewriteTable {
     @Override
     public Map<MappingSource, Mappings> getAllMappings() throws RecipientRewriteTableException {
         EntityManager entityManager = entityManagerFactory.createEntityManager();
-        final EntityTransaction transaction = entityManager.getTransaction();
         Map<MappingSource, Mappings> mapping = new HashMap<>();
         try {
-            transaction.begin();
             @SuppressWarnings("unchecked")
             List<JPARecipientRewrite> virtualUsers = entityManager.createNamedQuery("selectAllMappings").getResultList();
-            transaction.commit();
             for (JPARecipientRewrite virtualUser : virtualUsers) {
                 mapping.put(MappingSource.fromUser(virtualUser.getUser(), virtualUser.getDomain()), MappingsImpl.fromRawString(virtualUser.getTargetAddress()));
             }
             return mapping;
         } catch (PersistenceException e) {
             LOGGER.debug("Failed to get all mappings", e);
-            if (transaction.isActive()) {
-                transaction.rollback();
-            }
             throw new RecipientRewriteTableException("Error while retrieve mappings", e);
         } finally {
             entityManager.close();


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


[james-project] 25/49: [Refactoring] MailStateEquals class is not used

Posted by bt...@apache.org.
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 7bb9b6500ac92b9320ce40383541192895fcb41e
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 14:59:06 2019 +0700

    [Refactoring] MailStateEquals class is not used
---
 .../impl/camel/MailStateEquals.java                | 42 ----------------------
 1 file changed, 42 deletions(-)

diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/MailStateEquals.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/MailStateEquals.java
deleted file mode 100644
index 6f2b00d..0000000
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/MailStateEquals.java
+++ /dev/null
@@ -1,42 +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.mailetcontainer.impl.camel;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Predicate;
-import org.apache.mailet.Mail;
-
-/**
- * Check the the Mail state is Equals to the one give on the constructor
- */
-public class MailStateEquals implements Predicate {
-
-    private final String state;
-
-    public MailStateEquals(String state) {
-        this.state = state;
-    }
-
-    @Override
-    public boolean matches(Exchange ex) {
-        Mail m = ex.getIn().getBody(Mail.class);
-        return state.equals(m.getState());
-    }
-
-}


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


[james-project] 41/49: [Refactoring] protocols-library: remove unused code

Posted by bt...@apache.org.
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 9c6fddbd04e7b76ad21389a6d0e88499a2c8a170
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 21:11:54 2019 +0700

    [Refactoring] protocols-library: remove unused code
---
 .../lib/netty/AbstractConfigurableAsyncServer.java | 10 ---
 ...bstractExecutorAwareChannelPipelineFactory.java |  7 --
 ...nabledOrderedMemoryAwareThreadPoolExecutor.java |  6 --
 .../org/apache/james/protocols/lib/PortUtil.java   | 87 ----------------------
 4 files changed, 110 deletions(-)

diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
index 83566ed..8480c5d 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
@@ -329,16 +329,6 @@ public abstract class AbstractConfigurableAsyncServer extends AbstractAsyncServe
         // override me
     }
 
-  
-    /**
-     * Return the FileSystem
-     * 
-     * @return fileSystem
-     */
-    protected FileSystem getFileSystem() {
-        return fileSystem;
-    }
-
     /**
      * Configure the helloName for the given Configuration
      * 
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractExecutorAwareChannelPipelineFactory.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractExecutorAwareChannelPipelineFactory.java
index 2bf9d51..ee32379 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractExecutorAwareChannelPipelineFactory.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractExecutorAwareChannelPipelineFactory.java
@@ -34,13 +34,6 @@ import org.jboss.netty.util.HashedWheelTimer;
 public abstract class AbstractExecutorAwareChannelPipelineFactory extends AbstractSSLAwareChannelPipelineFactory {
 
     public AbstractExecutorAwareChannelPipelineFactory(int timeout, int maxConnections, int maxConnectsPerIp,
-                                                       ChannelGroup group, ExecutionHandler eHandler,
-                                                       ChannelHandlerFactory frameHandlerFactory,
-                                                       HashedWheelTimer hashedWheelTimer) {
-        super(timeout, maxConnections, maxConnectsPerIp, group, eHandler, frameHandlerFactory, hashedWheelTimer);
-    }
-
-    public AbstractExecutorAwareChannelPipelineFactory(int timeout, int maxConnections, int maxConnectsPerIp,
                                                        ChannelGroup group, String[] enabledCipherSuites,
                                                        ExecutionHandler eHandler, ChannelHandlerFactory frameHandlerFactory,
                                                        HashedWheelTimer hashedWheelTimer) {
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/JMXEnabledOrderedMemoryAwareThreadPoolExecutor.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/JMXEnabledOrderedMemoryAwareThreadPoolExecutor.java
index 338f654..d958531 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/JMXEnabledOrderedMemoryAwareThreadPoolExecutor.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/JMXEnabledOrderedMemoryAwareThreadPoolExecutor.java
@@ -48,12 +48,6 @@ public class JMXEnabledOrderedMemoryAwareThreadPoolExecutor extends OrderedMemor
         this.jmxPath = jmxPath;
         registerMBean();
     }
-    
-    public JMXEnabledOrderedMemoryAwareThreadPoolExecutor(int corePoolSize, long maxChannelMemorySize, long maxTotalMemorySize, long keepAliveTime, TimeUnit unit, String jmxPath, String name) {
-        super(corePoolSize, maxChannelMemorySize, maxTotalMemorySize, keepAliveTime, unit, NamedThreadFactory.withName(name));
-        this.jmxPath = jmxPath;
-        registerMBean();
-    }
 
     @Override
     protected void beforeExecute(Thread t, Runnable r) {
diff --git a/server/protocols/protocols-library/src/test/java/org/apache/james/protocols/lib/PortUtil.java b/server/protocols/protocols-library/src/test/java/org/apache/james/protocols/lib/PortUtil.java
deleted file mode 100644
index 460ced3..0000000
--- a/server/protocols/protocols-library/src/test/java/org/apache/james/protocols/lib/PortUtil.java
+++ /dev/null
@@ -1,87 +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.protocols.lib;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-
-/**
- * some utilities for James unit testing
- */
-public class PortUtil {
-
-    //the lowest possible port number assigned for testing
-    private static final int PORT_RANGE_START = 8000;
-    // the highest possible port number assigned for testing
-    private static final int PORT_RANGE_END = 11000; 
-    private static int PORT_LAST_USED = PORT_RANGE_START;
-
-    /**
-     * assigns a port from the range of test ports
-     * 
-     * @return port number
-     */
-    public static int getNonPrivilegedPort() {
-        // uses sequential assignment of ports
-        return getNextNonPrivilegedPort(); 
-    }
-
-    /**
-     * assigns a random port from the range of test ports
-     * 
-     * @return port number
-     */
-    protected static int getRandomNonPrivilegedPortInt() {
-        return ((int) (Math.random() * (PORT_RANGE_END - PORT_RANGE_START) + PORT_RANGE_START));
-    }
-
-    /**
-     * assigns ports sequentially from the range of test ports
-     * 
-     * @return port number
-     */
-    protected static synchronized int getNextNonPrivilegedPort() {
-        // Hack to increase probability that the port is bindable
-        int nextPortCandidate = PORT_LAST_USED;
-        while (true) {
-            try {
-                nextPortCandidate++;
-                if (PORT_LAST_USED == nextPortCandidate) {
-                    throw new RuntimeException("no free port found");
-                }
-                if (nextPortCandidate > PORT_RANGE_END) {
-                    nextPortCandidate = PORT_RANGE_START; // start over
-                }
-
-                // test, port is available
-                ServerSocket ss;
-                ss = new ServerSocket(nextPortCandidate);
-                ss.setReuseAddress(true);
-                ss.close();
-                break;
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
-        PORT_LAST_USED = nextPortCandidate;
-        return PORT_LAST_USED;
-    }
-
-}


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


[james-project] 03/49: [Refactoring] Lock::canI is never used

Posted by bt...@apache.org.
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 780d34250256b482c50a369de14bfdb56a3db5a0
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Nov 18 13:53:54 2019 +0700

    [Refactoring] Lock::canI is never used
---
 .../java/org/apache/james/mailrepository/file/Lock.java    | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/Lock.java b/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/Lock.java
index 1a1d5b6..48867b2 100644
--- a/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/Lock.java
+++ b/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/Lock.java
@@ -42,20 +42,6 @@ public class Lock {
     }
 
     /**
-     * Check to see if we can lock on a given object.
-     * 
-     * @param key
-     *            the Object on which to lock
-     * @return true if the calling thread can lock, false otherwise
-     */
-    public boolean canI(Object key) {
-        Object o = locks.get(key);
-
-        return null == o || o == this.getCallerId();
-
-    }
-
-    /**
      * Lock on a given object.
      * 
      * @param key


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


[james-project] 35/49: [Refactoring] MockMailetConfig & MockMatcherConfig are not used

Posted by bt...@apache.org.
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 86862beee1752cf04db0dbf4d7468fb11486d878
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 20:00:31 2019 +0700

    [Refactoring] MockMailetConfig & MockMatcherConfig are not used
---
 .../smtpserver/mock/mailet/MockMailetConfig.java   | 78 ----------------------
 .../smtpserver/mock/mailet/MockMatcherConfig.java  | 60 -----------------
 2 files changed, 138 deletions(-)

diff --git a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/mock/mailet/MockMailetConfig.java b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/mock/mailet/MockMailetConfig.java
deleted file mode 100644
index 8ad7f6f..0000000
--- a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/mock/mailet/MockMailetConfig.java
+++ /dev/null
@@ -1,78 +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.smtpserver.mock.mailet;
-
-import java.util.Iterator;
-import java.util.Properties;
-
-import org.apache.mailet.MailetConfig;
-import org.apache.mailet.MailetContext;
-
-/**
- * MailetConfig over Properties
- */
-public class MockMailetConfig extends Properties implements MailetConfig {
-
-    private final String mailetName;
-    private final MailetContext mc;
-
-    public MockMailetConfig(String mailetName, MailetContext mc) {
-        super();
-        this.mailetName = mailetName;
-        this.mc = mc;
-    }
-
-    public MockMailetConfig(String mailetName, MailetContext mc, Properties arg0) {
-        super(arg0);
-        this.mailetName = mailetName;
-        this.mc = mc;
-    }
-
-    @Override
-    public String getInitParameter(String name) {
-        return getProperty(name);
-    }
-
-    @Override
-    public Iterator<String> getInitParameterNames() {
-        return stringPropertyNames().iterator();
-    }
-
-    @Override
-    public MailetContext getMailetContext() {
-        return mc;
-    }
-
-    @Override
-    public String getMailetName() {
-        return mailetName;
-    }
-
-    // Override setProperty to work like it should in this MockMailetConfig
-    @Override
-    public Object setProperty(String key, String value) {
-        String oldValue = getProperty(key);
-        String newValue = value;
-
-        if (oldValue != null) {
-            newValue = oldValue + "," + value;
-        }
-        return super.setProperty(key, newValue);
-    }
-}
diff --git a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/mock/mailet/MockMatcherConfig.java b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/mock/mailet/MockMatcherConfig.java
deleted file mode 100644
index 3eca11e..0000000
--- a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/mock/mailet/MockMatcherConfig.java
+++ /dev/null
@@ -1,60 +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.smtpserver.mock.mailet;
-
-import org.apache.mailet.MailetContext;
-import org.apache.mailet.MatcherConfig;
-
-/**
- * MatcherConfig
- */
-public class MockMatcherConfig implements MatcherConfig {
-
-    private final String matcherName;
-    private final MailetContext mc;
-
-    public MockMatcherConfig(String matcherName, MailetContext mc) {
-        super();
-        this.matcherName = matcherName;
-        this.mc = mc;
-    }
-
-    @Override
-    public String getCondition() {
-        if (matcherName.contains("=")) {
-            return matcherName.substring(getMatcherName().length() + 1);
-        } else {
-            return null;
-        }
-    }
-
-    @Override
-    public MailetContext getMailetContext() {
-        return mc;
-    }
-
-    @Override
-    public String getMatcherName() {
-        if (matcherName.contains("=")) {
-            return matcherName.split("=")[0];
-        } else {
-            return matcherName;
-        }
-    }
-}


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


[james-project] 21/49: [Refactoring] Property can be a POJO instead of an interface

Posted by bt...@apache.org.
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 30161bbe07cd990d696b768954b3d0d010064914
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sat Nov 16 11:08:19 2019 +0700

    [Refactoring] Property can be a POJO instead of an interface
    
    Remove SimpleProperty
---
 .../cassandra/mail/CassandraMessageDAO.java        |   4 +-
 .../elasticsearch/json/IndexableMessage.java       |   4 +-
 .../elasticsearch/json/IndexableMessageTest.java   |   4 +-
 .../james/mailbox/jpa/mail/model/JPAProperty.java  |   3 +-
 .../james/mailbox/store/mail/model/Property.java   |  92 ++++++++++++++--
 .../store/mail/model/impl/PropertyBuilder.java     |  28 ++---
 .../store/mail/model/impl/SimpleProperty.java      | 116 ---------------------
 .../model/ListMessagePropertiesAssertTest.java     |  24 +----
 .../SimplePropertyTest.java => PropertyTest.java}  |   6 +-
 .../store/mail/model/impl/PropertyBuilderTest.java |   5 +-
 10 files changed, 117 insertions(+), 169 deletions(-)

diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java
index 0899903..e663b98 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java
@@ -70,8 +70,8 @@ import org.apache.james.mailbox.model.MessageAttachment;
 import org.apache.james.mailbox.model.MessageId;
 import org.apache.james.mailbox.store.mail.MessageMapper.FetchType;
 import org.apache.james.mailbox.store.mail.model.MailboxMessage;
+import org.apache.james.mailbox.store.mail.model.Property;
 import org.apache.james.mailbox.store.mail.model.impl.PropertyBuilder;
-import org.apache.james.mailbox.store.mail.model.impl.SimpleProperty;
 import org.apache.james.util.streams.Limit;
 
 import com.datastax.driver.core.BoundStatement;
@@ -278,7 +278,7 @@ public class CassandraMessageDAO {
     private PropertyBuilder getPropertyBuilder(Row row) {
         PropertyBuilder property = new PropertyBuilder(
             row.getList(PROPERTIES, UDTValue.class).stream()
-                .map(x -> new SimpleProperty(x.getString(Properties.NAMESPACE), x.getString(Properties.NAME), x.getString(Properties.VALUE)))
+                .map(x -> new Property(x.getString(Properties.NAMESPACE), x.getString(Properties.NAME), x.getString(Properties.VALUE)))
                 .collect(Collectors.toList()));
         property.setTextualLineCount(row.getLong(TEXTUAL_LINE_COUNT));
         return property;
diff --git a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessage.java b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessage.java
index 952e046..3409607 100644
--- a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessage.java
+++ b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessage.java
@@ -32,8 +32,8 @@ import org.apache.james.mailbox.elasticsearch.IndexAttachments;
 import org.apache.james.mailbox.elasticsearch.query.DateResolutionFormater;
 import org.apache.james.mailbox.extractor.TextExtractor;
 import org.apache.james.mailbox.store.mail.model.MailboxMessage;
+import org.apache.james.mailbox.store.mail.model.Property;
 import org.apache.james.mailbox.store.mail.model.impl.PropertyBuilder;
-import org.apache.james.mailbox.store.mail.model.impl.SimpleProperty;
 import org.apache.james.mailbox.store.search.SearchUtil;
 import org.apache.james.mime4j.MimeException;
 
@@ -191,7 +191,7 @@ public class IndexableMessage {
         }
     }
 
-    public static final SimpleProperty HAS_ATTACHMENT_PROPERTY = new SimpleProperty(PropertyBuilder.JAMES_INTERNALS, PropertyBuilder.HAS_ATTACHMENT, "true");
+    public static final Property HAS_ATTACHMENT_PROPERTY = new Property(PropertyBuilder.JAMES_INTERNALS, PropertyBuilder.HAS_ATTACHMENT, "true");
 
     public static Builder builder() {
         return new Builder();
diff --git a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessageTest.java b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessageTest.java
index efc276d..1d658dd 100644
--- a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessageTest.java
+++ b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessageTest.java
@@ -40,8 +40,8 @@ import org.apache.james.mailbox.model.MessageId;
 import org.apache.james.mailbox.model.TestId;
 import org.apache.james.mailbox.store.extractor.DefaultTextExtractor;
 import org.apache.james.mailbox.store.mail.model.MailboxMessage;
+import org.apache.james.mailbox.store.mail.model.Property;
 import org.apache.james.mailbox.store.mail.model.impl.PropertyBuilder;
-import org.apache.james.mailbox.store.mail.model.impl.SimpleProperty;
 import org.apache.james.mailbox.tika.TikaConfiguration;
 import org.apache.james.mailbox.tika.TikaContainerSingletonRule;
 import org.apache.james.mailbox.tika.TikaHttpClientImpl;
@@ -333,7 +333,7 @@ public class IndexableMessageTest {
         when(mailboxMessage.getUid())
             .thenReturn(MESSAGE_UID);
         when(mailboxMessage.getProperties())
-            .thenReturn(ImmutableList.of(new SimpleProperty(PropertyBuilder.JAMES_INTERNALS, PropertyBuilder.HAS_ATTACHMENT, "false")));
+            .thenReturn(ImmutableList.of(new Property(PropertyBuilder.JAMES_INTERNALS, PropertyBuilder.HAS_ATTACHMENT, "false")));
 
         // When
         IndexableMessage indexableMessage = IndexableMessage.builder()
diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAProperty.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAProperty.java
index 0eba4df..ee7c54e 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAProperty.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAProperty.java
@@ -28,7 +28,6 @@ import javax.persistence.Id;
 import javax.persistence.Table;
 
 import org.apache.james.mailbox.store.mail.model.Property;
-import org.apache.james.mailbox.store.mail.model.impl.SimpleProperty;
 import org.apache.openjpa.persistence.jdbc.Index;
 
 @Entity(name = "Property")
@@ -98,7 +97,7 @@ public class JPAProperty {
     }
 
     public Property toProperty() {
-        return new SimpleProperty(namespace, localName, value);
+        return new Property(namespace, localName, value);
     }
 
     @Override
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/Property.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/Property.java
index 742204e..2e0e7a3 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/Property.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/Property.java
@@ -18,6 +18,9 @@
  ****************************************************************/
 package org.apache.james.mailbox.store.mail.model;
 
+import java.util.Objects;
+
+import com.google.common.base.MoreObjects;
 
 /**
  * <p>Values a namespaced property.</p>
@@ -37,25 +40,102 @@ package org.apache.james.mailbox.store.mail.model;
  * object "BASE64".
  * </p>
  */
-public interface Property {
+public class Property {
+    private final String namespace;
+    private final String localName;
+    private final String value;
+
+    /**
+     * Construct a property.
+     * @param namespace not null
+     * @param localName not null
+     * @param value not null
+     */
+    public Property(String namespace, String localName, String value) {
+        super();
+        this.namespace = namespace;
+        this.localName = localName;
+        this.value = value;
+    }
+
+    public Property(Property property) {
+        this(property.getNamespace(), property.getLocalName(), property.getValue());
+    }
 
     /**
      * Gets the namespace for the name.
      * @return not null
      */
-    String getNamespace();
-    
+    public String getNamespace() {
+        return namespace;
+    }
+
     /**
      * Gets the local part of the name of the property.
      * @return not null
      */
-    String getLocalName();
-    
+    public String getLocalName() {
+        return localName;
+    }
+
     /**
      * Gets the value for this property.
      * @return not null
      */
-    String getValue();
+    public String getValue() {
+        return value;
+    }
+
+    /**
+     * Does the full name of the property match that given?
+     * @param namespace not null
+     * @param localName not null
+     * @return true when namespaces and local names match,
+     * false otherwise
+     */
+    public boolean isNamed(String namespace, String localName) {
+        return namespace.equals(this.namespace) && localName.equals(this.localName);
+    }
+
+    /**
+     * Is this property in the given namespace?
+     * @param namespace not null
+     * @return true when this property is in the given namespace,
+     * false otherwise
+     */
+    public boolean isInSpace(String namespace) {
+        return this.namespace.equals(namespace);
+    }
+
+    /**
+     * Constructs a <code>String</code> with all attributes
+     * in name = value format.
+     *
+     * @return a <code>String</code> representation
+     * of this object.
+     */
+    public String toString() {
+        return MoreObjects.toStringHelper(this)
+            .add("namespace", namespace)
+            .add("localName", localName)
+            .add("value", value)
+            .toString();
+    }
+
+    @Override
+    public final boolean equals(Object o) {
+        if (o instanceof Property) {
+            Property that = (Property) o;
 
+            return Objects.equals(namespace, that.namespace) &&
+                Objects.equals(localName, that.localName) &&
+                Objects.equals(value, that.value);
+        }
+        return false;
+    }
 
+    @Override
+    public final int hashCode() {
+        return Objects.hash(namespace, localName, value);
+    }
 }
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/PropertyBuilder.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/PropertyBuilder.java
index f25ebec..1a59241 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/PropertyBuilder.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/PropertyBuilder.java
@@ -69,13 +69,13 @@ public class PropertyBuilder {
     }
 
     private Long textualLineCount;
-    private final List<SimpleProperty> properties;
+    private final List<Property> properties;
 
     public PropertyBuilder(List<Property> props) {
         textualLineCount = null;
         properties = new ArrayList<>(props.size());
         for (Property property:props) {
-            properties.add(new SimpleProperty(property));
+            properties.add(new Property(property));
         }
     }
     
@@ -114,7 +114,7 @@ public class PropertyBuilder {
         return properties.stream()
             .filter(property -> property.isNamed(namespace, localName))
             .findFirst()
-            .map(SimpleProperty::getValue)
+            .map(Property::getValue)
             .orElse(null);
     }
     
@@ -127,7 +127,7 @@ public class PropertyBuilder {
     public List<String> getValues(String namespace, String localName) {
         return properties.stream()
             .filter(property -> property.isNamed(namespace, localName))
-            .map(SimpleProperty::getValue)
+            .map(Property::getValue)
             .collect(Guavate.toImmutableList());
     }
     
@@ -138,15 +138,15 @@ public class PropertyBuilder {
      * @param value null to remove property
      */
     public void setProperty(String namespace, String localName, String value) {
-        for (Iterator<SimpleProperty> it = properties.iterator();it.hasNext();) {
-            final SimpleProperty property = it.next();
+        for (Iterator<Property> it = properties.iterator();it.hasNext();) {
+            final Property property = it.next();
             if (property.isNamed(namespace, localName)) {
                 it.remove();
             }
         }
         
         if (value != null) {
-            properties.add(new SimpleProperty(namespace, localName, value));
+            properties.add(new Property(namespace, localName, value));
         }
     }
     
@@ -157,15 +157,15 @@ public class PropertyBuilder {
      * @param values null to remove property
      */
     public void setProperty(String namespace, String localName, List<String> values) {
-        for (Iterator<SimpleProperty> it = properties.iterator();it.hasNext();) {
-            final SimpleProperty property = it.next();
+        for (Iterator<Property> it = properties.iterator();it.hasNext();) {
+            final Property property = it.next();
             if (property.isNamed(namespace, localName)) {
                 it.remove();
             }
         }
         if (values != null) {
             for (String value:values) {
-                properties.add(new SimpleProperty(namespace, localName, value));
+                properties.add(new Property(namespace, localName, value));
             }
         }
     }
@@ -177,7 +177,7 @@ public class PropertyBuilder {
      */
     public SortedMap<String,String> getProperties(String namespace) {
         final SortedMap<String, String> parameters = new TreeMap<>();
-        for (SimpleProperty property : properties) {
+        for (Property property : properties) {
             if (property.isInSpace(namespace)) {
                 parameters.put(property.getLocalName(), property.getValue());
             }
@@ -193,14 +193,14 @@ public class PropertyBuilder {
      * @param valuesByLocalName not null
      */
     public void setProperties(String namespace, Map<String,String> valuesByLocalName) {
-        for (Iterator<SimpleProperty> it = properties.iterator();it.hasNext();) {
-            final SimpleProperty property = it.next();
+        for (Iterator<Property> it = properties.iterator();it.hasNext();) {
+            final Property property = it.next();
             if (property.isInSpace(namespace)) {
                 it.remove();
             }
         }
         for (Map.Entry<String, String> valueByLocalName:valuesByLocalName.entrySet()) {
-            properties.add(new SimpleProperty(namespace, valueByLocalName.getKey().toLowerCase(Locale.US), valueByLocalName.getValue()));
+            properties.add(new Property(namespace, valueByLocalName.getKey().toLowerCase(Locale.US), valueByLocalName.getValue()));
         }
     }
     
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleProperty.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleProperty.java
deleted file mode 100644
index aef6244..0000000
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleProperty.java
+++ /dev/null
@@ -1,116 +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.mailbox.store.mail.model.impl;
-
-import java.util.Objects;
-
-import org.apache.james.mailbox.store.mail.model.Property;
-
-import com.google.common.base.MoreObjects;
-
-public final class SimpleProperty implements Property {
-    private final String namespace;
-    private final String localName;
-    private final String value;
-    
-    /**
-     * Construct a property.
-     * @param namespace not null
-     * @param localName not null
-     * @param value not null
-     */
-    public SimpleProperty(String namespace, String localName, String value) {
-        super();
-        this.namespace = namespace;
-        this.localName = localName;
-        this.value = value;
-    }
-    
-    public SimpleProperty(Property property) {
-        this(property.getNamespace(), property.getLocalName(), property.getValue());
-    }
-
-    @Override
-    public String getLocalName() {
-        return localName;
-    }
-    
-    @Override
-    public String getNamespace() {
-        return namespace;
-    }
-    
-    @Override
-    public String getValue() {
-        return value;
-    }
-    
-    /**
-     * Does the full name of the property match that given?
-     * @param namespace not null
-     * @param localName not null
-     * @return true when namespaces and local names match,
-     * false otherwise
-     */
-    public boolean isNamed(String namespace, String localName) {
-        return namespace.equals(this.namespace) && localName.equals(this.localName);
-    }
-    
-    /**
-     * Is this property in the given namespace?
-     * @param namespace not null
-     * @return true when this property is in the given namespace,
-     * false otherwise
-     */
-    public boolean isInSpace(String namespace) {
-        return this.namespace.equals(namespace);
-    }
-
-    /**
-     * Constructs a <code>String</code> with all attributes
-     * in name = value format.
-     *
-     * @return a <code>String</code> representation 
-     * of this object.
-     */
-    public String toString() {
-        return MoreObjects.toStringHelper(this)
-            .add("namespace", namespace)
-            .add("localName", localName)
-            .add("value", value)
-            .toString();
-    }
-
-    @Override
-    public final boolean equals(Object o) {
-        if (o instanceof SimpleProperty) {
-            SimpleProperty that = (SimpleProperty) o;
-
-            return Objects.equals(namespace, that.namespace) &&
-                Objects.equals(localName, that.localName) &&
-                Objects.equals(value, that.value);
-        }
-        return false;
-    }
-
-    @Override
-    public final int hashCode() {
-        return Objects.hash(namespace, localName, value);
-    }
-}
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/ListMessagePropertiesAssertTest.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/ListMessagePropertiesAssertTest.java
index 2228d00..36bedef 100644
--- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/ListMessagePropertiesAssertTest.java
+++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/ListMessagePropertiesAssertTest.java
@@ -23,7 +23,6 @@ import static org.apache.james.mailbox.store.mail.model.ListMessagePropertiesAss
 
 import java.util.List;
 
-import org.apache.james.mailbox.store.mail.model.impl.SimpleProperty;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -37,8 +36,8 @@ public class ListMessagePropertiesAssertTest {
     private static final String LOCAL_NAME = StandardNames.MIME_CONTENT_TRANSFER_ENCODING_NAME;
     private static final String NAMESPACE = StandardNames.NAMESPACE_RFC_2045;
 
-    private static final Property PROPERTY1 = new SimpleProperty(NAMESPACE, LOCAL_NAME, VALUE);
-    private static final Property PROPERTY2 = new SimpleProperty(OTHER_NAMESPACE, OTHER_LOCAL_NAME, OTHER_VALUE);
+    private static final Property PROPERTY1 = new Property(NAMESPACE, LOCAL_NAME, VALUE);
+    private static final Property PROPERTY2 = new Property(OTHER_NAMESPACE, OTHER_LOCAL_NAME, OTHER_VALUE);
     
     private List<Property> actual;
     
@@ -76,22 +75,7 @@ public class ListMessagePropertiesAssertTest {
             createProperty(NAMESPACE, LOCAL_NAME, OTHER_VALUE)));
     }
 
-    private Property createProperty(final String namespace, final String name, final String value) {
-        return new Property() {
-            @Override
-            public String getValue() {
-                return value;
-            }
-            
-            @Override
-            public String getNamespace() {
-                return namespace;
-            }
-            
-            @Override
-            public String getLocalName() {
-                return name;
-            }
-        };
+    private Property createProperty(String namespace, String name, String value) {
+        return new Property(namespace, name, value);
     }
 }
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/impl/SimplePropertyTest.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/PropertyTest.java
similarity index 90%
rename from mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/impl/SimplePropertyTest.java
rename to mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/PropertyTest.java
index 5d5e979..31aa0d7 100644
--- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/impl/SimplePropertyTest.java
+++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/PropertyTest.java
@@ -17,16 +17,16 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mailbox.store.mail.model.impl;
+package org.apache.james.mailbox.store.mail.model;
 
 import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
-class SimplePropertyTest {
+class PropertyTest {
     @Test
     void shouldMatchBeanContract() {
-        EqualsVerifier.forClass(SimpleProperty.class)
+        EqualsVerifier.forClass(Property.class)
             .verify();
     }
 }
\ No newline at end of file
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/impl/PropertyBuilderTest.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/impl/PropertyBuilderTest.java
index 79b1548..320faf6 100644
--- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/impl/PropertyBuilderTest.java
+++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/impl/PropertyBuilderTest.java
@@ -21,6 +21,7 @@ package org.apache.james.mailbox.store.mail.model.impl;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
+import org.apache.james.mailbox.store.mail.model.Property;
 import org.junit.Test;
 
 public class PropertyBuilderTest {
@@ -35,7 +36,7 @@ public class PropertyBuilderTest {
         PropertyBuilder propertyBuilder = new PropertyBuilder();
         propertyBuilder.setHasAttachment(false);
         assertThat(propertyBuilder.toProperties())
-            .containsOnly(new SimpleProperty(PropertyBuilder.JAMES_INTERNALS, PropertyBuilder.HAS_ATTACHMENT, "false"));
+            .containsOnly(new Property(PropertyBuilder.JAMES_INTERNALS, PropertyBuilder.HAS_ATTACHMENT, "false"));
     }
 
     @Test
@@ -43,7 +44,7 @@ public class PropertyBuilderTest {
         PropertyBuilder propertyBuilder = new PropertyBuilder();
         propertyBuilder.setHasAttachment(true);
         assertThat(propertyBuilder.toProperties())
-            .containsOnly(new SimpleProperty(PropertyBuilder.JAMES_INTERNALS, PropertyBuilder.HAS_ATTACHMENT, "true"));
+            .containsOnly(new Property(PropertyBuilder.JAMES_INTERNALS, PropertyBuilder.HAS_ATTACHMENT, "true"));
     }
 
 }


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


[james-project] 46/49: JAMES-2958 Domain length validation is done by the model

Posted by bt...@apache.org.
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 078cf38b15a14432361c8c909c99d6eff1a55cc1
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 12:23:57 2019 +0700

    JAMES-2958 Domain length validation is done by the model
---
 .../src/main/java/org/apache/james/webadmin/routes/DomainsRoutes.java    | 1 -
 1 file changed, 1 deletion(-)

diff --git a/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DomainsRoutes.java b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DomainsRoutes.java
index e0d70fa..ac41c8e 100644
--- a/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DomainsRoutes.java
+++ b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DomainsRoutes.java
@@ -78,7 +78,6 @@ public class DomainsRoutes implements Routes {
     private static final String ALIASES = "aliases";
     private static final String DOMAIN_ALIASES = SPECIFIC_DOMAIN + SEPARATOR + ALIASES;
     private static final String SPECIFIC_ALIAS = DOMAINS + SEPARATOR + DESTINATION_DOMAIN + SEPARATOR + ALIASES + SEPARATOR + SOURCE_DOMAIN;
-    private static final int MAXIMUM_DOMAIN_SIZE = 256;
 
     private final DomainList domainList;
     private final DomainAliasService domainAliasService;


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


[james-project] 32/49: [Refactoring] MockMailProcessor shouldThrow is never used

Posted by bt...@apache.org.
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 b3355704ed1cbc7f9eb84c7ee3eb79144689be95
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 15:27:19 2019 +0700

    [Refactoring] MockMailProcessor shouldThrow is never used
---
 .../mailetcontainer/api/mock/MockMailProcessor.java  | 20 ++++----------------
 .../lib/AbstractStateCompositeProcessorTest.java     |  5 +----
 2 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/server/mailet/mailetcontainer-api/src/test/java/org/apache/james/mailetcontainer/api/mock/MockMailProcessor.java b/server/mailet/mailetcontainer-api/src/test/java/org/apache/james/mailetcontainer/api/mock/MockMailProcessor.java
index cf1451b..507a3bc 100644
--- a/server/mailet/mailetcontainer-api/src/test/java/org/apache/james/mailetcontainer/api/mock/MockMailProcessor.java
+++ b/server/mailet/mailetcontainer-api/src/test/java/org/apache/james/mailetcontainer/api/mock/MockMailProcessor.java
@@ -18,30 +18,18 @@
  ****************************************************************/
 package org.apache.james.mailetcontainer.api.mock;
 
-import javax.mail.MessagingException;
-
 import org.apache.james.mailetcontainer.api.MailProcessor;
 import org.apache.mailet.Mail;
 
 public class MockMailProcessor implements MailProcessor {
+    private String newState;
 
-    private boolean shouldThrow = false;
-    private String newState = null;
-
-    public MockMailProcessor(boolean shouldThrow) {
-        this.shouldThrow = shouldThrow;
-    }
-
-    public MockMailProcessor(String newState) {
+    protected MockMailProcessor(String newState) {
         this.newState = newState;
     }
 
     @Override
-    public void service(Mail mail) throws MessagingException {
-        if (shouldThrow) {
-            throw new MessagingException();
-        } else {
-            mail.setState(newState);
-        }
+    public void service(Mail mail) {
+        mail.setState(newState);
     }
 }
diff --git a/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessorTest.java b/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessorTest.java
index 0f1170f..fbe8000 100644
--- a/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessorTest.java
+++ b/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessorTest.java
@@ -26,8 +26,6 @@ import java.io.IOException;
 import java.util.Arrays;
 import java.util.List;
 
-import javax.mail.MessagingException;
-
 import org.apache.commons.configuration2.HierarchicalConfiguration;
 import org.apache.commons.configuration2.ex.ConfigurationException;
 import org.apache.commons.configuration2.tree.ImmutableNode;
@@ -53,9 +51,8 @@ public abstract class AbstractStateCompositeProcessorTest {
             protected MailProcessor createMailProcessor(final String state, HierarchicalConfiguration<ImmutableNode> config) throws
                 Exception {
                 return new MockMailProcessor("") {
-
                     @Override
-                    public void service(Mail mail) throws MessagingException {
+                    public void service(Mail mail) {
                         // check if the right processor wasAbstractStateMailetProcessorTest selected depending on the state
                         assertThat(mail.getState()).isEqualTo(state);
                         super.service(mail);


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


[james-project] 28/49: [Refactoring] AbstractStateCompositeProcessor: only addListener

Posted by bt...@apache.org.
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 22d77dda0a7d9527581a1c0a1854e393507258dd
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 15:03:17 2019 +0700

    [Refactoring] AbstractStateCompositeProcessor: only addListener
    
    Getting and removing listeners is never used...
---
 .../mailetcontainer/lib/AbstractStateCompositeProcessor.java      | 8 --------
 .../james/mailetcontainer/lib/AbstractStateMailetProcessor.java   | 4 ----
 2 files changed, 12 deletions(-)

diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java
index 4a0bb02..b7a5bd9 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java
@@ -59,14 +59,6 @@ public abstract class AbstractStateCompositeProcessor implements MailProcessor,
         listeners.add(listener);
     }
 
-    public List<CompositeProcessorListener> getListeners() {
-        return listeners;
-    }
-
-    public void removeListener(CompositeProcessorListener listener) {
-        listeners.remove(listener);
-    }
-
     @Override
     public void configure(HierarchicalConfiguration<ImmutableNode> config) {
         this.config = config;
diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java
index b6cf1e0..1e55d80 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java
@@ -187,10 +187,6 @@ public abstract class AbstractStateMailetProcessor implements MailProcessor, Con
         listeners.add(listener);
     }
 
-    public void removeListener(MailetProcessorListener listener) {
-        listeners.remove(listener);
-    }
-
     public List<MailetProcessorListener> getListeners() {
         return listeners;
     }


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


[james-project] 49/49: JAMES-2773 add glowroot plugin to track put into blobstore

Posted by bt...@apache.org.
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 caaed8be8a4a4fa9fa16de4a69663a94b8b253cb
Author: RĂ©mi KOWALSKI <rk...@linagora.com>
AuthorDate: Tue Nov 19 15:35:22 2019 +0100

    JAMES-2773 add glowroot plugin to track put into blobstore
---
 .../destination/glowroot/plugins/blobstore.json    | 26 ++++++++++++++++++++++
 .../destination/glowroot/plugins/blobstore.json    | 26 ++++++++++++++++++++++
 .../destination/glowroot/plugins/blobstore.json    | 26 ++++++++++++++++++++++
 .../destination/glowroot/plugins/blobstore.json    | 26 ++++++++++++++++++++++
 .../destination/glowroot/plugins/blobstore.json    | 26 ++++++++++++++++++++++
 .../destination/glowroot/plugins/blobstore.json    | 26 ++++++++++++++++++++++
 .../destination/glowroot/plugins/blobstore.json    | 26 ++++++++++++++++++++++
 7 files changed, 182 insertions(+)

diff --git a/dockerfiles/run/guice/cassandra-ldap/destination/glowroot/plugins/blobstore.json b/dockerfiles/run/guice/cassandra-ldap/destination/glowroot/plugins/blobstore.json
new file mode 100644
index 0000000..84291c6
--- /dev/null
+++ b/dockerfiles/run/guice/cassandra-ldap/destination/glowroot/plugins/blobstore.json
@@ -0,0 +1,26 @@
+{
+  "name": "BlobStore Plugin",
+  "id": "blob_store",
+  "instrumentation": [
+    {
+      "captureKind": "trace-entry",
+      "traceEntryMessageTemplate": "{{this.class.name}}.{{methodName}}",
+      "timerName": "blobstore",
+      "className": "org.apache.james.blob.objectstorage.BlobPutter",
+      "methodName": "putDirectly",
+      "methodParameterTypes": [
+        ".."
+      ]
+    },
+    {
+      "captureKind": "trace-entry",
+      "traceEntryMessageTemplate": "{{this.class.name}}.{{methodName}}",
+      "timerName": "blobstore",
+      "className": "org.apache.james.blob.objectstorage.BlobPutter",
+      "methodName": "putAndComputeId",
+      "methodParameterTypes": [
+        ".."
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/dockerfiles/run/guice/cassandra-rabbitmq-ldap/destination/glowroot/plugins/blobstore.json b/dockerfiles/run/guice/cassandra-rabbitmq-ldap/destination/glowroot/plugins/blobstore.json
new file mode 100644
index 0000000..84291c6
--- /dev/null
+++ b/dockerfiles/run/guice/cassandra-rabbitmq-ldap/destination/glowroot/plugins/blobstore.json
@@ -0,0 +1,26 @@
+{
+  "name": "BlobStore Plugin",
+  "id": "blob_store",
+  "instrumentation": [
+    {
+      "captureKind": "trace-entry",
+      "traceEntryMessageTemplate": "{{this.class.name}}.{{methodName}}",
+      "timerName": "blobstore",
+      "className": "org.apache.james.blob.objectstorage.BlobPutter",
+      "methodName": "putDirectly",
+      "methodParameterTypes": [
+        ".."
+      ]
+    },
+    {
+      "captureKind": "trace-entry",
+      "traceEntryMessageTemplate": "{{this.class.name}}.{{methodName}}",
+      "timerName": "blobstore",
+      "className": "org.apache.james.blob.objectstorage.BlobPutter",
+      "methodName": "putAndComputeId",
+      "methodParameterTypes": [
+        ".."
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/dockerfiles/run/guice/cassandra-rabbitmq/destination/glowroot/plugins/blobstore.json b/dockerfiles/run/guice/cassandra-rabbitmq/destination/glowroot/plugins/blobstore.json
new file mode 100644
index 0000000..84291c6
--- /dev/null
+++ b/dockerfiles/run/guice/cassandra-rabbitmq/destination/glowroot/plugins/blobstore.json
@@ -0,0 +1,26 @@
+{
+  "name": "BlobStore Plugin",
+  "id": "blob_store",
+  "instrumentation": [
+    {
+      "captureKind": "trace-entry",
+      "traceEntryMessageTemplate": "{{this.class.name}}.{{methodName}}",
+      "timerName": "blobstore",
+      "className": "org.apache.james.blob.objectstorage.BlobPutter",
+      "methodName": "putDirectly",
+      "methodParameterTypes": [
+        ".."
+      ]
+    },
+    {
+      "captureKind": "trace-entry",
+      "traceEntryMessageTemplate": "{{this.class.name}}.{{methodName}}",
+      "timerName": "blobstore",
+      "className": "org.apache.james.blob.objectstorage.BlobPutter",
+      "methodName": "putAndComputeId",
+      "methodParameterTypes": [
+        ".."
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/dockerfiles/run/guice/cassandra/destination/glowroot/plugins/blobstore.json b/dockerfiles/run/guice/cassandra/destination/glowroot/plugins/blobstore.json
new file mode 100644
index 0000000..84291c6
--- /dev/null
+++ b/dockerfiles/run/guice/cassandra/destination/glowroot/plugins/blobstore.json
@@ -0,0 +1,26 @@
+{
+  "name": "BlobStore Plugin",
+  "id": "blob_store",
+  "instrumentation": [
+    {
+      "captureKind": "trace-entry",
+      "traceEntryMessageTemplate": "{{this.class.name}}.{{methodName}}",
+      "timerName": "blobstore",
+      "className": "org.apache.james.blob.objectstorage.BlobPutter",
+      "methodName": "putDirectly",
+      "methodParameterTypes": [
+        ".."
+      ]
+    },
+    {
+      "captureKind": "trace-entry",
+      "traceEntryMessageTemplate": "{{this.class.name}}.{{methodName}}",
+      "timerName": "blobstore",
+      "className": "org.apache.james.blob.objectstorage.BlobPutter",
+      "methodName": "putAndComputeId",
+      "methodParameterTypes": [
+        ".."
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/dockerfiles/run/guice/jpa-smtp/destination/glowroot/plugins/blobstore.json b/dockerfiles/run/guice/jpa-smtp/destination/glowroot/plugins/blobstore.json
new file mode 100644
index 0000000..84291c6
--- /dev/null
+++ b/dockerfiles/run/guice/jpa-smtp/destination/glowroot/plugins/blobstore.json
@@ -0,0 +1,26 @@
+{
+  "name": "BlobStore Plugin",
+  "id": "blob_store",
+  "instrumentation": [
+    {
+      "captureKind": "trace-entry",
+      "traceEntryMessageTemplate": "{{this.class.name}}.{{methodName}}",
+      "timerName": "blobstore",
+      "className": "org.apache.james.blob.objectstorage.BlobPutter",
+      "methodName": "putDirectly",
+      "methodParameterTypes": [
+        ".."
+      ]
+    },
+    {
+      "captureKind": "trace-entry",
+      "traceEntryMessageTemplate": "{{this.class.name}}.{{methodName}}",
+      "timerName": "blobstore",
+      "className": "org.apache.james.blob.objectstorage.BlobPutter",
+      "methodName": "putAndComputeId",
+      "methodParameterTypes": [
+        ".."
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/dockerfiles/run/guice/jpa/destination/glowroot/plugins/blobstore.json b/dockerfiles/run/guice/jpa/destination/glowroot/plugins/blobstore.json
new file mode 100644
index 0000000..84291c6
--- /dev/null
+++ b/dockerfiles/run/guice/jpa/destination/glowroot/plugins/blobstore.json
@@ -0,0 +1,26 @@
+{
+  "name": "BlobStore Plugin",
+  "id": "blob_store",
+  "instrumentation": [
+    {
+      "captureKind": "trace-entry",
+      "traceEntryMessageTemplate": "{{this.class.name}}.{{methodName}}",
+      "timerName": "blobstore",
+      "className": "org.apache.james.blob.objectstorage.BlobPutter",
+      "methodName": "putDirectly",
+      "methodParameterTypes": [
+        ".."
+      ]
+    },
+    {
+      "captureKind": "trace-entry",
+      "traceEntryMessageTemplate": "{{this.class.name}}.{{methodName}}",
+      "timerName": "blobstore",
+      "className": "org.apache.james.blob.objectstorage.BlobPutter",
+      "methodName": "putAndComputeId",
+      "methodParameterTypes": [
+        ".."
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/dockerfiles/run/guice/memory/destination/glowroot/plugins/blobstore.json b/dockerfiles/run/guice/memory/destination/glowroot/plugins/blobstore.json
new file mode 100644
index 0000000..84291c6
--- /dev/null
+++ b/dockerfiles/run/guice/memory/destination/glowroot/plugins/blobstore.json
@@ -0,0 +1,26 @@
+{
+  "name": "BlobStore Plugin",
+  "id": "blob_store",
+  "instrumentation": [
+    {
+      "captureKind": "trace-entry",
+      "traceEntryMessageTemplate": "{{this.class.name}}.{{methodName}}",
+      "timerName": "blobstore",
+      "className": "org.apache.james.blob.objectstorage.BlobPutter",
+      "methodName": "putDirectly",
+      "methodParameterTypes": [
+        ".."
+      ]
+    },
+    {
+      "captureKind": "trace-entry",
+      "traceEntryMessageTemplate": "{{this.class.name}}.{{methodName}}",
+      "timerName": "blobstore",
+      "className": "org.apache.james.blob.objectstorage.BlobPutter",
+      "methodName": "putAndComputeId",
+      "methodParameterTypes": [
+        ".."
+      ]
+    }
+  ]
+}
\ No newline at end of file


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


[james-project] 01/49: JAMES-2949 Fix metric reporting upon dequeue

Posted by bt...@apache.org.
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 b8c3d7494dd530d2242bf43428a42acfdc4f9a71
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Tue Nov 19 13:07:13 2019 +0700

    JAMES-2949 Fix metric reporting upon dequeue
    
    Unacurrate time of 0 ms is always being reported...
---
 .../org/apache/james/mailetcontainer/impl/JamesMailSpooler.java    | 7 +++----
 .../james/transport/mailets/remote/delivery/DeliveryRunnable.java  | 5 ++---
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/JamesMailSpooler.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/JamesMailSpooler.java
index 6b40d81..e2101d1 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/JamesMailSpooler.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/JamesMailSpooler.java
@@ -118,12 +118,11 @@ public class JamesMailSpooler implements Disposable, Configurable, MailSpoolerMB
         TimeMetric timeMetric = metricFactory.timer(SPOOL_PROCESSING);
         try {
             processingActive.incrementAndGet();
-            return processMail(queueItem);
+            return processMail(queueItem)
+                .doOnSuccess(any -> timeMetric.stopAndPublish())
+                .doOnSuccess(any -> processingActive.decrementAndGet());
         } catch (Throwable e) {
             return Mono.error(e);
-        } finally {
-            processingActive.decrementAndGet();
-            timeMetric.stopAndPublish();
         }
     }
 
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/DeliveryRunnable.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/DeliveryRunnable.java
index eaeee96..1699174 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/DeliveryRunnable.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/DeliveryRunnable.java
@@ -94,11 +94,10 @@ public class DeliveryRunnable implements Disposable {
     private Mono<Void> runStep(MailQueue.MailQueueItem queueItem) {
         TimeMetric timeMetric = metricFactory.timer(REMOTE_DELIVERY_TRIAL);
         try {
-            return processMail(queueItem);
+            return processMail(queueItem)
+                .doOnSuccess(any -> timeMetric.stopAndPublish());
         } catch (Throwable e) {
             return Mono.error(e);
-        } finally {
-            timeMetric.stopAndPublish();
         }
     }
 


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


[james-project] 40/49: [Refactoring] protocols-pop3 should rely on constructor injection

Posted by bt...@apache.org.
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 7566c1da829c72fe0dc30a5f4d8c260c2ef5164d
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 21:08:36 2019 +0700

    [Refactoring] protocols-pop3 should rely on constructor injection
---
 .../main/java/org/apache/james/pop3server/core/PassCmdHandler.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/core/PassCmdHandler.java b/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/core/PassCmdHandler.java
index aa7a5a3..4c04fa5 100644
--- a/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/core/PassCmdHandler.java
+++ b/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/core/PassCmdHandler.java
@@ -50,10 +50,10 @@ import org.slf4j.LoggerFactory;
 public class PassCmdHandler extends AbstractPassCmdHandler  {
     private static final Logger LOGGER = LoggerFactory.getLogger(PassCmdHandler.class);
 
-    private MailboxManager manager;
+    private final MailboxManager manager;
 
     @Inject
-    public void setMailboxManager(@Named("mailboxmanager") MailboxManager manager) {
+    public PassCmdHandler(@Named("mailboxmanager") MailboxManager manager) {
         this.manager = manager;
     }
 


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


[james-project] 31/49: [Refactoring] mailetcontainer-api: Remove not thrown exceptions

Posted by bt...@apache.org.
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 6ed21a013a97555ebc7bb37b8fc50393f9e88f96
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 15:25:54 2019 +0700

    [Refactoring] mailetcontainer-api: Remove not thrown exceptions
---
 .../james/mailetcontainer/api/mock/ExceptionThrowingMailet.java     | 2 +-
 .../james/mailetcontainer/api/mock/ExceptionThrowingMatcher.java    | 2 +-
 .../java/org/apache/james/mailetcontainer/api/mock/MockMailet.java  | 6 ++----
 .../java/org/apache/james/mailetcontainer/api/mock/MockMatcher.java | 6 ++----
 4 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/server/mailet/mailetcontainer-api/src/test/java/org/apache/james/mailetcontainer/api/mock/ExceptionThrowingMailet.java b/server/mailet/mailetcontainer-api/src/test/java/org/apache/james/mailetcontainer/api/mock/ExceptionThrowingMailet.java
index 9f599db..7f64ca2 100644
--- a/server/mailet/mailetcontainer-api/src/test/java/org/apache/james/mailetcontainer/api/mock/ExceptionThrowingMailet.java
+++ b/server/mailet/mailetcontainer-api/src/test/java/org/apache/james/mailetcontainer/api/mock/ExceptionThrowingMailet.java
@@ -43,7 +43,7 @@ public class ExceptionThrowingMailet implements Mailet {
     }
 
     @Override
-    public void init(MailetConfig config) throws MessagingException {
+    public void init(MailetConfig config) {
         this.config = config;
     }
 
diff --git a/server/mailet/mailetcontainer-api/src/test/java/org/apache/james/mailetcontainer/api/mock/ExceptionThrowingMatcher.java b/server/mailet/mailetcontainer-api/src/test/java/org/apache/james/mailetcontainer/api/mock/ExceptionThrowingMatcher.java
index c802bd6..581400c 100644
--- a/server/mailet/mailetcontainer-api/src/test/java/org/apache/james/mailetcontainer/api/mock/ExceptionThrowingMatcher.java
+++ b/server/mailet/mailetcontainer-api/src/test/java/org/apache/james/mailetcontainer/api/mock/ExceptionThrowingMatcher.java
@@ -46,7 +46,7 @@ public class ExceptionThrowingMatcher implements Matcher {
     }
 
     @Override
-    public void init(MatcherConfig config) throws MessagingException {
+    public void init(MatcherConfig config) {
         this.config = config;
     }
 
diff --git a/server/mailet/mailetcontainer-api/src/test/java/org/apache/james/mailetcontainer/api/mock/MockMailet.java b/server/mailet/mailetcontainer-api/src/test/java/org/apache/james/mailetcontainer/api/mock/MockMailet.java
index f0a1e54..1e128f3 100644
--- a/server/mailet/mailetcontainer-api/src/test/java/org/apache/james/mailetcontainer/api/mock/MockMailet.java
+++ b/server/mailet/mailetcontainer-api/src/test/java/org/apache/james/mailetcontainer/api/mock/MockMailet.java
@@ -18,8 +18,6 @@
  ****************************************************************/
 package org.apache.james.mailetcontainer.api.mock;
 
-import javax.mail.MessagingException;
-
 import org.apache.mailet.Mail;
 import org.apache.mailet.Mailet;
 import org.apache.mailet.MailetConfig;
@@ -43,12 +41,12 @@ public class MockMailet implements Mailet {
     }
 
     @Override
-    public void init(MailetConfig config) throws MessagingException {
+    public void init(MailetConfig config) {
         this.config = config;
     }
 
     @Override
-    public void service(Mail mail) throws MessagingException {
+    public void service(Mail mail) {
         String state = config.getInitParameter("state");
         mail.setState(state);
     }
diff --git a/server/mailet/mailetcontainer-api/src/test/java/org/apache/james/mailetcontainer/api/mock/MockMatcher.java b/server/mailet/mailetcontainer-api/src/test/java/org/apache/james/mailetcontainer/api/mock/MockMatcher.java
index bf1ba43..21f0fd2 100644
--- a/server/mailet/mailetcontainer-api/src/test/java/org/apache/james/mailetcontainer/api/mock/MockMatcher.java
+++ b/server/mailet/mailetcontainer-api/src/test/java/org/apache/james/mailetcontainer/api/mock/MockMatcher.java
@@ -23,8 +23,6 @@ import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 
-import javax.mail.MessagingException;
-
 import org.apache.james.core.MailAddress;
 import org.apache.mailet.Mail;
 import org.apache.mailet.Matcher;
@@ -50,13 +48,13 @@ public class MockMatcher implements Matcher {
     }
 
     @Override
-    public void init(MatcherConfig config) throws MessagingException {
+    public void init(MatcherConfig config) {
         this.config = config;
         matchCount = Integer.parseInt(config.getCondition());
     }
 
     @Override
-    public Collection<MailAddress> match(Mail mail) throws MessagingException {
+    public Collection<MailAddress> match(Mail mail) {
         List<MailAddress> match = new ArrayList<>();
 
         Iterator<MailAddress> rcpts = mail.getRecipients().iterator();


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


[james-project] 45/49: [Refactoring] protocols-* clean javaDoc

Posted by bt...@apache.org.
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 0a6a86ca73113e9445332af9552260afe7d3df6c
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 21:27:16 2019 +0700

    [Refactoring] protocols-* clean javaDoc
---
 .../james/protocols/lib/handler/HandlersPackage.java   |  2 --
 .../protocols/lib/handler/ProtocolHandlerLoader.java   |  5 -----
 .../jmx/AbstractCommandHandlerResultJMXMonitor.java    |  4 ----
 .../protocols/lib/jmx/AbstractCommandHandlerStats.java |  4 ----
 .../jmx/AbstractConnectHandlerResultJMXMonitor.java    |  4 ----
 .../lib/jmx/AbstractLineHandlerResultJMXMonitor.java   |  2 --
 .../protocols/lib/jmx/CommandHandlerStatsMBean.java    |  5 +----
 .../james/protocols/lib/jmx/ConnectHandlerStats.java   |  2 --
 .../james/protocols/lib/jmx/HandlerStatsMBean.java     |  6 ------
 .../james/protocols/lib/jmx/LineHandlerStats.java      |  2 --
 .../apache/james/protocols/lib/jmx/ServerMBean.java    | 18 ------------------
 .../apache/james/lmtpserver/netty/LMTPServerMBean.java |  6 ------
 .../pop3server/jmx/POP3CommandHandlerStatsMBean.java   |  4 ----
 .../apache/james/pop3server/netty/OioPOP3Server.java   |  1 -
 .../org/apache/james/pop3server/netty/POP3Server.java  |  3 ---
 .../org/apache/james/smtpserver/SendMailHandler.java   |  1 -
 .../apache/james/smtpserver/jmx/HookStatsMBean.java    | 12 ------------
 .../smtpserver/jmx/SMTPCommandHandlerStatsMBean.java   |  6 ------
 .../apache/james/smtpserver/netty/OioSMTPServer.java   |  1 -
 .../smtpserver/netty/SMTPChannelUpstreamHandler.java   |  2 --
 .../org/apache/james/smtpserver/netty/SMTPServer.java  |  4 ----
 .../apache/james/smtpserver/netty/SMTPServerMBean.java | 10 ----------
 22 files changed, 1 insertion(+), 103 deletions(-)

diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/handler/HandlersPackage.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/handler/HandlersPackage.java
index 79c354f..d71295b 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/handler/HandlersPackage.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/handler/HandlersPackage.java
@@ -34,8 +34,6 @@ public interface HandlersPackage extends ProtocolHandler {
     
     /**
      * Return a List which contains a set of CommandHandlers
-     * 
-     * @return Map
      */
     List<String> getHandlers();
 
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/handler/ProtocolHandlerLoader.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/handler/ProtocolHandlerLoader.java
index 4e3e6ea..483dcc0 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/handler/ProtocolHandlerLoader.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/handler/ProtocolHandlerLoader.java
@@ -31,11 +31,6 @@ public interface ProtocolHandlerLoader {
     /**
      * Load the {@link ProtocolHandler} and make sure all lifecycle methods are called and all
      * needed services injected.
-     * 
-     * @param name
-     * @param config
-     * @return handler
-     * @throws LoadingException
      */
     ProtocolHandler load(String name, Configuration config) throws LoadingException;
     
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractCommandHandlerResultJMXMonitor.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractCommandHandlerResultJMXMonitor.java
index 6015f4f..ddd143d 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractCommandHandlerResultJMXMonitor.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractCommandHandlerResultJMXMonitor.java
@@ -82,10 +82,6 @@ public abstract class AbstractCommandHandlerResultJMXMonitor<S extends ProtocolS
     /**
      * Create the {@link AbstractCommandHandlerStats} for the given
      * {@link CommandHandler}
-     * 
-     * @param handler
-     * @return stats
-     * @throws Exception
      */
     protected abstract AbstractCommandHandlerStats createCommandHandlerStats(CommandHandler<S> handler) throws Exception;
 
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractCommandHandlerStats.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractCommandHandlerStats.java
index 1ae62d8..85f3c67 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractCommandHandlerStats.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractCommandHandlerStats.java
@@ -59,8 +59,6 @@ public abstract class AbstractCommandHandlerStats extends StandardMBean implemen
 
     /**
      * Increment stats based on the given response
-     * 
-     * @param response
      */
     public void increment(Response response) {
         if (response.isEndSession()) {
@@ -73,8 +71,6 @@ public abstract class AbstractCommandHandlerStats extends StandardMBean implemen
 
     /**
      * Subclasses need to implement this to handle more precise stats
-     * 
-     * @param response
      */
     protected abstract void incrementStats(Response response);
 
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractConnectHandlerResultJMXMonitor.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractConnectHandlerResultJMXMonitor.java
index c75b2d0..7e2f042 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractConnectHandlerResultJMXMonitor.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractConnectHandlerResultJMXMonitor.java
@@ -35,8 +35,6 @@ import org.apache.james.protocols.api.handler.WiringException;
 
 /**
  * Handler which will gather statistics for {@link ConnectHandler}'s
- * 
- * @param <S>
  */
 public abstract class AbstractConnectHandlerResultJMXMonitor<R extends Response, S extends ProtocolSession> implements ProtocolHandlerResultHandler<R,S>, ExtensibleHandler, ProtocolHandler {
 
@@ -92,8 +90,6 @@ public abstract class AbstractConnectHandlerResultJMXMonitor<R extends Response,
 
     /**
      * Return the default JMXName to use if none is configured
-     * 
-     * @return defaultJMXName
      */
     protected abstract String getDefaultJMXName();
 }
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractLineHandlerResultJMXMonitor.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractLineHandlerResultJMXMonitor.java
index 3aa1f17..9939fb7 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractLineHandlerResultJMXMonitor.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractLineHandlerResultJMXMonitor.java
@@ -92,8 +92,6 @@ public abstract class AbstractLineHandlerResultJMXMonitor<R extends Response, S
 
     /**
      * Return default JMX Name if none is configured
-     * 
-     * @return defaultJMXName
      */
     protected abstract String getDefaultJMXName();
 }
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/CommandHandlerStatsMBean.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/CommandHandlerStatsMBean.java
index d9df450..3f6d0e9 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/CommandHandlerStatsMBean.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/CommandHandlerStatsMBean.java
@@ -18,8 +18,6 @@
  ****************************************************************/
 package org.apache.james.protocols.lib.jmx;
 
-import org.apache.james.protocols.lib.jmx.HandlerStatsMBean;
-
 /**
  * JMX MBean for CommandHandler
  */
@@ -27,8 +25,7 @@ public interface CommandHandlerStatsMBean extends HandlerStatsMBean {
 
     /**
      * Return all implemented commands by this handler
-     * 
-     * @return commands
+
      */
     String[] getCommands();
 }
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/ConnectHandlerStats.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/ConnectHandlerStats.java
index 7fe8f0f..2e86864 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/ConnectHandlerStats.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/ConnectHandlerStats.java
@@ -53,8 +53,6 @@ public class ConnectHandlerStats extends StandardMBean implements HandlerStatsMB
 
     /**
      * Increment the stats
-     * 
-     * @param response
      */
     public void increment(Response response) {
         all.incrementAndGet();
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/HandlerStatsMBean.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/HandlerStatsMBean.java
index 8960b9a..3733a7f 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/HandlerStatsMBean.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/HandlerStatsMBean.java
@@ -25,22 +25,16 @@ public interface HandlerStatsMBean {
 
     /**
      * Return the count of all processed transactions by the handler
-     * 
-     * @return all
      */
     long getAll();
 
     /**
      * Return the name of the handler
-     * 
-     * @return name
      */
     String getName();
 
     /**
      * Return how often the Handler issued a disconnect
-     * 
-     * @return disconnect
      */
     long getDisconnect();
 
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/LineHandlerStats.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/LineHandlerStats.java
index aca25ec..dd08360 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/LineHandlerStats.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/LineHandlerStats.java
@@ -55,8 +55,6 @@ public class LineHandlerStats extends StandardMBean implements HandlerStatsMBean
 
     /**
      * Increment the stats
-     * 
-     * @param response
      */
     public void increment(Response response) {
         all.incrementAndGet();
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/ServerMBean.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/ServerMBean.java
index 276d292..0a0aea2 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/ServerMBean.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/ServerMBean.java
@@ -25,36 +25,26 @@ public interface ServerMBean {
 
     /**
      * Return the maximum allowed concurrent connections for the server
-     * 
-     * @return maxConcurrentConnections
      */
     int getMaximumConcurrentConnections();
 
     /**
      * Return the current connection count
-     * 
-     * @return currentConnection
      */
     int getCurrentConnections();
 
     /**
      * Return the count of handled connections till startup
-     * 
-     * @return handledConnections
      */
     long getHandledConnections();
 
     /**
      * Return true if the server is enabled
-     * 
-     * @return isEnabled
      */
     boolean isEnabled();
 
     /**
      * Return true if startTLS is supported by the server
-     * 
-     * @return startTLS
      */
     boolean getStartTLSSupported();
 
@@ -75,29 +65,21 @@ public interface ServerMBean {
     /**
      * Return true if the server is started, which basicly means it is bound to
      * a address and accept connections
-     * 
-     * @return started
      */
     boolean isStarted();
 
     /**
      * Start the server
-     * 
-     * @return start
      */
     boolean start();
 
     /**
      * Stop the server
-     * 
-     * @return stop
      */
     boolean stop();
 
     /**
      * Return the timeout in seconds
-     * 
-     * @return timeout
      */
     int getTimeout();
 }
diff --git a/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/netty/LMTPServerMBean.java b/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/netty/LMTPServerMBean.java
index f42cdc2..a21ee61 100644
--- a/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/netty/LMTPServerMBean.java
+++ b/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/netty/LMTPServerMBean.java
@@ -25,23 +25,17 @@ public interface LMTPServerMBean extends ServerMBean, SMTPServerMBean {
 
     /**
      * Return the maximum allowed size of the message
-     * 
-     * @return maxMessageSize
      */
     long getMaximalMessageSize();
 
     /**
      * Set the maximum allowed size of messages. Set this to 0 to accept every
      * message
-     * 
-     * @param maxSize
      */
     void setMaximalMessageSize(long maxSize);
 
     /**
      * Return the hello name
-     * 
-     * @return helo
      */
     String getHeloName();
 
diff --git a/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/jmx/POP3CommandHandlerStatsMBean.java b/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/jmx/POP3CommandHandlerStatsMBean.java
index 5321adc..baeacea 100644
--- a/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/jmx/POP3CommandHandlerStatsMBean.java
+++ b/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/jmx/POP3CommandHandlerStatsMBean.java
@@ -24,15 +24,11 @@ public interface POP3CommandHandlerStatsMBean extends CommandHandlerStatsMBean {
 
     /**
      * Return the count of errors returned by the handler
-     * 
-     * @return error
      */
     long getError();
 
     /**
      * Return the count of successful handling returned by the handler
-     * 
-     * @return tempCount
      */
     long getOk();
 
diff --git a/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/OioPOP3Server.java b/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/OioPOP3Server.java
index adae9b7..6ac1978 100644
--- a/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/OioPOP3Server.java
+++ b/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/OioPOP3Server.java
@@ -35,7 +35,6 @@ public class OioPOP3Server extends POP3Server {
 
     /**
      * As OIO use one thread per connection we disable the use of the {@link ExecutionHandler}
-     * 
      */
     @Override
     protected ExecutionHandler createExecutionHander() {
diff --git a/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/POP3Server.java b/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/POP3Server.java
index f00db57..cd4f4f5 100644
--- a/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/POP3Server.java
+++ b/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/POP3Server.java
@@ -55,9 +55,6 @@ public class POP3Server extends AbstractProtocolAsyncServer implements POP3Serve
      * A class to provide POP3 handler configuration to the handlers
      */
     private class POP3Configuration implements ProtocolConfiguration {
-
-        /**
-         */
         @Override
         public String getHelloName() {
             return POP3Server.this.getHelloName();
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/SendMailHandler.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/SendMailHandler.java
index 4de5cfe..4ef8201 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/SendMailHandler.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/SendMailHandler.java
@@ -54,7 +54,6 @@ public class SendMailHandler implements JamesMessageHook {
 
     /**
      * Adds header to the message
-     *
      */
     @Override
     public HookResult onMessage(SMTPSession session, Mail mail) {
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/jmx/HookStatsMBean.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/jmx/HookStatsMBean.java
index 87a147b..87ddc69 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/jmx/HookStatsMBean.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/jmx/HookStatsMBean.java
@@ -25,43 +25,31 @@ public interface HookStatsMBean {
 
     /**
      * Return the name of the Hook
-     * 
-     * @return name
      */
     String getName();
 
     /**
      * Return the count of how many OK the hook returned
-     * 
-     * @return ok
      */
     long getOk();
 
     /**
      * Return the count of how many DECLINED the hook returned
-     * 
-     * @return declined
      */
     long getDeclined();
 
     /**
      * Return the count of how many DENY the hook returned
-     * 
-     * @return deny
      */
     long getDeny();
 
     /**
      * Return the count of how many DENYSOFT the hook returned
-     * 
-     * @return denysoft
      */
     long getDenysoft();
 
     /**
      * Return the count of how many transaction this hook as processed
-     * 
-     * @return all
      */
     long getAll();
 }
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/jmx/SMTPCommandHandlerStatsMBean.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/jmx/SMTPCommandHandlerStatsMBean.java
index 6af16d2..4fc3daf 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/jmx/SMTPCommandHandlerStatsMBean.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/jmx/SMTPCommandHandlerStatsMBean.java
@@ -27,22 +27,16 @@ public interface SMTPCommandHandlerStatsMBean extends CommandHandlerStatsMBean {
 
     /**
      * Return the count of temporary errors returned by the handler
-     * 
-     * @return tempCount
      */
     long getTemporaryError();
 
     /**
      * Return the count of permanent errors returned by the handler
-     * 
-     * @return permCount
      */
     long getPermantError();
 
     /**
      * Return the count of successful handling returned by the handler
-     * 
-     * @return tempCount
      */
     long getOk();
 
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/OioSMTPServer.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/OioSMTPServer.java
index b40ad5d..bb8a456 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/OioSMTPServer.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/OioSMTPServer.java
@@ -39,7 +39,6 @@ public class OioSMTPServer extends SMTPServer {
 
     /**
      * As OIO use one thread per connection we disable the use of the {@link ExecutionHandler}
-     * 
      */
     @Override
     protected ExecutionHandler createExecutionHander() {
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPChannelUpstreamHandler.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPChannelUpstreamHandler.java
index 653b66d..6ad881d 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPChannelUpstreamHandler.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPChannelUpstreamHandler.java
@@ -69,8 +69,6 @@ public class SMTPChannelUpstreamHandler extends BasicChannelUpstreamHandler {
 
     /**
      * Cleanup temporary files
-     * 
-     * @param ctx
      */
     @Override
     protected void cleanup(ChannelHandlerContext ctx) {
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java
index 3f11a02..cc5379a 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java
@@ -195,8 +195,6 @@ public class SMTPServer extends AbstractProtocolAsyncServer implements SMTPServe
     /**
      * Return the default port which will get used for this server if non is
      * specify in the configuration
-     * 
-     * @return port
      */
     @Override
     protected int getDefaultPort() {
@@ -261,8 +259,6 @@ public class SMTPServer extends AbstractProtocolAsyncServer implements SMTPServe
         /**
          * Return true if the username and mail from must match for a authorized
          * user
-         * 
-         * @return verify
          */
         public boolean verifyIdentity() {
             return SMTPServer.this.verifyIdentity;
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPServerMBean.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPServerMBean.java
index 3b6b17c..898d454 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPServerMBean.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPServerMBean.java
@@ -27,16 +27,12 @@ public interface SMTPServerMBean extends org.apache.james.protocols.smtp.SMTPSer
 
     /**
      * Return the maximum allowed size of the message
-     * 
-     * @return maxMessageSize
      */
     long getMaximalMessageSize();
 
     /**
      * Set the maximum allowed size of messages. Set this to 0 to accept every
      * message
-     * 
-     * @param maxSize
      */
     void setMaximalMessageSize(long maxSize);
 
@@ -51,8 +47,6 @@ public interface SMTPServerMBean extends org.apache.james.protocols.smtp.SMTPSer
     /**
      * Enable or disable brackets enforcement around addressed in the MAIL and
      * RCPT command
-     * 
-     * @param enforceAddressBrackets
      */
     void setAddressBracketsEnforcement(boolean enforceAddressBrackets);
 
@@ -65,15 +59,11 @@ public interface SMTPServerMBean extends org.apache.james.protocols.smtp.SMTPSer
 
     /**
      * Enable or disable the need of the HELO/EHLO
-     * 
-     * @param enforceHeloEHlo
      */
     void setHeloEhloEnforcement(boolean enforceHeloEHlo);
 
     /**
      * Return the hello name
-     * 
-     * @return helo
      */
     String getHeloName();
 }


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


[james-project] 06/49: [Refactoring] DuplicateUserException is never used

Posted by bt...@apache.org.
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 3e3b0463aced66d9b85e9911d0b1141de34608ef
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Nov 18 14:03:54 2019 +0700

    [Refactoring] DuplicateUserException is never used
---
 .../api/exception/DuplicateUserException.java      | 65 ----------------------
 1 file changed, 65 deletions(-)

diff --git a/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/DuplicateUserException.java b/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/DuplicateUserException.java
deleted file mode 100644
index 807444e..0000000
--- a/server/data/data-api/src/main/java/org/apache/james/sieverepository/api/exception/DuplicateUserException.java
+++ /dev/null
@@ -1,65 +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.sieverepository.api.exception;
-
-/**
- * <code>DuplicateUserException</code>
- */
-public class DuplicateUserException extends SieveRepositoryException {
-
-    private static final long serialVersionUID = 2393178076895724704L;
-
-    /**
-     * Creates a new instance of DuplicateUserException.
-     *
-     */
-    public DuplicateUserException() {
-    }
-
-    /**
-     * Creates a new instance of DuplicateUserException.
-     *
-     * @param message
-     * @param cause
-     */
-    public DuplicateUserException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-    /**
-     * Creates a new instance of DuplicateUserException.
-     *
-     * @param message
-     */
-    public DuplicateUserException(String message) {
-        super(message);
-    }
-
-    /**
-     * Creates a new instance of DuplicateUserException.
-     *
-     * @param cause
-     */
-    public DuplicateUserException(Throwable cause) {
-        super(cause);
-    }
-
-}


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


[james-project] 26/49: [Refactoring] DisposeProcessor class is not used

Posted by bt...@apache.org.
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 cb6d3ce79ba6e5bcddaef826bf15c7ff3dcd0a7c
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 14:59:48 2019 +0700

    [Refactoring] DisposeProcessor class is not used
---
 .../impl/camel/DisposeProcessor.java               | 43 ----------------------
 1 file changed, 43 deletions(-)

diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/DisposeProcessor.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/DisposeProcessor.java
deleted file mode 100644
index 84cf661..0000000
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/DisposeProcessor.java
+++ /dev/null
@@ -1,43 +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.mailetcontainer.impl.camel;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.james.lifecycle.api.LifecycleUtil;
-import org.apache.mailet.Mail;
-
-/**
- * Processor which dispose body object if needed
- */
-public class DisposeProcessor implements Processor {
-
-    @Override
-    public void process(Exchange arg0) throws Exception {
-        Mail mail = arg0.getIn().getBody(Mail.class);
-        LifecycleUtil.dispose(mail.getMessage());
-        LifecycleUtil.dispose(mail);
-
-        // stop routing
-        arg0.setProperty(Exchange.ROUTE_STOP, true);
-
-    }
-
-}


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


[james-project] 02/49: [Refactoring] Lock is only used by FileMailRepository

Posted by bt...@apache.org.
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 d5372d9ce12775e7bf031c2c90430414b1bc3ad7
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Nov 18 13:53:15 2019 +0700

    [Refactoring] Lock is only used by FileMailRepository
---
 .../java/org/apache/james/mailrepository/file/FileMailRepository.java   | 1 -
 .../src/main/java/org/apache/james/mailrepository/file}/Lock.java       | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java b/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
index ee55188..7ebcd31 100644
--- a/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
+++ b/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
@@ -42,7 +42,6 @@ import org.apache.james.filesystem.api.FileSystem;
 import org.apache.james.lifecycle.api.Configurable;
 import org.apache.james.mailrepository.api.MailKey;
 import org.apache.james.mailrepository.api.MailRepository;
-import org.apache.james.mailrepository.lib.Lock;
 import org.apache.james.repository.api.Initializable;
 import org.apache.james.repository.file.FilePersistentObjectRepository;
 import org.apache.james.repository.file.FilePersistentStreamRepository;
diff --git a/server/data/data-library/src/main/java/org/apache/james/mailrepository/lib/Lock.java b/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/Lock.java
similarity index 98%
rename from server/data/data-library/src/main/java/org/apache/james/mailrepository/lib/Lock.java
rename to server/data/data-file/src/main/java/org/apache/james/mailrepository/file/Lock.java
index 8f0c709..1a1d5b6 100644
--- a/server/data/data-library/src/main/java/org/apache/james/mailrepository/lib/Lock.java
+++ b/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/Lock.java
@@ -17,7 +17,7 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mailrepository.lib;
+package org.apache.james.mailrepository.file;
 
 import java.util.Hashtable;
 


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