You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ro...@apache.org on 2018/01/15 09:56:02 UTC
[3/9] james-project git commit: JAMES-2286 create a
mailrepository-api project
JAMES-2286 create a mailrepository-api 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/55af3123
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/55af3123
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/55af3123
Branch: refs/heads/master
Commit: 55af312396f4731d01be68eaf565164dc0c5fbd0
Parents: 9191d3b
Author: Matthieu Baechler <ma...@apache.org>
Authored: Wed Jan 10 17:44:03 2018 +0100
Committer: benwa <bt...@linagora.com>
Committed: Mon Jan 15 16:52:08 2018 +0700
----------------------------------------------------------------------
pom.xml | 5 +
server/data/data-api/pom.xml | 4 +
.../mailrepository/api/MailRepository.java | 106 -------------------
.../mailrepository/mailrepository-api/pom.xml | 62 +++++++++++
.../mailrepository/api/MailRepository.java | 106 +++++++++++++++++++
server/pom.xml | 2 +
6 files changed, 179 insertions(+), 106 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/55af3123/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 22e35e1..74b22fe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1204,6 +1204,11 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>james-server-mailrepository-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>james-server-mailets</artifactId>
<version>${project.version}</version>
</dependency>
http://git-wip-us.apache.org/repos/asf/james-project/blob/55af3123/server/data/data-api/pom.xml
----------------------------------------------------------------------
diff --git a/server/data/data-api/pom.xml b/server/data/data-api/pom.xml
index 7052d31..26fc6ef 100644
--- a/server/data/data-api/pom.xml
+++ b/server/data/data-api/pom.xml
@@ -39,6 +39,10 @@
<artifactId>apache-mailet-api</artifactId>
</dependency>
<dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-mailrepository-api</artifactId>
+ </dependency>
+ <dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
http://git-wip-us.apache.org/repos/asf/james-project/blob/55af3123/server/data/data-api/src/main/java/org/apache/james/mailrepository/api/MailRepository.java
----------------------------------------------------------------------
diff --git a/server/data/data-api/src/main/java/org/apache/james/mailrepository/api/MailRepository.java b/server/data/data-api/src/main/java/org/apache/james/mailrepository/api/MailRepository.java
deleted file mode 100644
index aa2ff34..0000000
--- a/server/data/data-api/src/main/java/org/apache/james/mailrepository/api/MailRepository.java
+++ /dev/null
@@ -1,106 +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.mailrepository.api;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-import javax.mail.MessagingException;
-
-import org.apache.mailet.Mail;
-
-/**
- * Interface for a Repository to store Mails.
- */
-public interface MailRepository {
-
- /**
- * Stores a message in this repository.
- *
- * TODO: Shouldn't this return the key under which it is stored?
- *
- * @param mc
- * the mail message to store
- */
- void store(Mail mc) throws MessagingException;
-
- /**
- * List string keys of messages in repository.
- *
- * @return an <code>Iterator</code> over the list of keys in the repository
- *
- */
- Iterator<String> list() throws MessagingException;
-
- /**
- * Retrieves a message given a key. At the moment, keys can be obtained from
- * list() in superinterface Store.Repository
- *
- * @param key
- * the key of the message to retrieve
- * @return the mail corresponding to this key, null if none exists
- */
- Mail retrieve(String key) throws MessagingException;
-
- /**
- * Removes a specified message
- *
- * @param mail
- * the message to be removed from the repository
- */
- void remove(Mail mail) throws MessagingException;
-
- /**
- * Remove an Collection of mails from the repository
- *
- * @param mails
- * The Collection of <code>MailImpl</code>'s to delete
- * @since 2.2.0
- */
- void remove(Collection<Mail> mails) throws MessagingException;
-
- /**
- * Removes a message identified by key.
- *
- * @param key
- * the key of the message to be removed from the repository
- */
- void remove(String key) throws MessagingException;
-
- /**
- * Obtains a lock on a message identified by key
- *
- * @param key
- * the key of the message to be locked
- *
- * @return true if successfully obtained the lock, false otherwise
- */
- boolean lock(String key) throws MessagingException;
-
- /**
- * Releases a lock on a message identified the key
- *
- * @param key
- * the key of the message to be unlocked
- *
- * @return true if successfully released the lock, false otherwise
- */
- boolean unlock(String key) throws MessagingException;
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/55af3123/server/mailrepository/mailrepository-api/pom.xml
----------------------------------------------------------------------
diff --git a/server/mailrepository/mailrepository-api/pom.xml b/server/mailrepository/mailrepository-api/pom.xml
new file mode 100644
index 0000000..2c60417
--- /dev/null
+++ b/server/mailrepository/mailrepository-api/pom.xml
@@ -0,0 +1,62 @@
+<?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.1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>james-server-mailrepository-api</artifactId>
+ <packaging>bundle</packaging>
+
+ <name>Apache James :: Server :: MailRepository :: API</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apache-mailet-api</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </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/55af3123/server/mailrepository/mailrepository-api/src/main/java/org/apache/james/mailrepository/api/MailRepository.java
----------------------------------------------------------------------
diff --git a/server/mailrepository/mailrepository-api/src/main/java/org/apache/james/mailrepository/api/MailRepository.java b/server/mailrepository/mailrepository-api/src/main/java/org/apache/james/mailrepository/api/MailRepository.java
new file mode 100644
index 0000000..aa2ff34
--- /dev/null
+++ b/server/mailrepository/mailrepository-api/src/main/java/org/apache/james/mailrepository/api/MailRepository.java
@@ -0,0 +1,106 @@
+/****************************************************************
+ * 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.mailrepository.api;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.mail.MessagingException;
+
+import org.apache.mailet.Mail;
+
+/**
+ * Interface for a Repository to store Mails.
+ */
+public interface MailRepository {
+
+ /**
+ * Stores a message in this repository.
+ *
+ * TODO: Shouldn't this return the key under which it is stored?
+ *
+ * @param mc
+ * the mail message to store
+ */
+ void store(Mail mc) throws MessagingException;
+
+ /**
+ * List string keys of messages in repository.
+ *
+ * @return an <code>Iterator</code> over the list of keys in the repository
+ *
+ */
+ Iterator<String> list() throws MessagingException;
+
+ /**
+ * Retrieves a message given a key. At the moment, keys can be obtained from
+ * list() in superinterface Store.Repository
+ *
+ * @param key
+ * the key of the message to retrieve
+ * @return the mail corresponding to this key, null if none exists
+ */
+ Mail retrieve(String key) throws MessagingException;
+
+ /**
+ * Removes a specified message
+ *
+ * @param mail
+ * the message to be removed from the repository
+ */
+ void remove(Mail mail) throws MessagingException;
+
+ /**
+ * Remove an Collection of mails from the repository
+ *
+ * @param mails
+ * The Collection of <code>MailImpl</code>'s to delete
+ * @since 2.2.0
+ */
+ void remove(Collection<Mail> mails) throws MessagingException;
+
+ /**
+ * Removes a message identified by key.
+ *
+ * @param key
+ * the key of the message to be removed from the repository
+ */
+ void remove(String key) throws MessagingException;
+
+ /**
+ * Obtains a lock on a message identified by key
+ *
+ * @param key
+ * the key of the message to be locked
+ *
+ * @return true if successfully obtained the lock, false otherwise
+ */
+ boolean lock(String key) throws MessagingException;
+
+ /**
+ * Releases a lock on a message identified the key
+ *
+ * @param key
+ * the key of the message to be unlocked
+ *
+ * @return true if successfully released the lock, false otherwise
+ */
+ boolean unlock(String key) throws MessagingException;
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/55af3123/server/pom.xml
----------------------------------------------------------------------
diff --git a/server/pom.xml b/server/pom.xml
index 3414224..11693e3 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -80,6 +80,8 @@
<module>mailet/mailetcontainer-camel</module>
<module>mailet/mailets</module>
+ <module>mailrepository/mailrepository-api</module>
+
<module>protocols/fetchmail</module>
<module>protocols/jmap</module>
<module>protocols/jmap-integration-testing</module>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org