adjust the ComponentScan

This commit is contained in:
YuCheng Hu 2020-04-14 16:00:59 -04:00
parent a0656c6ca3
commit 7beadec056
6 changed files with 22 additions and 111 deletions

View File

@ -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'

View File

@ -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();
}

View File

@ -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;

View File

@ -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<Listing, Listing>, StepExecutionListener {
private final Logger logger = LoggerFactory.getLogger(LineProcessor.class);

View File

@ -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;
}
}

View File

@ -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<String> fields = new ArrayList<String>();
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<String> 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<String> getFields() {
return fields;
}
/**
* @param fields
*/
public void setFields(List<String> fields) {
this.fields = fields;
}
}