aboutsummaryrefslogtreecommitdiff
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
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
-rw-r--r--moaSig/libs/tsl-lib-2.0.1.jarbin801197 -> 803994 bytes
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/monitoring/ServiceStatusContainer.java17
-rw-r--r--moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/TSLClientStatusServlet.java44
3 files changed, 54 insertions, 7 deletions
diff --git a/moaSig/libs/tsl-lib-2.0.1.jar b/moaSig/libs/tsl-lib-2.0.1.jar
index e1efda6..45e18e3 100644
--- a/moaSig/libs/tsl-lib-2.0.1.jar
+++ b/moaSig/libs/tsl-lib-2.0.1.jar
Binary files differ
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
index 88e6474..3d100a4 100644
--- 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
@@ -1,6 +1,9 @@
package at.gv.egovernment.moa.spss.server.monitoring;
-import at.gv.egovernment.moaspss.util.StringUtils;
+import java.util.List;
+
+import at.gv.egovernment.moa.sig.tsl.engine.data.TSLProcessingResultElement;
+import at.gv.egovernment.moa.spss.tsl.TSLServiceFactory;
public class ServiceStatusContainer {
@@ -9,7 +12,7 @@ public class ServiceStatusContainer {
private static boolean TSLStatusValid = false;
private static String TSLStatusMsg = STATUS_NOT_SET;
-
+ private static List<TSLProcessingResultElement> tslDetailStatus = null;
public static boolean getStatus() {
return TSLStatusValid;
@@ -20,9 +23,17 @@ public class ServiceStatusContainer {
return TSLStatusMsg;
}
-
+
+ public static List<TSLProcessingResultElement> getTslDetailStatus() {
+ return tslDetailStatus;
+ }
+
public static void setStatus(boolean currentStatus) {
TSLStatusValid = currentStatus;
+
+ if (TSLServiceFactory.isInitialized())
+ tslDetailStatus = TSLServiceFactory.getTSLServiceClient().getCurrentTSLClientStatus();
+
}
public static void setStatusMsg(String msg) {
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;
+ }
}