diff --git a/covid-19-service/build.gradle b/covid-19-service/build.gradle index 7604d38..ad7a5f2 100644 --- a/covid-19-service/build.gradle +++ b/covid-19-service/build.gradle @@ -45,9 +45,9 @@ dependencies { implementation group: 'org.jasypt', name: 'jasypt-hibernate4', version: '1.9.3' // SPRING BOOT AND BATCH - implementation 'org.springframework.boot:spring-boot-starter-web' - implementation 'org.springframework.boot:spring-boot-starter-batch' - implementation 'org.springframework.boot:spring-boot-starter-amqp' + implementation 'org.springframework.boot:spring-boot-starter-web:2.2.6.RELEASE' + implementation 'org.springframework.boot:spring-boot-starter-batch:2.2.6.RELEASE' + implementation 'org.springframework.boot:spring-boot-starter-amqp:2.2.6.RELEASE' // CLOUD implementation 'com.amazonaws:aws-java-sdk-s3:1.11.699' diff --git a/covid-19-service/src/main/java/com/ossez/covid19/service/batch/jobs/CloudJobConf.java b/covid-19-service/src/main/java/com/ossez/covid19/service/batch/jobs/CloudJobConf.java index 8240d48..533cecb 100644 --- a/covid-19-service/src/main/java/com/ossez/covid19/service/batch/jobs/CloudJobConf.java +++ b/covid-19-service/src/main/java/com/ossez/covid19/service/batch/jobs/CloudJobConf.java @@ -1,10 +1,12 @@ package com.ossez.covid19.service.batch.jobs; -import com.ossez.covid19.service.batch.tasklet.AwsTasklet; import com.ossez.covid19.common.models.Listing; -import com.ossez.covid19.service.batch.JobCompletionNotificationListener; +import com.ossez.covid19.service.batch.jobs.listener.JobCompletionNotificationListener; +import com.ossez.covid19.service.batch.tasklet.AwsTasklet; import org.springframework.batch.core.Job; import org.springframework.batch.core.Step; + +import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing; import org.springframework.batch.core.configuration.annotation.JobBuilderFactory; import org.springframework.batch.core.configuration.annotation.StepBuilderFactory; import org.springframework.batch.core.launch.support.RunIdIncrementer; @@ -13,23 +15,30 @@ import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.ItemWriter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.FileSystemResource; @Configuration +@ComponentScan +@EnableBatchProcessing public class CloudJobConf { - @Autowired - public JobBuilderFactory jobBuilderFactory; - @Autowired + public JobBuilderFactory jobBuilderFactory; public StepBuilderFactory stepBuilderFactory; + @Autowired + public CloudJobConf(JobBuilderFactory jobBuilderFactory, StepBuilderFactory stepBuilderFactory) { + this.jobBuilderFactory = jobBuilderFactory; + this.stepBuilderFactory = stepBuilderFactory; + } + @Bean - public Job cloudClean(JobCompletionNotificationListener listener, Step stepAws, Step deleteFilesStep) { + public Job cloudClean(JobCompletionNotificationListener listener, Step deleteFilesStep) { return jobBuilderFactory.get("cloudClean") .incrementer(new RunIdIncrementer()) .listener(listener) - .flow(stepAws).next(deleteFilesStep) + .flow(deleteFilesStep) .end() .build(); } diff --git a/covid-19-service/src/main/java/com/ossez/covid19/service/batch/JobCompletionNotificationListener.java b/covid-19-service/src/main/java/com/ossez/covid19/service/batch/jobs/listener/JobCompletionNotificationListener.java similarity index 94% rename from covid-19-service/src/main/java/com/ossez/covid19/service/batch/JobCompletionNotificationListener.java rename to covid-19-service/src/main/java/com/ossez/covid19/service/batch/jobs/listener/JobCompletionNotificationListener.java index 0ccff6e..e4d62b7 100644 --- a/covid-19-service/src/main/java/com/ossez/covid19/service/batch/JobCompletionNotificationListener.java +++ b/covid-19-service/src/main/java/com/ossez/covid19/service/batch/jobs/listener/JobCompletionNotificationListener.java @@ -1,4 +1,4 @@ -package com.ossez.covid19.service.batch; +package com.ossez.covid19.service.batch.jobs.listener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/covid-19-service/src/main/java/com/ossez/covid19/service/batch/steps/LineProcessor.java b/covid-19-service/src/main/java/com/ossez/covid19/service/batch/steps/LineProcessor.java index 5d6052c..50cbad6 100644 --- a/covid-19-service/src/main/java/com/ossez/covid19/service/batch/steps/LineProcessor.java +++ b/covid-19-service/src/main/java/com/ossez/covid19/service/batch/steps/LineProcessor.java @@ -7,7 +7,9 @@ import org.springframework.batch.core.ExitStatus; import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.StepExecutionListener; import org.springframework.batch.item.ItemProcessor; +import org.springframework.stereotype.Component; +@Component public final class LineProcessor implements ItemProcessor, StepExecutionListener { private final Logger logger = LoggerFactory.getLogger(LineProcessor.class); diff --git a/covid-19-service/src/main/java/com/ossez/covid19/service/rets/MlsPinLocation.java b/covid-19-service/src/main/java/com/ossez/covid19/service/rets/MlsPinLocation.java deleted file mode 100644 index 74b509a..0000000 --- a/covid-19-service/src/main/java/com/ossez/covid19/service/rets/MlsPinLocation.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.ossez.covid19.service.rets; - -/** - * Class to store a town,state,county association. This class is used as part of a larger collection to map a town id to the three - * aforementioned values. - * - * @author YuCheng Hu - */ -public class MlsPinLocation { - private String townName = null; - private String stateName = null; - private String countyName = null; - - public MlsPinLocation(String townName, String stateName, String countyName) { - this.townName = townName; - this.stateName = stateName; - this.countyName = countyName; - } - - public String getTownName() { - return townName; - } - - public String getStateName() { - return stateName; - } - - public String getCountyName() { - return countyName; - } -} diff --git a/covid-19-service/src/main/java/com/ossez/covid19/service/rets/RetsCriteria.java b/covid-19-service/src/main/java/com/ossez/covid19/service/rets/RetsCriteria.java deleted file mode 100644 index 3b06581..0000000 --- a/covid-19-service/src/main/java/com/ossez/covid19/service/rets/RetsCriteria.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.ossez.covid19.service.rets; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * - * @author YuCheng Hu - */ -public class RetsCriteria { - private String query = ""; - private String path = ""; - private List fields = new ArrayList(); - - public RetsCriteria(String query, String path, String[] fields) { - this.query = query; - this.path = path; - this.fields = Arrays.asList(fields); - } - - public RetsCriteria(String query, String path, List fields) { - this.query = query; - this.path = path; - this.fields = fields; - } - - /** - * @return - */ - public String getQuery() { - return query; - } - - /** - * @param query - */ - public void setQuery(String query) { - this.query = query; - } - - /** - * @return - */ - public String getPath() { - return path; - } - - /** - * @param path - */ - public void setPath(String path) { - this.path = path; - } - - /** - * @return - */ - public List getFields() { - return fields; - } - - /** - * @param fields - */ - public void setFields(List fields) { - this.fields = fields; - } -}