usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject incubator-usergrid git commit: adding get job status
Date Thu, 09 Jul 2015 23:11:39 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/two-dot-o-dev 9ca7ce0d7 -> f727814ba


adding get job status


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

Branch: refs/heads/two-dot-o-dev
Commit: f727814bab584c46af4487cc7257fd2b30bb54cb
Parents: 9ca7ce0
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Thu Jul 9 17:11:14 2015 -0600
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Thu Jul 9 17:11:14 2015 -0600

----------------------------------------------------------------------
 .../org/apache/usergrid/rest/IndexResource.java | 26 +++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f727814b/stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java
index 9cf6672..d27cf98 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java
@@ -72,13 +72,37 @@ public class IndexResource extends AbstractContextResource {
         throws Exception {
 
 
-        logger.info( "Rebuilding all applications" );
+        logger.info("Rebuilding all applications");
 
         final ReIndexRequestBuilder request = createRequest();
 
         return executeAndCreateResponse( request, callback );
     }
 
+    @RequireSystemAccess
+    @GET
+    @Path( "rebuild" )
+    public JSONWithPadding rebuildIndexesGet(@QueryParam( "jobId" ) String jobId, @QueryParam(
"callback" ) @DefaultValue( "callback" ) String callback )
+        throws Exception {
+        logger.info("Getting status for index jobs");
+
+        Preconditions
+            .checkNotNull(jobId, "query param jobId must not be null" );
+
+
+        ReIndexService.ReIndexStatus status = getReIndexService().getStatus(jobId);
+
+        final ApiResponse response = createApiResponse();
+
+        response.setAction( "rebuild indexes" );
+        response.setProperty( "jobId", status.getJobId() );
+        response.setProperty( "status", status.getStatus() );
+        response.setProperty( "lastUpdatedEpoch", status.getLastUpdated() );
+        response.setProperty( "numberQueued", status.getNumberProcessed() );
+        response.setSuccess();
+
+        return new JSONWithPadding( response, callback );
+    }
 
     @RequireSystemAccess
     @PUT


Mime
View raw message