You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gora.apache.org by le...@apache.org on 2017/08/23 20:55:01 UTC

[03/37] gora git commit: Fix code review comments

Fix code review comments


Project: http://git-wip-us.apache.org/repos/asf/gora/repo
Commit: http://git-wip-us.apache.org/repos/asf/gora/commit/05b791a6
Tree: http://git-wip-us.apache.org/repos/asf/gora/tree/05b791a6
Diff: http://git-wip-us.apache.org/repos/asf/gora/diff/05b791a6

Branch: refs/heads/master
Commit: 05b791a62c03a35bdfbf156f795ff00edc61e4a1
Parents: a7b99f8
Author: madhawa <ma...@gmail.com>
Authored: Fri Jun 23 00:57:01 2017 +0530
Committer: madhawa <ma...@gmail.com>
Committed: Fri Jun 23 01:12:30 2017 +0530

----------------------------------------------------------------------
 .../gora/cassandra/bean/CassandraKey.java       | 24 ++++++++++++++++++++
 .../org/apache/gora/cassandra/bean/Field.java   | 19 +++++++++++++++-
 .../apache/gora/cassandra/bean/KeySpace.java    | 17 ++++++++++++++
 .../apache/gora/cassandra/bean/PrimaryKey.java  |  7 ------
 .../gora/cassandra/store/CassandraMapping.java  | 19 +++++++++++++++-
 .../cassandra/store/CassandraQueryFactory.java  | 20 ++++++++++++++++
 .../gora/cassandra/store/CassandraStore.java    | 22 ++++++++++++++++++
 7 files changed, 119 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/gora/blob/05b791a6/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/bean/CassandraKey.java
----------------------------------------------------------------------
diff --git a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/bean/CassandraKey.java b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/bean/CassandraKey.java
new file mode 100644
index 0000000..c0adf2c
--- /dev/null
+++ b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/bean/CassandraKey.java
@@ -0,0 +1,24 @@
+/*
+ *  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.gora.cassandra.bean;
+
+/**
+ * This Class represents the Cassandra Key.
+ */
+public class CassandraKey {
+}

http://git-wip-us.apache.org/repos/asf/gora/blob/05b791a6/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/bean/Field.java
----------------------------------------------------------------------
diff --git a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/bean/Field.java b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/bean/Field.java
index 2bd997f..8991b69 100644
--- a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/bean/Field.java
+++ b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/bean/Field.java
@@ -1,10 +1,27 @@
+/*
+ *  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.gora.cassandra.bean;
 
 import java.util.HashMap;
 import java.util.Map;
 
 /**
- * Created by madhawa on 6/22/17.
+ * This Class represents the Cassandra Column.
  */
 public class Field {
 

http://git-wip-us.apache.org/repos/asf/gora/blob/05b791a6/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/bean/KeySpace.java
----------------------------------------------------------------------
diff --git a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/bean/KeySpace.java b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/bean/KeySpace.java
index af563da..b695782 100644
--- a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/bean/KeySpace.java
+++ b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/bean/KeySpace.java
@@ -1,3 +1,20 @@
+/*
+ *  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.gora.cassandra.bean;
 
 import java.util.HashMap;

http://git-wip-us.apache.org/repos/asf/gora/blob/05b791a6/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/bean/PrimaryKey.java
----------------------------------------------------------------------
diff --git a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/bean/PrimaryKey.java b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/bean/PrimaryKey.java
deleted file mode 100644
index d3477f2..0000000
--- a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/bean/PrimaryKey.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.apache.gora.cassandra.bean;
-
-/**
- * Created by madhawa on 6/22/17.
- */
-public class PrimaryKey {
-}

http://git-wip-us.apache.org/repos/asf/gora/blob/05b791a6/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraMapping.java
----------------------------------------------------------------------
diff --git a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraMapping.java b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraMapping.java
index e533d57..4a67215 100644
--- a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraMapping.java
+++ b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraMapping.java
@@ -1,3 +1,20 @@
+/*
+ *  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.gora.cassandra.store;
 
 import org.apache.gora.cassandra.bean.Field;
@@ -9,7 +26,7 @@ import java.util.List;
 import java.util.Map;
 
 /**
- * Created by madhawa on 6/22/17.
+ * This class represents the Cassandra Mapping
  */
 public class CassandraMapping {
 

http://git-wip-us.apache.org/repos/asf/gora/blob/05b791a6/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraQueryFactory.java
----------------------------------------------------------------------
diff --git a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraQueryFactory.java b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraQueryFactory.java
index e70eaee..6decd3c 100644
--- a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraQueryFactory.java
+++ b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraQueryFactory.java
@@ -1,3 +1,20 @@
+/*
+ *  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.gora.cassandra.store;
 
 import org.apache.gora.cassandra.bean.Field;
@@ -5,6 +22,9 @@ import org.apache.gora.cassandra.bean.KeySpace;
 
 import java.util.Map;
 
+/**
+ * This class is used create Cassandra Queries.
+ */
 class CassandraQueryFactory {
 
   static String getCreateKeySpaceQuery(CassandraMapping mapping) {

http://git-wip-us.apache.org/repos/asf/gora/blob/05b791a6/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java
----------------------------------------------------------------------
diff --git a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java
index 4bd1ad3..20bf7f9 100644
--- a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java
+++ b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java
@@ -44,6 +44,12 @@ import java.io.IOException;
 import java.util.List;
 import java.util.Properties;
 
+/**
+ * Implementation of Cassandra Store.
+ *
+ * @param <K> key class
+ * @param <T> persistent class
+ */
 public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K, T> {
 
   private static final String DEFAULT_MAPPING_FILE = "gora-cassandra-mapping.xml";
@@ -64,6 +70,15 @@ public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K
     super();
   }
 
+  /**
+   * {@inheritDoc}
+   * In initializing the cassandra datastore, read the mapping file, creates the basic connection to cassandra cluster,
+   * according to the gora properties
+   *
+   * @param keyClass        key class
+   * @param persistentClass persistent class
+   * @param properties      properties
+   */
   @Override
   public void initialize(Class<K> keyClass, Class<T> persistentClass, Properties properties) {
     LOG.debug("Initializing Cassandra store");
@@ -89,6 +104,13 @@ public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K
     }
   }
 
+  /**
+   * In this method we reads the mapping file and creates the Cassandra Mapping.
+   *
+   * @param filename mapping file name
+   * @return @{@link CassandraMapping}
+   * @throws IOException
+   */
   private CassandraMapping readMapping(String filename) throws IOException {
     CassandraMapping map = new CassandraMapping();
     try {