You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by de...@apache.org on 2016/03/07 21:15:29 UTC
svn commit: r1733975 - in
/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws:
helper/BrokerHelper.java server/DuccHandlerClassic.java
server/DuccHandlerJsonFormat.java
Author: degenaro
Date: Mon Mar 7 20:15:29 2016
New Revision: 1733975
URL: http://svn.apache.org/viewvc?rev=1733975&view=rev
Log:
UIMA-4815 DUCC Web Server (WS) System Machines page re-imagined
Modified:
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/helper/BrokerHelper.java
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerClassic.java
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerJsonFormat.java
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/helper/BrokerHelper.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/helper/BrokerHelper.java?rev=1733975&r1=1733974&r2=1733975&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/helper/BrokerHelper.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/helper/BrokerHelper.java Mon Mar 7 20:15:29 2016
@@ -77,7 +77,7 @@ public class BrokerHelper {
private Map<String,Map<String,String>> entityAttributes = null;
- public enum JmxAttribute { destinationName, destinationType };
+ public enum JmxKeyWord { Destination, Type, Topic, Queue };
public enum FrameworkAttribute { ConsumerCount, QueueSize, MaxEnqueueTime, AverageEnqueueTime, MemoryPercentUsage };
@@ -251,31 +251,14 @@ public class BrokerHelper {
}
return retVal;
}
-
- private boolean isEndPoint(Hashtable<String, String> plist) {
- boolean retVal = true;
- if(plist != null) {
- String text = plist.get("endpoint");
- if(text == null) {
- retVal = false;
- }
- }
- return retVal;
- }
-
- private boolean isBroker(Hashtable<String, String> plist) {
- boolean retVal = false;
- if(plist != null) {
- String text = plist.get("type");
- retVal = match("Broker",text);
- }
- return retVal;
- }
-
+
private boolean isQueue(Hashtable<String, String> plist) {
boolean retVal = false;
if(plist != null) {
- String text = plist.get(JmxAttribute.destinationType.name());
+ String text = plist.get("type");
+ if(text == null) {
+ text = plist.get("Type");
+ }
retVal = match("Queue",text);
}
return retVal;
@@ -284,16 +267,17 @@ public class BrokerHelper {
private boolean isTopic(Hashtable<String, String> plist) {
boolean retVal = false;
if(plist != null) {
- if (!isEndPoint(plist)) {
- String text = plist.get(JmxAttribute.destinationType.name());
- retVal = match("Topic",text);
+ String text = plist.get("type");
+ if(text == null) {
+ text = plist.get("Type");
}
+ retVal = match("Topic",text);
}
return retVal;
}
private boolean isEligible(Hashtable<String, String> plist) {
- boolean retVal = isBroker(plist) && (isTopic(plist) || isQueue(plist));
+ boolean retVal = isTopic(plist) || isQueue(plist);
return retVal;
}
@@ -303,7 +287,7 @@ public class BrokerHelper {
if(objectName != null) {
Hashtable<String, String> plist = objectName.getKeyPropertyList();
if(isEligible(plist)) {
- String name = plist.get(JmxAttribute.destinationName.name());
+ String name = plist.get(JmxKeyWord.Destination.name());
String prefix = "ducc.";
if(start(name,prefix)) {
Map<String,String> attributes = new TreeMap<String,String>();
@@ -315,7 +299,7 @@ public class BrokerHelper {
attributes.put(attrName, attrValue);
logger.trace(location, jobid, attrName+"="+attrValue);
}
- String key = JmxAttribute.destinationType.name();
+ String key = JmxKeyWord.Type.name();
String value = plist.get(key);
attributes.put(key, value);
map.put(name, attributes);
@@ -343,6 +327,9 @@ public class BrokerHelper {
Hashtable<String, String> plist = objectName.getKeyPropertyList();
if(plist != null) {
String s0 = plist.get("type");
+ if(s0 == null) {
+ s0 = plist.get("Type");
+ }
String s1 = "Broker";
if(match(s0,s1)) {
AttributeList attributeList = mbsc.getAttributes(objectName, brokerAttributeNames);
@@ -505,12 +492,22 @@ public class BrokerHelper {
System.out.println("ThreadsPeak="+bh.getThreadsPeak());
System.out.println("SystemLoadAverage="+bh.getSystemLoadAverage());
Map<String, Map<String, String>> map = bh.getEntityAttributes();
- for(Entry<String, Map<String, String>> entry : map.entrySet()) {
- System.out.println(entry.getKey()+":");
- Map<String, String> attributes = entry.getValue();
- for(Entry<String, String> attribute : attributes.entrySet()) {
- System.out.println(attribute.getKey()+"="+attribute.getValue());
+ if(map != null) {
+ if(!map.isEmpty()) {
+ for(Entry<String, Map<String, String>> entry : map.entrySet()) {
+ System.out.println(entry.getKey()+":");
+ Map<String, String> attributes = entry.getValue();
+ for(Entry<String, String> attribute : attributes.entrySet()) {
+ System.out.println(attribute.getKey()+"="+attribute.getValue());
+ }
+ }
+ }
+ else {
+ System.out.println("map=empty");
}
}
+ else {
+ System.out.println("map=null");
+ }
}
}
\ No newline at end of file
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerClassic.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerClassic.java?rev=1733975&r1=1733974&r2=1733975&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerClassic.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerClassic.java Mon Mar 7 20:15:29 2016
@@ -77,7 +77,7 @@ import org.apache.uima.ducc.ws.JobInfo;
import org.apache.uima.ducc.ws.MachineInfo;
import org.apache.uima.ducc.ws.helper.BrokerHelper;
import org.apache.uima.ducc.ws.helper.BrokerHelper.FrameworkAttribute;
-import org.apache.uima.ducc.ws.helper.BrokerHelper.JmxAttribute;
+import org.apache.uima.ducc.ws.helper.BrokerHelper.JmxKeyWord;
import org.apache.uima.ducc.ws.helper.DatabaseHelper;
import org.apache.uima.ducc.ws.registry.ServiceInterpreter.StartState;
import org.apache.uima.ducc.ws.registry.ServicesRegistry;
@@ -1935,7 +1935,7 @@ public class DuccHandlerClassic extends
row.append(messages.fetch(topic));
row.append(messages.fetch("</td>"));
// type
- String type = map.get(JmxAttribute.destinationType.name());
+ String type = map.get(JmxKeyWord.Type.name());
row.append(messages.fetch("<td style=\"font-family: monospace;\" align=\"left\">"));
row.append(messages.fetch(type));
row.append(messages.fetch("</td>"));
@@ -1973,7 +1973,7 @@ public class DuccHandlerClassic extends
row.append(messages.fetch("</td>"));
//
row.append(messages.fetch("</tr>"));
- if(type.equals(JmxAttribute.destinationType.name())) {
+ if(type.equals(JmxKeyWord.Type.name())) {
topics.append(row);
}
else {
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=1733975&r1=1733974&r2=1733975&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 Mon Mar 7 20:15:29 2016
@@ -82,7 +82,7 @@ import org.apache.uima.ducc.ws.MachineIn
import org.apache.uima.ducc.ws.ReservationInfo;
import org.apache.uima.ducc.ws.helper.BrokerHelper;
import org.apache.uima.ducc.ws.helper.BrokerHelper.FrameworkAttribute;
-import org.apache.uima.ducc.ws.helper.BrokerHelper.JmxAttribute;
+import org.apache.uima.ducc.ws.helper.BrokerHelper.JmxKeyWord;
import org.apache.uima.ducc.ws.helper.DatabaseHelper;
import org.apache.uima.ducc.ws.registry.ServiceInterpreter.StartState;
import org.apache.uima.ducc.ws.registry.ServicesRegistry;
@@ -1686,7 +1686,7 @@ public class DuccHandlerJsonFormat exten
// Name
row.add(new JsonPrimitive(topic));
// Type
- String type = map.get(JmxAttribute.destinationType.name());
+ String type = map.get(JmxKeyWord.Type.name());
row.add(new JsonPrimitive(type));
// ConsumerCount
attrValue = map.get(FrameworkAttribute.ConsumerCount.name());