usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [19/50] [abbrv] git commit: Created ExportJob component so that it can be called from ExportService. Stored exportInformation and passed onto the job. Removed ExportBatchJob as I only need to be able to run one job currently. Removed exportService doExpo
Date Tue, 25 Feb 2014 06:21:33 GMT
Created ExportJob component so that it can be called from ExportService.
Stored exportInformation and passed onto the job.
Removed ExportBatchJob as I only need to be able to run one job currently.
Removed exportService doExport methods as it will now be called with the sch.


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

Branch: refs/pull/60/head
Commit: e8d47bad7407e39265cd46fe171276dba68bfe1f
Parents: b45a6fd
Author: George Reyes <ApigeeCorporation@George-Reyess-MacBook-Pro.local>
Authored: Mon Feb 10 11:14:48 2014 -0800
Committer: George Reyes <ApigeeCorporation@George-Reyess-MacBook-Pro.local>
Committed: Mon Feb 10 11:14:48 2014 -0800

----------------------------------------------------------------------
 .../rest/management/ManagementResource.java     |  2 +-
 .../rest/management/ManagementResourceIT.java   |  2 +-
 .../management/export/ExportBatchJob.java       | 36 ---------------
 .../usergrid/management/export/ExportJob.java   | 48 ++++++++++++++++++++
 .../management/export/ExportServiceImpl.java    |  5 +-
 5 files changed, 53 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e8d47bad/stack/rest/src/main/java/org/usergrid/rest/management/ManagementResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/usergrid/rest/management/ManagementResource.java
b/stack/rest/src/main/java/org/usergrid/rest/management/ManagementResource.java
index 4985239..65be6c3 100644
--- a/stack/rest/src/main/java/org/usergrid/rest/management/ManagementResource.java
+++ b/stack/rest/src/main/java/org/usergrid/rest/management/ManagementResource.java
@@ -465,7 +465,7 @@ public class ManagementResource extends AbstractContextResource {
         ExportInfo objEx = new ExportInfo(json);
 
         exportService.schedule(objEx);
-        exportService.doExport( objEx );
+       // exportService.doExport( objEx );
         }
         catch (Exception e) {
             //TODO:throw descriptive error message and or include on in the response

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e8d47bad/stack/rest/src/test/java/org/usergrid/rest/management/ManagementResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/usergrid/rest/management/ManagementResourceIT.java
b/stack/rest/src/test/java/org/usergrid/rest/management/ManagementResourceIT.java
index 6e54feb..a8278bc 100644
--- a/stack/rest/src/test/java/org/usergrid/rest/management/ManagementResourceIT.java
+++ b/stack/rest/src/test/java/org/usergrid/rest/management/ManagementResourceIT.java
@@ -530,7 +530,7 @@ public class ManagementResourceIT extends AbstractRestIT {
     }
 //test needs to be updated to do validation of files/ and validation of file created in s3.
     // eventually will need to simulate dropped connections as well.
-    @Ignore
+    @Test
     public void exportCallSuccessful() throws Exception {
         Status responseStatus = Status.OK;
         JsonNode node = null;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e8d47bad/stack/services/src/main/java/org/usergrid/management/export/ExportBatchJob.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/usergrid/management/export/ExportBatchJob.java
b/stack/services/src/main/java/org/usergrid/management/export/ExportBatchJob.java
deleted file mode 100644
index 08f3701..0000000
--- a/stack/services/src/main/java/org/usergrid/management/export/ExportBatchJob.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.usergrid.management.export;
-
-import java.util.UUID;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.usergrid.batch.Job;
-import org.usergrid.batch.JobExecution;
-import org.usergrid.persistence.entities.JobData;
-
-
-/**
- *
- *
- */
-public class ExportBatchJob implements Job {
-
-    private static final Logger logger = LoggerFactory.getLogger( ExportBatchJob.class );
-
-    //TODO: ask if the service manager is needed here. Maybe in order to see if process.
-    @Autowired
-    protected ExportService exportService;
-
-
-    @Override
-    public void execute( final JobExecution execution ) throws Exception {
-
-        logger.info("execute ExportBatchJob {}", execution);
-
-        JobData jobData = execution.getJobData();
-        UUID jobUUID = (UUID) jobData.getProperty( "jobUUID" );
-
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e8d47bad/stack/services/src/main/java/org/usergrid/management/export/ExportJob.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/usergrid/management/export/ExportJob.java b/stack/services/src/main/java/org/usergrid/management/export/ExportJob.java
new file mode 100644
index 0000000..4f57b5f
--- /dev/null
+++ b/stack/services/src/main/java/org/usergrid/management/export/ExportJob.java
@@ -0,0 +1,48 @@
+package org.usergrid.management.export;
+
+
+import java.util.UUID;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import org.usergrid.batch.JobExecution;
+import org.usergrid.batch.job.OnlyOnceJob;
+import org.usergrid.management.ExportInfo;
+import org.usergrid.persistence.entities.JobData;
+
+
+/**
+ *
+ *
+ */
+@Component("exportJob")
+public class ExportJob extends OnlyOnceJob {
+    private static final Logger logger = LoggerFactory.getLogger( ExportJob.class );
+
+    ExportService exportService;
+
+    public ExportJob() {
+        logger.info("ExportJob created " + this);
+    }
+
+    @Override
+    public void doJob(JobExecution jobExecution) throws Exception {
+        logger.info( "execute ExportJob {}", jobExecution );
+
+        JobData jobData = jobExecution.getJobData();
+        UUID exportId = ( UUID ) jobData.getProperty("exportId");
+        //this is probably the state info that todd mentioned
+        ExportInfo config = (ExportInfo) jobData.getProperty( "exportInfo" );
+
+        exportService.doExport( config );
+
+        logger.info( "executed ExportJob completed normally" );
+    }
+
+    @Override
+    protected long getDelay(JobExecution jobExecution) throws Exception {
+        //return arbitrary number
+        return 100;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e8d47bad/stack/services/src/main/java/org/usergrid/management/export/ExportServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/usergrid/management/export/ExportServiceImpl.java
b/stack/services/src/main/java/org/usergrid/management/export/ExportServiceImpl.java
index d34fb23..b0d8cf6 100644
--- a/stack/services/src/main/java/org/usergrid/management/export/ExportServiceImpl.java
+++ b/stack/services/src/main/java/org/usergrid/management/export/ExportServiceImpl.java
@@ -112,9 +112,10 @@ public class ExportServiceImpl implements ExportService{
         //schedule the job
         JobData jobData = new JobData();
 
-        jobData.setProperty( "jobId", "0001" );//TODO: store uuid here, give export job uuid.
+        jobData.setProperty( "exportId", "0001" );//TODO: store uuid here, give export job
uuid.
+        jobData.setProperty( "exportInfo",config );
         long soonestPossible = System.currentTimeMillis() + 250; //sch grace period
-        sch.createJob( "queueExportJob",soonestPossible, jobData );
+        sch.createJob( "exportJob",soonestPossible, jobData );
 
 
     }


Mime
View raw message