Repository: james-project Updated Branches: refs/heads/master 546d63f7d -> 876987c80
http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/data/data-hbase/src/main/java/org/apache/james/user/hbase/HBaseUsersRepository.java ---------------------------------------------------------------------- diff --git a/server/data/data-hbase/src/main/java/org/apache/james/user/hbase/HBaseUsersRepository.java b/server/data/data-hbase/src/main/java/org/apache/james/user/hbase/HBaseUsersRepository.java deleted file mode 100644 index 7d8e82c..0000000 --- a/server/data/data-hbase/src/main/java/org/apache/james/user/hbase/HBaseUsersRepository.java +++ /dev/null @@ -1,215 +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.user.hbase; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Locale; - -import org.apache.commons.configuration.ConfigurationException; -import org.apache.commons.configuration.HierarchicalConfiguration; -import org.apache.hadoop.hbase.KeyValue; -import org.apache.hadoop.hbase.client.Delete; -import org.apache.hadoop.hbase.client.Get; -import org.apache.hadoop.hbase.client.HTableInterface; -import org.apache.hadoop.hbase.client.Put; -import org.apache.hadoop.hbase.client.Result; -import org.apache.hadoop.hbase.client.ResultScanner; -import org.apache.hadoop.hbase.client.Scan; -import org.apache.hadoop.hbase.util.Bytes; -import org.apache.james.system.hbase.TablePool; -import org.apache.james.user.api.UsersRepositoryException; -import org.apache.james.user.api.model.User; -import org.apache.james.user.hbase.def.HUsersRepository; -import org.apache.james.user.lib.AbstractUsersRepository; -import org.apache.james.user.lib.model.DefaultUser; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Implementation of the UserRepository for a HBase persistence. - * - * @Deprecated: See JAMES-2571 The HBase implementation is not enough maintained and thus will be removed from James in version 3.3.0. Please prefer using - * other MailboxManagers or contribute the HBase mailbox maintenance. - */ -@Deprecated -public class HBaseUsersRepository extends AbstractUsersRepository { - - /** - * The Logger. - */ - private static final Logger log = LoggerFactory.getLogger(HBaseUsersRepository.class.getName()); - /** - * Hashing algorithm for the password. - */ - private String algo; - - @Override - public void doConfigure(HierarchicalConfiguration config) throws ConfigurationException { - algo = config.getString("algorithm", "MD5"); - super.doConfigure(config); - } - - @Override - public User getUserByName(String name) throws UsersRepositoryException { - KeyValue keyValue = getKeyValue(name); - User user = null; - if (keyValue != null) { - user = new DefaultUser(Bytes.toString(keyValue.getRow()), Bytes.toString(keyValue.getValue()), algo); - } - return user; - } - - @Override - public void updateUser(User user) throws UsersRepositoryException { - if (user == null) { - throw new UsersRepositoryException("Please provide a non null user"); - } - if (!(user instanceof DefaultUser)) { - throw new UsersRepositoryException("Please provide a user instanceof DefaultUser"); - } - User existingUser = getUserByName(user.getUserName()); - if (existingUser == null) { - throw new UsersRepositoryException("Please provide an existing user to update"); - } - putUser((DefaultUser) user, false); - } - - @Override - public void removeUser(String name) throws UsersRepositoryException { - try (HTableInterface table = TablePool.getInstance().getUsersRepositoryTable()) { - Delete delete = new Delete(Bytes.toBytes(name)); - table.delete(delete); - table.flushCommits(); - } catch (IOException e) { - log.error("Error while deleting user from HBase", e); - throw new UsersRepositoryException("Error while deleting user from HBase", e); - } - } - - @Override - public boolean contains(String name) throws UsersRepositoryException { - KeyValue keyValue = getKeyValue(name.toLowerCase(Locale.US)); - return (keyValue != null); - } - - @Override - public boolean test(String name, String password) throws UsersRepositoryException { - KeyValue keyValue = getKeyValue(name); - if (keyValue != null) { - DefaultUser user = new DefaultUser(name, algo); - user.setPassword(password); - return Bytes.toString(keyValue.getValue()).equals(user.getHashedPassword()); - } - return false; - } - - @Override - public int countUsers() throws UsersRepositoryException { - try (HTableInterface table = TablePool.getInstance().getUsersRepositoryTable()) { - Scan scan = new Scan(); - scan.addFamily(HUsersRepository.COLUMN_FAMILY_NAME); - scan.setCaching(table.getConfiguration().getInt("hbase.client.scanner.caching", 1) * 2); - try (ResultScanner resultScanner = table.getScanner(scan)) { - int resultCount = 0; - while (resultScanner.next() != null) { - resultCount++; - } - return resultCount; - } - } catch (IOException e) { - log.error("Error while counting users from HBase", e); - throw new UsersRepositoryException("Error while counting users from HBase", e); - } - } - - @Override - public Iterator<String> list() throws UsersRepositoryException { - List<String> list = new ArrayList<>(); - try (HTableInterface table = TablePool.getInstance().getUsersRepositoryTable()) { - Scan scan = new Scan(); - scan.addFamily(HUsersRepository.COLUMN_FAMILY_NAME); - scan.setCaching(table.getConfiguration().getInt("hbase.client.scanner.caching", 1) * 2); - try (ResultScanner resultScanner = table.getScanner(scan)) { - Result result; - while ((result = resultScanner.next()) != null) { - list.add(Bytes.toString(result.getRow())); - } - } - } catch (IOException e) { - log.error("Error while scanning users from HBase", e); - throw new UsersRepositoryException("Error while scanning users from HBase", e); - } - return list.iterator(); - } - - @Override - protected void doAddUser(String username, String password) throws UsersRepositoryException { - DefaultUser user = new DefaultUser(username, algo); - user.setPassword(password); - putUser(user, true); - } - - /** - * Utility method to retrieve a HBase KeyValue for a given username. - * - * @param username - * @return - * @throws UsersRepositoryException - */ - private KeyValue getKeyValue(String username) throws UsersRepositoryException { - try (HTableInterface table = TablePool.getInstance().getUsersRepositoryTable()) { - Get get = new Get(Bytes.toBytes(username)); - Result result = table.get(get); - KeyValue keyValue = result.getColumnLatest(HUsersRepository.COLUMN_FAMILY_NAME, HUsersRepository.COLUMN.PWD); - return keyValue; - } catch (IOException e) { - log.error("Error while counting users from HBase", e); - throw new UsersRepositoryException("Error while counting users from HBase", e); - } - } - - /** - * Utility method to put a User in HBase. - * - * @param user - * @throws UsersRepositoryException - */ - private void putUser(DefaultUser user, boolean isAdd) throws UsersRepositoryException { - String username = user.getUserName(); - if (isAdd) { - username = user.getUserName().toLowerCase(Locale.US); - if (contains(username)) { - throw new UsersRepositoryException(username + " already exists."); - } - } - try (HTableInterface table = TablePool.getInstance().getUsersRepositoryTable()) { - Put put = new Put(Bytes.toBytes(username)); - put.add(HUsersRepository.COLUMN_FAMILY_NAME, HUsersRepository.COLUMN.PWD, - Bytes.toBytes(user.getHashedPassword())); - table.put(put); - table.flushCommits(); - } catch (IOException e) { - log.error("Error while adding user in HBase", e); - throw new UsersRepositoryException("Error while adding user in HBase", e); - } - } -} http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/data/data-hbase/src/main/java/org/apache/james/user/hbase/def/HUsersRepository.java ---------------------------------------------------------------------- diff --git a/server/data/data-hbase/src/main/java/org/apache/james/user/hbase/def/HUsersRepository.java b/server/data/data-hbase/src/main/java/org/apache/james/user/hbase/def/HUsersRepository.java deleted file mode 100644 index 798f60a..0000000 --- a/server/data/data-hbase/src/main/java/org/apache/james/user/hbase/def/HUsersRepository.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.user.hbase.def; - -import org.apache.hadoop.hbase.util.Bytes; - -/** - * Definitions for the UsersRepository HBase Table. - * - * Contains the table name, column family name and - * the used column/qualifier names. - */ -public interface HUsersRepository { - - byte[] TABLE_NAME = Bytes.toBytes("JAMES_USERS"); - byte[] COLUMN_FAMILY_NAME = Bytes.toBytes("JAMES_USERS"); - - interface COLUMN { - byte [] PWD = Bytes.toBytes("pwd"); - } - -} http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/data/data-hbase/src/reporting-site/site.xml ---------------------------------------------------------------------- diff --git a/server/data/data-hbase/src/reporting-site/site.xml b/server/data/data-hbase/src/reporting-site/site.xml deleted file mode 100644 index d919164..0000000 --- a/server/data/data-hbase/src/reporting-site/site.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<project name="${project.name}"> - - <body> - - <menu ref="parent" /> - <menu ref="reports" /> - - </body> - -</project> http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/data/data-hbase/src/test/java/org/apache/james/domainlist/hbase/HBaseDomainListTest.java ---------------------------------------------------------------------- diff --git a/server/data/data-hbase/src/test/java/org/apache/james/domainlist/hbase/HBaseDomainListTest.java b/server/data/data-hbase/src/test/java/org/apache/james/domainlist/hbase/HBaseDomainListTest.java deleted file mode 100644 index a9ddf11..0000000 --- a/server/data/data-hbase/src/test/java/org/apache/james/domainlist/hbase/HBaseDomainListTest.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.domainlist.hbase; - -import java.io.IOException; - -import org.apache.james.core.Domain; -import org.apache.james.domainlist.api.DomainList; -import org.apache.james.domainlist.api.DomainListException; -import org.apache.james.domainlist.lib.AbstractDomainListTest; -import org.apache.james.mailbox.hbase.HBaseClusterSingleton; -import org.apache.james.system.hbase.TablePool; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; - -/** - * Tests for the HBase DomainList implementation. - * - * Simply create the needed HBaseDomainList instance, and let the - * AbstractDomainListTest run the tests - */ -public class HBaseDomainListTest extends AbstractDomainListTest { - - private static final HBaseClusterSingleton cluster = HBaseClusterSingleton.build(); - - @BeforeClass - public static void setMeUp() throws IOException { - TablePool.getInstance(cluster.getConf()); - } - - @Override - @Before - public void setUp() throws Exception { - super.setUp(); - } - - @After - public void tearDown() throws Exception { - DomainList domainList = createDomainList(); - for (Domain domain: domainList.getDomains()) { - domainList.removeDomain(domain); - } - } - - @Override - protected DomainList createDomainList() throws Exception { - HBaseDomainList domainList = new HBaseDomainList(getDNSServer("localhost")); - domainList.setAutoDetect(false); - domainList.setAutoDetectIP(false); - return domainList; - } - - @Ignore - @Test - @Override - public void removeDomainShouldThrowIfTheDomainIsAbsent() throws DomainListException { - - } -} http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java ---------------------------------------------------------------------- diff --git a/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java b/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java deleted file mode 100644 index 373ead1..0000000 --- a/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java +++ /dev/null @@ -1,57 +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.rrt.hbase; - -import org.apache.commons.configuration.DefaultConfigurationBuilder; -import org.apache.james.domainlist.hbase.def.HDomainList; -import org.apache.james.mailbox.hbase.HBaseClusterSingleton; -import org.apache.james.rrt.hbase.def.HRecipientRewriteTable; -import org.apache.james.rrt.lib.AbstractRecipientRewriteTable; -import org.apache.james.rrt.lib.AbstractRecipientRewriteTableTest; -import org.apache.james.system.hbase.TablePool; -import org.apache.james.user.hbase.def.HUsersRepository; -import org.junit.After; -import org.junit.Before; - -public class HBaseRecipientRewriteTableTest extends AbstractRecipientRewriteTableTest { - - private static final HBaseClusterSingleton cluster = HBaseClusterSingleton.build(); - - @Before - public void setMeUp() throws Exception { - TablePool.getInstance(cluster.getConf()); - super.setUp(); - } - - @Override - @After - public void tearDown() throws Exception { - cluster.clearTable(new String(HDomainList.TABLE_NAME)); - cluster.clearTable(new String(HRecipientRewriteTable.TABLE_NAME)); - cluster.clearTable(new String(HUsersRepository.TABLE_NAME)); - super.tearDown(); - } - - @Override - protected AbstractRecipientRewriteTable getRecipientRewriteTable() throws Exception { - HBaseRecipientRewriteTable rrt = new HBaseRecipientRewriteTable(); - rrt.configure(new DefaultConfigurationBuilder()); - return rrt; - } -} http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseStepdefs.java ---------------------------------------------------------------------- diff --git a/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseStepdefs.java b/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseStepdefs.java deleted file mode 100644 index 6359743..0000000 --- a/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseStepdefs.java +++ /dev/null @@ -1,67 +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.rrt.hbase; - -import java.io.IOException; - -import org.apache.commons.configuration.DefaultConfigurationBuilder; -import org.apache.james.domainlist.hbase.def.HDomainList; -import org.apache.james.mailbox.hbase.HBaseClusterSingleton; -import org.apache.james.rrt.hbase.def.HRecipientRewriteTable; -import org.apache.james.rrt.lib.AbstractRecipientRewriteTable; -import org.apache.james.rrt.lib.RewriteTablesStepdefs; -import org.apache.james.system.hbase.TablePool; -import org.apache.james.user.hbase.def.HUsersRepository; - -import cucumber.api.java.After; -import cucumber.api.java.Before; - -public class HBaseStepdefs { - - private static final HBaseClusterSingleton cluster = HBaseClusterSingleton.build(); - - private RewriteTablesStepdefs mainStepdefs; - - public HBaseStepdefs(RewriteTablesStepdefs mainStepdefs) { - try { - this.mainStepdefs = mainStepdefs; - TablePool.getInstance(cluster.getConf()); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - @Before - public void setup() throws Throwable { - mainStepdefs.rewriteTable = getRecipientRewriteTable(); - } - - @After - public void tearDown() { - cluster.clearTable(new String(HDomainList.TABLE_NAME)); - cluster.clearTable(new String(HRecipientRewriteTable.TABLE_NAME)); - cluster.clearTable(new String(HUsersRepository.TABLE_NAME)); - } - - private AbstractRecipientRewriteTable getRecipientRewriteTable() throws Exception { - HBaseRecipientRewriteTable rrt = new HBaseRecipientRewriteTable(); - rrt.configure(new DefaultConfigurationBuilder()); - return rrt; - } -} http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/RewriteTablesTest.java ---------------------------------------------------------------------- diff --git a/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/RewriteTablesTest.java b/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/RewriteTablesTest.java deleted file mode 100644 index 0ea9b02..0000000 --- a/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/RewriteTablesTest.java +++ /dev/null @@ -1,32 +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.rrt.hbase; - -import org.junit.runner.RunWith; - -import cucumber.api.CucumberOptions; -import cucumber.api.junit.Cucumber; - -@RunWith(Cucumber.class) -@CucumberOptions( - features = { "classpath:cucumber/" }, - glue = { "org.apache.james.rrt.lib", "org.apache.james.rrt.hbase" } - ) -public class RewriteTablesTest { -} http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/data/data-hbase/src/test/java/org/apache/james/system/hbase/TablePoolTest.java ---------------------------------------------------------------------- diff --git a/server/data/data-hbase/src/test/java/org/apache/james/system/hbase/TablePoolTest.java b/server/data/data-hbase/src/test/java/org/apache/james/system/hbase/TablePoolTest.java deleted file mode 100644 index 536afa9..0000000 --- a/server/data/data-hbase/src/test/java/org/apache/james/system/hbase/TablePoolTest.java +++ /dev/null @@ -1,61 +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.system.hbase; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.io.IOException; - -import org.apache.james.mailbox.hbase.HBaseClusterSingleton; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * Simple tests for the TablePool singleton class. - * Check that the returned singleton and table instances and not null. - */ -public class TablePoolTest { - - private static final HBaseClusterSingleton cluster = HBaseClusterSingleton.build(); - - @BeforeClass - public static void setMeUp() throws IOException { - TablePool.getInstance(cluster.getConf()); - } - - @Test - public void testGetInstance() throws IOException { - assertThat(TablePool.getInstance()).isNotNull(); - } - - @Test - public void testGetDomainlistTable() throws IOException { - assertThat(TablePool.getInstance().getDomainlistTable()).isNotNull(); - } - - @Test - public void testGetRecipientRewriteTable() throws IOException { - assertThat(TablePool.getInstance().getRecipientRewriteTable()).isNotNull(); - } - - @Test - public void testGetUsersRepositoryTable() throws IOException { - assertThat(TablePool.getInstance().getUsersRepositoryTable()).isNotNull(); - } -} http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/data/data-hbase/src/test/java/org/apache/james/user/hbase/HBaseUsersRepositoryTest.java ---------------------------------------------------------------------- diff --git a/server/data/data-hbase/src/test/java/org/apache/james/user/hbase/HBaseUsersRepositoryTest.java b/server/data/data-hbase/src/test/java/org/apache/james/user/hbase/HBaseUsersRepositoryTest.java deleted file mode 100644 index 4647a76..0000000 --- a/server/data/data-hbase/src/test/java/org/apache/james/user/hbase/HBaseUsersRepositoryTest.java +++ /dev/null @@ -1,82 +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.user.hbase; - -import java.io.IOException; -import java.util.Iterator; - -import org.apache.commons.configuration.DefaultConfigurationBuilder; -import org.apache.james.mailbox.hbase.HBaseClusterSingleton; -import org.apache.james.system.hbase.TablePool; -import org.apache.james.user.api.UsersRepositoryException; -import org.apache.james.user.lib.AbstractUsersRepository; -import org.apache.james.user.lib.AbstractUsersRepositoryTest; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; - -/** - * Tests for the HBase UsersRepository implementation. - * - * Simply create the needed HBaseUsersRepository instance, and let the - * AbstractUsersRepositoryTest run the tests - */ -public class HBaseUsersRepositoryTest extends AbstractUsersRepositoryTest { - - private static final HBaseClusterSingleton cluster = HBaseClusterSingleton.build(); - - @BeforeClass - public static void setMeUp() throws IOException { - TablePool.getInstance(cluster.getConf()); - } - - @Before - @Override - public void setUp() throws Exception { - super.setUp(); - deleteAll(); - } - - /** - * Delete all users in the repository. Used between each tests. - * - * @throws UsersRepositoryException - * @throws Exception - */ - private void deleteAll() throws Exception { - Iterator<String> it = getUsersRepository().list(); - while (it.hasNext()) { - getUsersRepository().removeUser(it.next()); - } - } - - @Override - protected AbstractUsersRepository getUsersRepository() throws Exception { - HBaseUsersRepository userRepository = new HBaseUsersRepository(); - userRepository.configure(new DefaultConfigurationBuilder()); - return userRepository; - } - - @Override - @Ignore - @Test(expected = UsersRepositoryException.class) - public void removeUserShouldThrowWhenUserNotInRepository() throws UsersRepositoryException { - } -} http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/data/data-hbase/src/test/resources/hadoop-metrics2.properties ---------------------------------------------------------------------- diff --git a/server/data/data-hbase/src/test/resources/hadoop-metrics2.properties b/server/data/data-hbase/src/test/resources/hadoop-metrics2.properties deleted file mode 100644 index e5a9785..0000000 --- a/server/data/data-hbase/src/test/resources/hadoop-metrics2.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Configuration of the "dfs" context for null -dfs.class=org.apache.hadoop.metrics.spi.NullContext - -# Configuration of the "mapred" context for null -mapred.class=org.apache.hadoop.metrics.spi.NullContext - -# Configuration of the "jvm" context for null -jvm.class=org.apache.hadoop.metrics.spi.NullContext http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/data/data-hbase/src/test/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/server/data/data-hbase/src/test/resources/log4j.properties b/server/data/data-hbase/src/test/resources/log4j.properties deleted file mode 100644 index a4047a6..0000000 --- a/server/data/data-hbase/src/test/resources/log4j.properties +++ /dev/null @@ -1,23 +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. - -log4j.rootLogger=WARN, A1 -log4j.appender.A1=org.apache.log4j.ConsoleAppender -log4j.appender.A1.layout=org.apache.log4j.PatternLayout - -# Print the date in ISO 8601 format -log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/karaf/features/src/main/resources/features.xml ---------------------------------------------------------------------- diff --git a/server/karaf/features/src/main/resources/features.xml b/server/karaf/features/src/main/resources/features.xml index 25b8716..081f486 100644 --- a/server/karaf/features/src/main/resources/features.xml +++ b/server/karaf/features/src/main/resources/features.xml @@ -151,10 +151,6 @@ </bundle> </feature> - <!--<feature name="james-server-data-hbase" version="${project.version}">--> - <!--<bundle>mvn:org.apache.james/james-server-data-hbase/${project.version}</bundle>--> - <!--</feature>--> - <!--<feature name="james-server-data-jcr" version="${project.version}">--> <!--<bundle>mvn:org.apache.james/james-server-data-jcr/${project.version}</bundle>--> <!--</feature>--> http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/pom.xml ---------------------------------------------------------------------- diff --git a/server/pom.xml b/server/pom.xml index 766ff2b..c90ea73 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -58,7 +58,6 @@ <module>data/data-api</module> <module>data/data-cassandra</module> <module>data/data-file</module> - <module>data/data-hbase</module> <module>data/data-jcr</module> <module>data/data-jdbc</module> <module>data/data-jmap</module> http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/src/site/site.xml ---------------------------------------------------------------------- diff --git a/src/site/site.xml b/src/site/site.xml index 89e4eb2..2135b16 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -202,7 +202,6 @@ <item name="Mailbox Maildir" href="/mailbox/mailbox-maildir.html" /> <item name="Mailbox JPA" href="/mailbox/mailbox-jpa.html" /> <item name="Mailbox JCR" href="/mailbox/mailbox-jcr.html" /> - <item name="Mailbox HBase" href="/mailbox/mailbox-hbase.html" /> </item> <item name="Wiring" href="/mailbox/mailbox-spring.html" /> <item name="Download releases" href="http://james.apache.org/download.cgi" /> http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/src/site/xdoc/mailbox/index.xml ---------------------------------------------------------------------- diff --git a/src/site/xdoc/mailbox/index.xml b/src/site/xdoc/mailbox/index.xml index 6612f1e..fd2ba9f 100644 --- a/src/site/xdoc/mailbox/index.xml +++ b/src/site/xdoc/mailbox/index.xml @@ -50,7 +50,6 @@ <li><a href="mailbox-maildir.html">Maildir</a></li> <li><a href="mailbox-jpa.html">JPA</a> </li> <li><a href="mailbox-jcr.html">JCR</a> </li> - <li><a href="mailbox-hbase.html">HBase</a>)</li> </ul> </section> http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/src/site/xdoc/mailbox/mailbox-api.xml ---------------------------------------------------------------------- diff --git a/src/site/xdoc/mailbox/mailbox-api.xml b/src/site/xdoc/mailbox/mailbox-api.xml index d1ad1ad..d40aa6b 100644 --- a/src/site/xdoc/mailbox/mailbox-api.xml +++ b/src/site/xdoc/mailbox/mailbox-api.xml @@ -39,8 +39,7 @@ <p>Each implementation <a href="mailbox-memory.html">Memory</a>, <a href="mailbox-maildir.html">Maildir</a>, <a href="mailbox-jpa.html">JPA</a>, - <a href="mailbox-jcr.html">JCR (Deprecated)</a>, - <a href="mailbox-hbase.html">HBase (Deprecated)</a>) is responsible + <a href="mailbox-jcr.html">JCR (Deprecated)</a>) is responsible to implement the management interfaces. All "common/util" implementations reside in the <a href="mailbox-store.html">Mailbox Store</a> module.</p> </section> http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/src/site/xdoc/mailbox/mailbox-hbase.xml ---------------------------------------------------------------------- diff --git a/src/site/xdoc/mailbox/mailbox-hbase.xml b/src/site/xdoc/mailbox/mailbox-hbase.xml deleted file mode 100644 index a2a06b9..0000000 --- a/src/site/xdoc/mailbox/mailbox-hbase.xml +++ /dev/null @@ -1,143 +0,0 @@ -<?xml version="1.0"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<document> - - <properties> - <title>Mailbox HBase (Deprecated)</title> - </properties> - - <body> - <section name="Mailbox HBase Responsibility"> - <div class="ui-widget"> - <div class="ui-priority-secondary ui-corner-all"> - <p> <span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span> - This implementation has been deprecated in the 3.2.0 release of James. It will be removed in the next (3.3.0) release. - We strongly encourage you to choose another mailbox implemetation (JPA for traditional SQL or Cassandra for NoSQL). - By the way, if you have some development skills and you would like to support this backend, - we will be really pleased to help you maintaining this project. - </p> - </div> - </div> - - <p>This module provides a mailbox implementation for persisting mailboxes (messages, and subscriptions) in a HBase cluster.</p> - <p>It only supports the Basic capability.</p> - </section> - - <section name="Overview"> - <p> - This should provide an overview of the design and implementation of Mailbox HBase. - <!-- - The current design is illustrated in <img src="apache-james-mailbox-hbase/images/james-hbase-mailbox-schema.svg"/>. It is generated from a MindMap file that you can find in the sources. - --> - </p> - <subsection name="Tables"> - <p>The current implementations stores Messages, Mailboxes and Subscriptions in their own tables.</p> There are: - <ul> - <li>JAMES_MAILBOXES - for storing mailboxes.</li> - <li>JAMES_MESSAGES - for storing messages.</li> - <li>JAMES_SUBSCRIPTIONS - for storing user subscriptions.</li> - </ul> - </subsection> - - <subsection name="Mailbox UID generation"> - <p>Mailboxes are identified using a unique - <a href="http://download.oracle.com/javase/6/docs/api/java/util/UUID.html">UUID</a> - </p> - </subsection> - - <subsection name="Message UID generation"> - <p>The IMAP RFC states that mailboxes should keep message UIDs unique and in ascending order. Mailbox HBase uses - <a href="http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTable.html#incrementColumnValue(byte[],%20byte[],%20byte[],%20long)">incrementColumnValue</a> - int the HBaseUidProvider implementation to achieve this. - </p> - </subsection> - <subsection name="HBase row keys"> - HBase uses keys to access values. The current design uses the following row key structure: - <ul> - <li>JAMES_MAILBOXES: row key is mailbox UUID</li> - <li>JAMES_MESSAGES: row key is compound by concatenating mailbox UID and message UID (in reverseorder). - This way we have messages groupd by mailbox and in descending order (most recent first). - </li> - <li>JAMES_SUBSCRIPTION: row key is user name.</li> - </ul> - </subsection> - <subsection name="Misc"> - <p>Message bodies (more importantly big attachements) sent to many users are stored many times. There is no space sharing yet.</p> - <p>Message data and message meta-data (flags and properties) are stored in different column families - so the column family optimization options can apply. Keep in mind that message data does not change, while meta-data does change. - </p> - </subsection> - - </section> - - <section name="Installation"> - <p>In order for the mailbox implementation to work you have to provide it with a link to your HBase cluster. Putting - <em>hbase-site.xml</em> on the class path should be enough. Mailbox HBase will pick it up an read all the configuration parameters from it. - </p> - </section> - - <section name="Mailbox HBase Classes"> - <p>This is a overview of the most important classes in the implementation. </p> - <subsection name="HBaseMailboxManager"> - <p> - <strong>HBaseMailboxManager</strong> extends the - <strong>StoreMailboxManager</strong> class. - It has a simple implementation that just overrides the - <em>doCreateMailbox</em> method to return a HBaseMailbox implementation and - <em>createMessageManger</em> method to return a HBaseMessageManager implementation. - Other then that it relies on the default StoreMailboxManager implementation. - </p> - </subsection> - - <subsection name="HBaseMessageManager"> - <p> - <strong>HBaseMessageManager</strong> extends StoreMailboxManager and provides an implementation for getPermanentFlags method. - </p> - </subsection> - - <subsection name="Chunked Streams"> - <p>Message bodies can have varying sizes. Some have attachements of up to 25Mb, some even greater. - There are practical limits to the size of a HBase column (see - <a href="http://hbase.apache.org/book.html#supported.datatypes">http://hbase.apache.org/book.html#supported.datatypes</a>). - To address this issue, the implementation splits the message into smaller chunks and saves each chunk into a separate column. - The columns have increasing integer names starting with 1 and there can be at most Long.MAX_VALUE chunks. - </p> - <p> - The magic happens in - <strong>ChunkInputStream</strong> and - <strong>ChunkOutputStream</strong> that extend - InputStream and OutputStream from java.io package. - <br/> - Data is retrieved using HBase Get operation and stored into an internal byte array. - Data is stored using HBase Put operation and chunks are split into - <strong>chunkSize</strong> configurable sized chunks. - Things could be more efficient if HBase had streaming support. - </p> - </subsection> - <subsection name="HBaseMessage"> - <p>Extends AbstractMessage and represents a message in the message store. - What is important to remember is that the current implementation retrieves just the message meta-data from HBase - and uses ChunkInputStream to load the message body only when needed. - </p> - </subsection> - </section> - </body> - -</document> http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/src/site/xdoc/mailbox/mailbox-spring.xml ---------------------------------------------------------------------- diff --git a/src/site/xdoc/mailbox/mailbox-spring.xml b/src/site/xdoc/mailbox/mailbox-spring.xml index f12e08e..1c40755 100644 --- a/src/site/xdoc/mailbox/mailbox-spring.xml +++ b/src/site/xdoc/mailbox/mailbox-spring.xml @@ -44,7 +44,6 @@ <ul> <li>spring-mailbox-memory.xml</li> <li>spring-mailbox-maildir.xml</li> - <li>spring-mailbox-hbase.xml</li> <li>spring-mailbox-jcr.xml</li> <li>spring-mailbox-jpa.xml</li> <li>spring-mailbox-authenticator.xml</li> http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/src/site/xdoc/mailbox/source-code.xml ---------------------------------------------------------------------- diff --git a/src/site/xdoc/mailbox/source-code.xml b/src/site/xdoc/mailbox/source-code.xml index c36ddb3..c09c2a0 100644 --- a/src/site/xdoc/mailbox/source-code.xml +++ b/src/site/xdoc/mailbox/source-code.xml @@ -31,8 +31,7 @@ and the different implementations we propose (<a href="mailbox-memory.html">Memory</a>, <a href="mailbox-maildir.html">Maildir</a>, <a href="mailbox-jpa.html">JPA</a>, - <a href="mailbox-jcr.html">JCR (Deprecated)</a> and - <a href="mailbox-hbase.html">HBase (Deprecated)</a>). + <a href="mailbox-jcr.html">JCR (Deprecated)</a>). </p> <p>A module for <a href="mailbox-tool.html">tooling</a> is also available. </p> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
