forked from lsmyrnaios/UrlsController
- Set the default value of the "isTestEnvironment" property to "true", in order to avoid undesired outcomes in the production db.
- Code polishing.
This commit is contained in:
parent
e975bec911
commit
4280f89296
|
@ -20,4 +20,4 @@ public class ScheduledTasks {
|
|||
public void reportCurrentTime() {
|
||||
logger.info("Server is live! Time is now {}", dateFormat.format(new Date()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,9 +69,10 @@ public class ImpalaConnector {
|
|||
jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS " + testDatabaseName + ".datasource stored as parquet as select * from " + initialDatabaseName + ".datasource");
|
||||
jdbcTemplate.execute("COMPUTE STATS " + testDatabaseName + ".datasource");
|
||||
|
||||
databaseName = testDatabaseName; // For the rest of the queries.
|
||||
databaseName = testDatabaseName;
|
||||
} else {
|
||||
logger.info("Going to create or validate the tables that are populated by the Controller, for the \"initialDatabase\" = \"" + initialDatabaseName + "\"");
|
||||
// Note that for the "initialDatabase", the initial 4 tables are expected to be created either manually or by other pieces of software, as views of the contents of the Graph.
|
||||
databaseName = initialDatabaseName;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,11 +40,9 @@ public class UrlsServiceImpl implements UrlsService {
|
|||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
|
||||
@Autowired
|
||||
private FileUtils fileUtils;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ParquetFileUtils parquetFileUtils;
|
||||
|
||||
|
@ -75,12 +73,12 @@ public class UrlsServiceImpl implements UrlsService {
|
|||
for ( int i=0; i < exclusionListSize; ++i ) {
|
||||
sb.append("\"").append(excludedIDs.get(i)).append("\"");
|
||||
if ( i < (exclusionListSize -1) )
|
||||
sb.append(",");
|
||||
sb.append(", ");
|
||||
}
|
||||
sb.append(")");
|
||||
|
||||
excludedDatasourceIDsStringList = sb.toString();
|
||||
//logger.debug("excludedDatasourceIDsStringList :\n" + excludedDatasourceIDsStringList); // DEBUG!
|
||||
logger.info("The following datasources will be excluded from crawling: " + excludedDatasourceIDsStringList);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ public class FileUtils {
|
|||
String baseUrl = "http://" + remoteAddr + ":1881/api/full-texts/getFullTexts/" + assignmentsBatchCounter + "/" + numOfBatches + "/";
|
||||
|
||||
// TODO - The worker should send the port in which it accepts requests, along with the current request.
|
||||
// TODO - The least we have to do it to expose the port-assignment somewhere more obvious like inside the "application.properties" file.
|
||||
// TODO - The least we have to do it to expose the port-assignment somewhere more obvious like inside the "application.yml" file.
|
||||
|
||||
String curAssignmentsBaseLocation = baseFilesLocation + "assignments_" + assignmentsBatchCounter + File.separator;
|
||||
// Note: the "curAssignmentsBaseLocation"-directory will be created once the first batch subdirectory is called for creation.
|
||||
|
|
|
@ -631,7 +631,7 @@ public class ParquetFileUtils {
|
|||
|
||||
int statusCode = conn.getResponseCode();
|
||||
if ( statusCode == 200 ) {
|
||||
logger.debug("The file \"" + parquetFileName + "\" was successfully deleted."); // DEBUG!
|
||||
logger.debug("The file \"" + parquetFileName + "\" was successfully deleted.");
|
||||
} else {
|
||||
String errorMsg = "The file \"" + parquetFileName + "\" could not be deleted! Response-code: " + statusCode;
|
||||
logger.error(errorMsg);
|
||||
|
|
|
@ -25,7 +25,7 @@ public class UriBuilder {
|
|||
|
||||
String sslEnabled = environment.getProperty("server.ssl.enabled");
|
||||
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.yml\". Continuing with plain HTTP..");
|
||||
sslEnabled = "false";
|
||||
}
|
||||
baseUrl += sslEnabled.equals("true") ? "s" : "";
|
||||
|
@ -45,7 +45,7 @@ public class UriBuilder {
|
|||
if ( !baseInternalPath.endsWith("/") )
|
||||
baseUrl += "/";
|
||||
} else {
|
||||
logger.warn("No property \"server.servlet.context-path\" was found in \"application.properties\"!"); // Yes it's expected.
|
||||
logger.warn("No property \"server.servlet.context-path\" was found in \"application.yml\"!"); // Yes it's expected.
|
||||
baseUrl += "/";
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ server:
|
|||
services:
|
||||
pdfaggregation:
|
||||
controller:
|
||||
isTestEnvironment: false
|
||||
isTestEnvironment: true
|
||||
# In case the "isTestEnvironment" is "true", the "testDatabase" below and all its tables are created (if not exist).
|
||||
# The tables "datasource", "publication", "publication_pids" and "publication_urls" are filled with the data from the same tables existing in the "initialDatabase", if they don't exist.
|
||||
# In case the "isTestEnvironment" is "false", the "initialDatabase" is used. The Controller assumes that the above 4 tables are present, and only creates, if they don't exist, the following tables:
|
||||
|
|
Loading…
Reference in New Issue