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 bt...@apache.org on 2019/03/22 03:07:01 UTC

[james-project] 04/06: JAMES-2684 Add BlobExportMechanism API

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit b6554d66ecae62d195c47bbf7ea2e74640b7cd4d
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Wed Mar 20 10:51:47 2019 +0700

    JAMES-2684 Add BlobExportMechanism API
---
 pom.xml                                            |  5 +++
 server/blob/{ => blob-export-api}/pom.xml          | 34 +++++++--------
 .../james/blob/export/api/BlobExportMechanism.java | 48 ++++++++++++++++++++++
 server/blob/pom.xml                                |  1 +
 4 files changed, 71 insertions(+), 17 deletions(-)

diff --git a/pom.xml b/pom.xml
index 969ed28..bac9810 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1087,6 +1087,11 @@
             </dependency>
             <dependency>
                 <groupId>${james.groupId}</groupId>
+                <artifactId>blob-export-api</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${james.groupId}</groupId>
                 <artifactId>blob-memory</artifactId>
                 <version>${project.version}</version>
             </dependency>
diff --git a/server/blob/pom.xml b/server/blob/blob-export-api/pom.xml
similarity index 70%
copy from server/blob/pom.xml
copy to server/blob/blob-export-api/pom.xml
index 4ff5f90..634d248 100644
--- a/server/blob/pom.xml
+++ b/server/blob/blob-export-api/pom.xml
@@ -18,28 +18,28 @@
     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>james-server-blob</artifactId>
         <groupId>org.apache.james</groupId>
-        <artifactId>james-server</artifactId>
         <version>3.4.0-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
-    <artifactId>james-server-blob</artifactId>
-    <packaging>pom</packaging>
-    <name>Apache James :: Server :: Blob</name>
-
-    <modules>
-        <module>blob-api</module>
-        <module>blob-cassandra</module>
-        <module>blob-memory</module>
-        <module>blob-objectstorage</module>
-        <module>blob-union</module>
-
-        <module>mail-store</module>
-    </modules>
-
-</project>
+    <artifactId>blob-export-api</artifactId>
+    <packaging>jar</packaging>
+
+    <name>Apache James :: Server :: Blob :: Export :: API</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>apache-mailet-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>blob-api</artifactId>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file
diff --git a/server/blob/blob-export-api/src/main/java/org/apache/james/blob/export/api/BlobExportMechanism.java b/server/blob/blob-export-api/src/main/java/org/apache/james/blob/export/api/BlobExportMechanism.java
new file mode 100644
index 0000000..2aa94cf
--- /dev/null
+++ b/server/blob/blob-export-api/src/main/java/org/apache/james/blob/export/api/BlobExportMechanism.java
@@ -0,0 +1,48 @@
+/****************************************************************
+ * 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.blob.export.api;
+
+import org.apache.james.blob.api.BlobId;
+import org.apache.james.core.MailAddress;
+
+public interface BlobExportMechanism {
+    class BlobExportException extends RuntimeException {
+        public BlobExportException(String message, Throwable cause) {
+            super(message, cause);
+        }
+    }
+
+    @FunctionalInterface
+    interface ShareeStage {
+        ExplanationStage with(MailAddress sharee);
+    }
+
+    @FunctionalInterface
+    interface ExplanationStage {
+        FinalStage explanation(String explanation);
+    }
+
+    @FunctionalInterface
+    interface FinalStage {
+        void export() throws BlobExportException;
+    }
+
+    ShareeStage blobId(BlobId blobId);
+}
diff --git a/server/blob/pom.xml b/server/blob/pom.xml
index 4ff5f90..a49932a 100644
--- a/server/blob/pom.xml
+++ b/server/blob/pom.xml
@@ -35,6 +35,7 @@
     <modules>
         <module>blob-api</module>
         <module>blob-cassandra</module>
+        <module>blob-export-api</module>
         <module>blob-memory</module>
         <module>blob-objectstorage</module>
         <module>blob-union</module>


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org