james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [02/41] james-project git commit: JAMES-2082 Change current message table to MessageV1Table
Date Mon, 10 Jul 2017 17:54:14 GMT
JAMES-2082 Change current message table to MessageV1Table


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/67aa1914
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/67aa1914
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/67aa1914

Branch: refs/heads/master
Commit: 67aa1914804b62bd102f03f9217841b8f56d83a5
Parents: c00651a
Author: quynhn <qnguyen@linagora.com>
Authored: Mon Jul 3 18:05:45 2017 +0700
Committer: Antoine Duprat <aduprat@linagora.com>
Committed: Mon Jul 10 14:23:54 2017 +0200

----------------------------------------------------------------------
 .../cassandra/mail/CassandraMessageDAO.java     | 32 +++++------
 .../modules/CassandraMessageModule.java         | 60 ++++++++++++--------
 .../cassandra/table/CassandraMessageTable.java  | 54 ------------------
 .../table/CassandraMessageV1Table.java          | 54 ++++++++++++++++++
 4 files changed, 107 insertions(+), 93 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/67aa1914/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java
index 9dd3d21..9c69158 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java
@@ -24,20 +24,20 @@ import static com.datastax.driver.core.querybuilder.QueryBuilder.eq;
 import static com.datastax.driver.core.querybuilder.QueryBuilder.insertInto;
 import static com.datastax.driver.core.querybuilder.QueryBuilder.select;
 import static org.apache.james.mailbox.cassandra.table.CassandraMessageIds.MESSAGE_ID;
-import static org.apache.james.mailbox.cassandra.table.CassandraMessageTable.ATTACHMENTS;
-import static org.apache.james.mailbox.cassandra.table.CassandraMessageTable.BODY;
-import static org.apache.james.mailbox.cassandra.table.CassandraMessageTable.BODY_CONTENT;
-import static org.apache.james.mailbox.cassandra.table.CassandraMessageTable.BODY_OCTECTS;
-import static org.apache.james.mailbox.cassandra.table.CassandraMessageTable.BODY_START_OCTET;
-import static org.apache.james.mailbox.cassandra.table.CassandraMessageTable.FIELDS;
-import static org.apache.james.mailbox.cassandra.table.CassandraMessageTable.FULL_CONTENT_OCTETS;
-import static org.apache.james.mailbox.cassandra.table.CassandraMessageTable.HEADERS;
-import static org.apache.james.mailbox.cassandra.table.CassandraMessageTable.HEADER_CONTENT;
-import static org.apache.james.mailbox.cassandra.table.CassandraMessageTable.INTERNAL_DATE;
-import static org.apache.james.mailbox.cassandra.table.CassandraMessageTable.METADATA;
-import static org.apache.james.mailbox.cassandra.table.CassandraMessageTable.PROPERTIES;
-import static org.apache.james.mailbox.cassandra.table.CassandraMessageTable.TABLE_NAME;
-import static org.apache.james.mailbox.cassandra.table.CassandraMessageTable.TEXTUAL_LINE_COUNT;
+import static org.apache.james.mailbox.cassandra.table.CassandraMessageV1Table.ATTACHMENTS;
+import static org.apache.james.mailbox.cassandra.table.CassandraMessageV1Table.BODY;
+import static org.apache.james.mailbox.cassandra.table.CassandraMessageV1Table.BODY_CONTENT;
+import static org.apache.james.mailbox.cassandra.table.CassandraMessageV1Table.BODY_OCTECTS;
+import static org.apache.james.mailbox.cassandra.table.CassandraMessageV1Table.BODY_START_OCTET;
+import static org.apache.james.mailbox.cassandra.table.CassandraMessageV1Table.FIELDS;
+import static org.apache.james.mailbox.cassandra.table.CassandraMessageV1Table.FULL_CONTENT_OCTETS;
+import static org.apache.james.mailbox.cassandra.table.CassandraMessageV1Table.HEADERS;
+import static org.apache.james.mailbox.cassandra.table.CassandraMessageV1Table.HEADER_CONTENT;
+import static org.apache.james.mailbox.cassandra.table.CassandraMessageV1Table.INTERNAL_DATE;
+import static org.apache.james.mailbox.cassandra.table.CassandraMessageV1Table.METADATA;
+import static org.apache.james.mailbox.cassandra.table.CassandraMessageV1Table.PROPERTIES;
+import static org.apache.james.mailbox.cassandra.table.CassandraMessageV1Table.TABLE_NAME;
+import static org.apache.james.mailbox.cassandra.table.CassandraMessageV1Table.TEXTUAL_LINE_COUNT;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -60,8 +60,8 @@ import org.apache.james.backends.cassandra.init.CassandraTypesProvider;
 import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor;
 import org.apache.james.mailbox.MessageUid;
 import org.apache.james.mailbox.cassandra.CassandraMessageId;
-import org.apache.james.mailbox.cassandra.table.CassandraMessageTable.Attachments;
-import org.apache.james.mailbox.cassandra.table.CassandraMessageTable.Properties;
+import org.apache.james.mailbox.cassandra.table.CassandraMessageV1Table.Attachments;
+import org.apache.james.mailbox.cassandra.table.CassandraMessageV1Table.Properties;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.AttachmentId;
 import org.apache.james.mailbox.model.Cid;

http://git-wip-us.apache.org/repos/asf/james-project/blob/67aa1914/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/modules/CassandraMessageModule.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/modules/CassandraMessageModule.java
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/modules/CassandraMessageModule.java
index 9e84008..3a55d6f 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/modules/CassandraMessageModule.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/modules/CassandraMessageModule.java
@@ -35,7 +35,8 @@ import org.apache.james.backends.cassandra.components.CassandraTable;
 import org.apache.james.backends.cassandra.components.CassandraType;
 import org.apache.james.mailbox.cassandra.table.CassandraMessageIdTable;
 import org.apache.james.mailbox.cassandra.table.CassandraMessageIds;
-import org.apache.james.mailbox.cassandra.table.CassandraMessageTable;
+import org.apache.james.mailbox.cassandra.table.CassandraMessageV1Table;
+import org.apache.james.mailbox.cassandra.table.CassandraMessageV2Table;
 import org.apache.james.mailbox.cassandra.table.Flag;
 import org.apache.james.mailbox.cassandra.table.MessageIdToImapUid;
 
@@ -89,33 +90,46 @@ public class CassandraMessageModule implements CassandraModule {
                     .compactionOptions(SchemaBuilder.leveledStrategy())
                     .caching(SchemaBuilder.KeyCaching.ALL,
                         SchemaBuilder.rows(CACHED_MESSAGE_ID_ROWS))),
-            new CassandraTable(CassandraMessageTable.TABLE_NAME,
-                SchemaBuilder.createTable(CassandraMessageTable.TABLE_NAME)
+            new CassandraTable(CassandraMessageV1Table.TABLE_NAME,
+                SchemaBuilder.createTable(CassandraMessageV1Table.TABLE_NAME)
                     .ifNotExists()
                     .addPartitionKey(CassandraMessageIds.MESSAGE_ID, timeuuid())
-                    .addColumn(CassandraMessageTable.INTERNAL_DATE, timestamp())
-                    .addColumn(CassandraMessageTable.BODY_START_OCTET, cint())
-                    .addColumn(CassandraMessageTable.BODY_OCTECTS, bigint())
-                    .addColumn(CassandraMessageTable.TEXTUAL_LINE_COUNT, bigint())
-                    .addColumn(CassandraMessageTable.FULL_CONTENT_OCTETS, bigint())
-                    .addColumn(CassandraMessageTable.BODY_CONTENT, blob())
-                    .addColumn(CassandraMessageTable.HEADER_CONTENT, blob())
-                    .addUDTListColumn(CassandraMessageTable.ATTACHMENTS, SchemaBuilder.frozen(CassandraMessageTable.ATTACHMENTS))
-                    .addUDTListColumn(CassandraMessageTable.PROPERTIES, SchemaBuilder.frozen(CassandraMessageTable.PROPERTIES))));
+                    .addColumn(CassandraMessageV1Table.INTERNAL_DATE, timestamp())
+                    .addColumn(CassandraMessageV1Table.BODY_START_OCTET, cint())
+                    .addColumn(CassandraMessageV1Table.BODY_OCTECTS, bigint())
+                    .addColumn(CassandraMessageV1Table.TEXTUAL_LINE_COUNT, bigint())
+                    .addColumn(CassandraMessageV1Table.FULL_CONTENT_OCTETS, bigint())
+                    .addColumn(CassandraMessageV1Table.BODY_CONTENT, blob())
+                    .addColumn(CassandraMessageV1Table.HEADER_CONTENT, blob())
+                    .addUDTListColumn(CassandraMessageV1Table.ATTACHMENTS, SchemaBuilder.frozen(CassandraMessageV1Table.ATTACHMENTS))
+                    .addUDTListColumn(CassandraMessageV1Table.PROPERTIES, SchemaBuilder.frozen(CassandraMessageV1Table.PROPERTIES))),
+            new CassandraTable(CassandraMessageV2Table.TABLE_NAME,
+                SchemaBuilder.createTable(CassandraMessageV2Table.TABLE_NAME)
+                    .ifNotExists()
+                    .addPartitionKey(CassandraMessageIds.MESSAGE_ID, timeuuid())
+                    .addColumn(CassandraMessageV2Table.INTERNAL_DATE, timestamp())
+                    .addColumn(CassandraMessageV2Table.BODY_START_OCTET, cint())
+                    .addColumn(CassandraMessageV2Table.BODY_OCTECTS, bigint())
+                    .addColumn(CassandraMessageV2Table.TEXTUAL_LINE_COUNT, bigint())
+                    .addColumn(CassandraMessageV2Table.FULL_CONTENT_OCTETS, bigint())
+                    .addColumn(CassandraMessageV2Table.BODY_CONTENT, timeuuid())
+                    .addColumn(CassandraMessageV2Table.HEADER_CONTENT, timeuuid())
+                    .addUDTListColumn(CassandraMessageV2Table.ATTACHMENTS, SchemaBuilder.frozen(CassandraMessageV2Table.ATTACHMENTS))
+                    .addUDTListColumn(CassandraMessageV2Table.PROPERTIES, SchemaBuilder.frozen(CassandraMessageV2Table.PROPERTIES))));
         types = ImmutableList.of(
-            new CassandraType(CassandraMessageTable.PROPERTIES,
-                SchemaBuilder.createType(CassandraMessageTable.PROPERTIES)
+            new CassandraType(CassandraMessageV1Table.PROPERTIES,
+                SchemaBuilder.createType(CassandraMessageV1Table.PROPERTIES)
                     .ifNotExists()
-                    .addColumn(CassandraMessageTable.Properties.NAMESPACE, text())
-                    .addColumn(CassandraMessageTable.Properties.NAME, text())
-                    .addColumn(CassandraMessageTable.Properties.VALUE, text())),
-            new CassandraType(CassandraMessageTable.ATTACHMENTS,
-                SchemaBuilder.createType(CassandraMessageTable.ATTACHMENTS)
+                    .addColumn(CassandraMessageV1Table.Properties.NAMESPACE, text())
+                    .addColumn(CassandraMessageV1Table.Properties.NAME, text())
+                    .addColumn(CassandraMessageV1Table.Properties.VALUE, text())),
+            new CassandraType(CassandraMessageV1Table.ATTACHMENTS,
+                SchemaBuilder.createType(CassandraMessageV1Table.ATTACHMENTS)
                     .ifNotExists()
-                    .addColumn(CassandraMessageTable.Attachments.ID, text())
-                    .addColumn(CassandraMessageTable.Attachments.NAME, text())
-                    .addColumn(CassandraMessageTable.Attachments.CID, text())
-                    .addColumn(CassandraMessageTable.Attachments.IS_INLINE, cboolean())));
+                    .addColumn(CassandraMessageV1Table.Attachments.ID, text())
+                    .addColumn(CassandraMessageV1Table.Attachments.NAME, text())
+                    .addColumn(CassandraMessageV1Table.Attachments.CID, text())
+                    .addColumn(CassandraMessageV1Table.Attachments.IS_INLINE, cboolean())));
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/67aa1914/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/table/CassandraMessageTable.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/table/CassandraMessageTable.java
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/table/CassandraMessageTable.java
deleted file mode 100644
index 7b6c7bf..0000000
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/table/CassandraMessageTable.java
+++ /dev/null
@@ -1,54 +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.mailbox.cassandra.table;
-
-import static org.apache.james.mailbox.cassandra.table.CassandraMessageIds.MESSAGE_ID;
-
-public interface CassandraMessageTable {
-
-    String TABLE_NAME = "message";
-    String INTERNAL_DATE = "internalDate";
-    String BODY_START_OCTET = "bodyStartOctet";
-    String FULL_CONTENT_OCTETS = "fullContentOctets";
-    String BODY_OCTECTS = "bodyOctets";
-    String TEXTUAL_LINE_COUNT = "textualLineCount";
-    String BODY_CONTENT = "bodyContent";
-    String HEADER_CONTENT = "headerContent";
-    String PROPERTIES = "properties";
-    String ATTACHMENTS = "attachments";
-
-    String[] FIELDS = { MESSAGE_ID, INTERNAL_DATE, BODY_START_OCTET, FULL_CONTENT_OCTETS,
BODY_OCTECTS, BODY_CONTENT, HEADER_CONTENT, TEXTUAL_LINE_COUNT, PROPERTIES, ATTACHMENTS };
-    String[] METADATA = { MESSAGE_ID, INTERNAL_DATE, BODY_START_OCTET, FULL_CONTENT_OCTETS,
BODY_OCTECTS, TEXTUAL_LINE_COUNT, PROPERTIES };
-    String[] HEADERS = { MESSAGE_ID, INTERNAL_DATE, BODY_START_OCTET, FULL_CONTENT_OCTETS,
BODY_OCTECTS, HEADER_CONTENT, TEXTUAL_LINE_COUNT, PROPERTIES };
-    String[] BODY = { MESSAGE_ID, INTERNAL_DATE, BODY_START_OCTET, FULL_CONTENT_OCTETS, BODY_OCTECTS,
BODY_CONTENT, TEXTUAL_LINE_COUNT, PROPERTIES, ATTACHMENTS };
-
-    interface Properties {
-        String NAMESPACE = "namespace";
-        String NAME = "name";
-        String VALUE = "value";
-    }
-
-    interface Attachments {
-        String ID = "id";
-        String NAME = "name";
-        String CID = "cid";
-        String IS_INLINE = "isInline";
-    }
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/67aa1914/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/table/CassandraMessageV1Table.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/table/CassandraMessageV1Table.java
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/table/CassandraMessageV1Table.java
new file mode 100644
index 0000000..d932807
--- /dev/null
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/table/CassandraMessageV1Table.java
@@ -0,0 +1,54 @@
+/****************************************************************
+ * 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.cassandra.table;
+
+import static org.apache.james.mailbox.cassandra.table.CassandraMessageIds.MESSAGE_ID;
+
+public interface CassandraMessageV1Table {
+
+    String TABLE_NAME = "message";
+    String INTERNAL_DATE = "internalDate";
+    String BODY_START_OCTET = "bodyStartOctet";
+    String FULL_CONTENT_OCTETS = "fullContentOctets";
+    String BODY_OCTECTS = "bodyOctets";
+    String TEXTUAL_LINE_COUNT = "textualLineCount";
+    String BODY_CONTENT = "bodyContent";
+    String HEADER_CONTENT = "headerContent";
+    String PROPERTIES = "properties";
+    String ATTACHMENTS = "attachments";
+
+    String[] FIELDS = { MESSAGE_ID, INTERNAL_DATE, BODY_START_OCTET, FULL_CONTENT_OCTETS,
BODY_OCTECTS, BODY_CONTENT, HEADER_CONTENT, TEXTUAL_LINE_COUNT, PROPERTIES, ATTACHMENTS };
+    String[] METADATA = { MESSAGE_ID, INTERNAL_DATE, BODY_START_OCTET, FULL_CONTENT_OCTETS,
BODY_OCTECTS, TEXTUAL_LINE_COUNT, PROPERTIES };
+    String[] HEADERS = { MESSAGE_ID, INTERNAL_DATE, BODY_START_OCTET, FULL_CONTENT_OCTETS,
BODY_OCTECTS, HEADER_CONTENT, TEXTUAL_LINE_COUNT, PROPERTIES };
+    String[] BODY = { MESSAGE_ID, INTERNAL_DATE, BODY_START_OCTET, FULL_CONTENT_OCTETS, BODY_OCTECTS,
BODY_CONTENT, TEXTUAL_LINE_COUNT, PROPERTIES, ATTACHMENTS };
+
+    interface Properties {
+        String NAMESPACE = "namespace";
+        String NAME = "name";
+        String VALUE = "value";
+    }
+
+    interface Attachments {
+        String ID = "id";
+        String NAME = "name";
+        String CID = "cid";
+        String IS_INLINE = "isInline";
+    }
+}


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


Mime
View raw message