falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From srik...@apache.org
Subject git commit: FALCON-152 REST API for entity & Admin resources only returns XML. Contributed by Venkatesh Seetharam
Date Mon, 28 Oct 2013 13:46:13 GMT
Updated Branches:
  refs/heads/FALCON-85 e66e18fa7 -> e22889eb8


FALCON-152 REST API for entity & Admin resources only returns XML. 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/e22889eb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-falcon/tree/e22889eb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-falcon/diff/e22889eb

Branch: refs/heads/FALCON-85
Commit: e22889eb8d8e156d83241e65e23d86323d31ed93
Parents: e66e18f
Author: srikanth.sundarrajan <srikanth.sundarrajan@inmobi.com>
Authored: Mon Oct 28 10:21:43 2013 +0530
Committer: srikanth.sundarrajan <srikanth.sundarrajan@inmobi.com>
Committed: Mon Oct 28 10:21:43 2013 +0530

----------------------------------------------------------------------
 CHANGES.txt                                     |  3 ++
 .../java/org/apache/falcon/cli/FalconCLI.java   |  3 +-
 .../org/apache/falcon/client/FalconClient.java  | 54 +++++++++-----------
 .../falcon/resource/admin/AdminResource.java    |  4 +-
 .../proxy/SchedulableEntityManagerProxy.java    | 24 ++++-----
 .../resource/SchedulableEntityManager.java      | 14 ++---
 6 files changed, 49 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/e22889eb/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index ab43e52..b032845 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -53,6 +53,9 @@ Trunk (Unreleased)
     via Srikanth Sundarrajan)
 
   IMPROVEMENTS
+    FALCON-152 REST API for entity & Admin resources only returns 
+    XML. (Venkatesh Seetharam via Srikanth Sundarrajan)
+
     FALCON-132 assembly plugin for embedded does not generate client
     artifacts. (Venkatesh Seetharam via Srikanth Sundarrajan)
 

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/e22889eb/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 086bf4a..0623074 100644
--- a/client/src/main/java/org/apache/falcon/cli/FalconCLI.java
+++ b/client/src/main/java/org/apache/falcon/cli/FalconCLI.java
@@ -188,8 +188,7 @@ public class FalconCLI {
         if (optionsList.contains(RUNNING_OPT)) {
             result = client.getRunningInstances(type, entity, colo);
         } else if (optionsList.contains(STATUS_OPT)) {
-            result = client.getStatusOfInstances(type, entity, start, end,
-                    runid, colo);
+            result = client.getStatusOfInstances(type, entity, start, end, colo);
         } else if (optionsList.contains(KILL_OPT)) {
             result = client.killInstances(type, entity, start, end, colo, clusters, sourceClusters);
         } else if (optionsList.contains(SUSPEND_OPT)) {

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/e22889eb/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 1ad9831..9839745 100644
--- a/client/src/main/java/org/apache/falcon/client/FalconClient.java
+++ b/client/src/main/java/org/apache/falcon/client/FalconClient.java
@@ -103,20 +103,18 @@ public class FalconClient {
      * Methods allowed on Entity Resources.
      */
     protected static enum Entities {
-        VALIDATE("api/entities/validate/", HttpMethod.POST, MediaType.TEXT_XML), SUBMIT(
-                "api/entities/submit/", HttpMethod.POST, MediaType.TEXT_XML), UPDATE(
-                "api/entities/update/", HttpMethod.POST, MediaType.TEXT_XML), SUBMITandSCHEDULE(
-                "api/entities/submitAndSchedule/", HttpMethod.POST,
-                MediaType.TEXT_XML), SCHEDULE("api/entities/schedule/",
-                HttpMethod.POST, MediaType.TEXT_XML), SUSPEND(
-                "api/entities/suspend/", HttpMethod.POST, MediaType.TEXT_XML), RESUME(
-                "api/entities/resume/", HttpMethod.POST, MediaType.TEXT_XML), DELETE(
-                "api/entities/delete/", HttpMethod.DELETE, MediaType.TEXT_XML), STATUS(
-                "api/entities/status/", HttpMethod.GET, MediaType.TEXT_XML), DEFINITION(
-                "api/entities/definition/", HttpMethod.GET, MediaType.TEXT_XML), LIST(
-                "api/entities/list/", HttpMethod.GET, MediaType.TEXT_XML), DEPENDENCY(
-                "api/entities/dependencies/", HttpMethod.GET,
-                MediaType.TEXT_XML);
+        VALIDATE("api/entities/validate/", HttpMethod.POST, MediaType.TEXT_XML),
+        SUBMIT("api/entities/submit/", HttpMethod.POST, MediaType.TEXT_XML),
+        UPDATE("api/entities/update/", HttpMethod.POST, MediaType.TEXT_XML),
+        SUBMITandSCHEDULE("api/entities/submitAndSchedule/", HttpMethod.POST, MediaType.TEXT_XML),
+        SCHEDULE("api/entities/schedule/", HttpMethod.POST, MediaType.TEXT_XML),
+        SUSPEND("api/entities/suspend/", HttpMethod.POST, MediaType.TEXT_XML),
+        RESUME("api/entities/resume/", HttpMethod.POST, MediaType.TEXT_XML),
+        DELETE("api/entities/delete/", HttpMethod.DELETE, MediaType.TEXT_XML),
+        STATUS("api/entities/status/", HttpMethod.GET, MediaType.TEXT_XML),
+        DEFINITION("api/entities/definition/", HttpMethod.GET, MediaType.TEXT_XML),
+        LIST("api/entities/list/", HttpMethod.GET, MediaType.TEXT_XML),
+        DEPENDENCY("api/entities/dependencies/", HttpMethod.GET, MediaType.TEXT_XML);
 
         private String path;
         private String method;
@@ -133,16 +131,14 @@ public class FalconClient {
      * Methods allowed on Process Instance Resources.
      */
     protected static enum Instances {
-        RUNNING("api/instance/running/", HttpMethod.GET,
-                MediaType.APPLICATION_JSON), STATUS("api/instance/status/",
-                HttpMethod.GET, MediaType.APPLICATION_JSON), KILL(
-                "api/instance/kill/", HttpMethod.POST,
-                MediaType.APPLICATION_JSON), SUSPEND("api/instance/suspend/",
-                HttpMethod.POST, MediaType.APPLICATION_JSON), RESUME(
-                "api/instance/resume/", HttpMethod.POST,
-                MediaType.APPLICATION_JSON), RERUN("api/instance/rerun/",
-                HttpMethod.POST, MediaType.APPLICATION_JSON), LOG("api/instance/logs/",
-                HttpMethod.GET, MediaType.APPLICATION_JSON);
+        RUNNING("api/instance/running/", HttpMethod.GET, MediaType.APPLICATION_JSON),
+        STATUS("api/instance/status/", HttpMethod.GET, MediaType.APPLICATION_JSON),
+        KILL("api/instance/kill/", HttpMethod.POST, MediaType.APPLICATION_JSON),
+        SUSPEND("api/instance/suspend/", HttpMethod.POST, MediaType.APPLICATION_JSON),
+        RESUME("api/instance/resume/", HttpMethod.POST, MediaType.APPLICATION_JSON),
+        RERUN("api/instance/rerun/", HttpMethod.POST, MediaType.APPLICATION_JSON),
+        LOG("api/instance/logs/", HttpMethod.GET, MediaType.APPLICATION_JSON);
+
         private String path;
         private String method;
         private String mimeType;
@@ -156,10 +152,9 @@ public class FalconClient {
 
     protected static enum AdminOperations {
 
-        STACK("api/admin/stack", HttpMethod.GET,
-                MediaType.TEXT_PLAIN),
-        VERSION("api/admin/version", HttpMethod.GET,
-                MediaType.TEXT_PLAIN);
+        STACK("api/admin/stack", HttpMethod.GET, MediaType.TEXT_PLAIN),
+        VERSION("api/admin/version", HttpMethod.GET, MediaType.TEXT_PLAIN);
+
         private String path;
         private String method;
         private String mimeType;
@@ -278,8 +273,7 @@ public class FalconClient {
 
     public String getStatusOfInstances(String type, String entity,
                                        String start, String end,
-                                       String runid, String colo)
-        throws FalconCLIException {
+                                       String colo) throws FalconCLIException {
 
         return sendInstanceRequest(Instances.STATUS, type, entity, start, end,
                 null, null, colo);

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/e22889eb/prism/src/main/java/org/apache/falcon/resource/admin/AdminResource.java
----------------------------------------------------------------------
diff --git a/prism/src/main/java/org/apache/falcon/resource/admin/AdminResource.java b/prism/src/main/java/org/apache/falcon/resource/admin/AdminResource.java
index a2b9f61..03a9149 100644
--- a/prism/src/main/java/org/apache/falcon/resource/admin/AdminResource.java
+++ b/prism/src/main/java/org/apache/falcon/resource/admin/AdminResource.java
@@ -68,7 +68,7 @@ public class AdminResource {
 
     @GET
     @Path("version")
-    @Produces(MediaType.TEXT_PLAIN)
+    @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
     public String getVersion() {
         if (version == null) {
             version = "{Version:\"" + BuildProperties.get().getProperty("build.version")
@@ -79,7 +79,7 @@ public class AdminResource {
 
     @GET
     @Path("config/{type}")
-    @Produces(MediaType.TEXT_XML)
+    @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_JSON})
     public PropertyList getVersion(@PathParam("type") String type) {
         if ("build".equals(type)) {
             return getProperties(BuildProperties.get());

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/e22889eb/prism/src/main/java/org/apache/falcon/resource/proxy/SchedulableEntityManagerProxy.java
----------------------------------------------------------------------
diff --git a/prism/src/main/java/org/apache/falcon/resource/proxy/SchedulableEntityManagerProxy.java
b/prism/src/main/java/org/apache/falcon/resource/proxy/SchedulableEntityManagerProxy.java
index 986291e..0b6b34a 100644
--- a/prism/src/main/java/org/apache/falcon/resource/proxy/SchedulableEntityManagerProxy.java
+++ b/prism/src/main/java/org/apache/falcon/resource/proxy/SchedulableEntityManagerProxy.java
@@ -100,7 +100,7 @@ public class SchedulableEntityManagerProxy extends AbstractSchedulableEntityMana
     @POST
     @Path("submit/{type}")
     @Consumes({MediaType.TEXT_XML, MediaType.TEXT_PLAIN})
-    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN})
+    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
     @Monitored(event = "submit")
     @Override
     public APIResult submit(
@@ -135,7 +135,7 @@ public class SchedulableEntityManagerProxy extends AbstractSchedulableEntityMana
     @POST
     @Path("validate/{type}")
     @Consumes({MediaType.TEXT_XML, MediaType.TEXT_PLAIN})
-    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN})
+    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
     @Override
     public APIResult validate(@Context HttpServletRequest request, @PathParam("type") String
type) {
         return super.validate(request, type);
@@ -143,7 +143,7 @@ public class SchedulableEntityManagerProxy extends AbstractSchedulableEntityMana
 
     @DELETE
     @Path("delete/{type}/{entity}")
-    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN})
+    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
     @Monitored(event = "delete")
     @Override
     public APIResult delete(
@@ -181,7 +181,7 @@ public class SchedulableEntityManagerProxy extends AbstractSchedulableEntityMana
 
     @POST
     @Path("update/{type}/{entity}")
-    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN})
+    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
     @Monitored(event = "update")
     @Override
     public APIResult update(
@@ -250,7 +250,7 @@ public class SchedulableEntityManagerProxy extends AbstractSchedulableEntityMana
 
     @GET
     @Path("status/{type}/{entity}")
-    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN})
+    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
     @Monitored(event = "status")
     @Override
     public APIResult getStatus(@Dimension("entityType") @PathParam("type") final String type,
@@ -271,7 +271,7 @@ public class SchedulableEntityManagerProxy extends AbstractSchedulableEntityMana
 
     @GET
     @Path("dependencies/{type}/{entity}")
-    @Produces(MediaType.TEXT_XML)
+    @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_JSON})
     @Monitored(event = "dependencies")
     @Override
     public EntityList getDependencies(@Dimension("entityType") @PathParam("type") String
type,
@@ -281,7 +281,7 @@ public class SchedulableEntityManagerProxy extends AbstractSchedulableEntityMana
 
     @GET
     @Path("list/{type}")
-    @Produces(MediaType.TEXT_XML)
+    @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_JSON})
     @Override
     public EntityList getDependencies(@PathParam("type") String type) {
         return super.getDependencies(type);
@@ -289,7 +289,7 @@ public class SchedulableEntityManagerProxy extends AbstractSchedulableEntityMana
 
     @GET
     @Path("definition/{type}/{entity}")
-    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN})
+    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
     @Override
     public String getEntityDefinition(@PathParam("type") String type, @PathParam("entity")
String entityName) {
         return super.getEntityDefinition(type, entityName);
@@ -297,7 +297,7 @@ public class SchedulableEntityManagerProxy extends AbstractSchedulableEntityMana
 
     @POST
     @Path("schedule/{type}/{entity}")
-    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN})
+    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
     @Monitored(event = "schedule")
     @Override
     public APIResult schedule(@Context final HttpServletRequest request,
@@ -322,7 +322,7 @@ public class SchedulableEntityManagerProxy extends AbstractSchedulableEntityMana
     @POST
     @Path("submitAndSchedule/{type}")
     @Consumes({MediaType.TEXT_XML, MediaType.TEXT_PLAIN})
-    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN})
+    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
     @Monitored(event = "submitAndSchedule")
     @Override
     public APIResult submitAndSchedule(
@@ -338,7 +338,7 @@ public class SchedulableEntityManagerProxy extends AbstractSchedulableEntityMana
 
     @POST
     @Path("suspend/{type}/{entity}")
-    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN})
+    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
     @Monitored(event = "suspend")
     @Override
     public APIResult suspend(@Context final HttpServletRequest request,
@@ -362,7 +362,7 @@ public class SchedulableEntityManagerProxy extends AbstractSchedulableEntityMana
 
     @POST
     @Path("resume/{type}/{entity}")
-    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN})
+    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
     @Monitored(event = "resume")
     @Override
     public APIResult resume(

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/e22889eb/webapp/src/main/java/org/apache/falcon/resource/SchedulableEntityManager.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/falcon/resource/SchedulableEntityManager.java
b/webapp/src/main/java/org/apache/falcon/resource/SchedulableEntityManager.java
index 96f5db4..b17dcc8 100644
--- a/webapp/src/main/java/org/apache/falcon/resource/SchedulableEntityManager.java
+++ b/webapp/src/main/java/org/apache/falcon/resource/SchedulableEntityManager.java
@@ -34,7 +34,7 @@ public class SchedulableEntityManager extends AbstractSchedulableEntityManager
{
 
     @GET
     @Path("status/{type}/{entity}")
-    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN})
+    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
     @Monitored(event = "status")
     @Override
     public APIResult getStatus(@Dimension("entityType") @PathParam("type") String type,
@@ -45,7 +45,7 @@ public class SchedulableEntityManager extends AbstractSchedulableEntityManager
{
 
     @GET
     @Path("dependencies/{type}/{entity}")
-    @Produces(MediaType.TEXT_XML)
+    @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_JSON})
     @Monitored(event = "dependencies")
     @Override
     public EntityList getDependencies(@Dimension("entityType") @PathParam("type") String
type,
@@ -55,7 +55,7 @@ public class SchedulableEntityManager extends AbstractSchedulableEntityManager
{
 
     @GET
     @Path("list/{type}")
-    @Produces(MediaType.TEXT_XML)
+    @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_JSON})
     @Monitored(event = "dependencies")
     @Override
     public EntityList getDependencies(@Dimension("type") @PathParam("type") String type)
{
@@ -64,7 +64,7 @@ public class SchedulableEntityManager extends AbstractSchedulableEntityManager
{
 
     @GET
     @Path("definition/{type}/{entity}")
-    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN})
+    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
     @Monitored(event = "definition")
     @Override
     public String getEntityDefinition(@Dimension("type") @PathParam("type") String type,
@@ -74,7 +74,7 @@ public class SchedulableEntityManager extends AbstractSchedulableEntityManager
{
 
     @POST
     @Path("schedule/{type}/{entity}")
-    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN})
+    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
     @Monitored(event = "schedule")
     @Override
     public APIResult schedule(@Context HttpServletRequest request,
@@ -86,7 +86,7 @@ public class SchedulableEntityManager extends AbstractSchedulableEntityManager
{
 
     @POST
     @Path("suspend/{type}/{entity}")
-    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN})
+    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
     @Monitored(event = "suspend")
     @Override
     public APIResult suspend(@Context HttpServletRequest request,
@@ -98,7 +98,7 @@ public class SchedulableEntityManager extends AbstractSchedulableEntityManager
{
 
     @POST
     @Path("resume/{type}/{entity}")
-    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN})
+    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
     @Monitored(event = "resume")
     @Override
     public APIResult resume(@Context HttpServletRequest request,


Mime
View raw message