incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [1/3] git commit: Adding new commands to be able to manage traces from command line.
Date Fri, 06 Dec 2013 15:55:11 GMT
Updated Branches:
  refs/heads/master 617bfe890 -> 043e52e5c


Adding new commands to be able to manage traces from command line.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/bc688a44
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/bc688a44
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/bc688a44

Branch: refs/heads/master
Commit: bc688a441fd7a466d3ebdbf580cd2d391815c13f
Parents: 6a1f7a4
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Fri Dec 6 10:52:27 2013 -0500
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Fri Dec 6 10:55:04 2013 -0500

----------------------------------------------------------------------
 .../main/java/org/apache/blur/shell/Main.java   |  5 +-
 .../java/org/apache/blur/shell/TraceList.java   | 52 ++++++++++++++++++++
 .../java/org/apache/blur/shell/TraceRemove.java | 50 +++++++++++++++++++
 3 files changed, 106 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/bc688a44/blur-shell/src/main/java/org/apache/blur/shell/Main.java
----------------------------------------------------------------------
diff --git a/blur-shell/src/main/java/org/apache/blur/shell/Main.java b/blur-shell/src/main/java/org/apache/blur/shell/Main.java
index c202f8a..ec0ae8a 100644
--- a/blur-shell/src/main/java/org/apache/blur/shell/Main.java
+++ b/blur-shell/src/main/java/org/apache/blur/shell/Main.java
@@ -402,7 +402,8 @@ public class Main {
   public static String[] dataCommands = { "query", "get", "mutate", "delete", "highlight",
"selector", "terms",
       "create-snapshot", "remove-snapshot", "list-snapshots" };
   public static String[] clusterCommands = { "controllers", "shards", "clusterlist", "cluster",
"safemodewait", "top" };
-  public static String[] shellCommands = { "help", "debug", "timed", "quit", "reset", "user",
"whoami" };
+  public static String[] shellCommands = { "help", "debug", "timed", "quit", "reset", "user",
"whoami", "trace",
+      "trace-remove", "trace-list" };
 
   private static class HelpCommand extends Command {
     @Override
@@ -670,6 +671,8 @@ public class Main {
     register(builder, new WhoAmICommand());
     register(builder, new UserCommand());
     register(builder, new TraceCommand());
+    register(builder, new TraceList());
+    register(builder, new TraceRemove());
     commands = builder.build();
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/bc688a44/blur-shell/src/main/java/org/apache/blur/shell/TraceList.java
----------------------------------------------------------------------
diff --git a/blur-shell/src/main/java/org/apache/blur/shell/TraceList.java b/blur-shell/src/main/java/org/apache/blur/shell/TraceList.java
new file mode 100644
index 0000000..3d13253
--- /dev/null
+++ b/blur-shell/src/main/java/org/apache/blur/shell/TraceList.java
@@ -0,0 +1,52 @@
+/**
+ * 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.blur.shell;
+
+import java.io.PrintWriter;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.blur.thirdparty.thrift_0_9_0.TException;
+import org.apache.blur.thrift.generated.Blur;
+import org.apache.blur.thrift.generated.BlurException;
+
+public class TraceList extends Command {
+  @Override
+  public void doit(PrintWriter out, Blur.Iface client, String[] args) throws CommandException,
TException,
+      BlurException {
+    List<String> traceList = client.traceList();
+    Collections.sort(traceList);
+    for (String s : traceList) {
+      out.println(s);
+    }
+  }
+
+  @Override
+  public String description() {
+    return "List traces by id.";
+  }
+
+  @Override
+  public String usage() {
+    return "";
+  }
+
+  @Override
+  public String name() {
+    return "trace-list";
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/bc688a44/blur-shell/src/main/java/org/apache/blur/shell/TraceRemove.java
----------------------------------------------------------------------
diff --git a/blur-shell/src/main/java/org/apache/blur/shell/TraceRemove.java b/blur-shell/src/main/java/org/apache/blur/shell/TraceRemove.java
new file mode 100644
index 0000000..ed5fac5
--- /dev/null
+++ b/blur-shell/src/main/java/org/apache/blur/shell/TraceRemove.java
@@ -0,0 +1,50 @@
+/**
+ * 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.blur.shell;
+
+import java.io.PrintWriter;
+
+import org.apache.blur.thirdparty.thrift_0_9_0.TException;
+import org.apache.blur.thrift.generated.Blur;
+import org.apache.blur.thrift.generated.BlurException;
+
+public class TraceRemove extends Command {
+  @Override
+  public void doit(PrintWriter out, Blur.Iface client, String[] args) throws CommandException,
TException,
+      BlurException {
+    if (args.length < 2) {
+      throw new CommandException("Invalid args: " + help());
+    }
+    String traceId = args[1];
+    client.traceRemove(traceId);
+  }
+
+  @Override
+  public String description() {
+    return "Delete trace by id.";
+  }
+
+  @Override
+  public String usage() {
+    return "<trace id>";
+  }
+
+  @Override
+  public String name() {
+    return "trace-remove";
+  }
+}
\ No newline at end of file


Mime
View raw message