Author: degenaro
Date: Thu Feb 21 15:43:21 2013
New Revision: 1448686

URL: http://svn.apache.org/r1448686
Log:
UIMA-2684 DUCC webserver (WS) should not present start/stop buttons for 
non-Registered Services on Services page

Modified:
    
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerJsonFormat.java
    
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerLegacy.java

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerJsonFormat.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerJsonFormat.java?rev=1448686&r1=1448685&r2=1448686&view=diff
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerJsonFormat.java
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerJsonFormat.java
 Thu Feb 21 15:43:21 2013
@@ -880,43 +880,49 @@ public class DuccHandlerJsonFormat exten
                                String deployments = 
getDeployments(servicesRegistry,propertiesMeta);
                                JsonArray row = new JsonArray();
                                
+                               String typeRegistered = "Registered";
+                               
+                               String type = "";
+                               if(propertiesMeta != null) {
+                                       
if(propertiesMeta.containsKey(IServicesRegistry.service_class)) {
+                                               String value = 
propertiesMeta.getProperty(IServicesRegistry.service_class);
+                                               if(value != null) {
+                                                       type = value.trim();
+                                               }
+                                       }
+                               }
+                               
                                StringBuffer col;
                                // Start
                                col = new StringBuffer();
-                               col.append("<span class=\"ducc-col-start\">");
-                               if(buttonsEnabled) {
-                                       if(!deployments.equals(instances)) {
-                                               col.append("<input 
type=\"button\" onclick=\"ducc_confirm_service_start("+sid+")\" value=\"Start\" 
"+getDisabled(request,user)+"/>");
+                               if(type.equals(typeRegistered)) {
+                                       col.append("<span 
class=\"ducc-col-start\">");
+                                       if(buttonsEnabled) {
+                                               
if(!deployments.equals(instances)) {
+                                                       col.append("<input 
type=\"button\" onclick=\"ducc_confirm_service_start("+sid+")\" value=\"Start\" 
"+getDisabled(request,user)+"/>");
+                                               }
                                        }
+                                       col.append("</span>");
                                }
-                               col.append("</span>");
                                row.add(new JsonPrimitive(col.toString()));
                                // Stop
                                col = new StringBuffer();
-                               col.append("<span class=\"ducc-col-stop\">");
-                               if(buttonsEnabled) {
-                                       if(!deployments.equals("0")) {
-                                               col.append("<input 
type=\"button\" onclick=\"ducc_confirm_service_stop("+sid+")\" value=\"Stop\" 
"+getDisabled(request,user)+"/>");
+                               if(type.equals(typeRegistered)) {
+                                       col.append("<span 
class=\"ducc-col-stop\">");
+                                       if(buttonsEnabled) {
+                                               if(!deployments.equals("0")) {
+                                                       col.append("<input 
type=\"button\" onclick=\"ducc_confirm_service_stop("+sid+")\" value=\"Stop\" 
"+getDisabled(request,user)+"/>");
+                                               }
                                        }
+                                       col.append("</span>");
                                }
-                               col.append("</span>");
                                row.add(new JsonPrimitive(col.toString()));
-                               
                                // Id
                                String id = "<a 
href=\"service.details.html?name="+name+"\">"+key+"</a>";
                                row.add(new JsonPrimitive(id));
                                // Endpoint
                                row.add(new JsonPrimitive(name));
                                // Type
-                               String type = "";
-                               if(propertiesMeta != null) {
-                                       
if(propertiesMeta.containsKey(IServicesRegistry.service_class)) {
-                                               String value = 
propertiesMeta.getProperty(IServicesRegistry.service_class);
-                                               if(value != null) {
-                                                       type = value;
-                                               }
-                                       }
-                               }
                                row.add(new JsonPrimitive(type));
                                // State
                                String state = "";

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerLegacy.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerLegacy.java?rev=1448686&r1=1448685&r2=1448686&view=diff
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerLegacy.java
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerLegacy.java
 Thu Feb 21 15:43:21 2013
@@ -740,23 +740,38 @@ public class DuccHandlerLegacy extends D
                                String deployments = 
getDeployments(servicesRegistry,propertiesMeta);
                                sb.append(trGet(++counter));
                                
+                               String typeRegistered = "Registered";
+                               
+                               String type = "";
+                               if(propertiesMeta != null) {
+                                       
if(propertiesMeta.containsKey(IServicesRegistry.service_class)) {
+                                               String value = 
propertiesMeta.getProperty(IServicesRegistry.service_class);
+                                               if(value != null) {
+                                                       type = value.trim();
+                                               }
+                                       }
+                               }
+                               
                                // Start
                                sb.append("<td valign=\"bottom\" 
class=\"ducc-col-start\">");
-                               if(buttonsEnabled) {
-                                       if(!deployments.equals(instances)) {
-                                               sb.append("<input 
type=\"button\" onclick=\"ducc_confirm_service_start("+sid+")\" value=\"Start\" 
"+getDisabled(request,user)+"/>");
+                               if(type.equals(typeRegistered)) {
+                                       if(buttonsEnabled) {
+                                               
if(!deployments.equals(instances)) {
+                                                       sb.append("<input 
type=\"button\" onclick=\"ducc_confirm_service_start("+sid+")\" value=\"Start\" 
"+getDisabled(request,user)+"/>");
+                                               }
                                        }
                                }
                                sb.append("</td>");
                                // Stop
                                sb.append("<td valign=\"bottom\" 
class=\"ducc-col-stop\">");
-                               if(buttonsEnabled) {
-                                       if(!deployments.equals("0")) {
-                                               sb.append("<input 
type=\"button\" onclick=\"ducc_confirm_service_stop("+sid+")\" value=\"Stop\" 
"+getDisabled(request,user)+"/>");
+                               if(type.equals(typeRegistered)) {
+                                       if(buttonsEnabled) {
+                                               if(!deployments.equals("0")) {
+                                                       sb.append("<input 
type=\"button\" onclick=\"ducc_confirm_service_stop("+sid+")\" value=\"Stop\" 
"+getDisabled(request,user)+"/>");
+                                               }
                                        }
                                }
                                sb.append("</td>");
-                               
                                // Service Id
                                sb.append("<td align=\"right\">");
                                String id = "<a 
href=\"service.details.html?name="+name+"\">"+key+"</a>";
@@ -768,15 +783,6 @@ public class DuccHandlerLegacy extends D
                                sb.append("</td>");
                                // Type
                                sb.append("<td>");
-                               String type = "";
-                               if(propertiesMeta != null) {
-                                       
if(propertiesMeta.containsKey(IServicesRegistry.service_class)) {
-                                               String value = 
propertiesMeta.getProperty(IServicesRegistry.service_class);
-                                               if(type != null) {
-                                                       type = value;
-                                               }
-                                       }
-                               }
                                sb.append(type);
                                sb.append("</td>");
                                // State


Reply via email to