aboutsummaryrefslogtreecommitdiff
path: root/moaSig/moa-sig-lib/src/main/java
diff options
context:
space:
mode:
authortlenz <thomas.lenz@egiz.gv.at>2018-02-08 12:56:43 +0100
committertlenz <thomas.lenz@egiz.gv.at>2018-02-08 12:56:43 +0100
commitbea447f643c2ca8f6c2d770b826f84b840488a54 (patch)
treea5d93e50f1a7e79af4c68f79db28cfb2e1908d4d /moaSig/moa-sig-lib/src/main/java
parent1461f2488a3e62d4044af7a88ddebf1ab67626f6 (diff)
downloadmoa-sig-bea447f643c2ca8f6c2d770b826f84b840488a54.tar.gz
moa-sig-bea447f643c2ca8f6c2d770b826f84b840488a54.tar.bz2
moa-sig-bea447f643c2ca8f6c2d770b826f84b840488a54.zip
add Servlet to ask for TSL client status
Diffstat (limited to 'moaSig/moa-sig-lib/src/main/java')
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java3
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/monitoring/ServiceStatusContainer.java32
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/TSLServiceFactory.java12
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/timer/TSLUpdaterTimerTask.java15
4 files changed, 60 insertions, 2 deletions
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java
index 7d7d372..d023d18 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java
@@ -41,6 +41,7 @@ import at.gv.egovernment.moa.spss.MOAException;
import at.gv.egovernment.moa.spss.api.common.TSLConfiguration;
import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
import at.gv.egovernment.moa.spss.server.iaik.config.IaikConfigurator;
+import at.gv.egovernment.moa.spss.server.monitoring.ServiceStatusContainer;
import at.gv.egovernment.moa.spss.server.service.RevocationArchiveCleaner;
import at.gv.egovernment.moa.spss.tsl.TSLServiceFactory;
import at.gv.egovernment.moa.spss.tsl.timer.TSLUpdaterTimerTask;
@@ -158,7 +159,7 @@ public class SystemInitializer {
Logger.info(new LogMsg(msg.getMessage("config.41", null)));
TSLServiceFactory.initialize(tslConfig);
Logger.info("TSL-Service client initialization finished");
-
+
//initialize TSL Update Task
initTSLUpdateTask(moaSPTslConfig);
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/monitoring/ServiceStatusContainer.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/monitoring/ServiceStatusContainer.java
new file mode 100644
index 0000000..88e6474
--- /dev/null
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/monitoring/ServiceStatusContainer.java
@@ -0,0 +1,32 @@
+package at.gv.egovernment.moa.spss.server.monitoring;
+
+import at.gv.egovernment.moaspss.util.StringUtils;
+
+public class ServiceStatusContainer {
+
+ public static final String STATUS_NOT_SET = "no status message";
+ public static final String STATUS_OK = "ok";
+
+ private static boolean TSLStatusValid = false;
+ private static String TSLStatusMsg = STATUS_NOT_SET;
+
+
+ public static boolean getStatus() {
+ return TSLStatusValid;
+
+ }
+
+ public static String getStatusMsg() {
+ return TSLStatusMsg;
+
+ }
+
+ public static void setStatus(boolean currentStatus) {
+ TSLStatusValid = currentStatus;
+ }
+
+ public static void setStatusMsg(String msg) {
+ TSLStatusMsg = msg;
+ }
+
+}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/TSLServiceFactory.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/TSLServiceFactory.java
index 6463745..bc902f2 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/TSLServiceFactory.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/TSLServiceFactory.java
@@ -5,6 +5,7 @@ import at.gv.egovernment.moa.sig.tsl.api.ITslService;
import at.gv.egovernment.moa.sig.tsl.config.TslConfigurationImpl;
import at.gv.egovernment.moa.sig.tsl.exception.TslException;
import at.gv.egovernment.moa.sig.tsl.pki.chaining.ChainingTrustStoreHandler;
+import at.gv.egovernment.moa.spss.server.monitoring.ServiceStatusContainer;
import at.gv.egovernment.moa.spss.util.MessageProvider;
import at.gv.egovernment.moaspss.logging.LogMsg;
import at.gv.egovernment.moaspss.logging.Logger;
@@ -23,9 +24,18 @@ public class TSLServiceFactory {
TrustStoreFactory.addTrustStoreHandler(new ChainingTrustStoreHandler());
+ //set global TSL client status
+ ServiceStatusContainer.setStatus(true);
+ ServiceStatusContainer.setStatusMsg(ServiceStatusContainer.STATUS_OK);
+
} catch (TslException e) {
Logger.fatal(new LogMsg(MessageProvider.getInstance().getMessage("init.05", new Object[]{e.getMessage()})), e);
-
+
+ //set global TSL client status
+ ServiceStatusContainer.setStatus(false);
+ ServiceStatusContainer.setStatusMsg(
+ new LogMsg(MessageProvider.getInstance().getMessage("init.05", new Object[]{e.getMessage()})).toString());
+
}
} else {
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/timer/TSLUpdaterTimerTask.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/timer/TSLUpdaterTimerTask.java
index 300bcae..b5a7a8c 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/timer/TSLUpdaterTimerTask.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/timer/TSLUpdaterTimerTask.java
@@ -30,6 +30,7 @@ import at.gv.egovernment.moa.spss.server.config.TrustProfile;
import at.gv.egovernment.moa.spss.server.iaik.config.IaikConfigurator;
import at.gv.egovernment.moa.spss.server.iaik.pki.store.truststore.TrustStoreProfileImpl;
import at.gv.egovernment.moa.spss.server.logging.TransactionId;
+import at.gv.egovernment.moa.spss.server.monitoring.ServiceStatusContainer;
import at.gv.egovernment.moa.spss.tsl.TSLServiceFactory;
import at.gv.egovernment.moa.spss.util.MessageProvider;
import at.gv.egovernment.moaspss.logging.LogMsg;
@@ -47,14 +48,28 @@ public class TSLUpdaterTimerTask extends TimerTask {
TSLServiceFactory.getTSLServiceClient().updateTSLInformation();
Logger.info("Finished TSL Update");
+ //set global TSL client status
+ ServiceStatusContainer.setStatus(true);
+ ServiceStatusContainer.setStatusMsg(ServiceStatusContainer.STATUS_OK);
+
} catch (TslUpdateException e) {
MessageProvider msg = MessageProvider.getInstance();
Logger.error(new LogMsg(msg.getMessage("tsl.00", null)), e);
+ //set global TSL client status
+ ServiceStatusContainer.setStatus(false);
+ ServiceStatusContainer.setStatusMsg(
+ new LogMsg(msg.getMessage("tsl.00", null)).toString());
+
} catch (TslException e) {
MessageProvider msg = MessageProvider.getInstance();
Logger.error(new LogMsg(msg.getMessage("tsl.00", null)), e);
+ //set global TSL client status
+ ServiceStatusContainer.setStatus(false);
+ ServiceStatusContainer.setStatusMsg(
+ new LogMsg(msg.getMessage("tsl.00", null)).toString());
+
}
}