Repository: falcon
Updated Branches:
  refs/heads/master 49050c84c -> 62da1cd3f


FALCON-1774 Server side check added to disallow Prism operations

Testing :

$ bin/falcon entity -type feed -submitAndSchedule -file ../cluster.xml
ERROR: Forbidden;submitAndSchedule on server is not supported.Please run your 
operation on Prism.

$ bin/falcon entity -type feed -update -name abc -file ../cluster.xml
ERROR: Forbidden;update on server is not supported.Please run your operation on 
Prism.

$ bin/falcon entity -type feed -delete -name abc
ERROR: Forbidden;delete on server is not supported.Please run your operation on 
Prism.

$ bin/falcon entity -type feed -submit -file ../cluster.xml
ERROR: Forbidden;submit on server is not supported.Please run your operation on 
Prism.

Author: Praveen Adlakha <[email protected]>

Reviewers: Pallavi Rao <[email protected]> Pavan Kolamuri 
<[email protected]>

Closes #16 from PraveenAdlakha/FALCON-1774 and squashes the following commits:

4935e2b [Praveen Adlakha] rebased patched
23ba055 [Praveen Adlakha] checkstyle issue fixed
75807f6 [Praveen Adlakha] changes.txt updated


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

Branch: refs/heads/master
Commit: 62da1cd3f2abe8eb9a29c72d49eaca7301dc5119
Parents: 49050c8
Author: Praveen Adlakha <[email protected]>
Authored: Mon Feb 8 14:22:29 2016 +0530
Committer: Pallavi Rao <[email protected]>
Committed: Mon Feb 8 14:22:29 2016 +0530

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 +
 .../resource/SchedulableEntityManager.java      | 87 ++++++++++++++++++++
 2 files changed, 89 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/62da1cd3/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 01e16b5..297e508 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -11,6 +11,8 @@ Trunk
     FALCON-1230 Data based notification Service to notify execution instances 
when data becomes available(Pavan Kumar Kolamuri via Ajay Yadava)
 
   IMPROVEMENTS
+    FALCON-1774 Falcon to honour PRISM_URL env var (Praveen Adlakha) 
+
     FALCON-1721 Checkstyle doesn't extend parent.
     
     FALCON-1818 Minor doc update for tar package locations after FALCON-1751 
(Deepak Barr)

http://git-wip-us.apache.org/repos/asf/falcon/blob/62da1cd3/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 afa2b6f..e97adff 100644
--- 
a/webapp/src/main/java/org/apache/falcon/resource/SchedulableEntityManager.java
+++ 
b/webapp/src/main/java/org/apache/falcon/resource/SchedulableEntityManager.java
@@ -27,8 +27,10 @@ import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
+import javax.ws.rs.DELETE;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.falcon.FalconWebException;
@@ -57,6 +59,91 @@ public class SchedulableEntityManager extends 
AbstractSchedulableEntityManager {
         }
     }
 
+    /**
+     * Delete the specified entity.
+     * @param request Servlet Request
+     * @param type Valid options are cluster, feed or process.
+     * @param entity Name of the entity.
+     * @param ignore colo is ignored
+     * @return Results of the delete operation.
+     */
+    @DELETE
+    @Path("delete/{type}/{entity}")
+    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN, 
MediaType.APPLICATION_JSON})
+    @Monitored(event = "delete")
+    @Override
+    public APIResult delete(
+            @Context HttpServletRequest request, @Dimension("entityType") 
@PathParam("type") final String type,
+            @Dimension("entityName") @PathParam("entity") final String entity,
+            @Dimension("colo") @QueryParam("colo") String ignore) {
+        throw FalconWebException.newAPIException("delete on server is not"
+                + " supported.Please run your operation on Prism.", 
Response.Status.FORBIDDEN);
+    }
+    /**
+     * Updates the submitted entity.
+     * @param request Servlet Request
+     * @param type Valid options are feed or process.
+     * @param entityName Name of the entity.
+     * @param ignore colo is ignored
+     * @param skipDryRun Optional query param, Falcon skips oozie dryrun when 
value is set to true.
+     * @return Result of the validation.
+     */
+    @POST
+    @Path("update/{type}/{entity}")
+    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN, 
MediaType.APPLICATION_JSON})
+    @Monitored(event = "update")
+    @Override
+    public APIResult update(
+            @Context HttpServletRequest request, @Dimension("entityType") 
@PathParam("type") final String type,
+            @Dimension("entityName") @PathParam("entity") final String 
entityName,
+            @Dimension("colo") @QueryParam("colo") String ignore,
+            @QueryParam("skipDryRun") final Boolean skipDryRun) {
+        throw FalconWebException.newAPIException("update on server is not"
+                + " supported.Please run your operation on Prism.", 
Response.Status.FORBIDDEN);
+    }
+
+    /**
+     * Submits and schedules an entity.
+     * @param request Servlet Request
+     * @param type Valid options are feed or process.
+     * @param coloExpr Colo on which the query should be run.
+     * @param skipDryRun Optional query param, Falcon skips oozie dryrun when 
value is set to true.
+     * @return Result of the submit and schedule command.
+     */
+    @POST
+    @Path("submitAndSchedule/{type}")
+    @Consumes({MediaType.TEXT_XML, MediaType.TEXT_PLAIN})
+    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN, 
MediaType.APPLICATION_JSON})
+    @Monitored(event = "submitAndSchedule")
+    @Override
+    public APIResult submitAndSchedule(
+            @Context HttpServletRequest request, @Dimension("entityType") 
@PathParam("type") String type,
+            @Dimension("colo") @QueryParam("colo") String coloExpr,
+            @QueryParam("skipDryRun") Boolean skipDryRun,
+            @QueryParam("properties") String properties) {
+        throw FalconWebException.newAPIException("submitAndSchedule on server 
is not"
+                + " supported.Please run your operation on Prism.", 
Response.Status.FORBIDDEN);
+    }
+    /**
+     * Submit the given entity.
+     * @param request Servlet Request
+     * @param type Valid options are cluster, feed or process.
+     * @param ignore colo is ignored
+     * @return Result of the submission.
+     */
+    @POST
+    @Path("submit/{type}")
+    @Consumes({MediaType.TEXT_XML, MediaType.TEXT_PLAIN})
+    @Produces({MediaType.TEXT_XML, MediaType.TEXT_PLAIN, 
MediaType.APPLICATION_JSON})
+    @Monitored(event = "submit")
+    @Override
+    public APIResult submit(
+            @Context HttpServletRequest request, @Dimension("entityType") 
@PathParam("type") final String type,
+            @Dimension("colo") @QueryParam("colo") final String ignore) {
+        throw FalconWebException.newAPIException("submit on server is not"
+                + " supported.Please run your operation on Prism.", 
Response.Status.FORBIDDEN);
+    }
+
     @GET
     @Path("sla-alert/{type}")
     @Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_XML})

Reply via email to