Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

SWITCHYARD-1020 add metrics columns to services list on runtime page;

add operation metrics view to service runtime details
  • Loading branch information...
commit b2c36dae675940cbfd32a6fea29fb7fc997bd397 1 parent b0ab1e4
@rcernich rcernich authored
Showing with 535 additions and 233 deletions.
  1. +2 −1  .gitignore
  2. +6 −107 app/pom.xml
  3. +23 −7 as7-core/pom.xml
  4. +32 −0 as7-core/src/main/assembly/module.xml
  5. +9 −6 as7-core/src/main/java/org/jboss/dmr/client/DataInput.java
  6. +1 −1  as7-core/src/main/java/org/jboss/dmr/client/IEEE754.java
  7. +0 −3  component/pom.xml
  8. +7 −61 gwt/pom.xml
  9. +39 −0 gwt/src/main/java/org/switchyard/console/client/model/OperationMetrics.java
  10. +10 −0 gwt/src/main/java/org/switchyard/console/client/model/ServiceMetrics.java
  11. +7 −0 gwt/src/main/java/org/switchyard/console/client/model/SwitchYardStore.java
  12. +43 −15 gwt/src/main/java/org/switchyard/console/client/model/SwitchYardStoreImpl.java
  13. +10 −0 gwt/src/main/java/org/switchyard/console/client/ui/common/AbstractDataTable.java
  14. +11 −15 gwt/src/main/java/org/switchyard/console/client/ui/runtime/RuntimePresenter.java
  15. +15 −11 gwt/src/main/java/org/switchyard/console/client/ui/runtime/RuntimeView.java
  16. +157 −0 gwt/src/main/java/org/switchyard/console/client/ui/runtime/ServiceMetricsList.java
  17. +152 −0 gwt/src/main/java/org/switchyard/console/client/ui/runtime/ServiceOperationMetricsList.java
  18. +11 −6 gwt/src/main/java/org/switchyard/console/client/ui/runtime/ServiceReferenceMetricsList.java
View
3  .gitignore
@@ -5,4 +5,5 @@ target/
.gwt/
*.iml
*.ipr
-*.iws
+*.iws
+.checkstyle
View
113 app/pom.xml
@@ -26,118 +26,14 @@
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>org.switchyard.console</groupId>
- <artifactId>switchyard-console-component-core</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.switchyard.console</groupId>
- <artifactId>switchyard-console-component-bean</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.switchyard.console</groupId>
- <artifactId>switchyard-console-component-bpel</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.switchyard.console</groupId>
- <artifactId>switchyard-console-component-bpm</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.switchyard.console</groupId>
- <artifactId>switchyard-console-component-camel</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.switchyard.console</groupId>
- <artifactId>switchyard-console-component-clojure</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.switchyard.console</groupId>
- <artifactId>switchyard-console-component-hornetq</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.switchyard.console</groupId>
- <artifactId>switchyard-console-component-rules</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.switchyard.console</groupId>
- <artifactId>switchyard-console-component-soap</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.ballroom</groupId>
- <artifactId>widgets</artifactId>
- <scope>provided</scope>
- </dependency>
-
<!-- XXX: replace with proper AS dependency once console includes extension support. -->
<dependency>
<groupId>org.switchyard.console</groupId>
<artifactId>switchyard-console-as7-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <!-- Need to include the source files for GWT compilation. -->
- <dependency>
- <groupId>org.switchyard.console</groupId>
- <artifactId>switchyard-console-as7-core</artifactId>
- <classifier>sources</classifier>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-servlet</artifactId>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-user</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>com.google.code</groupId>
- <artifactId>gwt-visualization</artifactId>
+ <classifier>module</classifier>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>com.google.code.gwt-log</groupId>
- <artifactId>gwt-log</artifactId>
- </dependency>
- <dependency>
- <groupId>com.gwtplatform</groupId>
- <artifactId>gwtp-mvp-client</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.google.inject</groupId>
- <artifactId>guice</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-assistedinject</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.gwt.inject</groupId>
- <artifactId>gin</artifactId>
- </dependency>
<dependency>
<groupId>junit</groupId>
@@ -170,10 +66,12 @@
</executions>
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin documentation at codehaus.org -->
<configuration>
+ <compileSourcesArtifacts>
+ <compileSourcesArtifact>javax.validation:validation-api</compileSourcesArtifact>
+ </compileSourcesArtifacts>
<compileReport>false</compileReport>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<htmlunit>FF3,IE7</htmlunit>
- <i18nMessagesBundle>org.switchyard.console.client.Messages</i18nMessagesBundle>
<logLevel>TRACE</logLevel>
<mode>htmlunit</mode>
<runTarget>App.html</runTarget>
@@ -189,7 +87,7 @@
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
- <phase>compile</phase>
+ <phase>generate-sources</phase>
<goals>
<goal>exploded</goal>
</goals>
@@ -203,6 +101,7 @@
<id>core-web-resources</id>
<groupId>org.switchyard.console</groupId>
<artifactId>switchyard-console-as7-core</artifactId>
+ <classifier>module</classifier>
<type>jar</type>
<includes>
<include>images/**</include>
View
30 as7-core/pom.xml
@@ -22,24 +22,21 @@
<dependency>
<groupId>org.jboss.ballroom</groupId>
<artifactId>widgets</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-servlet</artifactId>
- <scope>runtime</scope>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
</dependency>
+
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code</groupId>
<artifactId>gwt-visualization</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
@@ -49,7 +46,8 @@
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-mvp-client</artifactId>
- <scope>provided</scope>
+ <!-- this gets picked up as provided through dependencyManagement -->
+ <scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
@@ -155,6 +153,24 @@
</executions>
</plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>package-gwt-module</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/module.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+
<!-- Most of this code is from jbossas, so don't run checkstyle -->
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
View
32 as7-core/src/main/assembly/module.xml
@@ -0,0 +1,32 @@
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+ <id>module</id>
+ <formats>
+ <format>jar</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>${project.build.sourceDirectory}</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${asConsoleIncludesDirectory}/java</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ <dependencySets>
+ <dependencySet>
+ <unpack>true</unpack>
+ <includes>
+ <include>org.switchyard.console:switchyard-console-as7-core</include>
+ </includes>
+ </dependencySet>
+ </dependencySets>
+</assembly>
View
15 as7-core/src/main/java/org/jboss/dmr/client/DataInput.java
@@ -21,6 +21,8 @@
import java.io.IOException;
+import com.google.gwt.ajaxloader.client.ArrayHelper;
+
/**
* see also http://quake2-gwt-port.googlecode.com/hg/src/com/google/gwt/corp/emul/java/io/DataInputStream.java?r=5c7c4b545ff4a8875b4cab5d77492d37e150d46b
*/
@@ -58,9 +60,10 @@ public char readChar() throws IOException {
}
public double readDouble() throws IOException {
- byte doubleBytes[] = new byte[8];
- readFully(doubleBytes);
- return IEEE754.toDouble(doubleBytes);
+ // byte doubleBytes[] = new byte[8];
+ // readFully(doubleBytes);
+ return IEEE754.toDouble(ArrayHelper.toJsArrayInteger(bytes[pos++], bytes[pos++], bytes[pos++], bytes[pos++],
+ bytes[pos++], bytes[pos++], bytes[pos++], bytes[pos++]));
}
public float readFloat() throws IOException {
@@ -110,16 +113,16 @@ private int readUtfChar(StringBuilder sb) throws IOException {
}
if ((a & 0xe0) == 0xb0) {
int b = readUnsignedByte();
- sb.append((char)(((a& 0x1F) << 6) | (b & 0x3F)));
+ sb.append((char) (((a & 0x1F) << 6) | (b & 0x3F)));
return 2;
}
if ((a & 0xf0) == 0xe0) {
int b = readUnsignedByte();
int c = readUnsignedByte();
- sb.append((char)(((a & 0x0F) << 12) | ((b & 0x3F) << 6) | (c & 0x3F)));
+ sb.append((char) (((a & 0x0F) << 12) | ((b & 0x3F) << 6) | (c & 0x3F)));
return 3;
}
- throw new IllegalArgumentException("Illegal byte "+a);
+ throw new IllegalArgumentException("Illegal byte " + a);
}
public int readUnsignedByte() throws IOException {
View
2  as7-core/src/main/java/org/jboss/dmr/client/IEEE754.java
@@ -155,7 +155,7 @@ else if (v === 0) {
return bytes;
}-*/;
- public static native double toDouble(byte[] bytes) /*-{
+ public static native double toDouble(JsArrayInteger bytes) /*-{
var ebits = 11;
var fbits = 52;
View
3  component/pom.xml
@@ -27,18 +27,15 @@
<dependency>
<groupId>org.jboss.ballroom</groupId>
<artifactId>widgets</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-mvp-client</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
View
68 gwt/pom.xml
@@ -15,110 +15,56 @@
<description>AS7 management console extension supporting the SwitchYard runtime.</description>
<dependencies>
+ <!-- XXX: replace with proper AS dependency once console includes extension support. -->
+ <dependency>
+ <groupId>org.switchyard.console</groupId>
+ <artifactId>switchyard-console-as7-core</artifactId>
+ <classifier>module</classifier>
+ </dependency>
+
<dependency>
<groupId>org.switchyard.console</groupId>
<artifactId>switchyard-console-component-core</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.switchyard.console</groupId>
<artifactId>switchyard-console-component-bean</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.switchyard.console</groupId>
<artifactId>switchyard-console-component-bpel</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.switchyard.console</groupId>
<artifactId>switchyard-console-component-bpm</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.switchyard.console</groupId>
<artifactId>switchyard-console-component-camel</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.switchyard.console</groupId>
<artifactId>switchyard-console-component-clojure</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.switchyard.console</groupId>
<artifactId>switchyard-console-component-hornetq</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.switchyard.console</groupId>
<artifactId>switchyard-console-component-rules</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.switchyard.console</groupId>
<artifactId>switchyard-console-component-soap</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.ballroom</groupId>
- <artifactId>widgets</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <!-- XXX: replace with proper AS dependency once console includes extension support. -->
- <dependency>
- <groupId>org.switchyard.console</groupId>
- <artifactId>switchyard-console-as7-core</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-servlet</artifactId>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-user</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>com.google.code</groupId>
- <artifactId>gwt-visualization</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>com.google.code.gwt-log</groupId>
- <artifactId>gwt-log</artifactId>
- </dependency>
- <dependency>
- <groupId>com.gwtplatform</groupId>
- <artifactId>gwtp-mvp-client</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.google.inject</groupId>
- <artifactId>guice</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-assistedinject</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.gwt.inject</groupId>
- <artifactId>gin</artifactId>
</dependency>
<dependency>
View
39 gwt/src/main/java/org/switchyard/console/client/model/OperationMetrics.java
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @author tags. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.switchyard.console.client.model;
+
+/**
+ * OperationMetrics
+ *
+ * <p/>
+ * Message metrics specific to an operation.
+ */
+public interface OperationMetrics extends MessageMetrics {
+
+ /**
+ * @return operation name
+ */
+ String getName();
+
+ /**
+ * @param value operation name
+ */
+ void setName(String value);
+
+}
View
10 gwt/src/main/java/org/switchyard/console/client/model/ServiceMetrics.java
@@ -31,6 +31,16 @@
public interface ServiceMetrics extends MessageMetrics, HasQName {
/**
+ * @return metrics for operations
+ */
+ List<OperationMetrics> getOperations();
+
+ /**
+ * @param value metrics for operations
+ */
+ void setOperations(List<OperationMetrics> value);
+
+ /**
* @return metrics for referenced services
*/
List<ServiceMetrics> getReferences();
View
7 gwt/src/main/java/org/switchyard/console/client/model/SwitchYardStore.java
@@ -103,6 +103,13 @@
void loadServiceMetrics(String serviceName, AsyncCallback<ServiceMetrics> asyncCallback);
/**
+ * Loads message metrics for the specified service.
+ *
+ * @param asyncCallback the callback
+ */
+ void loadAllServiceMetrics(AsyncCallback<List<ServiceMetrics>> asyncCallback);
+
+ /**
* Loads message metrics for the entire system.
*
* @param asyncCallback the callback
View
58 gwt/src/main/java/org/switchyard/console/client/model/SwitchYardStoreImpl.java
@@ -93,7 +93,6 @@ public BeanFactory getBeanFactory() {
return _factory;
}
- @SuppressWarnings("rawtypes")
@Override
public void loadSystemDetails(final AsyncCallback<SystemDetails> callback) {
// /subsystem=switchyard:get-version()
@@ -121,7 +120,6 @@ public void onSuccess(DMRResponse result) {
});
}
- @SuppressWarnings("rawtypes")
@Override
public void loadApplications(final AsyncCallback<List<Application>> callback) {
// /subsystem=switchyard:list-applications()
@@ -159,7 +157,6 @@ public void onSuccess(DMRResponse result) {
});
}
- @SuppressWarnings("rawtypes")
@Override
public void loadApplication(final String applicationName, final AsyncCallback<Application> callback) {
// /subsystem=switchyard:read-application(name=applicationName)
@@ -191,7 +188,6 @@ public void onSuccess(DMRResponse result) {
});
}
- @SuppressWarnings("rawtypes")
@Override
public void loadComponents(final AsyncCallback<List<Component>> callback) {
// /subsystem=switchyard:list-components
@@ -229,7 +225,6 @@ public void onSuccess(DMRResponse result) {
});
}
- @SuppressWarnings("rawtypes")
@Override
public void loadComponent(final String componentName, final AsyncCallback<Component> callback) {
// /subsystem=switchyard:read-component(name=componentName)
@@ -261,7 +256,6 @@ public void onSuccess(DMRResponse result) {
});
}
- @SuppressWarnings("rawtypes")
@Override
public void loadServices(final AsyncCallback<List<Service>> callback) {
// /subsystem=switchyard:list-services()
@@ -296,7 +290,6 @@ public void onSuccess(DMRResponse result) {
});
}
- @SuppressWarnings("rawtypes")
@Override
public void loadService(final String serviceName, final String applicationName,
final AsyncCallback<Service> callback) {
@@ -352,13 +345,44 @@ public void onFailure(Throwable caught) {
public void onSuccess(DMRResponse result) {
final ModelNode response = result.get();
if (response.hasDefined(RESULT)) {
- final ServiceMetrics metrics = createServiceMetrics(response.get(RESULT).asList().get(0));
+ final List<ServiceMetrics> metrics = createServiceMetrics(response.get(RESULT));
+ if (metrics != null && metrics.size() > 0) {
+ callback.onSuccess(metrics.get(0));
+ return;
+ }
+ }
+ callback.onFailure(new Exception("Could not load metrics for service: " + serviceName));
+ }
+ });
+ }
+
+ @Override
+ public void loadAllServiceMetrics(final AsyncCallback<List<ServiceMetrics>> callback) {
+ // /subsystem=switchyard:show-metrics(service-name=*)
+
+ final ModelNode operation = new ModelNode();
+ operation.get(OP).set(SHOW_METRICS);
+ operation.get(OP_ADDR, SUBSYSTEM).set(SWITCHYARD);
+ operation.get(SERVICE_NAME).set("*");
+
+ _dispatcher.execute(new DMRAction(operation), new AsyncCallback<DMRResponse>() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ callback.onFailure(caught);
+ }
+
+ @Override
+ public void onSuccess(DMRResponse result) {
+ final ModelNode response = result.get();
+ if (response.hasDefined(RESULT)) {
+ final List<ServiceMetrics> metrics = createServiceMetrics(response.get(RESULT));
if (metrics != null) {
callback.onSuccess(metrics);
return;
}
}
- callback.onFailure(new Exception("Could not load metrics for service: " + serviceName));
+ callback.onFailure(new Exception("Could not load all service metrics."));
}
});
}
@@ -489,13 +513,17 @@ private Service createService(final ModelNode serviceNode) {
}
}
- private ServiceMetrics createServiceMetrics(final ModelNode metricsNode) {
- try {
- return AutoBeanCodex.decode(_factory, ServiceMetrics.class, metricsNode.toJSONString(true)).as();
- } catch (Exception e) {
- Log.error("Failed to parse data source representation", e);
- return null;
+ private List<ServiceMetrics> createServiceMetrics(final ModelNode metricsNode) {
+ final List<ModelNode> items = metricsNode.asList();
+ final List<ServiceMetrics> metrics = new ArrayList<ServiceMetrics>(items.size());
+ for (ModelNode item : items) {
+ try {
+ metrics.add(AutoBeanCodex.decode(_factory, ServiceMetrics.class, item.toJSONString(true)).as());
+ } catch (Exception e) {
+ Log.error("Failed to parse data source representation", e);
+ }
}
+ return metrics;
}
private MessageMetrics createMessageMetrics(final ModelNode metricsNode) {
View
10 gwt/src/main/java/org/switchyard/console/client/ui/common/AbstractDataTable.java
@@ -145,6 +145,16 @@ public int compare(T o1, T o2) {
};
}
+ protected Comparator<T> createNumberColumnCommparator(final Column<T, ? extends Number> column) {
+ return new Comparator<T>() {
+ @SuppressWarnings({"rawtypes", "unchecked" })
+ @Override
+ public int compare(T o1, T o2) {
+ return ((Comparable) column.getValue(o1)).compareTo((Comparable) column.getValue(o2));
+ }
+ };
+ }
+
/**
* Add column definitions to the table.
*
View
26 gwt/src/main/java/org/switchyard/console/client/ui/runtime/RuntimePresenter.java
@@ -29,7 +29,6 @@
import org.jboss.ballroom.client.layout.LHSHighlightEvent;
import org.switchyard.console.client.NameTokens;
import org.switchyard.console.client.model.MessageMetrics;
-import org.switchyard.console.client.model.Service;
import org.switchyard.console.client.model.ServiceMetrics;
import org.switchyard.console.client.model.SwitchYardStore;
@@ -79,14 +78,14 @@
void setPresenter(RuntimePresenter presenter);
/**
- * @param services the services deployed on the server.
+ * @param serviceMetrics metrics for all services deployed on the server.
*/
- void setServices(List<Service> services);
+ void setServices(List<ServiceMetrics> serviceMetrics);
/**
* @param service set the selected service
*/
- void setService(Service service);
+ void setService(ServiceMetrics service);
/**
* @param serviceMetrics the metrics for the selected service.
@@ -137,12 +136,12 @@ public RuntimePresenter(EventBus eventBus, MyView view, MyProxy proxy, PlaceMana
* presenter will load the service details and pass them back to the view to
* be displayed.
*
- * @param service the selected service.
+ * @param serviceMetrics the selected service.
*/
- public void onServiceSelected(Service service) {
+ public void onServiceSelected(ServiceMetrics serviceMetrics) {
PlaceRequest request = new PlaceRequest(NameTokens.RUNTIME_PRESENTER);
- if (service != null) {
- request = request.with(NameTokens.SERVICE_NAME_PARAM, URL.encode(service.getName()));
+ if (serviceMetrics != null) {
+ request = request.with(NameTokens.SERVICE_NAME_PARAM, URL.encode(serviceMetrics.getName()));
}
_placeManager.revealRelativePlace(request, -1);
}
@@ -215,10 +214,10 @@ private void loadMetrics() {
}
private void loadServicesList() {
- _switchYardStore.loadServices(new AsyncCallback<List<Service>>() {
+ _switchYardStore.loadAllServiceMetrics(new AsyncCallback<List<ServiceMetrics>>() {
@Override
- public void onSuccess(List<Service> services) {
- getView().setServices(services);
+ public void onSuccess(List<ServiceMetrics> serviceMetrics) {
+ getView().setServices(serviceMetrics);
}
@Override
@@ -237,10 +236,7 @@ private void loadServiceMetrics() {
@Override
public void onSuccess(ServiceMetrics result) {
- Service service = _switchYardStore.getBeanFactory().service().as();
- service.setName(result.getName());
-
- getView().setService(service);
+ getView().setService(result);
getView().setServiceMetrics(result);
}
View
26 gwt/src/main/java/org/switchyard/console/client/ui/runtime/RuntimeView.java
@@ -24,10 +24,8 @@
import org.jboss.as.console.client.shared.viewframework.builder.OneToOneLayout;
import org.jboss.as.console.client.shared.viewframework.builder.SimpleLayout;
import org.switchyard.console.client.model.MessageMetrics;
-import org.switchyard.console.client.model.Service;
import org.switchyard.console.client.model.ServiceMetrics;
import org.switchyard.console.client.ui.runtime.RuntimePresenter.MyView;
-import org.switchyard.console.client.ui.service.ServicesList;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
@@ -46,18 +44,20 @@
private RuntimePresenter _presenter;
private MessageMetricsViewer _systemMetricsViewer;
- private ServicesList _servicesList;
+ private ServiceMetricsList _servicesList;
private MessageMetricsViewer _serviceMetricsViewer;
private ServiceReferenceMetricsList _serviceReferenceMetricsList;
+ private ServiceOperationMetricsList _serviceOperationMetricsList;
private MessageMetrics _systemMetrics;
- private Service _selectedService;
+ private ServiceMetrics _selectedService;
@Override
public Widget createWidget() {
_systemMetricsViewer = new MessageMetricsViewer(false);
- _servicesList = new ServicesList();
+ _servicesList = new ServiceMetricsList();
_serviceMetricsViewer = new MessageMetricsViewer(true);
_serviceReferenceMetricsList = new ServiceReferenceMetricsList();
+ _serviceOperationMetricsList = new ServiceOperationMetricsList();
_servicesList.addSelectionChangeHandler(new Handler() {
@Override
@@ -76,6 +76,7 @@ public void onSelectionChange(SelectionChangeEvent event) {
.setDescription(
"Displays message metrics for individual services. Select a service to see message metrics for a specific service.")
.setMaster(null, servicesWidget).addDetail("Service Metrics", _serviceMetricsViewer.asWidget())
+ .addDetail("Operation Metrics", _serviceOperationMetricsList.asWidget())
.addDetail("Reference Metrics", _serviceReferenceMetricsList.asWidget());
serviceMetricsLayout.build();
servicesWidget = servicesWidget.getParent();
@@ -84,8 +85,7 @@ public void onSelectionChange(SelectionChangeEvent event) {
SimpleLayout layout = new SimpleLayout().setTitle("SwitchYard Message Metrics").setHeadline("System")
.setDescription("Displays message metrics for the SwitchYard subsystem.")
.addContent("System Message Metrics", _systemMetricsViewer.asWidget())
- .addContent("spacer", new HTMLPanel("&nbsp;"))
- .addContent("Service Message Metrics", servicesWidget);
+ .addContent("spacer", new HTMLPanel("&nbsp;")).addContent("Service Message Metrics", servicesWidget);
return layout.build();
}
@@ -96,8 +96,8 @@ public void setPresenter(RuntimePresenter presenter) {
}
@Override
- public void setServices(List<Service> services) {
- _servicesList.setData(services);
+ public void setServices(List<ServiceMetrics> serviceMetrics) {
+ _servicesList.setData(serviceMetrics);
}
@Override
@@ -105,14 +105,17 @@ public void setServiceMetrics(ServiceMetrics serviceMetrics) {
if (serviceMetrics == null) {
_serviceMetricsViewer.clear();
_serviceReferenceMetricsList.setServiceMetrics(null);
+ _serviceOperationMetricsList.setServiceMetrics(null);
return;
}
if (_systemMetrics == null) {
_serviceMetricsViewer.setMessageMetrics(serviceMetrics);
} else {
- _serviceMetricsViewer.setMessageMetrics(serviceMetrics, _systemMetrics.getTotalCount(), _systemMetrics.getTotalProcessingTime());
+ _serviceMetricsViewer.setMessageMetrics(serviceMetrics, _systemMetrics.getTotalCount(),
+ _systemMetrics.getTotalProcessingTime());
}
_serviceReferenceMetricsList.setServiceMetrics(serviceMetrics);
+ _serviceOperationMetricsList.setServiceMetrics(serviceMetrics);
}
@Override
@@ -123,10 +126,11 @@ public void setSystemMetrics(MessageMetrics systemMetrics) {
return;
}
_systemMetricsViewer.setMessageMetrics(systemMetrics);
+ _servicesList.setSystemMetrics(systemMetrics);
}
@Override
- public void setService(Service service) {
+ public void setService(ServiceMetrics service) {
_selectedService = service;
_servicesList.setSelection(service);
}
View
157 gwt/src/main/java/org/switchyard/console/client/ui/runtime/ServiceMetricsList.java
@@ -0,0 +1,157 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @author tags. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.switchyard.console.client.ui.runtime;
+
+import org.jboss.ballroom.client.widgets.tables.DefaultCellTable;
+import org.switchyard.console.client.model.MessageMetrics;
+import org.switchyard.console.client.model.ServiceMetrics;
+import org.switchyard.console.client.ui.common.AbstractDataTable;
+import org.switchyard.console.client.ui.common.PercentageBarCell;
+
+import com.google.gwt.cell.client.NumberCell;
+import com.google.gwt.user.cellview.client.Column;
+import com.google.gwt.user.cellview.client.ColumnSortEvent;
+import com.google.gwt.user.cellview.client.TextColumn;
+import com.google.gwt.view.client.ListDataProvider;
+import com.google.gwt.view.client.ProvidesKey;
+
+/**
+ * ServiceReferenceMetricsList
+ *
+ * Wraps a table control for displaying metrics for services referenced by a
+ * service.
+ *
+ * @author Rob Cernich
+ */
+public class ServiceMetricsList extends AbstractDataTable<ServiceMetrics> {
+
+ private static final ProvidesKey<ServiceMetrics> KEY_PROVIDER = new ProvidesKey<ServiceMetrics>() {
+ @Override
+ public Object getKey(ServiceMetrics item) {
+ return item.getName();
+ }
+ };
+
+ private MessageMetrics _systemMetrics;
+
+ /**
+ * Create a new ServiceReferenceMetricsList.
+ */
+ public ServiceMetricsList() {
+ super("Service Metrics");
+ }
+
+ @Override
+ protected void createColumns(DefaultCellTable<ServiceMetrics> table, ListDataProvider<ServiceMetrics> dataProvider) {
+ final TextColumn<ServiceMetrics> nameColumn = new TextColumn<ServiceMetrics>() {
+ @Override
+ public String getValue(ServiceMetrics metrics) {
+ return metrics.localName();
+ }
+ };
+ nameColumn.setSortable(true);
+
+ final TextColumn<ServiceMetrics> namespaceColumn = new TextColumn<ServiceMetrics>() {
+ @Override
+ public String getValue(ServiceMetrics service) {
+ return service.namespace();
+ }
+ };
+ namespaceColumn.setSortable(true);
+
+ final Column<ServiceMetrics, Number> countColumn = new Column<ServiceMetrics, Number>(new NumberCell()) {
+ @Override
+ public Number getValue(ServiceMetrics metrics) {
+ return metrics.getTotalCount();
+ }
+ };
+ countColumn.setSortable(true);
+
+ final Column<ServiceMetrics, Number> averageTimeColumn = new Column<ServiceMetrics, Number>(new NumberCell()) {
+ @Override
+ public Number getValue(ServiceMetrics metrics) {
+ return metrics.getAverageProcessingTime();
+ }
+ };
+ averageTimeColumn.setSortable(true);
+
+ final Column<ServiceMetrics, Double> totalTimePercentageColumn = new Column<ServiceMetrics, Double>(
+ new PercentageBarCell()) {
+ @Override
+ public Double getValue(ServiceMetrics metrics) {
+ if (_systemMetrics == null || _systemMetrics.getTotalProcessingTime() == 0) {
+ return 0.0;
+ }
+ return metrics.getTotalProcessingTime() / (double) _systemMetrics.getTotalProcessingTime();
+ }
+ };
+ totalTimePercentageColumn.setSortable(true);
+
+ final Column<ServiceMetrics, Double> faultPercentageColumn = new Column<ServiceMetrics, Double>(
+ new PercentageBarCell()) {
+ @Override
+ public Double getValue(ServiceMetrics metrics) {
+ if (_systemMetrics == null || _systemMetrics.getFaultCount() == 0) {
+ return 0.0;
+ }
+ return metrics.getFaultCount() / (double) _systemMetrics.getFaultCount();
+ }
+ };
+ faultPercentageColumn.setSortable(true);
+
+ ColumnSortEvent.ListHandler<ServiceMetrics> sortHandler = new ColumnSortEvent.ListHandler<ServiceMetrics>(
+ dataProvider.getList());
+ sortHandler.setComparator(nameColumn, createColumnCommparator(nameColumn));
+ sortHandler.setComparator(namespaceColumn, createColumnCommparator(namespaceColumn));
+ sortHandler.setComparator(countColumn, createNumberColumnCommparator(countColumn));
+ sortHandler.setComparator(averageTimeColumn, createNumberColumnCommparator(averageTimeColumn));
+ sortHandler.setComparator(totalTimePercentageColumn, createNumberColumnCommparator(totalTimePercentageColumn));
+ sortHandler.setComparator(faultPercentageColumn, createNumberColumnCommparator(faultPercentageColumn));
+
+ table.addColumn(nameColumn, "Name");
+ table.addColumn(namespaceColumn, "Target Namespace");
+ table.addColumn(countColumn, "Message Count");
+ table.addColumn(averageTimeColumn, "Average Time");
+ table.addColumn(totalTimePercentageColumn, "Time %");
+ table.addColumn(faultPercentageColumn, "Fault %");
+
+ table.addColumnSortHandler(sortHandler);
+ table.getColumnSortList().push(averageTimeColumn);
+ table.getColumnSortList().push(countColumn);
+ table.getColumnSortList().push(faultPercentageColumn);
+ table.getColumnSortList().push(namespaceColumn);
+ table.getColumnSortList().push(nameColumn);
+ // insert twice for descending
+ table.getColumnSortList().push(totalTimePercentageColumn);
+ table.getColumnSortList().push(totalTimePercentageColumn);
+ }
+
+ /**
+ * @param systemMetrics the system metrics.
+ */
+ public void setSystemMetrics(MessageMetrics systemMetrics) {
+ _systemMetrics = systemMetrics;
+ }
+
+ @Override
+ protected ProvidesKey<ServiceMetrics> createKeyProvider() {
+ return KEY_PROVIDER;
+ }
+
+}
View
152 gwt/src/main/java/org/switchyard/console/client/ui/runtime/ServiceOperationMetricsList.java
@@ -0,0 +1,152 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @author tags. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.switchyard.console.client.ui.runtime;
+
+import org.jboss.ballroom.client.widgets.tables.DefaultCellTable;
+import org.switchyard.console.client.model.OperationMetrics;
+import org.switchyard.console.client.model.ServiceMetrics;
+import org.switchyard.console.client.ui.common.AbstractDataTable;
+import org.switchyard.console.client.ui.common.PercentageBarCell;
+
+import com.google.gwt.cell.client.NumberCell;
+import com.google.gwt.user.cellview.client.Column;
+import com.google.gwt.user.cellview.client.ColumnSortEvent;
+import com.google.gwt.user.cellview.client.TextColumn;
+import com.google.gwt.view.client.ListDataProvider;
+import com.google.gwt.view.client.ProvidesKey;
+
+/**
+ * ServiceOperationMetricsList
+ *
+ * Wraps a table control for displaying metrics for services referenced by a
+ * service.
+ *
+ * @author Rob Cernich
+ */
+public class ServiceOperationMetricsList extends AbstractDataTable<OperationMetrics> {
+
+ private static final ProvidesKey<OperationMetrics> KEY_PROVIDER = new ProvidesKey<OperationMetrics>() {
+ @Override
+ public Object getKey(OperationMetrics item) {
+ return item.getName();
+ }
+ };
+
+ private ServiceMetrics _serviceMetrics;
+
+ /**
+ * Create a new ServiceReferenceMetricsList.
+ */
+ public ServiceOperationMetricsList() {
+ super("Service Operation Metrics");
+ }
+
+ @Override
+ protected void createColumns(DefaultCellTable<OperationMetrics> table,
+ ListDataProvider<OperationMetrics> dataProvider) {
+ final TextColumn<OperationMetrics> nameColumn = new TextColumn<OperationMetrics>() {
+ @Override
+ public String getValue(OperationMetrics metrics) {
+ return metrics.getName();
+ }
+ };
+ nameColumn.setSortable(true);
+
+ final Column<OperationMetrics, Number> countColumn = new Column<OperationMetrics, Number>(new NumberCell()) {
+ @Override
+ public Number getValue(OperationMetrics metrics) {
+ return metrics.getTotalCount();
+ }
+ };
+ countColumn.setSortable(true);
+
+ final Column<OperationMetrics, Number> averageTimeColumn = new Column<OperationMetrics, Number>(
+ new NumberCell()) {
+ @Override
+ public Number getValue(OperationMetrics metrics) {
+ return metrics.getAverageProcessingTime();
+ }
+ };
+ averageTimeColumn.setSortable(true);
+
+ final Column<OperationMetrics, Double> totalTimePercentageColumn = new Column<OperationMetrics, Double>(
+ new PercentageBarCell()) {
+ @Override
+ public Double getValue(OperationMetrics metrics) {
+ if (_serviceMetrics == null || _serviceMetrics.getTotalProcessingTime() == 0) {
+ return 0.0;
+ }
+ return metrics.getTotalProcessingTime() / (double) _serviceMetrics.getTotalProcessingTime();
+ }
+ };
+ totalTimePercentageColumn.setSortable(true);
+
+ final Column<OperationMetrics, Double> faultPercentageColumn = new Column<OperationMetrics, Double>(
+ new PercentageBarCell()) {
+ @Override
+ public Double getValue(OperationMetrics metrics) {
+ if (metrics.getTotalCount() == 0) {
+ return 0.0;
+ }
+ return metrics.getFaultCount() / (double) metrics.getTotalCount();
+ }
+ };
+ faultPercentageColumn.setSortable(true);
+
+ ColumnSortEvent.ListHandler<OperationMetrics> sortHandler = new ColumnSortEvent.ListHandler<OperationMetrics>(
+ dataProvider.getList());
+ sortHandler.setComparator(nameColumn, createColumnCommparator(nameColumn));
+ sortHandler.setComparator(countColumn, createNumberColumnCommparator(countColumn));
+ sortHandler.setComparator(averageTimeColumn, createNumberColumnCommparator(averageTimeColumn));
+ sortHandler.setComparator(totalTimePercentageColumn, createNumberColumnCommparator(totalTimePercentageColumn));
+ sortHandler.setComparator(faultPercentageColumn, createNumberColumnCommparator(faultPercentageColumn));
+
+ table.addColumn(nameColumn, "Name");
+ table.addColumn(countColumn, "Message Count");
+ table.addColumn(averageTimeColumn, "Average Time");
+ table.addColumn(totalTimePercentageColumn, "Time %");
+ table.addColumn(faultPercentageColumn, "Fault %");
+
+ table.addColumnSortHandler(sortHandler);
+ table.getColumnSortList().push(averageTimeColumn);
+ table.getColumnSortList().push(countColumn);
+ table.getColumnSortList().push(totalTimePercentageColumn);
+ table.getColumnSortList().push(faultPercentageColumn);
+ table.getColumnSortList().push(nameColumn);
+ }
+
+ /**
+ * @param serviceMetrics the parent service's metrics, containing a list of
+ * reference metrics.
+ */
+ public void setServiceMetrics(ServiceMetrics serviceMetrics) {
+ _serviceMetrics = serviceMetrics;
+ if (serviceMetrics == null) {
+ setData(null);
+ } else {
+ setData(serviceMetrics.getOperations());
+ }
+ }
+
+ @Override
+ protected ProvidesKey<OperationMetrics> createKeyProvider() {
+ return KEY_PROVIDER;
+ }
+
+}
View
17 gwt/src/main/java/org/switchyard/console/client/ui/runtime/ServiceReferenceMetricsList.java
@@ -23,6 +23,7 @@
import org.switchyard.console.client.ui.common.AbstractDataTable;
import org.switchyard.console.client.ui.common.PercentageBarCell;
+import com.google.gwt.cell.client.NumberCell;
import com.google.gwt.user.cellview.client.Column;
import com.google.gwt.user.cellview.client.ColumnSortEvent;
import com.google.gwt.user.cellview.client.TextColumn;
@@ -65,18 +66,18 @@ public String getValue(ServiceMetrics metrics) {
};
nameColumn.setSortable(true);
- final TextColumn<ServiceMetrics> countColumn = new TextColumn<ServiceMetrics>() {
+ final Column<ServiceMetrics, Number> countColumn = new Column<ServiceMetrics, Number>(new NumberCell()) {
@Override
- public String getValue(ServiceMetrics metrics) {
- return "" + metrics.getTotalCount();
+ public Number getValue(ServiceMetrics metrics) {
+ return metrics.getTotalCount();
}
};
countColumn.setSortable(true);
- final TextColumn<ServiceMetrics> averageTimeColumn = new TextColumn<ServiceMetrics>() {
+ final Column<ServiceMetrics, Number> averageTimeColumn = new Column<ServiceMetrics, Number>(new NumberCell()) {
@Override
- public String getValue(ServiceMetrics metrics) {
- return "" + metrics.getAverageProcessingTime();
+ public Number getValue(ServiceMetrics metrics) {
+ return metrics.getAverageProcessingTime();
}
};
averageTimeColumn.setSortable(true);
@@ -108,6 +109,10 @@ public Double getValue(ServiceMetrics metrics) {
ColumnSortEvent.ListHandler<ServiceMetrics> sortHandler = new ColumnSortEvent.ListHandler<ServiceMetrics>(
dataProvider.getList());
sortHandler.setComparator(nameColumn, createColumnCommparator(nameColumn));
+ sortHandler.setComparator(countColumn, createNumberColumnCommparator(countColumn));
+ sortHandler.setComparator(averageTimeColumn, createNumberColumnCommparator(averageTimeColumn));
+ sortHandler.setComparator(totalTimePercentageColumn, createNumberColumnCommparator(totalTimePercentageColumn));
+ sortHandler.setComparator(faultPercentageColumn, createNumberColumnCommparator(faultPercentageColumn));
table.addColumn(nameColumn, "Name");
table.addColumn(countColumn, "Message Count");
Please sign in to comment.
Something went wrong with that request. Please try again.