add distr
This commit is contained in:
parent
031bc087fc
commit
72de7e595a
17 changed files with 38 additions and 37 deletions
|
|
@ -49,6 +49,16 @@
|
|||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<excludes>
|
||||
<exclude>application.properties</exclude>
|
||||
</excludes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package ru.spcex.clearing.dbf.exporter.config;
|
|||
|
||||
import com.mchange.v2.c3p0.ComboPooledDataSource;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
|
@ -18,12 +19,13 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
@EnableConfigurationProperties
|
||||
@ComponentScan(basePackages = {"ru.spcex.clearing.dbf.exporter"})
|
||||
public class DBFExportConfig {
|
||||
private final AProperties properties;
|
||||
private final ApplicationContext context;
|
||||
|
||||
public DBFExportConfig(@Qualifier("dbfExportProperties") AProperties properties, ApplicationContext context) {
|
||||
public DBFExportConfig(@Qualifier("dbfExporterProperties") AProperties properties, ApplicationContext context) {
|
||||
this.properties = properties;
|
||||
this.context = context;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class ExportFromDB extends Stage implements InitializingBean {
|
|||
|
||||
private Charset dbfCharset;
|
||||
|
||||
public ExportFromDB(@Qualifier("dbfExportProperties") AProperties properties,
|
||||
public ExportFromDB(@Qualifier("dbfExporterProperties") AProperties properties,
|
||||
@Qualifier("dbfJdbcTemplate") JdbcTemplate dbfJdbcTemplate) {
|
||||
this.properties = properties;
|
||||
this.dbfJdbcTemplate = dbfJdbcTemplate;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public class PrepareDBFFiles extends Stage implements InitializingBean {
|
|||
private final AProperties properties;
|
||||
private String outDirWithDateTime;
|
||||
|
||||
public PrepareDBFFiles(@Qualifier("dbfExportProperties") AProperties properties) {
|
||||
public PrepareDBFFiles(@Qualifier("dbfExporterProperties") AProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
package ru.spcex.clearing.dbf.exporter.properties;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("dbfExportProperties")
|
||||
@PropertySource(value = {"classpath:dbf_export.properties"})
|
||||
@PropertySource(value = {"file:dbf_export.properties"}, ignoreResourceNotFound = true)
|
||||
@Component("dbfExporterProperties")
|
||||
public class AProperties {
|
||||
|
||||
@Value("${db.jdbc-url}")
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
</appender>
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>./logs//dbf_export.log</file>
|
||||
<file>./logs/dbf_exporter.log</file>
|
||||
<encoder>
|
||||
<charset>UTF-8</charset>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package ru.spcex.clearing.dbf.importer.config;
|
|||
|
||||
import com.mchange.v2.c3p0.ComboPooledDataSource;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
|
@ -18,12 +19,13 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
@EnableConfigurationProperties
|
||||
@ComponentScan(basePackages = {"ru.spcex.clearing.dbf.importer"})
|
||||
public class DBFLoaderConfig {
|
||||
private final AProperties properties;
|
||||
private final ApplicationContext context;
|
||||
|
||||
public DBFLoaderConfig(@Qualifier("dbfLoaderProperties") AProperties properties, ApplicationContext context) {
|
||||
public DBFLoaderConfig(@Qualifier("dbfImporterProperties") AProperties properties, ApplicationContext context) {
|
||||
this.properties = properties;
|
||||
this.context = context;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class ImportToDB extends Stage {
|
|||
private final AProperties properties;
|
||||
private final JdbcTemplate dbfJdbcTemplate;
|
||||
|
||||
public ImportToDB(@Qualifier("dbfLoaderProperties") AProperties properties,
|
||||
public ImportToDB(@Qualifier("dbfImporterProperties") AProperties properties,
|
||||
@Qualifier("dbfJdbcTemplate") JdbcTemplate dbfJdbcTemplate) {
|
||||
this.properties = properties;
|
||||
this.dbfJdbcTemplate = dbfJdbcTemplate;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
package ru.spcex.clearing.dbf.importer.properties;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("dbfLoaderProperties")
|
||||
@PropertySource(value = {"classpath:dbf_loader.properties"})
|
||||
@PropertySource(value = {"file:dbf_loader.properties"}, ignoreResourceNotFound = true)
|
||||
@Component("dbfImporterProperties")
|
||||
public class AProperties {
|
||||
|
||||
@Value("${db.jdbc-url}")
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
package ru.spcex.clearing.dbf.importer.services;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.spcex.clearing.dbf.importer.logic.data.ResultContainer;
|
||||
import ru.spcex.clearing.dbf.importer.logic.data.enums.StageResult;
|
||||
|
|
@ -13,7 +11,7 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@EnableScheduling
|
||||
//@EnableScheduling
|
||||
public class DBFLoaderService {
|
||||
private final AProperties properties;
|
||||
private final MessageListener messageListener;
|
||||
|
|
@ -27,7 +25,7 @@ public class DBFLoaderService {
|
|||
this.pipeline = pipeline;
|
||||
}
|
||||
|
||||
@Scheduled(fixedDelayString = "${dbf.execute-timeout}")
|
||||
// @Scheduled(fixedDelayString = "${dbf.execute-timeout}")
|
||||
public void run() {
|
||||
List<ResultContainer> newTaskList = messageListener.getTasks();
|
||||
for (ResultContainer newTask : newTaskList) {
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@ package ru.spcex.clearing.dbf.importer.services;
|
|||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.spcex.clearing.dbf.importer.exceptions.ConfigException;
|
||||
import ru.spcex.clearing.dbf.importer.logic.data.enums.Table;
|
||||
import ru.spcex.clearing.dbf.importer.properties.AProperties;
|
||||
|
||||
|
|
@ -19,8 +15,7 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
|
||||
@Service("fileMessageListener")
|
||||
@EnableScheduling
|
||||
public class FileMessageListener extends MessageListener implements InitializingBean {
|
||||
public class FileMessageListener extends MessageListener {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final AProperties properties;
|
||||
|
||||
|
|
@ -29,7 +24,6 @@ public class FileMessageListener extends MessageListener implements Initializing
|
|||
}
|
||||
|
||||
@Override
|
||||
@Scheduled(fixedDelayString = "${dbf.check-source-timeout}")
|
||||
public void checkMessage() {
|
||||
String srcDir = properties.getSrcDir();
|
||||
List<File> dbfFiles = lsDBF(srcDir);
|
||||
|
|
@ -75,13 +69,4 @@ public class FileMessageListener extends MessageListener implements Initializing
|
|||
|
||||
return resultFiles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
String dbfSourceDirPath = properties.getSrcDir();
|
||||
File dbfSourceDir = new File(dbfSourceDirPath);
|
||||
|
||||
if (!dbfSourceDir.exists()) throw new ConfigException(String.format("DBF directory (%s) doesn't exist", dbfSourceDirPath));
|
||||
if (!dbfSourceDir.isDirectory()) throw new ConfigException(String.format("DBF path (%s) isn't directory", dbfSourceDirPath));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
</appender>
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>./logs//dbf_loader.log</file>
|
||||
<file>./logs/dbf_importer.log</file>
|
||||
<encoder>
|
||||
<charset>UTF-8</charset>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
|
|
|
|||
|
|
@ -119,6 +119,10 @@
|
|||
<sourceFile>${folder_root_dbf-exporter}/target/dbf-exporter.jar</sourceFile>
|
||||
<destinationFile>${folder.clearing.distr.modules}/dbf-exporter/dbf-exporter.jar</destinationFile>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<sourceFile>${folder_root_dbf-exporter}/src/main/resources/application.properties</sourceFile>
|
||||
<destinationFile>${folder.clearing.distr.modules}/dbf-exporter/application.properties</destinationFile>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
|
@ -134,6 +138,10 @@
|
|||
<sourceFile>${folder_root_dbf-importer}/target/dbf-importer.jar</sourceFile>
|
||||
<destinationFile>${folder.clearing.distr.modules}/dbf-importer/dbf-importer.jar</destinationFile>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<sourceFile>${folder_root_dbf-importer}/src/main/resources/application.properties</sourceFile>
|
||||
<destinationFile>${folder.clearing.distr.modules}/dbf-importer/application.properties</destinationFile>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
FROM debian:stable-20220125-jdk17
|
||||
|
||||
ADD dbf-exporter.jar /opt/clearing/bin/dbf-exporter.jar
|
||||
ADD application.properties /opt/clearing/bin/application.properties
|
||||
USER root
|
||||
ENTRYPOINT java -jar /opt/clearing/bin/dbf-exporter.jar
|
||||
ENTRYPOINT java -jar /opt/clearing/bin/dbf-exporter.jar --spring.config.location=/opt/clearing/bin/
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
FROM debian:stable-20220125-jdk17
|
||||
|
||||
ADD dbf-importer.jar /opt/clearing/bin/dbf-importer.jar
|
||||
ADD application.properties /opt/clearing/bin/application.properties
|
||||
USER root
|
||||
ENTRYPOINT java -jar /opt/clearing/bin/dbf-importer.jar
|
||||
ENTRYPOINT java -jar /opt/clearing/bin/dbf-importer.jar --spring.config.location=/opt/clearing/bin/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue