JAMES-2521 Move Maildir utils as a separate tool project
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/77fdac54 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/77fdac54 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/77fdac54 Branch: refs/heads/master Commit: 77fdac54977be411208fb5a2abf5e500fb8db4c2 Parents: 0e2482e Author: Benoit Tellier <[email protected]> Authored: Tue Aug 14 17:21:56 2018 +0700 Committer: Benoit Tellier <[email protected]> Committed: Wed Aug 29 10:11:46 2018 +0700 ---------------------------------------------------------------------- mailbox/pom.xml | 1 + mailbox/tools/maildir-utils/pom.xml | 49 +++++++++++++++++ .../mailbox/tools/maildir/MaildirStoreUtil.java | 55 ++++++++++++++++++++ mailbox/tools/pom.xml | 37 +++++++++++++ server/container/mailbox-adapter/pom.xml | 4 -- .../mailbox/maildir/MaildirStoreUtil.java | 55 -------------------- 6 files changed, 142 insertions(+), 59 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/77fdac54/mailbox/pom.xml ---------------------------------------------------------------------- diff --git a/mailbox/pom.xml b/mailbox/pom.xml index 974ef85..2660dc6 100644 --- a/mailbox/pom.xml +++ b/mailbox/pom.xml @@ -60,6 +60,7 @@ <module>plugin/quota-search-elasticsearch</module> <module>plugin/quota-search-scanning</module> <module>plugin/spamassassin</module> + <module>tools</module> </modules> <issueManagement> http://git-wip-us.apache.org/repos/asf/james-project/blob/77fdac54/mailbox/tools/maildir-utils/pom.xml ---------------------------------------------------------------------- diff --git a/mailbox/tools/maildir-utils/pom.xml b/mailbox/tools/maildir-utils/pom.xml new file mode 100644 index 0000000..92a5184 --- /dev/null +++ b/mailbox/tools/maildir-utils/pom.xml @@ -0,0 +1,49 @@ +<?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> + <artifactId>apache-james-mailbox-tools</artifactId> + <groupId>org.apache.james</groupId> + <version>3.2.0-SNAPSHOT</version> + </parent> + + <artifactId>apache-james-mailbox-tool-maildir-utils</artifactId> + + <name>Apache James :: Mailbox :: Tools :: Maildir utils</name> + + <dependencies> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>apache-james-mailbox-maildir</artifactId> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-filesystem-api</artifactId> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-data-api</artifactId> + </dependency> + </dependencies> + + +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/77fdac54/mailbox/tools/maildir-utils/src/main/java/org/apache/james/mailbox/tools/maildir/MaildirStoreUtil.java ---------------------------------------------------------------------- diff --git a/mailbox/tools/maildir-utils/src/main/java/org/apache/james/mailbox/tools/maildir/MaildirStoreUtil.java b/mailbox/tools/maildir-utils/src/main/java/org/apache/james/mailbox/tools/maildir/MaildirStoreUtil.java new file mode 100644 index 0000000..6362d39 --- /dev/null +++ b/mailbox/tools/maildir-utils/src/main/java/org/apache/james/mailbox/tools/maildir/MaildirStoreUtil.java @@ -0,0 +1,55 @@ +/**************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one * + * or more contributor license agreements. See the NOTICE file * + * distributed with this work for additional information * + * regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the * + * "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, * + * software distributed under the License is distributed on an * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * + * KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations * + * under the License. * + ****************************************************************/ +package org.apache.james.mailbox.tools.maildir; + +import java.io.FileNotFoundException; + +import org.apache.james.filesystem.api.FileSystem; +import org.apache.james.mailbox.MailboxPathLocker; +import org.apache.james.mailbox.maildir.MaildirStore; +import org.apache.james.user.api.UsersRepository; +import org.apache.james.user.api.UsersRepositoryException; + +/** + * Utility to instance a {@link MaildirStore} object + */ +public class MaildirStoreUtil { + + /** + * Return a {@link MaildirStore} instance + * + * @param fs + * @param rootURL + * @param locker + * @return store + * @throws FileNotFoundException + * @throws UsersRepositoryException + */ + public static MaildirStore create(FileSystem fs, UsersRepository usersRepos, String rootURL, MailboxPathLocker locker) throws FileNotFoundException, UsersRepositoryException { + StringBuilder root = new StringBuilder(); + root.append(fs.getFile(rootURL).getAbsolutePath()); + if (usersRepos.supportVirtualHosting()) { + root.append("/").append(MaildirStore.PATH_DOMAIN).append("/").append(MaildirStore.PATH_USER).append("/"); + } else { + root.append("/").append(MaildirStore.PATH_USER).append("/"); + } + + return new MaildirStore(root.toString(), locker); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/77fdac54/mailbox/tools/pom.xml ---------------------------------------------------------------------- diff --git a/mailbox/tools/pom.xml b/mailbox/tools/pom.xml new file mode 100644 index 0000000..64c3fb7 --- /dev/null +++ b/mailbox/tools/pom.xml @@ -0,0 +1,37 @@ +<?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> + <artifactId>apache-james-mailbox</artifactId> + <groupId>org.apache.james</groupId> + <version>3.2.0-SNAPSHOT</version> + </parent> + + <artifactId>apache-james-mailbox-tools</artifactId> + <packaging>pom</packaging> + + <name>Apache James :: Mailbox :: Tools</name> + + <modules> + <module>maildir-utils</module> + </modules> +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/77fdac54/server/container/mailbox-adapter/pom.xml ---------------------------------------------------------------------- diff --git a/server/container/mailbox-adapter/pom.xml b/server/container/mailbox-adapter/pom.xml index 8e3c338..3d05f4d 100644 --- a/server/container/mailbox-adapter/pom.xml +++ b/server/container/mailbox-adapter/pom.xml @@ -45,10 +45,6 @@ </dependency> <dependency> <groupId>${james.groupId}</groupId> - <artifactId>apache-james-mailbox-maildir</artifactId> - </dependency> - <dependency> - <groupId>${james.groupId}</groupId> <artifactId>apache-james-mailbox-memory</artifactId> <scope>test</scope> </dependency> http://git-wip-us.apache.org/repos/asf/james-project/blob/77fdac54/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/maildir/MaildirStoreUtil.java ---------------------------------------------------------------------- diff --git a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/maildir/MaildirStoreUtil.java b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/maildir/MaildirStoreUtil.java deleted file mode 100644 index 9cd9fa7..0000000 --- a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/maildir/MaildirStoreUtil.java +++ /dev/null @@ -1,55 +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.adapter.mailbox.maildir; - -import java.io.FileNotFoundException; - -import org.apache.james.filesystem.api.FileSystem; -import org.apache.james.mailbox.MailboxPathLocker; -import org.apache.james.mailbox.maildir.MaildirStore; -import org.apache.james.user.api.UsersRepository; -import org.apache.james.user.api.UsersRepositoryException; - -/** - * Utility to instance a {@link MaildirStore} object - */ -public class MaildirStoreUtil { - - /** - * Return a {@link MaildirStore} instance - * - * @param fs - * @param rootURL - * @param locker - * @return store - * @throws FileNotFoundException - * @throws UsersRepositoryException - */ - public static MaildirStore create(FileSystem fs, UsersRepository usersRepos, String rootURL, MailboxPathLocker locker) throws FileNotFoundException, UsersRepositoryException { - StringBuilder root = new StringBuilder(); - root.append(fs.getFile(rootURL).getAbsolutePath()); - if (usersRepos.supportVirtualHosting()) { - root.append("/").append(MaildirStore.PATH_DOMAIN).append("/").append(MaildirStore.PATH_USER).append("/"); - } else { - root.append("/").append(MaildirStore.PATH_USER).append("/"); - } - - return new MaildirStore(root.toString(), locker); - } -} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
