gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lewi...@apache.org
Subject gora git commit: adding GORA-274 fix
Date Thu, 19 May 2016 20:43:08 GMT
Repository: gora
Updated Branches:
  refs/heads/master 049555130 -> 8a7101781


adding GORA-274 fix


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

Branch: refs/heads/master
Commit: 8a7101781ea18d8e3ca2a8e37978110337fe2373
Parents: 0495551
Author: djkevincr <djkevincr@yahoo.com>
Authored: Wed May 18 20:44:45 2016 +0530
Committer: djkevincr <djkevincr@yahoo.com>
Committed: Wed May 18 20:44:45 2016 +0530

----------------------------------------------------------------------
 .../org/apache/gora/tutorial/log/LogManager.java | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/gora/blob/8a710178/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogManager.java
----------------------------------------------------------------------
diff --git a/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogManager.java b/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogManager.java
index f089afb..b80c20f 100644
--- a/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogManager.java
+++ b/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogManager.java
@@ -147,6 +147,12 @@ public class LogManager {
     Pageview pageview = dataStore.get(key);
     printPageview(pageview);
   }
+
+  /** Fetches a single pageview object with required fields and prints it*/
+  private void get(long key, String[] fields) throws Exception {
+    Pageview pageview = dataStore.get(key, fields);
+    printPageview(pageview);
+  }
   
   /** Queries and prints a single pageview object */
   private void query(long key) throws Exception {
@@ -224,10 +230,11 @@ public class LogManager {
   
   private static final String USAGE = "LogManager -parse <input_log_file>\n" +
                                       "           -get <lineNum>\n" +
+                                      "           -get <lineNum> <fieldList>\n"
+
                                       "           -query <lineNum>\n" +
                                       "           -query <startLineNum> <endLineNum>\n"
+
-  		                                "           -delete <lineNum>\n" +
-  		                                "           -deleteByQuery <startLineNum> <endLineNum>\n";
+  		                              "           -delete <lineNum>\n" +
+  		                              "           -deleteByQuery <startLineNum> <endLineNum>\n";
   
   public static void main(String[] args) throws Exception {
     if(args.length < 2) {
@@ -240,7 +247,13 @@ public class LogManager {
     if("-parse".equals(args[0])) {
       manager.parse(args[1]);
     } else if("-get".equals(args[0])) {
-      manager.get(Long.parseLong(args[1]));
+      if(args.length == 2) {
+        manager.get(Long.parseLong(args[1]));
+      } else {
+        //field array should be input as comma ',' separated
+        String[] fields = args[2].split(",");
+        manager.get(Long.parseLong(args[1]), fields);
+      }
     } else if("-query".equals(args[0])) {
       if(args.length == 2) 
         manager.query(Long.parseLong(args[1]));


Mime
View raw message