UIMA-6117 DUCC Web Server (WS) should display "no data - not master" on Viz page
git-svn-id: https://svn.apache.org/repos/asf/uima/uima-ducc/trunk@1865988 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerViz.java b/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerViz.java
index 5eb4193..88086cc 100644
--- a/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerViz.java
+++ b/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerViz.java
@@ -24,9 +24,11 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.uima.ducc.common.head.IDuccHead;
import org.apache.uima.ducc.common.internationalization.Messages;
import org.apache.uima.ducc.common.utils.DuccLogger;
import org.apache.uima.ducc.common.utils.id.DuccId;
+import org.apache.uima.ducc.ws.DuccHead;
import org.apache.uima.ducc.ws.server.nodeviz.NodeViz;
import org.eclipse.jetty.server.Request;
@@ -36,6 +38,8 @@
private static Messages messages = Messages.getInstance();
private static DuccId jobid = null;
+ private static IDuccHead dh = DuccHead.getInstance();
+
public final String vizNodes = duccContextViz+"-nodes";
NodeViz viz = null;
@@ -51,10 +55,21 @@
String methodName = "handleServletVizNodes";
duccLogger.trace(methodName, jobid, messages.fetch("enter"));
+ String data = null;
- //String data = "<html><p>"+methodName+" not yet implemented</p></html>";
- String data = viz.getVisualization();
-
+ if(dh.is_ducc_head_backup()) {
+ StringBuffer sb = new StringBuffer();
+ sb.append("<tr>");
+ sb.append("<td>");
+ sb.append(messages.fetch("no data - not master"));
+ sb.append("</td>");
+ sb.append("</tr>");
+ data = sb.toString();
+ }
+ else {
+ data = viz.getVisualization();
+ }
+
duccLogger.debug(methodName, jobid, data);
response.getWriter().println(data);
duccLogger.trace(methodName, jobid, messages.fetch("exit"));