Repository: james-project Updated Branches: refs/heads/master e37e92fca -> a0050bd11
JAMES-1842: Change searching for subject because 'the' is a stop word -- Written by Quynhn Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/33e39c77 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/33e39c77 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/33e39c77 Branch: refs/heads/master Commit: 33e39c77f771c4287ee703f5c3087ae4bd742a3d Parents: b6cd9e2 Author: Benoit Tellier <[email protected]> Authored: Wed Nov 9 16:09:56 2016 +0700 Committer: Benoit Tellier <[email protected]> Committed: Wed Nov 9 16:09:56 2016 +0700 ---------------------------------------------------------------------- dockerfiles/compilation/java-6/compile.sh | 4 +- .../run/spring/destination/conf/indexer.xml | 2 +- .../META-INF/spring/mailbox-cassandra.xml | 1 + .../org/apache/james/mailbox/jpa/JPAId.java | 7 + .../resources/META-INF/spring/mailbox-jpa.xml | 2 + mailbox/lucene/pom.xml | 16 -- .../META-INF/spring/mailbox-index-lucene.xml | 9 +- .../META-INF/spring/mailbox-memory.xml | 2 + .../META-INF/spring/mailbox-index-lucene.xml | 43 ++++ mailbox/src/site/xdoc/mailbox-spring.xml | 1 - .../imap/scripts/UidSearchAtomsIndexer.test | 4 +- mpt/impl/imap-mailbox/lucenesearch/pom.xml | 238 +++++++++++++++++++ .../lucenesearch/LuceneSearchMailboxTest.java | 74 ++++++ .../LuceneSearchMailboxTestModule.java | 42 ++++ .../host/LuceneSearchHostSystem.java | 194 +++++++++++++++ mpt/impl/imap-mailbox/pom.xml | 7 + mpt/pom.xml | 11 + .../app/src/main/resources/indexer-template.xml | 4 +- .../app/spring/JamesAppSpringMainTest.java | 7 +- server/app/src/test/resources/events.xml | 90 +++++++ server/app/src/test/resources/indexer.xml | 33 +++ .../src/test/resources/managesieveserver.xml | 63 +++++ server/app/src/test/resources/quota.xml | 53 +++++ ...erConfigurationBeanFactoryPostProcessor.java | 3 + ...oxConfigurationBeanFactoryPostProcessor.java | 5 + 25 files changed, 883 insertions(+), 32 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/dockerfiles/compilation/java-6/compile.sh ---------------------------------------------------------------------- diff --git a/dockerfiles/compilation/java-6/compile.sh b/dockerfiles/compilation/java-6/compile.sh index 55182ea..4655c0f 100755 --- a/dockerfiles/compilation/java-6/compile.sh +++ b/dockerfiles/compilation/java-6/compile.sh @@ -44,9 +44,9 @@ git checkout $SHA1 # Compilation if [ "$SKIPTESTS" = "skipTests" ]; then - mvn package -DskipTests -Pjpa + mvn package -DskipTests -Pjpa,lucene,with-assembly else - mvn package -Pjpa + mvn package -Pjpa,lucene,with-assembly fi # Retrieve result http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/dockerfiles/run/spring/destination/conf/indexer.xml ---------------------------------------------------------------------- diff --git a/dockerfiles/run/spring/destination/conf/indexer.xml b/dockerfiles/run/spring/destination/conf/indexer.xml index e349f8f..51591ab 100644 --- a/dockerfiles/run/spring/destination/conf/indexer.xml +++ b/dockerfiles/run/spring/destination/conf/indexer.xml @@ -19,5 +19,5 @@ --> <indexer> - <provider>lazyIndex</provider> + <provider>luceneIndex</provider> </indexer> http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/mailbox/cassandra/src/main/resources/META-INF/spring/mailbox-cassandra.xml ---------------------------------------------------------------------- diff --git a/mailbox/cassandra/src/main/resources/META-INF/spring/mailbox-cassandra.xml b/mailbox/cassandra/src/main/resources/META-INF/spring/mailbox-cassandra.xml index 331f322..3d40aad 100644 --- a/mailbox/cassandra/src/main/resources/META-INF/spring/mailbox-cassandra.xml +++ b/mailbox/cassandra/src/main/resources/META-INF/spring/mailbox-cassandra.xml @@ -23,6 +23,7 @@ xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> + <bean id="cassandra-mailboxIdFactory" class="org.apache.james.mailbox.cassandra.CassandraId.Factory" /> <!-- Mailbox Cassandra --> http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAId.java ---------------------------------------------------------------------- diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAId.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAId.java index 8a5eb88..343476f 100644 --- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAId.java +++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAId.java @@ -22,6 +22,13 @@ import org.apache.james.mailbox.model.MailboxId; public class JPAId implements MailboxId { + public static class Factory implements MailboxId.Factory { + @Override + public JPAId fromString(String serialized) { + return of(Long.parseLong(serialized)); + } + } + public static JPAId of(long value) { return new JPAId(value); } http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/mailbox/jpa/src/main/resources/META-INF/spring/mailbox-jpa.xml ---------------------------------------------------------------------- diff --git a/mailbox/jpa/src/main/resources/META-INF/spring/mailbox-jpa.xml b/mailbox/jpa/src/main/resources/META-INF/spring/mailbox-jpa.xml index ecb471f..223187c 100644 --- a/mailbox/jpa/src/main/resources/META-INF/spring/mailbox-jpa.xml +++ b/mailbox/jpa/src/main/resources/META-INF/spring/mailbox-jpa.xml @@ -29,6 +29,8 @@ <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/> + <bean id="jpa-mailboxIdFactory" class="org.apache.james.mailbox.jpa.JPAId.Factory" /> + <bean id="jpa-mailboxmanager" class="org.apache.james.mailbox.jpa.openjpa.OpenJPAMailboxManager" init-method="init"> <constructor-arg index="0" ref="jpa-sessionMapperFactory"/> <constructor-arg index="1" ref="authenticator"/> http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/mailbox/lucene/pom.xml ---------------------------------------------------------------------- diff --git a/mailbox/lucene/pom.xml b/mailbox/lucene/pom.xml index fe381b5..de0612d 100644 --- a/mailbox/lucene/pom.xml +++ b/mailbox/lucene/pom.xml @@ -107,21 +107,5 @@ <activeByDefault>true</activeByDefault> </activation> </profile> - <profile> - <id>exclude-lucene</id> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <configuration> - <excludes> - <exclude>**/**</exclude> - </excludes> - </configuration> - </plugin> - </plugins> - </build> - </profile> </profiles> </project> http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/mailbox/lucene/src/main/resources/META-INF/spring/mailbox-index-lucene.xml ---------------------------------------------------------------------- diff --git a/mailbox/lucene/src/main/resources/META-INF/spring/mailbox-index-lucene.xml b/mailbox/lucene/src/main/resources/META-INF/spring/mailbox-index-lucene.xml index e49bb49..18a2c1a 100644 --- a/mailbox/lucene/src/main/resources/META-INF/spring/mailbox-index-lucene.xml +++ b/mailbox/lucene/src/main/resources/META-INF/spring/mailbox-index-lucene.xml @@ -31,13 +31,12 @@ <constructor-arg index="0" ref="luceneIndex"/> </bean> <bean id="luceneIndex" class="org.apache.james.mailbox.lucene.search.LuceneMessageSearchIndex"> - <constructor-arg index="0" ref="maildir-sessionMapperFactory"/> - <constructor-arg index="1" ref="ramDirectory"/> - <constructor-arg index="2" value="false"/> - <constructor-arg index="3" value="true"/> + <constructor-arg index="0" ref="messageMapperFactory"/> + <constructor-arg index="1" ref="mailboxIdFactory"/> + <constructor-arg index="2" type="org.apache.lucene.store.Directory" ref="fsDirectory"/> <property name="enableSuffixMatch" value="true"/> </bean> - <bean id="ramDirectory" class="org.apache.lucene.store.FSDirectory" factory-method="open"> + <bean id="fsDirectory" class="org.apache.lucene.store.FSDirectory" factory-method="open"> <constructor-arg index="0" value="../var/store/lucene"/> </bean> http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/mailbox/memory/src/main/resources/META-INF/spring/mailbox-memory.xml ---------------------------------------------------------------------- diff --git a/mailbox/memory/src/main/resources/META-INF/spring/mailbox-memory.xml b/mailbox/memory/src/main/resources/META-INF/spring/mailbox-memory.xml index 8789871..1beac65 100644 --- a/mailbox/memory/src/main/resources/META-INF/spring/mailbox-memory.xml +++ b/mailbox/memory/src/main/resources/META-INF/spring/mailbox-memory.xml @@ -23,6 +23,8 @@ xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> + <bean id="memory-mailboxIdFactory" class="org.apache.james.mailbox.inmemory.InMemoryId.Factory" /> + <!-- Mailbox Memory --> http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/mailbox/spring/src/test/resources/META-INF/spring/mailbox-index-lucene.xml ---------------------------------------------------------------------- diff --git a/mailbox/spring/src/test/resources/META-INF/spring/mailbox-index-lucene.xml b/mailbox/spring/src/test/resources/META-INF/spring/mailbox-index-lucene.xml new file mode 100644 index 0000000..d645b30 --- /dev/null +++ b/mailbox/spring/src/test/resources/META-INF/spring/mailbox-index-lucene.xml @@ -0,0 +1,43 @@ +<?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 http://www.springframework.org/schema/beans/spring-beans.xsd"> + + <!-- + Mailbox Lucene + --> + + <bean id="lazyIndex" class="org.apache.james.mailbox.store.search.LazyMessageSearchIndex"> + <constructor-arg index="0" ref="luceneIndex"/> + </bean> + <bean id="luceneIndex" class="org.apache.james.mailbox.lucene.search.LuceneMessageSearchIndex"> + <constructor-arg index="0" ref="messageMapperFactory"/> + <constructor-arg index="1" ref="mailboxIdFactory"/> + <constructor-arg index="2" type="org.apache.lucene.store.Directory" ref="fsDirectory"/> + <property name="enableSuffixMatch" value="true"/> + </bean> + <bean id="fsDirectory" class="org.apache.lucene.store.FSDirectory" factory-method="open"> + <constructor-arg index="0" value="../var/store/lucene"/> + </bean> + <alias name="jpa-mailboxIdFactory" alias="mailboxIdFactory"/> +</beans> http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/mailbox/src/site/xdoc/mailbox-spring.xml ---------------------------------------------------------------------- diff --git a/mailbox/src/site/xdoc/mailbox-spring.xml b/mailbox/src/site/xdoc/mailbox-spring.xml index 5d18494..f12e08e 100644 --- a/mailbox/src/site/xdoc/mailbox-spring.xml +++ b/mailbox/src/site/xdoc/mailbox-spring.xml @@ -49,7 +49,6 @@ <li>spring-mailbox-jpa.xml</li> <li>spring-mailbox-authenticator.xml</li> <li>spring-mailbox-locker.xml</li> - <li>spring-mailbox-lucene.xml</li> </ul> <p>Each mailbox configuration file is used to declare beans that will instantiate all components http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/UidSearchAtomsIndexer.test ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/UidSearchAtomsIndexer.test b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/UidSearchAtomsIndexer.test index 9c5fc26..aecc249 100644 --- a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/UidSearchAtomsIndexer.test +++ b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/UidSearchAtomsIndexer.test @@ -2111,7 +2111,7 @@ S: \* 2 FETCH \(FLAGS \(\\Answered \\Deleted \\Flagged \\Recent \\Seen\)\) S: \* 3 FETCH \(FLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Recent\)\) S: A99 OK STORE completed\. -LOG INFO Waiting for ElasticSearch to index data +LOG INFO Waiting for Indexer to index data WAIT 5000 @@ -2314,7 +2314,7 @@ S: \* 1 EXISTS S: \* 1 RECENT S: A202 OK (\[.+\] )?APPEND completed\. -LOG INFO Waiting for ElasticSearch to index data +LOG INFO Waiting for Indexer to index data WAIT 1000 http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/mpt/impl/imap-mailbox/lucenesearch/pom.xml ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/lucenesearch/pom.xml b/mpt/impl/imap-mailbox/lucenesearch/pom.xml new file mode 100644 index 0000000..e88550d --- /dev/null +++ b/mpt/impl/imap-mailbox/lucenesearch/pom.xml @@ -0,0 +1,238 @@ +<?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/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <artifactId>apache-james-mpt-imapmailbox</artifactId> + <groupId>org.apache.james</groupId> + <version>3.0.0-beta5-SNAPSHOT</version> + </parent> + + <artifactId>apache-james-mpt-imapmailbox-jpa-lucene</artifactId> + <name>Apache James MPT Imap Mailbox - LuceneSearch</name> + + <dependencies> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>apache-james-mpt-imapmailbox-core</artifactId> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>apache-james-mailbox-jpa</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + <profiles> + <profile> + <id>disable-build-for-older-jdk</id> + <activation> + <jdk>(,1.8)</jdk> + </activation> + <build> + <plugins> + <plugin> + <artifactId>maven-jar-plugin</artifactId> + <executions> + <execution> + <id>default-jar</id> + <phase>none</phase> + </execution> + <execution> + <id>jar</id> + <phase>none</phase> + </execution> + <execution> + <id>test-jar</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <executions> + <execution> + <id>default-compile</id> + <phase>none</phase> + </execution> + <execution> + <id>default-testCompile</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <executions> + <execution> + <id>default-test</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-source-plugin</artifactId> + <executions> + <execution> + <id>attach-sources</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-install-plugin</artifactId> + <executions> + <execution> + <id>default-install</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>default-resources</id> + <phase>none</phase> + </execution> + <execution> + <id>default-testResources</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-site-plugin</artifactId> + <executions> + <execution> + <id>attach-descriptor</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>build-for-jdk-8</id> + <activation> + <jdk>[1.8,)</jdk> + </activation> + <dependencies> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>apache-james-mailbox-api</artifactId> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>apache-james-mailbox-lucene</artifactId> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>apache-james-mailbox-lucene</artifactId> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>apache-james-mailbox-jpa</artifactId> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>apache-james-mailbox-store</artifactId> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>apache-james-mpt-imapmailbox-core</artifactId> + </dependency> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <archive> + <manifest> + <mainClass>fully.qualified.MainClass</mainClass> + </manifest> + </archive> + <descriptorRefs> + <descriptorRef>jar-with-dependencies</descriptorRef> + </descriptorRefs> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.8</source> + <target>1.8</target> + </configuration> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>animal-sniffer-java-8</id> + <activation> + <jdk>[1.8,)</jdk> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>animal-sniffer-maven-plugin</artifactId> + <configuration> + <signature> + <groupId>org.codehaus.mojo.signature</groupId> + <artifactId>java18</artifactId> + <version>1.0</version> + </signature> + </configuration> + <executions> + <execution> + <id>check_java_8</id> + <phase>test</phase> + <goals> + <goal>check</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> +</project> http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/mpt/impl/imap-mailbox/lucenesearch/src/test/java/org/apache/james/mpt/imapmailbox/lucenesearch/LuceneSearchMailboxTest.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/lucenesearch/src/test/java/org/apache/james/mpt/imapmailbox/lucenesearch/LuceneSearchMailboxTest.java b/mpt/impl/imap-mailbox/lucenesearch/src/test/java/org/apache/james/mpt/imapmailbox/lucenesearch/LuceneSearchMailboxTest.java new file mode 100644 index 0000000..193849e --- /dev/null +++ b/mpt/impl/imap-mailbox/lucenesearch/src/test/java/org/apache/james/mpt/imapmailbox/lucenesearch/LuceneSearchMailboxTest.java @@ -0,0 +1,74 @@ +/**************************************************************** + * 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.lucenesearch; + +import org.apache.james.mpt.imapmailbox.suite.AuthenticatedState; +import org.apache.james.mpt.imapmailbox.suite.ConcurrentSessions; +import org.apache.james.mpt.imapmailbox.suite.Events; +import org.apache.james.mpt.imapmailbox.suite.Expunge; +import org.apache.james.mpt.imapmailbox.suite.Fetch; +import org.apache.james.mpt.imapmailbox.suite.FetchBodySection; +import org.apache.james.mpt.imapmailbox.suite.FetchBodyStructure; +import org.apache.james.mpt.imapmailbox.suite.FetchHeaders; +import org.apache.james.mpt.imapmailbox.suite.Listing; +import org.apache.james.mpt.imapmailbox.suite.MailboxAnnotation; +import org.apache.james.mpt.imapmailbox.suite.Move; +import org.apache.james.mpt.imapmailbox.suite.NonAuthenticatedState; +import org.apache.james.mpt.imapmailbox.suite.PartialFetch; +import org.apache.james.mpt.imapmailbox.suite.QuotaTest; +import org.apache.james.mpt.imapmailbox.suite.Rename; +import org.apache.james.mpt.imapmailbox.suite.Security; +import org.apache.james.mpt.imapmailbox.suite.Select; +import org.apache.james.mpt.imapmailbox.suite.SelectedInbox; +import org.apache.james.mpt.imapmailbox.suite.SelectedState; +import org.apache.james.mpt.imapmailbox.suite.UidSearchOnIndex; +import org.apache.james.mpt.imapmailbox.suite.UserFlagsSupport; +import org.apache.james.mpt.onami.test.OnamiSuite; +import org.apache.james.mpt.onami.test.annotation.GuiceModules; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(OnamiSuite.class) [email protected]({ + AuthenticatedState.class, + ConcurrentSessions.class, + Events.class, + Expunge.class, + Fetch.class, + FetchBodySection.class, + FetchBodyStructure.class, + FetchHeaders.class, + Listing.class, + NonAuthenticatedState.class, + PartialFetch.class, + Rename.class, + Security.class, + Select.class, + QuotaTest.class, + UserFlagsSupport.class, + Move.class, + SelectedInbox.class, + SelectedState.class, + MailboxAnnotation.class, + UidSearchOnIndex.class +}) +@GuiceModules({LuceneSearchMailboxTestModule.class}) +public class LuceneSearchMailboxTest { +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/mpt/impl/imap-mailbox/lucenesearch/src/test/java/org/apache/james/mpt/imapmailbox/lucenesearch/LuceneSearchMailboxTestModule.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/lucenesearch/src/test/java/org/apache/james/mpt/imapmailbox/lucenesearch/LuceneSearchMailboxTestModule.java b/mpt/impl/imap-mailbox/lucenesearch/src/test/java/org/apache/james/mpt/imapmailbox/lucenesearch/LuceneSearchMailboxTestModule.java new file mode 100644 index 0000000..474cc5d --- /dev/null +++ b/mpt/impl/imap-mailbox/lucenesearch/src/test/java/org/apache/james/mpt/imapmailbox/lucenesearch/LuceneSearchMailboxTestModule.java @@ -0,0 +1,42 @@ +/**************************************************************** + * 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.lucenesearch; + +import org.apache.james.mpt.api.HostSystem; +import org.apache.james.mpt.api.ImapHostSystem; +import org.apache.james.mpt.imapmailbox.lucenesearch.host.LuceneSearchHostSystem; + +import com.google.inject.AbstractModule; +import com.google.inject.Provides; +import com.google.inject.Singleton; + +public class LuceneSearchMailboxTestModule extends AbstractModule { + @Override + protected void configure() { + bind(HostSystem.class).to(ImapHostSystem.class); + } + + @Provides + @Singleton + public ImapHostSystem provideImapHostSystem() throws Exception { + return new LuceneSearchHostSystem(); + } + +} http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/mpt/impl/imap-mailbox/lucenesearch/src/test/java/org/apache/james/mpt/imapmailbox/lucenesearch/host/LuceneSearchHostSystem.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/lucenesearch/src/test/java/org/apache/james/mpt/imapmailbox/lucenesearch/host/LuceneSearchHostSystem.java b/mpt/impl/imap-mailbox/lucenesearch/src/test/java/org/apache/james/mpt/imapmailbox/lucenesearch/host/LuceneSearchHostSystem.java new file mode 100644 index 0000000..d0cfc2c --- /dev/null +++ b/mpt/impl/imap-mailbox/lucenesearch/src/test/java/org/apache/james/mpt/imapmailbox/lucenesearch/host/LuceneSearchHostSystem.java @@ -0,0 +1,194 @@ +/**************************************************************** + * 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.lucenesearch.host; + +import java.io.File; +import java.io.IOException; +import java.util.HashMap; + +import javax.persistence.EntityManagerFactory; + +import org.apache.commons.io.FileUtils; +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.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.exception.MailboxException; +import org.apache.james.mailbox.jpa.JPAId; +import org.apache.james.mailbox.jpa.JPAId.Factory; +import org.apache.james.mailbox.jpa.JPAMailboxSessionMapperFactory; +import org.apache.james.mailbox.jpa.JPASubscriptionManager; +import org.apache.james.mailbox.jpa.mail.JPAModSeqProvider; +import org.apache.james.mailbox.jpa.mail.JPAUidProvider; +import org.apache.james.mailbox.jpa.mail.model.JPAMailbox; +import org.apache.james.mailbox.jpa.mail.model.JPAProperty; +import org.apache.james.mailbox.jpa.mail.model.JPAUserFlag; +import org.apache.james.mailbox.jpa.mail.model.openjpa.AbstractJPAMailboxMessage; +import org.apache.james.mailbox.jpa.mail.model.openjpa.JPAMailboxMessage; +import org.apache.james.mailbox.jpa.openjpa.OpenJPAMailboxManager; +import org.apache.james.mailbox.jpa.user.model.JPASubscription; +import org.apache.james.mailbox.lucene.search.LuceneMessageSearchIndex; +import org.apache.james.mailbox.model.MailboxPath; +import org.apache.james.mailbox.store.FakeAuthenticator; +import org.apache.james.mailbox.store.JVMMailboxPathLocker; +import org.apache.james.mailbox.store.mail.model.impl.MessageParser; +import org.apache.james.mailbox.store.quota.DefaultQuotaRootResolver; +import org.apache.james.mailbox.store.quota.NoQuotaManager; +import org.apache.james.mpt.api.ImapFeatures; +import org.apache.james.mpt.api.ImapFeatures.Feature; +import org.apache.james.mpt.host.JamesImapHostSystem; +import org.apache.james.mpt.imapmailbox.MailboxCreationDelegate; +import org.apache.lucene.store.FSDirectory; +import org.apache.openjpa.persistence.OpenJPAPersistence; +import org.slf4j.LoggerFactory; + +import com.google.common.base.Throwables; +import com.google.common.io.Files; + +public class LuceneSearchHostSystem extends JamesImapHostSystem { + public static final String META_DATA_DIRECTORY = "target/user-meta-data"; + private static final ImapFeatures SUPPORTED_FEATURES = ImapFeatures.of(Feature.NAMESPACE_SUPPORT); + + private File tempFile; + private OpenJPAMailboxManager mailboxManager; + private FakeAuthenticator userManager; + private EntityManagerFactory entityManagerFactory; + + public boolean addUser(String user, String password) throws Exception { + userManager.addUser(user, password); + return true; + } + + @Override + public void beforeTest() throws Exception { + this.tempFile = Files.createTempDir(); + initFields(); + } + + @Override + public void resetData() throws Exception { + tempFile.deleteOnExit(); + + resetUserMetaData(); + MailboxSession session = mailboxManager.createSystemSession("test", LoggerFactory.getLogger("TestLog")); + mailboxManager.startProcessingRequest(session); + mailboxManager.deleteEverything(session); + mailboxManager.endProcessingRequest(session); + mailboxManager.logout(session, false); + + } + + public void resetUserMetaData() throws Exception { + File dir = new File(META_DATA_DIRECTORY); + if (dir.exists()) { + FileUtils.deleteDirectory(dir); + } + dir.mkdirs(); + } + + private void initFields() { + HashMap<String, String> properties = new HashMap<String, String>(); + + // Configure OpenJPA for H2 Memory Database + properties.put("openjpa.ConnectionDriverName", org.h2.Driver.class.getName()); + properties.put("openjpa.ConnectionURL", "jdbc:h2:mem:mailboxintegration;DB_CLOSE_DELAY=-1"); // Memory H2 database + + // Configure OpenJPA Tables creation + properties.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)"); // Create Foreign Keys + properties.put("openjpa.jdbc.MappingDefaults", "ForeignKeyDeleteAction=restrict, JoinForeignKeyDeleteAction=restrict"); + properties.put("openjpa.jdbc.SchemaFactory", "native(ForeignKeys=true)"); + properties.put("openjpa.jdbc.MappingDefaults", "ForeignKeyDeleteAction=cascade, JoinForeignKeyDeleteAction=cascade"); + + + // Configure OpenJPA Cache + properties.put("openjpa.jdbc.QuerySQLCache", "false"); + + // Configure OpenJPA Log + properties.put("openjpa.Log", "JDBC=WARN, SQL=WARN, Runtime=WARN"); + //properties.put("openjpa.RuntimeUnenhancedClasses", "warn"); + + // Configure OpenJPA Metadata + properties.put("openjpa.MetaDataFactory", "jpa(Types=" + + JPAMailbox.class.getName() + ";" + + AbstractJPAMailboxMessage.class.getName() + ";" + + JPAMailboxMessage.class.getName() + ";" + + JPAProperty.class.getName() + ";" + + JPAUserFlag.class.getName() + ";" + + JPASubscription.class.getName() + ")"); + + userManager = new FakeAuthenticator(); + entityManagerFactory = OpenJPAPersistence.getEntityManagerFactory(properties); + JVMMailboxPathLocker locker = new JVMMailboxPathLocker(); + JPAUidProvider uidProvider = new JPAUidProvider(locker, entityManagerFactory); + JPAModSeqProvider modSeqProvider = new JPAModSeqProvider(locker, entityManagerFactory); + JPAMailboxSessionMapperFactory factory = new JPAMailboxSessionMapperFactory(entityManagerFactory, uidProvider, modSeqProvider); + + try { + JPAId.Factory mailboxIdFactory = new Factory(); + FSDirectory fsDirectory = FSDirectory.open(tempFile); + LuceneMessageSearchIndex searchIndex = new LuceneMessageSearchIndex(factory, mailboxIdFactory, fsDirectory); + searchIndex.setEnableSuffixMatch(true); + + MailboxACLResolver aclResolver = new UnionMailboxACLResolver(); + GroupMembershipResolver groupMembershipResolver = new SimpleGroupMembershipResolver(); + MessageParser messageParser = new MessageParser(); + + mailboxManager = new OpenJPAMailboxManager(factory, userManager, locker, false, aclResolver, groupMembershipResolver, messageParser); + mailboxManager.setMessageSearchIndex(searchIndex); + + mailboxManager.init(); + + SubscriptionManager subscriptionManager = new JPASubscriptionManager(factory); + + final ImapProcessor defaultImapProcessorFactory = + DefaultImapProcessorFactory.createDefaultProcessor( + mailboxManager, + subscriptionManager, + new NoQuotaManager(), + new DefaultQuotaRootResolver(factory)); + + configure(new DefaultImapDecoderFactory().buildImapDecoder(), + new DefaultImapEncoderFactory().buildImapEncoder(), + defaultImapProcessorFactory); + + } catch (IOException e) { + throw Throwables.propagate(e); + } catch (MailboxException e) { + throw Throwables.propagate(e); + } + } + + @Override + public void createMailbox(MailboxPath mailboxPath) throws Exception{ + new MailboxCreationDelegate(mailboxManager).createMailbox(mailboxPath); + } + + @Override + public boolean supports(Feature... features) { + return SUPPORTED_FEATURES.supports(features); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/mpt/impl/imap-mailbox/pom.xml ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/pom.xml b/mpt/impl/imap-mailbox/pom.xml index 31fd9b2..9e392df 100644 --- a/mpt/impl/imap-mailbox/pom.xml +++ b/mpt/impl/imap-mailbox/pom.xml @@ -43,6 +43,7 @@ <module>jcr</module> <module>jpa</module> <module>maildir</module> + <module>lucenesearch</module> </modules> <dependencyManagement> @@ -101,6 +102,12 @@ <version>${project.version}</version> <scope>test</scope> </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>apache-james-mpt-imapmailbox-jpa-lucene</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> </dependencies> </dependencyManagement> http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/mpt/pom.xml ---------------------------------------------------------------------- diff --git a/mpt/pom.xml b/mpt/pom.xml index 78191cc..99375bb 100644 --- a/mpt/pom.xml +++ b/mpt/pom.xml @@ -211,6 +211,17 @@ </dependency> <dependency> <groupId>org.apache.james</groupId> + <artifactId>apache-james-mailbox-lucene</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>apache-james-mailbox-lucene</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> <artifactId>apache-james-mailbox-maildir</artifactId> <version>${project.version}</version> </dependency> http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/server/app/src/main/resources/indexer-template.xml ---------------------------------------------------------------------- diff --git a/server/app/src/main/resources/indexer-template.xml b/server/app/src/main/resources/indexer-template.xml index c8282b0..8fd7248 100644 --- a/server/app/src/main/resources/indexer-template.xml +++ b/server/app/src/main/resources/indexer-template.xml @@ -27,7 +27,7 @@ <indexer> <!-- supported providers are: --> - <!-- lazyIndex, elasticsearch --> + <!-- lazyIndex, luceneIndex, elasticsearch --> <!-- --> - <provider>lazyIndex</provider> + <provider>luceneIndex</provider> </indexer> http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/server/app/src/test/java/org/apache/james/app/spring/JamesAppSpringMainTest.java ---------------------------------------------------------------------- diff --git a/server/app/src/test/java/org/apache/james/app/spring/JamesAppSpringMainTest.java b/server/app/src/test/java/org/apache/james/app/spring/JamesAppSpringMainTest.java index e578249..aa0d4f5 100644 --- a/server/app/src/test/java/org/apache/james/app/spring/JamesAppSpringMainTest.java +++ b/server/app/src/test/java/org/apache/james/app/spring/JamesAppSpringMainTest.java @@ -18,14 +18,15 @@ ****************************************************************/ package org.apache.james.app.spring; -import org.junit.Ignore; +import org.hamcrest.CoreMatchers; +import org.junit.Assume; import org.junit.Test; public class JamesAppSpringMainTest { - + @Test - @Ignore(value="Test sometimes breaks on the integration build - see JAMES-1555") public void testServer() throws Exception { + Assume.assumeThat(System.getProperty("java.version"), CoreMatchers.startsWith("1.6")); JamesAppSpringMain.main(null); } http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/server/app/src/test/resources/events.xml ---------------------------------------------------------------------- diff --git a/server/app/src/test/resources/events.xml b/server/app/src/test/resources/events.xml new file mode 100644 index 0000000..536278a --- /dev/null +++ b/server/app/src/test/resources/events.xml @@ -0,0 +1,90 @@ +<?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. + --> + +<!-- + This template file can be used as example for James Server configuration + DO NOT USE IT AS SUCH AND ADAPT IT TO YOUR NEEDS +--> + +<events> + <!-- By default the event system is in memory based, providing better performances but is not + distributed and won't do the work with multiples servers --> + <type>default</type> + + <!-- Do you want to wait for MailboxListeners to be executed before returning result to the user ? + + If yes set this to synchronous + If no set this to asynchronous + If you want to use default supported behaviour exposed by listeners set this to mixed + --> + <delivery>synchronous</delivery> + + <!-- Broadcast event system will send messages to all your James servers. + + It is the only viable options if you rely on Mailbox Listeners that do not perform well in a distributed system. + + Here follows a non exhaustive list of such Mailbox Listeners : + - Memory quota based system + - Lucene based search system + + Workload is higher because event needs to be serialized and de serialized. + + Also note that depending on the publisher you use, messages might be either lost or duplicated, implying wrong + indexing or wrong quota count on network partitions. + + Here follows a sample configuration : + --> + <!-- + <type>broadcast</type> + <serialization>json</serialization> + <publisher>kafka</publisher> + --> + + <!-- + Further notes on the choice you had here : + + serialization : you have to choices : either json or message-pack + + message-pack is a binary representation for json, and is 2 times lighter by average, but is 2 time slower to serialize and de serialize. + This choice allows you to trade compute against network. + + publisher : Publish - subscribe used. The only current implementation is Kafka. + --> + + <!-- Registered event system + + Scalable event system based on registration : each James server listen on his own topic and manage registrations on + mailbox paths in order to receive events interesting him. + + This configuration does not support distributed unfriendly Mailbox Listeners (see the non exhaustive list above) for obvious reasons. + --> + <!-- + <type>registered</type> + <serialization>json</serialization> + <registration>cassandra</registration> + <publisher>kafka</publisher> + --> + + <!-- + The only registration system available is Cassandra, used in an available fashion. This means there is no warranties, + either at least one delivery nor at most one delivery. But you get the certitude that the system will always be available. + --> + +</events> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/server/app/src/test/resources/indexer.xml ---------------------------------------------------------------------- diff --git a/server/app/src/test/resources/indexer.xml b/server/app/src/test/resources/indexer.xml new file mode 100644 index 0000000..8fd7248 --- /dev/null +++ b/server/app/src/test/resources/indexer.xml @@ -0,0 +1,33 @@ +<?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. + --> + +<!-- + This template file can be used as example for James Server configuration + DO NOT USE IT AS SUCH AND ADAPT IT TO YOUR NEEDS +--> + +<!-- See http://james.apache.org/server/3/config.html for usage --> + +<indexer> + <!-- supported providers are: --> + <!-- lazyIndex, luceneIndex, elasticsearch --> + <!-- --> + <provider>luceneIndex</provider> +</indexer> http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/server/app/src/test/resources/managesieveserver.xml ---------------------------------------------------------------------- diff --git a/server/app/src/test/resources/managesieveserver.xml b/server/app/src/test/resources/managesieveserver.xml new file mode 100644 index 0000000..22e7a53 --- /dev/null +++ b/server/app/src/test/resources/managesieveserver.xml @@ -0,0 +1,63 @@ +<?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. + --> + +<!-- + This template file can be used as example for James Server configuration + DO NOT USE IT AS SUCH AND ADAPT IT TO YOUR NEEDS +--> + +<!-- See http://james.apache.org/server/3/config.html for usage --> + +<managesieveservers> + + <managesieveserver enabled="true"> + + <jmxName>managesieveserver</jmxName> + + <bind>0.0.0.0:4190</bind> + + <connectionBacklog>200</connectionBacklog> + + <tls socketTLS="false" startTLS="false"> + <!-- To create a new keystore execute: + keytool -genkey -alias james -keyalg RSA -keystore /path/to/james/conf/keystore + --> + <keystore>file://conf/keystore</keystore> + <secret>james72laBalle</secret> + <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider> + <!-- The algorithm is optional and only needs to be specified when using something other + than the Sun JCE provider - You could use IbmX509 with IBM Java runtime. --> + <algorithm>SunX509</algorithm> + </tls> + + <!-- connection timeout in secconds --> + <connectiontimeout>360</connectiontimeout> + + <!-- Set the maximum simultaneous incoming connections for this service --> + <connectionLimit>0</connectionLimit> + + <!-- Set the maximum simultaneous incoming connections per IP for this service --> + <connectionLimitPerIP>0</connectionLimitPerIP> + <maxmessagesize>0</maxmessagesize> + <addressBracketsEnforcement>true</addressBracketsEnforcement> + + </managesieveserver> + +</managesieveservers> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/server/app/src/test/resources/quota.xml ---------------------------------------------------------------------- diff --git a/server/app/src/test/resources/quota.xml b/server/app/src/test/resources/quota.xml new file mode 100644 index 0000000..91d4e6a --- /dev/null +++ b/server/app/src/test/resources/quota.xml @@ -0,0 +1,53 @@ +<?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. + --> + +<!-- + This template file can be used as example for James Server configuration + DO NOT USE IT AS SUCH AND ADAPT IT TO YOUR NEEDS +--> + +<!-- See http://james.apache.org/server/3/config.html for usage --> + +<!-- + This configuration file allows you to customize the way quota are handled on this server. + You need to rename it in quota.xml so that it gets interpreted by James on startup. + + The different configuration options are detailed here. + + Read RFC-2087 for full details. +--> + +<quota> + <quotaRootResolver> + <provider>default</provider> + </quotaRootResolver> + <currentQuotaManager> + <provider>inmemory</provider> + </currentQuotaManager> + <maxQuotaManager> + <provider>inmemory</provider> + </maxQuotaManager> + <quotaManager> + <provider>store</provider> + </quotaManager> + <updates> + <provider>event</provider> + </updates> +</quota> http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factorypostprocessor/IndexerConfigurationBeanFactoryPostProcessor.java ---------------------------------------------------------------------- diff --git a/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factorypostprocessor/IndexerConfigurationBeanFactoryPostProcessor.java b/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factorypostprocessor/IndexerConfigurationBeanFactoryPostProcessor.java index b28396b..adbd3b1 100644 --- a/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factorypostprocessor/IndexerConfigurationBeanFactoryPostProcessor.java +++ b/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factorypostprocessor/IndexerConfigurationBeanFactoryPostProcessor.java @@ -56,6 +56,9 @@ public class IndexerConfigurationBeanFactoryPostProcessor implements BeanFactory } else if (provider.equalsIgnoreCase("elasticsearch")) { indexer = "elasticsearch-listener"; reIndexer = "reindexer-impl"; + } else if (provider.equalsIgnoreCase("luceneIndex")) { + indexer = "luceneIndex"; + reIndexer = "fake-reindexer"; } if (indexer == null) http://git-wip-us.apache.org/repos/asf/james-project/blob/33e39c77/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 f33a6cb..db2625c 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 @@ -52,16 +52,19 @@ public class MailboxConfigurationBeanFactoryPostProcessor implements BeanFactory String subscription = null; String messageMapperFactory = null; String mailboxIdDeserializer = null; + String mailboxIdFactory = null; if (provider.equalsIgnoreCase("jpa")) { mailbox = "jpa-mailboxmanager"; subscription = "jpa-subscriptionManager"; messageMapperFactory = "jpa-sessionMapperFactory"; mailboxIdDeserializer = "jpa-mailbox-id-deserializer"; + mailboxIdFactory = "jpa-mailboxIdFactory"; } else if (provider.equalsIgnoreCase("memory")) { mailbox = "memory-mailboxmanager"; subscription = "memory-subscriptionManager"; messageMapperFactory = "memory-sessionMapperFactory"; mailboxIdDeserializer = "memory-mailbox-id-deserializer"; + mailboxIdFactory = "memory-mailboxIdFactory"; } else if (provider.equalsIgnoreCase("jcr")) { mailbox = "jcr-mailboxmanager"; subscription = "jcr-subscriptionManager"; @@ -82,6 +85,7 @@ public class MailboxConfigurationBeanFactoryPostProcessor implements BeanFactory subscription = "cassandra-subscriptionManager"; messageMapperFactory = "cassandra-sessionMapperFactory"; mailboxIdDeserializer = "cassandra-mailbox-id-deserializer"; + mailboxIdFactory = "cassandra-mailboxIdFactory"; } if (mailbox == null) @@ -90,6 +94,7 @@ public class MailboxConfigurationBeanFactoryPostProcessor implements BeanFactory registry.registerAlias(subscription, "subscriptionManager"); registry.registerAlias(messageMapperFactory, "messageMapperFactory"); registry.registerAlias(mailboxIdDeserializer, "mailbox-id-deserializer"); + registry.registerAlias(mailboxIdFactory, "mailboxIdFactory"); } catch (ConfigurationException e) { throw new FatalBeanException("Unable to config the mailboxmanager", e); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
