aboutsummaryrefslogtreecommitdiff
path: root/moaSig/moa-sig/src
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2018-02-13 10:25:29 +0100
committerThomas Lenz <thomas.lenz@egiz.gv.at>2018-02-13 10:25:29 +0100
commit05449aee540c18fd766ae667d8e0a2f1d84281f7 (patch)
treedcab971e80fc44ea5971a4ec0771beffdc8b1400 /moaSig/moa-sig/src
parentbea447f643c2ca8f6c2d770b826f84b840488a54 (diff)
downloadmoa-sig-05449aee540c18fd766ae667d8e0a2f1d84281f7.tar.gz
moa-sig-05449aee540c18fd766ae667d8e0a2f1d84281f7.tar.bz2
moa-sig-05449aee540c18fd766ae667d8e0a2f1d84281f7.zip
update TSL monitoring servlet
update TSL libs/tsl-lib-2.0.1.jar
Diffstat (limited to 'moaSig/moa-sig/src')
-rw-r--r--moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/TSLClientStatusServlet.java44
1 files changed, 40 insertions, 4 deletions
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
index 7bb7217..d763c44 100644
--- 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
@@ -3,13 +3,17 @@ package at.gv.egovernment.moa.spss.server.service;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.MessageFormat;
+import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import at.gv.egovernment.moa.sig.tsl.TslClientFactory;
+import at.gv.egovernment.moa.sig.tsl.engine.data.TSLProcessingResultElement;
import at.gv.egovernment.moa.spss.server.monitoring.ServiceStatusContainer;
+import at.gv.egovernment.moa.spss.tsl.TSLServiceFactory;
public class TSLClientStatusServlet extends HttpServlet {
@@ -19,12 +23,14 @@ public class TSLClientStatusServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
- public static final String STATUS_RESP = "{\"TSLStatus\":\"{0}\", \"TSLStatusMsg\":\"{1}\"}";
+ public static final String STATUS_RESP = "'{'\"EUTSLStatus\":\"{0}\", \"EUTSLStatusMsg\":\"{1}\"{2}'}'";
+ public static final String DETAIL_INFO = ", \"Details\":'{'{0}'}'";
+ //public static final String DETAIL_ENTRY = "\"{0}\":'{'\"verified\":\"{1}\", \"processed\":\"{2}\"'}'";
+ public static final String DETAIL_ENTRY = "\"{0}\":'{'\"processed\":\"{2}\"'}'";
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
-
-
+
if (ServiceStatusContainer.getStatus())
response.setStatus(200);
else
@@ -35,11 +41,41 @@ public class TSLClientStatusServlet extends HttpServlet {
out.println(MessageFormat.format(STATUS_RESP,
new Object[] {
String.valueOf(ServiceStatusContainer.getStatus()),
- ServiceStatusContainer.getStatusMsg()
+ ServiceStatusContainer.getStatusMsg(),
+ getTSLClientDetailInfos()
}));
out.flush();
out.close();
}
+ private String getTSLClientDetailInfos() {
+ String detailInfo = "";
+ List<TSLProcessingResultElement> tslDetailStatus = ServiceStatusContainer.getTslDetailStatus();
+ if (tslDetailStatus != null) {
+ String detailElements = null;
+
+ for (TSLProcessingResultElement el : tslDetailStatus) {
+ String entry = MessageFormat.format(DETAIL_ENTRY,
+ new Object[] {
+ el.getCountryCode(),
+ String.valueOf(el.isVerified()),
+ String.valueOf(el.isProcessed())
+ });
+ if (detailElements == null)
+ detailElements = entry;
+ else
+ detailElements += ", " + entry;
+
+ }
+
+ if (detailElements != null)
+ detailInfo = MessageFormat.format(DETAIL_INFO,
+ new Object[] {
+ detailElements
+ });
+ }
+
+ return detailInfo;
+ }
}