JAMES-2366 drop getAllMappings wrapping methods and expose backend implementation
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/565c6a23 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/565c6a23 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/565c6a23 Branch: refs/heads/master Commit: 565c6a23841a5d311502eb63ce35cf36f9853fda Parents: e2c0bcd Author: Matthieu Baechler <matth...@apache.org> Authored: Wed Apr 18 16:14:26 2018 +0200 Committer: Matthieu Baechler <matth...@apache.org> Committed: Tue Apr 24 14:45:26 2018 +0200 ---------------------------------------------------------------------- .../rrt/cassandra/CassandraRecipientRewriteTable.java | 2 +- .../apache/james/rrt/file/XMLRecipientRewriteTable.java | 2 +- .../james/rrt/hbase/HBaseRecipientRewriteTable.java | 2 +- .../apache/james/rrt/jdbc/JDBCRecipientRewriteTable.java | 2 +- .../apache/james/rrt/jpa/JPARecipientRewriteTable.java | 2 +- .../james/rrt/lib/AbstractRecipientRewriteTable.java | 10 +--------- .../james/rrt/memory/MemoryRecipientRewriteTable.java | 2 +- 7 files changed, 7 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/565c6a23/server/data/data-cassandra/src/main/java/org/apache/james/rrt/cassandra/CassandraRecipientRewriteTable.java ---------------------------------------------------------------------- diff --git a/server/data/data-cassandra/src/main/java/org/apache/james/rrt/cassandra/CassandraRecipientRewriteTable.java b/server/data/data-cassandra/src/main/java/org/apache/james/rrt/cassandra/CassandraRecipientRewriteTable.java index b4239d8..6e805a0 100644 --- a/server/data/data-cassandra/src/main/java/org/apache/james/rrt/cassandra/CassandraRecipientRewriteTable.java +++ b/server/data/data-cassandra/src/main/java/org/apache/james/rrt/cassandra/CassandraRecipientRewriteTable.java @@ -130,7 +130,7 @@ public class CassandraRecipientRewriteTable extends AbstractRecipientRewriteTabl } @Override - protected Map<String, Mappings> getAllMappingsInternal() { + public Map<String, Mappings> getAllMappings() { return executor.execute(retrieveAllMappingsStatement.bind()) .thenApply(resultSet -> cassandraUtils.convertToStream(resultSet) .map(row -> new UserMapping(row.getString(USER), Domain.of(row.getString(DOMAIN)), row.getString(MAPPING))) http://git-wip-us.apache.org/repos/asf/james-project/blob/565c6a23/server/data/data-file/src/main/java/org/apache/james/rrt/file/XMLRecipientRewriteTable.java ---------------------------------------------------------------------- diff --git a/server/data/data-file/src/main/java/org/apache/james/rrt/file/XMLRecipientRewriteTable.java b/server/data/data-file/src/main/java/org/apache/james/rrt/file/XMLRecipientRewriteTable.java index 08063cc..e6a6f19 100644 --- a/server/data/data-file/src/main/java/org/apache/james/rrt/file/XMLRecipientRewriteTable.java +++ b/server/data/data-file/src/main/java/org/apache/james/rrt/file/XMLRecipientRewriteTable.java @@ -81,7 +81,7 @@ public class XMLRecipientRewriteTable extends AbstractRecipientRewriteTable { } @Override - protected Map<String, Mappings> getAllMappingsInternal() throws RecipientRewriteTableException { + public Map<String, Mappings> getAllMappings() throws RecipientRewriteTableException { if (mappings != null && mappings.size() > 0) { Map<String, Mappings> mappingsNew = new HashMap<>(); for (String key : mappings.keySet()) { http://git-wip-us.apache.org/repos/asf/james-project/blob/565c6a23/server/data/data-hbase/src/main/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTable.java ---------------------------------------------------------------------- diff --git a/server/data/data-hbase/src/main/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTable.java b/server/data/data-hbase/src/main/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTable.java index 7fa77ac..7cfb6af 100644 --- a/server/data/data-hbase/src/main/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTable.java +++ b/server/data/data-hbase/src/main/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTable.java @@ -102,7 +102,7 @@ public class HBaseRecipientRewriteTable extends AbstractRecipientRewriteTable { } @Override - protected Map<String, Mappings> getAllMappingsInternal() throws RecipientRewriteTableException { + public Map<String, Mappings> getAllMappings() throws RecipientRewriteTableException { HTableInterface table = null; ResultScanner resultScanner = null; Map<String, Mappings> map = new HashMap<>(); http://git-wip-us.apache.org/repos/asf/james-project/blob/565c6a23/server/data/data-jdbc/src/main/java/org/apache/james/rrt/jdbc/JDBCRecipientRewriteTable.java ---------------------------------------------------------------------- diff --git a/server/data/data-jdbc/src/main/java/org/apache/james/rrt/jdbc/JDBCRecipientRewriteTable.java b/server/data/data-jdbc/src/main/java/org/apache/james/rrt/jdbc/JDBCRecipientRewriteTable.java index eee32b6..2cae41f 100644 --- a/server/data/data-jdbc/src/main/java/org/apache/james/rrt/jdbc/JDBCRecipientRewriteTable.java +++ b/server/data/data-jdbc/src/main/java/org/apache/james/rrt/jdbc/JDBCRecipientRewriteTable.java @@ -257,7 +257,7 @@ public class JDBCRecipientRewriteTable extends AbstractRecipientRewriteTable { } @Override - protected Map<String, Mappings> getAllMappingsInternal() throws RecipientRewriteTableException { + public Map<String, Mappings> getAllMappings() throws RecipientRewriteTableException { Connection conn = null; PreparedStatement mappingStmt = null; Map<String, Mappings> mapping = new HashMap<>(); http://git-wip-us.apache.org/repos/asf/james-project/blob/565c6a23/server/data/data-jpa/src/main/java/org/apache/james/rrt/jpa/JPARecipientRewriteTable.java ---------------------------------------------------------------------- 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 b046e0d..c0ab2ce 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 @@ -139,7 +139,7 @@ public class JPARecipientRewriteTable extends AbstractRecipientRewriteTable { } @Override - protected Map<String, Mappings> getAllMappingsInternal() throws RecipientRewriteTableException { + public Map<String, Mappings> getAllMappings() throws RecipientRewriteTableException { EntityManager entityManager = entityManagerFactory.createEntityManager(); final EntityTransaction transaction = entityManager.getTransaction(); Map<String, Mappings> mapping = new HashMap<>(); http://git-wip-us.apache.org/repos/asf/james-project/blob/565c6a23/server/data/data-library/src/main/java/org/apache/james/rrt/lib/AbstractRecipientRewriteTable.java ---------------------------------------------------------------------- diff --git a/server/data/data-library/src/main/java/org/apache/james/rrt/lib/AbstractRecipientRewriteTable.java b/server/data/data-library/src/main/java/org/apache/james/rrt/lib/AbstractRecipientRewriteTable.java index 21066af..d028eca 100644 --- a/server/data/data-library/src/main/java/org/apache/james/rrt/lib/AbstractRecipientRewriteTable.java +++ b/server/data/data-library/src/main/java/org/apache/james/rrt/lib/AbstractRecipientRewriteTable.java @@ -246,14 +246,6 @@ public abstract class AbstractRecipientRewriteTable implements RecipientRewriteT } @Override - public Map<String, Mappings> getAllMappings() throws RecipientRewriteTableException { - Map<String, Mappings> mappings = getAllMappingsInternal(); - - LOGGER.debug("Retrieve all mappings. Mapping count: {}", mappings.size()); - return mappings; - } - - @Override public void addAliasDomainMapping(Domain aliasDomain, Domain realDomain) throws RecipientRewriteTableException { LOGGER.info("Add domain mapping: {} => {}", aliasDomain, realDomain); addMapping(null, aliasDomain, Mapping.domain(realDomain)); @@ -312,7 +304,7 @@ public abstract class AbstractRecipientRewriteTable implements RecipientRewriteT * * @return Map */ - protected abstract Map<String, Mappings> getAllMappingsInternal() throws RecipientRewriteTableException; + public abstract Map<String, Mappings> getAllMappings() throws RecipientRewriteTableException; /** * This method must return stored Mappings for the given user. http://git-wip-us.apache.org/repos/asf/james-project/blob/565c6a23/server/data/data-memory/src/main/java/org/apache/james/rrt/memory/MemoryRecipientRewriteTable.java ---------------------------------------------------------------------- diff --git a/server/data/data-memory/src/main/java/org/apache/james/rrt/memory/MemoryRecipientRewriteTable.java b/server/data/data-memory/src/main/java/org/apache/james/rrt/memory/MemoryRecipientRewriteTable.java index b871370..b45e4ed 100644 --- a/server/data/data-memory/src/main/java/org/apache/james/rrt/memory/MemoryRecipientRewriteTable.java +++ b/server/data/data-memory/src/main/java/org/apache/james/rrt/memory/MemoryRecipientRewriteTable.java @@ -117,7 +117,7 @@ public class MemoryRecipientRewriteTable extends AbstractRecipientRewriteTable { } @Override - protected Map<String, Mappings> getAllMappingsInternal() { + public Map<String, Mappings> getAllMappings() { return Multimaps.index(mappingEntries, InMemoryMappingEntry::asKey) .asMap() .entrySet() --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org