forked from lsmyrnaios/UrlsController
- Improve logging configurations.
- Fix the "AssignmentResponse.toString()" method. - Update SpringBoot to v.2.5.6 - Code cleanup.
This commit is contained in:
parent
0540820817
commit
0d47c33a08
32
build.gradle
32
build.gradle
|
@ -1,17 +1,9 @@
|
||||||
buildscript {
|
|
||||||
ext {
|
|
||||||
springBootVersion = "2.5.4"
|
|
||||||
springSecurityVersion = "5.5.2"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'org.springframework.boot' version '2.5.4'
|
id 'org.springframework.boot' version '2.5.6'
|
||||||
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
|
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
|
||||||
id 'java'
|
id 'java'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
group = 'eu.openaire.urls_controller'
|
group = 'eu.openaire.urls_controller'
|
||||||
version = '0.0.1-SNAPSHOT'
|
version = '0.0.1-SNAPSHOT'
|
||||||
sourceCompatibility = '1.8'
|
sourceCompatibility = '1.8'
|
||||||
|
@ -21,18 +13,24 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
runtimeOnly "org.springframework.boot:spring-boot-devtools:${springBootVersion}"
|
runtimeOnly "org.springframework.boot:spring-boot-devtools"
|
||||||
|
|
||||||
implementation "org.springframework.boot:spring-boot-starter-web:${springBootVersion}"
|
implementation "org.springframework.boot:spring-boot-starter-web"
|
||||||
implementation("org.springframework.boot:spring-boot-starter-security:${springBootVersion}")
|
implementation("org.springframework.boot:spring-boot-starter-security")
|
||||||
implementation("org.springframework.boot:spring-boot-starter-jdbc:${springBootVersion}")
|
implementation("org.springframework.boot:spring-boot-starter-jdbc")
|
||||||
|
|
||||||
|
implementation("org.springframework.boot:spring-boot-configuration-processor")
|
||||||
|
implementation("org.springframework.security:spring-security-core")
|
||||||
|
implementation("org.springframework.security:spring-security-web")
|
||||||
|
implementation("org.springframework.security:spring-security-config")
|
||||||
|
|
||||||
implementation("org.springframework.boot:spring-boot-configuration-processor:${springBootVersion}")
|
|
||||||
implementation("org.springframework.security:spring-security-core:${springSecurityVersion}")
|
|
||||||
implementation("org.springframework.security:spring-security-web:${springSecurityVersion}")
|
|
||||||
implementation("org.springframework.security:spring-security-config:${springSecurityVersion}")
|
|
||||||
//implementation("io.jsonwebtoken:jjwt:0.9.1") // Use this in case we use auth-tokens later on.
|
//implementation("io.jsonwebtoken:jjwt:0.9.1") // Use this in case we use auth-tokens later on.
|
||||||
|
|
||||||
|
// Enable the validation annotations.
|
||||||
|
//implementation group: 'javax.validation', name: 'validation-api', version: '2.0.1.Final'
|
||||||
|
|
||||||
|
implementation "org.projectlombok:lombok:1.18.22"
|
||||||
|
|
||||||
// https://mvnrepository.com/artifact/com.google.guava/guava
|
// https://mvnrepository.com/artifact/com.google.guava/guava
|
||||||
implementation group: 'com.google.guava', name: 'guava', version: '30.1.1-jre'
|
implementation group: 'com.google.guava', name: 'guava', version: '30.1.1-jre'
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ public class AssignmentResponse {
|
||||||
@JsonProperty("assignments")
|
@JsonProperty("assignments")
|
||||||
private List<Assignment> assignments;
|
private List<Assignment> assignments;
|
||||||
|
|
||||||
|
|
||||||
public AssignmentResponse(Long assignmentCounter, List<Assignment> assignments) {
|
public AssignmentResponse(Long assignmentCounter, List<Assignment> assignments) {
|
||||||
this.assignmentCounter = assignmentCounter;
|
this.assignmentCounter = assignmentCounter;
|
||||||
this.assignments = assignments;
|
this.assignments = assignments;
|
||||||
|
@ -37,10 +38,12 @@ public class AssignmentResponse {
|
||||||
this.assignments = assignments;
|
this.assignments = assignments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "AssignmentResponse{" +
|
return "AssignmentResponse{" +
|
||||||
"assignments=" + assignments +
|
"assignmentCounter=" + assignmentCounter +
|
||||||
|
", assignments=" + assignments +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package eu.openaire.urls_controller.util;
|
package eu.openaire.urls_controller.util;
|
||||||
|
|
||||||
|
|
||||||
public interface ControllerConstants {
|
public interface ControllerConstants {
|
||||||
|
|
||||||
int ASSIGNMENTS_LIMIT = 10000; // The general assignments-limit the Controller will get. If the worker cannot handle them, then the worker's limit will be applied.
|
int ASSIGNMENTS_LIMIT = 10000; // The general assignments-limit the Controller will get. If the worker cannot handle them, then the worker's limit will be applied.
|
||||||
|
|
|
@ -19,8 +19,8 @@ public class FileUtils {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(FileUtils.class);
|
private static final Logger logger = LoggerFactory.getLogger(FileUtils.class);
|
||||||
|
|
||||||
public static ThreadLocal<Scanner> inputScanner = new ThreadLocal<Scanner>(); // Every Thread has its own variable.
|
public static ThreadLocal<Scanner> inputScanner = new ThreadLocal<Scanner>(); // Every Thread has its own variable.
|
||||||
private static ThreadLocal<Integer> fileIndex = new ThreadLocal<Integer>();
|
private static final ThreadLocal<Integer> fileIndex = new ThreadLocal<Integer>();
|
||||||
private static ThreadLocal<Integer> unretrievableInputLines = new ThreadLocal<Integer>();
|
private static final ThreadLocal<Integer> unretrievableInputLines = new ThreadLocal<Integer>();
|
||||||
public static ThreadLocal<Integer> duplicateIdUrlEntries = new ThreadLocal<Integer>();
|
public static ThreadLocal<Integer> duplicateIdUrlEntries = new ThreadLocal<Integer>();
|
||||||
public static final int jsonBatchSize = 3000;
|
public static final int jsonBatchSize = 3000;
|
||||||
private static final String utf8Charset = "UTF-8";
|
private static final String utf8Charset = "UTF-8";
|
||||||
|
@ -62,7 +62,7 @@ public class FileUtils {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method decodes a Jason String into its members.
|
* This method decodes a Json String and returns its members.
|
||||||
* @param jsonLine String
|
* @param jsonLine String
|
||||||
* @return HashMap<String,String>
|
* @return HashMap<String,String>
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -13,21 +13,19 @@ public class UriBuilder {
|
||||||
|
|
||||||
public static String baseUrl = null;
|
public static String baseUrl = null;
|
||||||
|
|
||||||
public UriBuilder(Environment environment) {
|
public UriBuilder(Environment environment)
|
||||||
|
{
|
||||||
baseUrl = "http";
|
baseUrl = "http";
|
||||||
|
|
||||||
String sslEnabled = environment.getProperty("server.ssl.enabled");
|
String sslEnabled = environment.getProperty("server.ssl.enabled");
|
||||||
if (sslEnabled == null) { // It's expected to not exist if there is no SSL-configuration.
|
if (sslEnabled == null) { // It's expected to not exist if there is no SSL-configuration.
|
||||||
logger.warn("No property \"server.ssl.enabled\" was found in \"application.properties\". Continuing with plain HTTP..");
|
logger.warn("No property \"server.ssl.enabled\" was found in \"application.properties\". Continuing with plain HTTP..");
|
||||||
sslEnabled = "false";
|
sslEnabled = "false";
|
||||||
}
|
}
|
||||||
baseUrl += sslEnabled.equals("true") ? "s" : "";
|
baseUrl += sslEnabled.equals("true") ? "s" : "";
|
||||||
|
|
||||||
baseUrl += "://";
|
baseUrl += "://";
|
||||||
|
|
||||||
String hostName = InetAddress.getLoopbackAddress().getHostName(); // Non-null.
|
String hostName = InetAddress.getLoopbackAddress().getHostName(); // Non-null.
|
||||||
baseUrl += hostName;
|
baseUrl += hostName;
|
||||||
|
|
||||||
String serverPort = environment.getProperty("server.port");
|
String serverPort = environment.getProperty("server.port");
|
||||||
if (serverPort == null) { // This is unacceptable!
|
if (serverPort == null) { // This is unacceptable!
|
||||||
logger.error("No property \"server.port\" was found in \"application.properties\"!");
|
logger.error("No property \"server.port\" was found in \"application.properties\"!");
|
||||||
|
|
|
@ -16,8 +16,9 @@ server.port = 1880
|
||||||
server.servlet.context-path=/api
|
server.servlet.context-path=/api
|
||||||
|
|
||||||
# LOGGING LEVELS
|
# LOGGING LEVELS
|
||||||
logging.level.root=WARN
|
logging.level.root=INFO
|
||||||
logging.level.org.springframework.web=INFO
|
logging.level.org.springframework.web=INFO
|
||||||
|
logging.level.org.springframework.security=WARN
|
||||||
logging.level.eu.openaire.urls_controller=DEBUG
|
logging.level.eu.openaire.urls_controller=DEBUG
|
||||||
spring.output.ansi.enabled=always
|
spring.output.ansi.enabled=always
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<root level="info">
|
<root level="debug">
|
||||||
<appender-ref ref="Console" />
|
<appender-ref ref="Console" /> <!-- TODO - Change it to "File" in production! -->
|
||||||
</root>
|
</root>
|
||||||
|
|
||||||
</configuration>
|
</configuration>
|
Loading…
Reference in New Issue