http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseSecurityTest.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseSecurityTest.java b/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseSecurityTest.java deleted file mode 100644 index 2f0da9b..0000000 --- a/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseSecurityTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information * - * regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the * - * "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, * - * software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * - * KIND, either express or implied. See the License for the * - * specific language governing permissions and limitations * - * under the License. * - ****************************************************************/ - -package org.apache.james.mpt.imapmailbox.hbase; - -import org.apache.james.mpt.api.ImapHostSystem; -import org.apache.james.mpt.imapmailbox.hbase.host.HBaseHostSystem; -import org.apache.james.mpt.imapmailbox.suite.Security; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; - -@Ignore -public class HBaseSecurityTest extends Security { - - private ImapHostSystem system; - - @Override - @Before - public void setUp() throws Exception { - system = HBaseHostSystem.build(); - system.beforeTest(); - super.setUp(); - } - - @Override - protected ImapHostSystem createImapHostSystem() { - return system; - } - - @After - public void tearDown() throws Exception { - system.afterTest(); - } - -}
http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseSelectTest.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseSelectTest.java b/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseSelectTest.java deleted file mode 100644 index 831bb16..0000000 --- a/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseSelectTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information * - * regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the * - * "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, * - * software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * - * KIND, either express or implied. See the License for the * - * specific language governing permissions and limitations * - * under the License. * - ****************************************************************/ - -package org.apache.james.mpt.imapmailbox.hbase; - -import org.apache.james.mpt.api.ImapHostSystem; -import org.apache.james.mpt.imapmailbox.hbase.host.HBaseHostSystem; -import org.apache.james.mpt.imapmailbox.suite.Select; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; - -@Ignore -public class HBaseSelectTest extends Select { - - private ImapHostSystem system; - - @Override - @Before - public void setUp() throws Exception { - system = HBaseHostSystem.build(); - system.beforeTest(); - super.setUp(); - } - - @Override - protected ImapHostSystem createImapHostSystem() { - return system; - } - - @After - public void tearDown() throws Exception { - system.afterTest(); - } - -} http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseSelectedInboxTest.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseSelectedInboxTest.java b/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseSelectedInboxTest.java deleted file mode 100644 index 747c83c..0000000 --- a/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseSelectedInboxTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information * - * regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the * - * "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, * - * software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * - * KIND, either express or implied. See the License for the * - * specific language governing permissions and limitations * - * under the License. * - ****************************************************************/ - -package org.apache.james.mpt.imapmailbox.hbase; - -import org.apache.james.mpt.api.ImapHostSystem; -import org.apache.james.mpt.imapmailbox.hbase.host.HBaseHostSystem; -import org.apache.james.mpt.imapmailbox.suite.SelectedInbox; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; - -@Ignore -public class HBaseSelectedInboxTest extends SelectedInbox { - - private ImapHostSystem system; - - @Override - @Before - public void setUp() throws Exception { - system = HBaseHostSystem.build(); - system.beforeTest(); - super.setUp(); - } - - @Override - protected ImapHostSystem createImapHostSystem() { - return system; - } - - @After - public void tearDown() throws Exception { - system.afterTest(); - } - -} http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseSelectedStateTest.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseSelectedStateTest.java b/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseSelectedStateTest.java deleted file mode 100644 index 2029655..0000000 --- a/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseSelectedStateTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information * - * regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the * - * "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, * - * software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * - * KIND, either express or implied. See the License for the * - * specific language governing permissions and limitations * - * under the License. * - ****************************************************************/ - -package org.apache.james.mpt.imapmailbox.hbase; - -import org.apache.james.mpt.api.ImapHostSystem; -import org.apache.james.mpt.imapmailbox.hbase.host.HBaseHostSystem; -import org.apache.james.mpt.imapmailbox.suite.SelectedState; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; - -@Ignore -public class HBaseSelectedStateTest extends SelectedState { - - private ImapHostSystem system; - - @Override - @Before - public void setUp() throws Exception { - system = HBaseHostSystem.build(); - system.beforeTest(); - super.setUp(); - } - - @Override - protected ImapHostSystem createImapHostSystem() { - return system; - } - - @After - public void tearDown() throws Exception { - system.afterTest(); - } - -} http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseUidSearchOnIndexTest.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseUidSearchOnIndexTest.java b/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseUidSearchOnIndexTest.java deleted file mode 100644 index 99163dc..0000000 --- a/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseUidSearchOnIndexTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information * - * regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the * - * "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, * - * software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * - * KIND, either express or implied. See the License for the * - * specific language governing permissions and limitations * - * under the License. * - ****************************************************************/ - -package org.apache.james.mpt.imapmailbox.hbase; - -import org.apache.james.mpt.api.ImapHostSystem; -import org.apache.james.mpt.imapmailbox.hbase.host.HBaseHostSystem; -import org.apache.james.mpt.imapmailbox.suite.UidSearchOnIndex; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; - -@Ignore -public class HBaseUidSearchOnIndexTest extends UidSearchOnIndex { - - private ImapHostSystem system; - - @Override - @Before - public void setUp() throws Exception { - system = HBaseHostSystem.build(); - system.beforeTest(); - super.setUp(); - } - - @Override - protected ImapHostSystem createImapHostSystem() { - return system; - } - - @After - public void tearDown() throws Exception { - system.afterTest(); - } - -} http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseUidSearchTest.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseUidSearchTest.java b/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseUidSearchTest.java deleted file mode 100644 index 702a8c1..0000000 --- a/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseUidSearchTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information * - * regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the * - * "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, * - * software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * - * KIND, either express or implied. See the License for the * - * specific language governing permissions and limitations * - * under the License. * - ****************************************************************/ - -package org.apache.james.mpt.imapmailbox.hbase; - -import org.apache.james.mpt.api.ImapHostSystem; -import org.apache.james.mpt.imapmailbox.hbase.host.HBaseHostSystem; -import org.apache.james.mpt.imapmailbox.suite.UidSearch; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; - -@Ignore -public class HBaseUidSearchTest extends UidSearch { - - private ImapHostSystem system; - - @Override - @Before - public void setUp() throws Exception { - system = HBaseHostSystem.build(); - system.beforeTest(); - super.setUp(); - } - - @Override - protected ImapHostSystem createImapHostSystem() { - return system; - } - - @After - public void tearDown() throws Exception { - system.afterTest(); - } - -} http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseUserFlagsSupportTest.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseUserFlagsSupportTest.java b/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseUserFlagsSupportTest.java deleted file mode 100644 index 968ad27..0000000 --- a/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/HBaseUserFlagsSupportTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information * - * regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the * - * "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, * - * software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * - * KIND, either express or implied. See the License for the * - * specific language governing permissions and limitations * - * under the License. * - ****************************************************************/ - -package org.apache.james.mpt.imapmailbox.hbase; - -import org.apache.james.mpt.api.ImapHostSystem; -import org.apache.james.mpt.imapmailbox.hbase.host.HBaseHostSystem; -import org.apache.james.mpt.imapmailbox.suite.UserFlagsSupport; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; - -@Ignore -public class HBaseUserFlagsSupportTest extends UserFlagsSupport { - - private ImapHostSystem system; - - @Override - @Before - public void setUp() throws Exception { - system = HBaseHostSystem.build(); - system.beforeTest(); - super.setUp(); - } - - @Override - protected ImapHostSystem createImapHostSystem() { - return system; - } - - @After - public void tearDown() throws Exception { - system.afterTest(); - } - -} http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/host/HBaseHostSystem.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/host/HBaseHostSystem.java b/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/host/HBaseHostSystem.java deleted file mode 100644 index df29157..0000000 --- a/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/host/HBaseHostSystem.java +++ /dev/null @@ -1,190 +0,0 @@ -/**************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information * - * regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the * - * "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, * - * software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * - * KIND, either express or implied. See the License for the * - * specific language governing permissions and limitations * - * under the License. * - ****************************************************************/ -package org.apache.james.mpt.imapmailbox.hbase.host; - -import java.io.File; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang.NotImplementedException; -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.hbase.HBaseConfiguration; -import org.apache.hadoop.hbase.HBaseTestingUtility; -import org.apache.hadoop.hbase.MiniHBaseCluster; -import org.apache.james.core.quota.QuotaCount; -import org.apache.james.core.quota.QuotaSize; -import org.apache.james.imap.api.process.ImapProcessor; -import org.apache.james.imap.encode.main.DefaultImapEncoderFactory; -import org.apache.james.imap.main.DefaultImapDecoderFactory; -import org.apache.james.imap.processor.main.DefaultImapProcessorFactory; -import org.apache.james.mailbox.MailboxManager; -import org.apache.james.mailbox.MailboxSession; -import org.apache.james.mailbox.SubscriptionManager; -import org.apache.james.mailbox.acl.GroupMembershipResolver; -import org.apache.james.mailbox.acl.MailboxACLResolver; -import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver; -import org.apache.james.mailbox.acl.UnionMailboxACLResolver; -import org.apache.james.mailbox.hbase.HBaseMailboxManager; -import org.apache.james.mailbox.hbase.HBaseMailboxSessionMapperFactory; -import org.apache.james.mailbox.hbase.mail.HBaseModSeqProvider; -import org.apache.james.mailbox.hbase.mail.HBaseUidProvider; -import org.apache.james.mailbox.store.JVMMailboxPathLocker; -import org.apache.james.mailbox.store.StoreMailboxAnnotationManager; -import org.apache.james.mailbox.store.StoreRightManager; -import org.apache.james.mailbox.store.StoreSubscriptionManager; -import org.apache.james.mailbox.store.event.DefaultDelegatingMailboxListener; -import org.apache.james.mailbox.store.event.MailboxEventDispatcher; -import org.apache.james.mailbox.store.mail.model.DefaultMessageId; -import org.apache.james.mailbox.store.mail.model.impl.MessageParser; -import org.apache.james.mailbox.store.quota.DefaultUserQuotaRootResolver; -import org.apache.james.mailbox.store.quota.NoQuotaManager; -import org.apache.james.metrics.api.NoopMetricFactory; -import org.apache.james.mpt.api.ImapFeatures; -import org.apache.james.mpt.api.ImapFeatures.Feature; -import org.apache.james.mpt.host.JamesImapHostSystem; - -public class HBaseHostSystem extends JamesImapHostSystem { - - public static final String META_DATA_DIRECTORY = "target/user-meta-data"; - private static final ImapFeatures SUPPORTED_FEATURES = ImapFeatures.of(Feature.NAMESPACE_SUPPORT, - Feature.MOD_SEQ_SEARCH); - - public static HBaseHostSystem host = null; - /** Set this to false if you wish to test it against a real cluster. - * In that case you should provide the configuration file for the real - * cluster on the classpath. - */ - public static Boolean useMiniCluster = true; - - private MiniHBaseCluster hbaseCluster; - private final Configuration conf; - private HBaseMailboxManager mailboxManager; - - public static synchronized JamesImapHostSystem build() throws Exception { - if (host == null) { - host = new HBaseHostSystem(useMiniCluster); - } - return host; - } - - public HBaseHostSystem(boolean useMiniCluster) throws Exception { - if (useMiniCluster) { - HBaseTestingUtility htu = new HBaseTestingUtility(); - htu.getConfiguration().setBoolean("dfs.support.append", true); - try { - hbaseCluster = htu.startMiniCluster(); - conf = hbaseCluster.getConfiguration(); - } catch (Exception e) { - throw new Exception("Error starting MiniCluster ", e); - } - } else { - conf = HBaseConfiguration.create(); - } - } - - - @Override - public void beforeTest() throws Exception { - super.beforeTest(); - final HBaseModSeqProvider modSeqProvider = new HBaseModSeqProvider(conf); - final HBaseUidProvider uidProvider = new HBaseUidProvider(conf); - DefaultMessageId.Factory messageIdFactory = new DefaultMessageId.Factory(); - final HBaseMailboxSessionMapperFactory mapperFactory = new HBaseMailboxSessionMapperFactory( - conf, uidProvider, modSeqProvider, messageIdFactory); - MailboxACLResolver aclResolver = new UnionMailboxACLResolver(); - GroupMembershipResolver groupMembershipResolver = new SimpleGroupMembershipResolver(); - MessageParser messageParser = new MessageParser(); - - DefaultDelegatingMailboxListener delegatingListener = new DefaultDelegatingMailboxListener(); - MailboxEventDispatcher mailboxEventDispatcher = new MailboxEventDispatcher(delegatingListener); - StoreRightManager storeRightManager = new StoreRightManager(mapperFactory, aclResolver, groupMembershipResolver, mailboxEventDispatcher); - StoreMailboxAnnotationManager annotationManager = new StoreMailboxAnnotationManager(mapperFactory, storeRightManager); - mailboxManager = new HBaseMailboxManager(mapperFactory, authenticator, authorizator, - new JVMMailboxPathLocker(), messageParser, - messageIdFactory, mailboxEventDispatcher, delegatingListener, - annotationManager, storeRightManager); - mailboxManager.init(); - - SubscriptionManager subscriptionManager = new StoreSubscriptionManager(mapperFactory); - - final ImapProcessor defaultImapProcessorFactory = - DefaultImapProcessorFactory.createDefaultProcessor( - mailboxManager, - subscriptionManager, - new NoQuotaManager(), - new DefaultUserQuotaRootResolver(mapperFactory), - new NoopMetricFactory()); - - resetUserMetaData(); - - configure(new DefaultImapDecoderFactory().buildImapDecoder(), - new DefaultImapEncoderFactory().buildImapEncoder(), - defaultImapProcessorFactory); - } - - @Override - public void afterTest() throws Exception { - super.afterTest(); - resetUserMetaData(); - if (mailboxManager != null) { - MailboxSession session = mailboxManager.createSystemSession("test"); - mailboxManager.startProcessingRequest(session); - mailboxManager.deleteEverything(session); - mailboxManager.endProcessingRequest(session); - mailboxManager.logout(session, false); - } - } - - public final void resetUserMetaData() throws Exception { - File dir = new File(META_DATA_DIRECTORY); - if (dir.exists()) { - FileUtils.deleteDirectory(dir); - } - dir.mkdirs(); - } - - @Override - protected void finalize() throws Throwable { - super.finalize(); - if (useMiniCluster) { - if (hbaseCluster != null) { - hbaseCluster.shutdown(); - } - } - } - - @Override - protected MailboxManager getMailboxManager() { - return mailboxManager; - } - - @Override - public boolean supports(Feature... features) { - return SUPPORTED_FEATURES.supports(features); - } - - @Override - public void setQuotaLimits(QuotaCount maxMessageQuota, QuotaSize maxStorageQuota) { - throw new NotImplementedException(); - } - - @Override - protected void await() { - - } -} http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/mpt/impl/imap-mailbox/hbase/src/test/resources/logback-test.xml ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/hbase/src/test/resources/logback-test.xml b/mpt/impl/imap-mailbox/hbase/src/test/resources/logback-test.xml deleted file mode 100644 index bc84c7b..0000000 --- a/mpt/impl/imap-mailbox/hbase/src/test/resources/logback-test.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<configuration> - - <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator"> - <resetJUL>true</resetJUL> - </contextListener> - - <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> - <encoder> - <pattern>%d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx</pattern> - <immediateFlush>false</immediateFlush> - </encoder> - </appender> - - <root level="WARN"> - <appender-ref ref="CONSOLE" /> - </root> - - <logger name="org.apache.james" level="DEBUG" /> - - -</configuration> http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/mpt/impl/imap-mailbox/pom.xml ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/pom.xml b/mpt/impl/imap-mailbox/pom.xml index 288c86b..f384f58 100644 --- a/mpt/impl/imap-mailbox/pom.xml +++ b/mpt/impl/imap-mailbox/pom.xml @@ -38,7 +38,6 @@ <module>cyrus</module> <module>elasticsearch</module> <module>external-james</module> - <module>hbase</module> <module>inmemory</module> <module>jcr</module> <module>jpa</module> @@ -74,12 +73,6 @@ </dependency> <dependency> <groupId>${james.groupId}</groupId> - <artifactId>apache-james-mpt-imapmailbox-hbase</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>${james.groupId}</groupId> <artifactId>apache-james-mpt-imapmailbox-inmemory</artifactId> <version>${project.version}</version> <scope>test</scope> http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/mpt/pom.xml ---------------------------------------------------------------------- diff --git a/mpt/pom.xml b/mpt/pom.xml index 12b341c..794eb1b 100644 --- a/mpt/pom.xml +++ b/mpt/pom.xml @@ -56,7 +56,6 @@ <derby.version>10.14.2.0</derby.version> <guice.version>4.0</guice.version> <hadoop.version>1.0.1</hadoop.version> - <hbase.version>0.94.27</hbase.version> <junit.version>4.11</junit.version> <lucene-core.version>3.6.0</lucene-core.version> <slf4j.version>1.7.25</slf4j.version> http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 59e606e..24e4525 100644 --- a/pom.xml +++ b/pom.xml @@ -591,7 +591,6 @@ <camel.version>2.22.1</camel.version> <derby.version>10.14.2.0</derby.version> <hadoop.version>1.1.1</hadoop.version> - <hbase.version>0.94.27</hbase.version> <javax.inject.version>1</javax.inject.version> <javax.activation.groupId>javax.activation</javax.activation.groupId> <javax.activation.artifactId>activation</javax.activation.artifactId> @@ -757,17 +756,6 @@ </dependency> <dependency> <groupId>${james.groupId}</groupId> - <artifactId>apache-james-mailbox-hbase</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>${james.groupId}</groupId> - <artifactId>apache-james-mailbox-hbase</artifactId> - <version>${project.version}</version> - <classifier>tests</classifier> - </dependency> - <dependency> - <groupId>${james.groupId}</groupId> <artifactId>apache-james-mailbox-jcr</artifactId> <version>${project.version}</version> </dependency> @@ -1228,11 +1216,6 @@ </dependency> <dependency> <groupId>${james.groupId}</groupId> - <artifactId>james-server-data-hbase</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>${james.groupId}</groupId> <artifactId>james-server-data-jcr</artifactId> <version>${project.version}</version> </dependency> @@ -2184,29 +2167,6 @@ <version>${hadoop.version}</version> </dependency> <dependency> - <groupId>org.apache.hbase</groupId> - <artifactId>hbase</artifactId> - <version>${hbase.version}</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.hbase</groupId> - <artifactId>hbase</artifactId> - <version>${hbase.version}</version> - <type>test-jar</type> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient-osgi</artifactId> <version>${apache.httpcomponents.version}</version> http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/Overview.md ---------------------------------------------------------------------- diff --git a/server/Overview.md b/server/Overview.md index fe44f6f..f270e8c 100644 --- a/server/Overview.md +++ b/server/Overview.md @@ -26,7 +26,6 @@ I'll explain what I mean by 'component' and 'service' bellow. |-- data `-- data-api `-- data-file - `-- data-hbase `-- data-jcr `-- data-jdbc `-- data-jpa http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/app/pom.xml ---------------------------------------------------------------------- diff --git a/server/app/pom.xml b/server/app/pom.xml index 4dec2a6..3fab093 100644 --- a/server/app/pom.xml +++ b/server/app/pom.xml @@ -121,10 +121,6 @@ <scope>runtime</scope> <exclusions> <exclusion> - <groupId>org.apache.hbase</groupId> - <artifactId>hbase</artifactId> - </exclusion> - <exclusion> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-core</artifactId> </exclusion> @@ -172,33 +168,6 @@ </dependency> <dependency> <groupId>${james.groupId}</groupId> - <artifactId>james-server-data-hbase</artifactId> - <scope>runtime</scope> - <exclusions> - <exclusion> - <groupId>org.jruby</groupId> - <artifactId>jruby-complete</artifactId> - </exclusion> - <exclusion> - <groupId>hsqldb</groupId> - <artifactId>hsqldb</artifactId> - </exclusion> - <exclusion> - <groupId>org.apache.hbase</groupId> - <artifactId>hbase</artifactId> - </exclusion> - <exclusion> - <groupId>org.apache.hadoop</groupId> - <artifactId>hadoop-core</artifactId> - </exclusion> - <exclusion> - <groupId>javax.mail</groupId> - <artifactId>mail</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>${james.groupId}</groupId> <artifactId>james-server-data-jcr</artifactId> <scope>runtime</scope> <exclusions> http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/app/src/main/resources/mailbox.xml ---------------------------------------------------------------------- diff --git a/server/app/src/main/resources/mailbox.xml b/server/app/src/main/resources/mailbox.xml index 4c0cf91..a557c96 100644 --- a/server/app/src/main/resources/mailbox.xml +++ b/server/app/src/main/resources/mailbox.xml @@ -27,7 +27,7 @@ <mailbox> <!-- supported providers are: --> - <!-- jpa, jcr, maildir, hbase, memory --> + <!-- jpa, jcr, maildir, memory --> <!-- --> <!-- Be aware that maildir will only work on unix like operation systems! --> <provider>jpa</provider> http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/app/src/test/resources/mailbox.xml ---------------------------------------------------------------------- diff --git a/server/app/src/test/resources/mailbox.xml b/server/app/src/test/resources/mailbox.xml index 366d377..03ce5eb 100644 --- a/server/app/src/test/resources/mailbox.xml +++ b/server/app/src/test/resources/mailbox.xml @@ -25,7 +25,7 @@ <mailbox> <!-- supported providers are: --> - <!-- jpa, jcr, maildir, hbase, memory --> + <!-- jpa, jcr, maildir, memory --> <!-- --> <!-- Be aware that maildir will only work on unix like operation systems! --> <provider>jpa</provider> http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/container/mailbox-adapter/src/main/resources/mailbox.xml ---------------------------------------------------------------------- diff --git a/server/container/mailbox-adapter/src/main/resources/mailbox.xml b/server/container/mailbox-adapter/src/main/resources/mailbox.xml index 5f0186c..4314234 100644 --- a/server/container/mailbox-adapter/src/main/resources/mailbox.xml +++ b/server/container/mailbox-adapter/src/main/resources/mailbox.xml @@ -22,8 +22,8 @@ <mailbox> <!-- supported providers are: --> - <!-- jpa, jcr, maildir, hbase, memory --> + <!-- jpa, jcr, maildir, memory --> <!-- --> <!-- Be aware that maildir will only work on unix like operation systems! --> <provider>jpa</provider> -</mailbox> \ No newline at end of file +</mailbox> http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factorypostprocessor/MailboxConfigurationBeanFactoryPostProcessor.java ---------------------------------------------------------------------- diff --git a/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factorypostprocessor/MailboxConfigurationBeanFactoryPostProcessor.java b/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factorypostprocessor/MailboxConfigurationBeanFactoryPostProcessor.java index 4cbc9ad..687772c 100644 --- a/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factorypostprocessor/MailboxConfigurationBeanFactoryPostProcessor.java +++ b/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factorypostprocessor/MailboxConfigurationBeanFactoryPostProcessor.java @@ -43,11 +43,10 @@ public class MailboxConfigurationBeanFactoryPostProcessor implements BeanFactory private static final String MEMORY_MAILBOX_MANAGER = "memory-mailboxManager"; private static final String JCR_MAILBOXMANAGER = "jcr-mailboxmanager"; private static final String MAILDIR_MAILBOXMANAGER = "maildir-mailboxmanager"; - private static final String HBASE_MAILBOXMANAGER = "hbase-mailboxmanager"; private static final String CASSANDRA_MAILBOXMANAGER = "cassandra-mailboxmanager"; private static final ImmutableSet<String> MAILBOX_MANAGER_IDS = ImmutableSet.of(JPA_MAILBOXMANAGER, MEMORY_MAILBOX_MANAGER, JCR_MAILBOXMANAGER, MAILDIR_MAILBOXMANAGER, - HBASE_MAILBOXMANAGER, CASSANDRA_MAILBOXMANAGER); + CASSANDRA_MAILBOXMANAGER); @Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { @@ -85,11 +84,6 @@ public class MailboxConfigurationBeanFactoryPostProcessor implements BeanFactory messageMapperFactory = "maildir-sessionMapperFactory"; mailboxIdDeserializer = "maildir-mailbox-id-deserializer"; mailboxIdFactory = "maildir-mailboxIdFactory"; - } else if (provider.equalsIgnoreCase("hbase")) { - mailbox = HBASE_MAILBOXMANAGER; - subscription = "hbase-subscriptionManager"; - messageMapperFactory = "hbase-sessionMapperFactory"; - mailboxIdDeserializer = "hbase-mailbox-id-deserializer"; } else if (provider.equalsIgnoreCase("cassandra")) { mailbox = CASSANDRA_MAILBOXMANAGER; subscription = "cassandra-subscriptionManager"; http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/container/spring/src/main/resources/META-INF/org/apache/james/spring-mailbox-hbase.xml ---------------------------------------------------------------------- diff --git a/server/container/spring/src/main/resources/META-INF/org/apache/james/spring-mailbox-hbase.xml b/server/container/spring/src/main/resources/META-INF/org/apache/james/spring-mailbox-hbase.xml deleted file mode 100644 index daf6820..0000000 --- a/server/container/spring/src/main/resources/META-INF/org/apache/james/spring-mailbox-hbase.xml +++ /dev/null @@ -1,61 +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. ---> - -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation=" - http://www.springframework.org/schema/beans classpath:org/springframework/beans/factory/xml/spring-beans-3.0.xsd"> - - <!-- - Mailbox HBase - Uncomment the definitions if you are using a real hbase cluster. - --> - - <!-- - This is the link to the HBase Cluster. You need to place a valid hbase - config file on the classpath that will be picked up by HBaseConfiguration.create(). - --> - <!-- - <bean id="hbase-conf" class="org.apache.hadoop.hbase.HBaseConfiguration" factory-method="create" /> - - <bean id="hbase-mailboxmanager" class="org.apache.james.mailbox.hbase.HBaseMailboxManager" init-method="init"> - <constructor-arg index="0" ref="hbase-sessionMapperFactory"/> - <constructor-arg index="1" ref="authenticator"/> - <constructor-arg index="2" ref="authorizator"/> - <constructor-arg index="3" ref="hbase-locker"/> - <constructor-arg index="4" ref="aclResolver"/> - <constructor-arg index="5" ref="groupMembershipResolver"/> - </bean> - - <bean id="hbase-sessionMapperFactory" class="org.apache.james.mailbox.hbase.HBaseMailboxSessionMapperFactory"> - <constructor-arg index="0" ref="hbase-conf"/> - <constructor-arg index="1" ref="hbase-uidProvider"/> - <constructor-arg index="2" ref="hbase-modSeqProvider"/> - </bean> - <bean id="hbase-uidProvider" class="org.apache.james.mailbox.hbase.mail.HBaseUidProvider"> - <constructor-arg index="0" ref="hbase-conf"/> - </bean> - <bean id="hbase-modSeqProvider" class="org.apache.james.mailbox.hbase.mail.HBaseModSeqProvider"> - <constructor-arg index="0" ref="hbase-conf"/> - </bean> - - <alias name="locker" alias="hbase-locker"/> - --> -</beans> http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/data/data-hbase/pom.xml ---------------------------------------------------------------------- diff --git a/server/data/data-hbase/pom.xml b/server/data/data-hbase/pom.xml deleted file mode 100644 index 239ceaa..0000000 --- a/server/data/data-hbase/pom.xml +++ /dev/null @@ -1,190 +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>james-server</artifactId> - <version>3.2.0-SNAPSHOT</version> - <relativePath>../../pom.xml</relativePath> - </parent> - - <artifactId>james-server-data-hbase</artifactId> - <packaging>bundle</packaging> - - <name>Apache James :: Server :: Data :: HBase Persistence</name> - <dependencies> - <dependency> - <groupId>${james.groupId}</groupId> - <artifactId>apache-james-mailbox-hbase</artifactId> - <classifier>tests</classifier> - <scope>test</scope> - </dependency> - <dependency> - <groupId>${james.groupId}</groupId> - <artifactId>james-server-data-api</artifactId> - </dependency> - <dependency> - <groupId>${james.groupId}</groupId> - <artifactId>james-server-data-library</artifactId> - </dependency> - <dependency> - <groupId>${james.groupId}</groupId> - <artifactId>james-server-data-library</artifactId> - <type>test-jar</type> - <scope>test</scope> - </dependency> - <dependency> - <groupId>${james.groupId}</groupId> - <artifactId>james-server-dnsservice-api</artifactId> - </dependency> - <dependency> - <groupId>${james.groupId}</groupId> - <artifactId>james-server-dnsservice-test</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>${james.groupId}</groupId> - <artifactId>james-server-lifecycle-api</artifactId> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</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>commons-configuration</groupId> - <artifactId>commons-configuration</artifactId> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - </dependency> - <dependency> - <groupId>io.cucumber</groupId> - <artifactId>cucumber-java</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>io.cucumber</groupId> - <artifactId>cucumber-junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>io.cucumber</groupId> - <artifactId>cucumber-picocontainer</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derby</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.hadoop</groupId> - <artifactId>hadoop-core</artifactId> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.hadoop</groupId> - <artifactId>hadoop-test</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.hbase</groupId> - <artifactId>hbase</artifactId> - <exclusions> - <exclusion> - <groupId>org.jruby</groupId> - <artifactId>jruby-complete</artifactId> - </exclusion> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - </exclusion> - <exclusion> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - </exclusion> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.hbase</groupId> - <artifactId>hbase</artifactId> - <type>test-jar</type> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>org.jruby</groupId> - <artifactId>jruby-complete</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jcl-over-slf4j</artifactId> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <reuseForks>true</reuseForks> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - </plugin> - </plugins> - </build> - -</project> http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/data/data-hbase/src/main/java/org/apache/james/domainlist/hbase/HBaseDomainList.java ---------------------------------------------------------------------- diff --git a/server/data/data-hbase/src/main/java/org/apache/james/domainlist/hbase/HBaseDomainList.java b/server/data/data-hbase/src/main/java/org/apache/james/domainlist/hbase/HBaseDomainList.java deleted file mode 100644 index 1eeb571..0000000 --- a/server/data/data-hbase/src/main/java/org/apache/james/domainlist/hbase/HBaseDomainList.java +++ /dev/null @@ -1,125 +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 java.util.ArrayList; -import java.util.List; - -import javax.inject.Inject; - -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.core.Domain; -import org.apache.james.dnsservice.api.DNSService; -import org.apache.james.domainlist.api.DomainListException; -import org.apache.james.domainlist.hbase.def.HDomainList; -import org.apache.james.domainlist.lib.AbstractDomainList; -import org.apache.james.system.hbase.TablePool; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Implementation of the DomainList 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 HBaseDomainList extends AbstractDomainList { - - /** - * The Logger. - */ - private static final Logger log = LoggerFactory.getLogger(HBaseDomainList.class.getName()); - - @Inject - public HBaseDomainList(DNSService dns) { - super(dns); - } - - @Override - protected boolean containsDomainInternal(Domain domain) throws DomainListException { - try (HTableInterface table = TablePool.getInstance().getDomainlistTable()) { - Get get = new Get(Bytes.toBytes(domain.asString())); - Result result = table.get(get); - if (!result.isEmpty()) { - return true; - } - } catch (IOException e) { - log.error("Error while counting domains from HBase", e); - throw new DomainListException("Error while counting domains from HBase", e); - } - return false; - } - - @Override - public void addDomain(Domain domain) throws DomainListException { - if (containsDomain(domain)) { - throw new DomainListException(domain.name() + " already exists."); - } - try (HTableInterface table = TablePool.getInstance().getDomainlistTable()) { - Put put = new Put(Bytes.toBytes(domain.asString())); - put.add(HDomainList.COLUMN_FAMILY_NAME, HDomainList.COLUMN.DOMAIN, null); - table.put(put); - table.flushCommits(); - } catch (IOException e) { - log.error("Error while adding domain in HBase", e); - throw new DomainListException("Error while adding domain in HBase", e); - } - } - - @Override - public void removeDomain(Domain domain) throws DomainListException { - try (HTableInterface table = TablePool.getInstance().getDomainlistTable()) { - Delete delete = new Delete(Bytes.toBytes(domain.asString())); - table.delete(delete); - table.flushCommits(); - } catch (IOException e) { - log.error("Error while deleting user from HBase", e); - throw new DomainListException("Error while deleting domain from HBase", e); - } - } - - @Override - protected List<Domain> getDomainListInternal() throws DomainListException { - List<Domain> list = new ArrayList<>(); - try (HTableInterface table = TablePool.getInstance().getDomainlistTable()) { - Scan scan = new Scan(); - scan.addFamily(HDomainList.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(Domain.of(Bytes.toString(result.getRow()))); - } - } - } catch (IOException e) { - log.error("Error while counting domains from HBase", e); - throw new DomainListException("Error while counting domains from HBase", e); - } - return list; - } -} http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/data/data-hbase/src/main/java/org/apache/james/domainlist/hbase/def/HDomainList.java ---------------------------------------------------------------------- diff --git a/server/data/data-hbase/src/main/java/org/apache/james/domainlist/hbase/def/HDomainList.java b/server/data/data-hbase/src/main/java/org/apache/james/domainlist/hbase/def/HDomainList.java deleted file mode 100644 index cecdaf4..0000000 --- a/server/data/data-hbase/src/main/java/org/apache/james/domainlist/hbase/def/HDomainList.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.domainlist.hbase.def; - -import org.apache.hadoop.hbase.util.Bytes; - -/** - * Definitions for the DomainList HBase Table. - * - * Contains the table name, column family name and - * the used column/qualifier names. - */ -public interface HDomainList { - - byte[] TABLE_NAME = Bytes.toBytes("JAMES_DOMAINLIST"); - byte[] COLUMN_FAMILY_NAME = Bytes.toBytes("JAMES_DOMAINLIST"); - - interface COLUMN { - byte [] DOMAIN = Bytes.toBytes("dom"); - } - -} http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/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 deleted file mode 100644 index 95aefe0..0000000 --- a/server/data/data-hbase/src/main/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTable.java +++ /dev/null @@ -1,241 +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 java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -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.core.Domain; -import org.apache.james.rrt.api.RecipientRewriteTableException; -import org.apache.james.rrt.hbase.def.HRecipientRewriteTable; -import org.apache.james.rrt.lib.AbstractRecipientRewriteTable; -import org.apache.james.rrt.lib.Mapping; -import org.apache.james.rrt.lib.MappingSource; -import org.apache.james.rrt.lib.Mappings; -import org.apache.james.rrt.lib.MappingsImpl; -import org.apache.james.system.hbase.TablePool; -import org.apache.james.util.OptionalUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.github.fge.lambdas.Throwing; -import com.google.common.base.Splitter; - -/** - * Implementation of the RecipientRewriteTable 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 HBaseRecipientRewriteTable extends AbstractRecipientRewriteTable { - - private static final Logger log = LoggerFactory.getLogger(HBaseRecipientRewriteTable.class.getName()); - private static final String ROW_SEPARATOR = "@"; - private static final String COLUMN_SEPARATOR = ";"; - - @Override - public void addMapping(MappingSource source, Mapping mapping) throws RecipientRewriteTableException { - Mappings map = getUserDomainMappings(source); - if (!map.isEmpty()) { - Mappings updatedMappings = MappingsImpl.from(map).add(mapping).build(); - doUpdateMapping(source, updatedMappings.serialize()); - } else { - doAddMapping(source, mapping.asString()); - } - } - - @Override - public Mappings getUserDomainMappings(MappingSource source) throws - RecipientRewriteTableException { - Mappings list = MappingsImpl.empty(); - try (HTableInterface table = TablePool.getInstance().getRecipientRewriteTable()) { - // Optimize this to only make one call. - return feedUserDomainMappingsList(table, source, list); - } catch (IOException e) { - log.error("Error while getting user domain mapping in HBase", e); - throw new RecipientRewriteTableException("Error while getting user domain mapping in HBase", e); - } - } - - private Mappings feedUserDomainMappingsList(HTableInterface table, MappingSource source, Mappings list) throws - IOException { - Get get = new Get(Bytes.toBytes(getRowKey(source))); - Result result = table.get(get); - List<KeyValue> keyValues = result.getColumn(HRecipientRewriteTable.COLUMN_FAMILY_NAME, - HRecipientRewriteTable.COLUMN.MAPPING); - if (keyValues.size() > 0) { - return MappingsImpl.from(list) - .addAll(MappingsImpl.fromRawString(Bytes.toString(keyValues.get(0).getValue()))).build(); - } - return list; - } - - @Override - public Map<MappingSource, Mappings> getAllMappings() throws RecipientRewriteTableException { - Map<MappingSource, Mappings> map = new HashMap<>(); - try (HTableInterface table = TablePool.getInstance().getRecipientRewriteTable()) { - Scan scan = new Scan(); - scan.addFamily(HRecipientRewriteTable.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<KeyValue> keyValues = result.list(); - if (keyValues != null) { - for (KeyValue keyValue : keyValues) { - MappingSource email = MappingSource.parse(Bytes.toString(keyValue.getRow())); - Mappings mappings = - MappingsImpl.from( - Optional.ofNullable( - map.get(email)) - .orElse(MappingsImpl.empty())) - .addAll(Splitter.on(COLUMN_SEPARATOR).split(Bytes.toString(keyValue.getValue()))) - .build(); - map.put(email, mappings); - } - } - } - } - } catch (IOException e) { - log.error("Error while getting all mapping from HBase", e); - throw new RecipientRewriteTableException("Error while getting all mappings from HBase", e); - } - return map; - } - - @Override - protected Mappings mapAddress(String user, Domain domain) throws RecipientRewriteTableException { - return getApplicableMappingRow(user, domain) - .map(MappingsImpl::fromRawString) - .orElse(MappingsImpl.empty()); - } - - private Optional<String> getApplicableMappingRow(String user, Domain domain) throws RecipientRewriteTableException { - try (HTableInterface table = TablePool.getInstance().getRecipientRewriteTable()) { - HTableInterface tableCopy = table; - return OptionalUtils.orSuppliers( - Throwing.supplier(() -> Optional.ofNullable(getMapping(tableCopy, MappingSource.fromUser(user, domain)))).sneakyThrow(), - Throwing.supplier(() -> Optional.ofNullable(getMapping(tableCopy, MappingSource.fromDomain(domain)))).sneakyThrow(), - Throwing.supplier(() -> Optional.ofNullable(getMapping(tableCopy, MappingSource.fromUser(user, Domains.WILDCARD)))).sneakyThrow()); - } catch (IOException e) { - log.error("Error while mapping address in HBase", e); - throw new RecipientRewriteTableException("Error while mapping address in HBase", e); - } - } - - private String getMapping(HTableInterface table, MappingSource source) throws IOException { - Get get = new Get(Bytes.toBytes(getRowKey(source))); - Result result = table.get(get); - List<KeyValue> keyValues = result.getColumn(HRecipientRewriteTable.COLUMN_FAMILY_NAME, - HRecipientRewriteTable.COLUMN.MAPPING); - if (keyValues.size() > 0) { - return Bytes.toString(keyValues.get(0).getValue()); - } - return null; - } - - @Override - public void removeMapping(MappingSource source, Mapping mapping) throws - RecipientRewriteTableException { - Mappings map = getUserDomainMappings(source); - if (map.size() > 1) { - Mappings updatedMappings = map.remove(mapping); - doUpdateMapping(source, updatedMappings.serialize()); - } else { - doRemoveMapping(source); - } - } - - /** - * Update the mapping for the given user and domain. - * For HBase, this is simply achieved delegating - * the work to the doAddMapping method. - * - * @param user the user - * @param domain the domain - * @param mapping the mapping - * @throws RecipientRewriteTableException - */ - private void doUpdateMapping(MappingSource source, String mapping) throws RecipientRewriteTableException { - doAddMapping(source, mapping); - } - - /** - * Remove a mapping for the given user and domain. - * - * @param user the user - * @param domain the domain - * @throws RecipientRewriteTableException - */ - private void doRemoveMapping(MappingSource source) throws RecipientRewriteTableException { - try (HTableInterface table = TablePool.getInstance().getRecipientRewriteTable()) { - Delete delete = new Delete(Bytes.toBytes(getRowKey(source))); - table.delete(delete); - table.flushCommits(); - } catch (IOException e) { - log.error("Error while removing mapping from HBase", e); - throw new RecipientRewriteTableException("Error while removing mapping from HBase", e); - } - } - - /** - * Add mapping for given user and domain - * - * @param user the user - * @param domain the domain - * @param mapping the mapping - * @throws RecipientRewriteTableException - */ - private void doAddMapping(MappingSource source, String mapping) throws RecipientRewriteTableException { - try (HTableInterface table = TablePool.getInstance().getRecipientRewriteTable()) { - Put put = new Put(Bytes.toBytes(getRowKey(source))); - put.add(HRecipientRewriteTable.COLUMN_FAMILY_NAME, HRecipientRewriteTable.COLUMN.MAPPING, Bytes.toBytes( - mapping)); - table.put(put); - table.flushCommits(); - } catch (IOException e) { - log.error("Error while adding mapping in HBase", e); - throw new RecipientRewriteTableException("Error while adding mapping in HBase", e); - } - } - - /** - * Constructs a Key based on the user and domain. - * - * @param user - * @param domain - * @return the key - */ - private String getRowKey(MappingSource source) { - return source.getFixedUser() + ROW_SEPARATOR + source.getFixedDomain(); - } -} http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/data/data-hbase/src/main/java/org/apache/james/rrt/hbase/def/HRecipientRewriteTable.java ---------------------------------------------------------------------- diff --git a/server/data/data-hbase/src/main/java/org/apache/james/rrt/hbase/def/HRecipientRewriteTable.java b/server/data/data-hbase/src/main/java/org/apache/james/rrt/hbase/def/HRecipientRewriteTable.java deleted file mode 100644 index 60c3421..0000000 --- a/server/data/data-hbase/src/main/java/org/apache/james/rrt/hbase/def/HRecipientRewriteTable.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.rrt.hbase.def; - -import org.apache.hadoop.hbase.util.Bytes; - -/** - * Definitions for the RecipientRewriteTable HBase Table. - * - * Contains the table name, column family name and - * the used column/qualifier names. - */ -public interface HRecipientRewriteTable { - - byte[] TABLE_NAME = Bytes.toBytes("JAMES_RRT"); - byte[] COLUMN_FAMILY_NAME = Bytes.toBytes("JAMES_RRT"); - - interface COLUMN { - byte [] MAPPING = Bytes.toBytes("map"); - } - -} http://git-wip-us.apache.org/repos/asf/james-project/blob/81d65f1c/server/data/data-hbase/src/main/java/org/apache/james/system/hbase/TablePool.java ---------------------------------------------------------------------- diff --git a/server/data/data-hbase/src/main/java/org/apache/james/system/hbase/TablePool.java b/server/data/data-hbase/src/main/java/org/apache/james/system/hbase/TablePool.java deleted file mode 100644 index 8fa434f..0000000 --- a/server/data/data-hbase/src/main/java/org/apache/james/system/hbase/TablePool.java +++ /dev/null @@ -1,133 +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 java.io.IOException; - -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.hbase.HBaseConfiguration; -import org.apache.hadoop.hbase.HColumnDescriptor; -import org.apache.hadoop.hbase.HTableDescriptor; -import org.apache.hadoop.hbase.client.HBaseAdmin; -import org.apache.hadoop.hbase.client.HTableInterface; -import org.apache.hadoop.hbase.client.HTablePool; -import org.apache.james.domainlist.hbase.def.HDomainList; -import org.apache.james.rrt.hbase.def.HRecipientRewriteTable; -import org.apache.james.user.api.UsersRepository; -import org.apache.james.user.hbase.def.HUsersRepository; - -/** - * Table Pool singleton to get the DomainList, RecipientRewriteTable and UserRepository HBase tables. - * - * TODO Two getInstance methods are public, one for the impl, one for the tests. This is not good. - * - * @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. - */ -@SuppressWarnings("deprecation") -@Deprecated -public class TablePool { - - private static Configuration configuration; - private static TablePool hbaseSchema; - private static HTablePool htablePool; - - /** - * Use getInstance to get an instance of the {@link HTablePool}. - * - * Don't give any configuration, the default one will be used - * via {@link HBaseConfiguration#create(Configuration)}. - * - * If you want to create the instance with a specific {@link HBaseConfiguration}, - * use {@link #getInstance(Configuration)} - * - * @return An instance using a default configuration - * @throws IOException - */ - public static synchronized TablePool getInstance() throws IOException { - return getInstance(HBaseConfiguration.create()); - } - - /** - * Use getInstance to get an instance of the {@link HTablePool}. - * - * You can give at first call a specific {@link HBaseConfiguration} to suit your needs. - * - * @param configuration - * @return An instance of {@link HTablePool} - * @throws IOException - */ - public static synchronized TablePool getInstance(Configuration configuration) throws IOException { - if (hbaseSchema == null) { - TablePool.configuration = configuration; - TablePool.hbaseSchema = new TablePool(); - TablePool.htablePool = new HTablePool(configuration, 100); - ensureTable(HDomainList.TABLE_NAME, HDomainList.COLUMN_FAMILY_NAME); - ensureTable(HRecipientRewriteTable.TABLE_NAME, HRecipientRewriteTable.COLUMN_FAMILY_NAME); - ensureTable(HUsersRepository.TABLE_NAME, HUsersRepository.COLUMN_FAMILY_NAME); - } - return hbaseSchema; - } - - /** - * Get an instance of the {@link HDomainList} table. - * - * @return An instance of {@link HDomainList} - */ - public HTableInterface getDomainlistTable() { - return htablePool.getTable(HDomainList.TABLE_NAME); - } - - /** - * Get an instance of the RecipientRewriteTable table. - * - * @return An instance of {@link RecipientRewriteTable} - */ - public HTableInterface getRecipientRewriteTable() { - return htablePool.getTable(HRecipientRewriteTable.TABLE_NAME); - } - - /** - * Get an instance of the UsersRepository table. - * - * @return An instance of {@link UsersRepository} - */ - public HTableInterface getUsersRepositoryTable() { - return htablePool.getTable(HUsersRepository.TABLE_NAME); - } - - /** - * Create a table if needed. - * - * @param tableName - * @param columnFamilyName - * @throws IOException - */ - private static void ensureTable(byte[] tableName, byte[] columnFamilyName) throws IOException { - try (HBaseAdmin hbaseAdmin = new HBaseAdmin(configuration)) { - if (!hbaseAdmin.tableExists(tableName)) { - HTableDescriptor desc = new HTableDescriptor(tableName); - HColumnDescriptor hColumnDescriptor = new HColumnDescriptor(columnFamilyName); - hColumnDescriptor.setMaxVersions(1); - desc.addFamily(hColumnDescriptor); - hbaseAdmin.createTable(desc); - } - } - } -} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
