falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From venkat...@apache.org
Subject [3/4] git commit: FALCON-358 REST API does not conform to Rexster. Contributed by Venkatesh Seetharam
Date Wed, 19 Mar 2014 23:14:35 GMT
FALCON-358 REST API does not conform to Rexster. Contributed by Venkatesh Seetharam


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

Branch: refs/heads/master
Commit: abc97fbd47e44792698b261fe5e987a81735a19f
Parents: 6504e7a
Author: Venkatesh Seetharam <venkatesh@hortonworks.com>
Authored: Wed Mar 19 11:06:05 2014 -0700
Committer: Venkatesh Seetharam <venkatesh@hortonworks.com>
Committed: Wed Mar 19 11:06:05 2014 -0700

----------------------------------------------------------------------
 CHANGES.txt                                       |  2 ++
 .../java/org/apache/falcon/cli/FalconCLI.java     | 18 +++++++++---------
 .../org/apache/falcon/client/FalconClient.java    |  4 ++--
 .../metadata/LineageMetadataResource.java         | 14 ++++++++------
 .../org/apache/falcon/cli/FalconCLISmokeIT.java   |  2 +-
 5 files changed, 22 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/abc97fbd/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 6aedbf0..c75f04c 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -260,6 +260,8 @@ Release Version: 0.4-incubating
     FALCON-363 Jetty is started with war when the war is already expanded
     (Venkatesh Seetharam)
 
+    FALCON-358 REST API does not conform to Rexster (Venkatesh Seetharam)
+
   BUG FIXES
 
     FALCON-223: hive-exec bundles protobuf-2.4.1 which is incompatible with hadoop-2 requiring
protobuf-2.5

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/abc97fbd/client/src/main/java/org/apache/falcon/cli/FalconCLI.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/cli/FalconCLI.java b/client/src/main/java/org/apache/falcon/cli/FalconCLI.java
index c8ce780..d467662 100644
--- a/client/src/main/java/org/apache/falcon/cli/FalconCLI.java
+++ b/client/src/main/java/org/apache/falcon/cli/FalconCLI.java
@@ -98,7 +98,7 @@ public class FalconCLI {
     // Graph Command Options
     public static final String EDGE_CMD = "edge";
     public static final String ID_OPT = "id";
-    public static final String NAME_OPT = "name";
+    public static final String KEY_OPT = "key";
     public static final String VALUE_OPT = "value";
     public static final String DIRECTION_OPT = "direction";
     public static final String DUMP_OPT = "all";
@@ -609,8 +609,8 @@ public class FalconCLI {
         Option id = new Option(ID_OPT, true, "vertex or edge id");
         graphOptions.addOption(id);
 
-        Option name = new Option(NAME_OPT, true, "name property");
-        graphOptions.addOption(name);
+        Option key = new Option(KEY_OPT, true, "key property");
+        graphOptions.addOption(key);
 
         Option value = new Option(VALUE_OPT, true, "value property");
         graphOptions.addOption(value);
@@ -633,7 +633,7 @@ public class FalconCLI {
 
         String result;
         String id = commandLine.getOptionValue(ID_OPT);
-        String name = commandLine.getOptionValue(NAME_OPT);
+        String key = commandLine.getOptionValue(KEY_OPT);
         String value = commandLine.getOptionValue(VALUE_OPT);
         String direction = commandLine.getOptionValue(DIRECTION_OPT);
 
@@ -644,8 +644,8 @@ public class FalconCLI {
             if (optionsList.contains(DUMP_OPT)) {
                 result = client.getVertices();
             } else {
-                validateVerticesCommand(name, value);
-                result = client.getVertices(name, value);
+                validateVerticesCommand(key, value);
+                result = client.getVertices(key, value);
             }
         } else if (optionsList.contains(VERTEX_EDGES_CMD)) {
             if (optionsList.contains(DUMP_OPT)) {
@@ -670,9 +670,9 @@ public class FalconCLI {
         }
     }
 
-    private void validateVerticesCommand(String name, String value) throws FalconCLIException
{
-        if (name == null || name.length() == 0) {
-            throw new FalconCLIException("Missing argument: name");
+    private void validateVerticesCommand(String key, String value) throws FalconCLIException
{
+        if (key == null || key.length() == 0) {
+            throw new FalconCLIException("Missing argument: key");
         }
 
         if (value == null || value.length() == 0) {

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/abc97fbd/client/src/main/java/org/apache/falcon/client/FalconClient.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/client/FalconClient.java b/client/src/main/java/org/apache/falcon/client/FalconClient.java
index f008953..1c6f2c5 100644
--- a/client/src/main/java/org/apache/falcon/client/FalconClient.java
+++ b/client/src/main/java/org/apache/falcon/client/FalconClient.java
@@ -786,10 +786,10 @@ public class FalconClient {
         return parseStringResult(clientResponse);
     }
 
-    private String sendGraphRequest(GraphOperations job, String name,
+    private String sendGraphRequest(GraphOperations job, String key,
                                     String value) throws FalconCLIException {
         ClientResponse clientResponse = service.path(job.path)
-                .queryParam("name", name)
+                .queryParam("key", key)
                 .queryParam("value", value)
                 .header("Cookie", AUTH_COOKIE_EQ + authenticationToken)
                 .accept(job.mimeType)

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/abc97fbd/prism/src/main/java/org/apache/falcon/resource/metadata/LineageMetadataResource.java
----------------------------------------------------------------------
diff --git a/prism/src/main/java/org/apache/falcon/resource/metadata/LineageMetadataResource.java
b/prism/src/main/java/org/apache/falcon/resource/metadata/LineageMetadataResource.java
index 7c307e3..64a1d77 100644
--- a/prism/src/main/java/org/apache/falcon/resource/metadata/LineageMetadataResource.java
+++ b/prism/src/main/java/org/apache/falcon/resource/metadata/LineageMetadataResource.java
@@ -47,6 +47,8 @@ import java.util.Set;
 
 /**
  * Jersey Resource for lineage metadata operations.
+ * Implements most of the GET operations of Rexster API with out the indexes.
+ * https://github.com/tinkerpop/rexster/wiki/Basic-REST-API
  */
 @Path("graphs/lineage")
 public class LineageMetadataResource {
@@ -154,20 +156,20 @@ public class LineageMetadataResource {
     }
 
     /**
-     * Get a list of vertices matching a property name and a value.
+     * Get a list of vertices matching a property key and a value.
      * <p/>
-     * GET http://host/graphs/lineage/vertices?name=<name>&value=<value>
-     * graph.getVertices(name, value);
+     * GET http://host/graphs/lineage/vertices?key=<key>&value=<value>
+     * graph.getVertices(key, value);
      */
     @GET
     @Path("/vertices")
     @Produces({MediaType.APPLICATION_JSON})
-    public Response getVertices(@QueryParam("name") final String name,
+    public Response getVertices(@QueryParam("key") final String key,
                                 @QueryParam("value") final String value) {
         checkIfMetadataMappingServiceIsEnabled();
-        LOG.info("Get vertices for property name= " + name + ", value= " + value);
+        LOG.info("Get vertices for property key= " + key + ", value= " + value);
         try {
-            JSONObject response = buildJSONResponse(getGraph().getVertices(name, value));
+            JSONObject response = buildJSONResponse(getGraph().getVertices(key, value));
             return Response.ok(response).build();
 
         } catch (JSONException e) {

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/abc97fbd/webapp/src/test/java/org/apache/falcon/cli/FalconCLISmokeIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/falcon/cli/FalconCLISmokeIT.java b/webapp/src/test/java/org/apache/falcon/cli/FalconCLISmokeIT.java
index 671ff4f..41b270e 100644
--- a/webapp/src/test/java/org/apache/falcon/cli/FalconCLISmokeIT.java
+++ b/webapp/src/test/java/org/apache/falcon/cli/FalconCLISmokeIT.java
@@ -60,7 +60,7 @@ public class FalconCLISmokeIT {
         // verify
         Assert.assertEquals(0, executeWithURL("graph -vertices -all"));
         Assert.assertEquals(0, executeWithURL("graph -edges -all"));
-        Assert.assertEquals(0, executeWithURL("graph -vertices -name name -value " + context.getClusterName()));
+        Assert.assertEquals(0, executeWithURL("graph -vertices -key name -value " + context.getClusterName()));
 
         filePath = TestContext.overlayParametersOverTemplate(TestContext.FEED_TEMPLATE1,
overlay);
         Assert.assertEquals(0,


Mime
View raw message