aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-rw-r--r--moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/TSLClientStatusServlet.java45
-rw-r--r--moaSig/moa-sig/src/main/webapp/WEB-INF/web.xml11
6 files changed, 116 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());
+
}
}
diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/TSLClientStatusServlet.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/TSLClientStatusServlet.java
new file mode 100644
index 0000000..7bb7217
--- /dev/null
+++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/TSLClientStatusServlet.java
@@ -0,0 +1,45 @@
+package at.gv.egovernment.moa.spss.server.service;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.text.MessageFormat;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import at.gv.egovernment.moa.spss.server.monitoring.ServiceStatusContainer;
+
+public class TSLClientStatusServlet extends HttpServlet {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+
+ public static final String STATUS_RESP = "{\"TSLStatus\":\"{0}\", \"TSLStatusMsg\":\"{1}\"}";
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+
+
+ if (ServiceStatusContainer.getStatus())
+ response.setStatus(200);
+ else
+ response.setStatus(500);
+
+ response.setContentType("application/json");
+ PrintWriter out = response.getWriter();
+ out.println(MessageFormat.format(STATUS_RESP,
+ new Object[] {
+ String.valueOf(ServiceStatusContainer.getStatus()),
+ ServiceStatusContainer.getStatusMsg()
+ }));
+ out.flush();
+ out.close();
+
+ }
+
+}
diff --git a/moaSig/moa-sig/src/main/webapp/WEB-INF/web.xml b/moaSig/moa-sig/src/main/webapp/WEB-INF/web.xml
index 910c037..ca3b69f 100644
--- a/moaSig/moa-sig/src/main/webapp/WEB-INF/web.xml
+++ b/moaSig/moa-sig/src/main/webapp/WEB-INF/web.xml
@@ -22,6 +22,12 @@
<servlet-class>at.gv.egovernment.moa.spss.server.service.CertificateProviderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
+ <servlet>
+ <servlet-name>TSLClientStatusServlet</servlet-name>
+ <display-name>MOA TSLClient Status-Check Servlet</display-name>
+ <servlet-class>at.gv.egovernment.moa.spss.server.service.TSLClientStatusServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
@@ -36,6 +42,11 @@
<servlet-name>CertificateProviderServlet</servlet-name>
<url-pattern>/Certificate</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>TSLClientStatusServlet</servlet-name>
+ <url-pattern>/TSLStatusCheck</url-pattern>
+ </servlet-mapping>
+
<security-constraint>
<web-resource-collection>