added logs, some refactor

This commit is contained in:
Radek Davidek 2025-10-01 13:19:32 +02:00
parent ff9bfccee8
commit 8dea4b4c76
2 changed files with 9 additions and 7 deletions

View File

@ -33,17 +33,16 @@ public abstract class AbstractProcess {
protected AbstractProcess() { protected AbstractProcess() {
setTrustStoreCredentials("TRUSTSTORE_PATH", "TRUSTSTORE_PASSWORD"); setTrustStoreCredentials();
javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(new javax.net.ssl.HostnameVerifier() { javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(new javax.net.ssl.HostnameVerifier() {
public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) { public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) {
return true; return true;
} }
}); });
} }
protected static String getTrustStorePath(String trustStorePath) { protected static String getTrustStorePath() {
String path = System.getProperty("user.dir") + File.separatorChar String path = System.getProperty("user.dir") + File.separatorChar
+ ConfigManager.getInstance().getTruststorePath(); + ConfigManager.getInstance().getTruststorePath();
if (!new File(path).canRead()) if (!new File(path).canRead())
@ -51,9 +50,9 @@ public abstract class AbstractProcess {
return path; return path;
} }
protected static void setTrustStoreCredentials(String trustStorePath, String trustStorePassword) { protected static void setTrustStoreCredentials() {
log.info(getTrustStorePath(trustStorePath)); log.info(getTrustStorePath());
System.setProperty("javax.net.ssl.trustStore", getTrustStorePath(trustStorePath)); System.setProperty("javax.net.ssl.trustStore", getTrustStorePath());
System.setProperty("javax.net.ssl.trustStorePassword", ConfigManager.getInstance().getTruststorePassword()); System.setProperty("javax.net.ssl.trustStorePassword", ConfigManager.getInstance().getTruststorePassword());
} }

View File

@ -12,14 +12,17 @@ public class ApiSync {
protected final static String resourceName = "api-operator.properties"; protected final static String resourceName = "api-operator.properties";
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
log.info("API Operator started.");
if (args == null) { if (args == null) {
log.error("No parameters found.");
printHelp(); printHelp();
} else { } else {
String commandLine = String.join("", args).trim(); String commandLine = String.join("", args).trim();
StartParameters sp = StartParameters.parse(commandLine); StartParameters sp = StartParameters.parse(commandLine);
log.info("Parsed parameters: " + sp);
if (sp.getCommand().equalsIgnoreCase("import")) { if (sp.getCommand().equalsIgnoreCase("import")) {
log.info("Import command selected.");
Import imp = new Import(sp); Import imp = new Import(sp);
imp.process(); imp.process();
} }