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() {
setTrustStoreCredentials("TRUSTSTORE_PATH", "TRUSTSTORE_PASSWORD");
setTrustStoreCredentials();
javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(new javax.net.ssl.HostnameVerifier() {
public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) {
return true;
}
});
}
protected static String getTrustStorePath(String trustStorePath) {
protected static String getTrustStorePath() {
String path = System.getProperty("user.dir") + File.separatorChar
+ ConfigManager.getInstance().getTruststorePath();
if (!new File(path).canRead())
@ -51,9 +50,9 @@ public abstract class AbstractProcess {
return path;
}
protected static void setTrustStoreCredentials(String trustStorePath, String trustStorePassword) {
log.info(getTrustStorePath(trustStorePath));
System.setProperty("javax.net.ssl.trustStore", getTrustStorePath(trustStorePath));
protected static void setTrustStoreCredentials() {
log.info(getTrustStorePath());
System.setProperty("javax.net.ssl.trustStore", getTrustStorePath());
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";
public static void main(String[] args) throws Exception {
log.info("API Operator started.");
if (args == null) {
log.error("No parameters found.");
printHelp();
} else {
String commandLine = String.join("", args).trim();
StartParameters sp = StartParameters.parse(commandLine);
log.info("Parsed parameters: " + sp);
if (sp.getCommand().equalsIgnoreCase("import")) {
log.info("Import command selected.");
Import imp = new Import(sp);
imp.process();
}