Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

SWITCHYARD-1500 update console to support new admin features

  • Loading branch information...
commit 8ee50ab1dd7a2193c691cefc6da500b93897899c 1 parent b45f8ca
@rcernich rcernich authored
Showing with 2,272 additions and 141 deletions.
  1. +6 −0 gwt/src/main/java/org/switchyard/console/client/BeanFactory.java
  2. +7 −1 gwt/src/main/java/org/switchyard/console/client/NameTokens.java
  3. +4 −0 gwt/src/main/java/org/switchyard/console/client/gin/SwitchYardClientModule.java
  4. +6 −0 gwt/src/main/java/org/switchyard/console/client/gin/SwitchYardGinjector.java
  5. +21 −0 gwt/src/main/java/org/switchyard/console/client/model/Application.java
  6. +23 −4 gwt/src/main/java/org/switchyard/console/client/model/Binding.java
  7. +49 −0 gwt/src/main/java/org/switchyard/console/client/model/GatewayMetrics.java
  8. +60 −0 gwt/src/main/java/org/switchyard/console/client/model/Reference.java
  9. +21 −1 gwt/src/main/java/org/switchyard/console/client/model/ServiceMetrics.java
  10. +33 −0 gwt/src/main/java/org/switchyard/console/client/model/State.java
  11. +70 −0 gwt/src/main/java/org/switchyard/console/client/model/SwitchYardStore.java
  12. +302 −6 gwt/src/main/java/org/switchyard/console/client/model/SwitchYardStoreImpl.java
  13. +58 −7 gwt/src/main/java/org/switchyard/console/client/ui/application/ApplicationPresenter.java
  14. +96 −0 gwt/src/main/java/org/switchyard/console/client/ui/application/ApplicationReferencesList.java
  15. +18 −2 gwt/src/main/java/org/switchyard/console/client/ui/application/ApplicationView.java
  16. +2 −2 gwt/src/main/java/org/switchyard/console/client/ui/application/ComponentServicesList.java
  17. +1 −1  gwt/src/main/java/org/switchyard/console/client/ui/artifacts/ArtifactPresenter.java
  18. +231 −0 gwt/src/main/java/org/switchyard/console/client/ui/common/PlainColumnView.java
  19. +160 −0 gwt/src/main/java/org/switchyard/console/client/ui/metrics/GatewayMetricsList.java
  20. +1 −1  gwt/src/main/java/org/switchyard/console/client/ui/metrics/MessageMetricsViewer.java
  21. +44 −0 gwt/src/main/java/org/switchyard/console/client/ui/metrics/MetricsDetailsWidget.java
  22. +41 −40 gwt/src/main/java/org/switchyard/console/client/ui/metrics/MetricsPresenter.java
  23. +35 −58 gwt/src/main/java/org/switchyard/console/client/ui/metrics/MetricsView.java
  24. +85 −0 gwt/src/main/java/org/switchyard/console/client/ui/metrics/ReferenceDetailsWidget.java
  25. +90 −0 gwt/src/main/java/org/switchyard/console/client/ui/metrics/ServiceDetailsWidget.java
  26. +79 −2 gwt/src/main/java/org/switchyard/console/client/ui/metrics/ServiceMetricsList.java
  27. +145 −0 gwt/src/main/java/org/switchyard/console/client/ui/reference/ReferenceEditor.java
  28. +242 −0 gwt/src/main/java/org/switchyard/console/client/ui/reference/ReferencePresenter.java
  29. +94 −0 gwt/src/main/java/org/switchyard/console/client/ui/reference/ReferenceView.java
  30. +89 −0 gwt/src/main/java/org/switchyard/console/client/ui/reference/ReferencesList.java
  31. +44 −0 gwt/src/main/java/org/switchyard/console/client/ui/service/GatewayPresenter.java
  32. +56 −3 gwt/src/main/java/org/switchyard/console/client/ui/service/GatewaysList.java
  33. +13 −7 gwt/src/main/java/org/switchyard/console/client/ui/service/ServiceEditor.java
  34. +35 −3 gwt/src/main/java/org/switchyard/console/client/ui/service/ServicePresenter.java
  35. +11 −3 gwt/src/main/java/org/switchyard/console/client/ui/service/ServiceView.java
View
6 gwt/src/main/java/org/switchyard/console/client/BeanFactory.java
@@ -27,6 +27,7 @@
import org.switchyard.console.client.model.ComponentService;
import org.switchyard.console.client.model.MessageMetrics;
import org.switchyard.console.client.model.QNameCategory;
+import org.switchyard.console.client.model.Reference;
import org.switchyard.console.client.model.Service;
import org.switchyard.console.client.model.ServiceMetrics;
import org.switchyard.console.client.model.SystemDetails;
@@ -68,6 +69,11 @@
AutoBean<Service> service();
/**
+ * @return a new AutoBean<Reference>
+ */
+ AutoBean<Reference> reference();
+
+ /**
* @return a new AutoBean<ComponentService>
*/
AutoBean<ComponentService> componentService();
View
8 gwt/src/main/java/org/switchyard/console/client/NameTokens.java
@@ -42,6 +42,8 @@ private NameTokens() {
public static final String ARTIFACTS_PRESENTER = "sy-artifacts";
/** The subpath for the SwitchYard services view. */
public static final String SERVICES_PRESENTER = "sy-services";
+ /** The subpath for the SwitchYard references view. */
+ public static final String REFERENCES_PRESENTER = "sy-references";
/** The subpath for the SwitchYard message metrics view. */
public static final String METRICS_PRESENTER = "sy-metrics";
/** The subpath for the SwitchYard runtime view. */
@@ -57,15 +59,19 @@ private NameTokens() {
public static final String ARTIFACT_REFERENCE_KEY_PARAM = "artifactKey";
/** The parameter name used for service name. */
public static final String SERVICE_NAME_PARAM = "service";
+ /** The parameter name used for reference name. */
+ public static final String REFERENCE_NAME_PARAM = "reference";
/** The display text for the SwitchYard system configuration navigator item. */
public static final String SYSTEM_CONFIG_TEXT = "Runtime Details";
/** The display text for the SwitchYard applications navigator item. */
public static final String APPLICATIONS_TEXT = "Applications";
/** The display text for the SwitchYard artifact references navigator item. */
- public static final String ARTIFACT_REFERENCES_TEXT = "Artifact References";
+ public static final String ARTIFACT_REFERENCES_TEXT = "Artifacts";
/** The display text for the SwitchYard services navigator item. */
public static final String SERVICES_TEXT = "Services";
+ /** The display text for the SwitchYard services navigator item. */
+ public static final String REFERENCES_TEXT = "References";
/** The display text for the SwitchYard runtime navigator item. */
public static final String RUNTIME_TEXT = "SwitchYard";
View
4 gwt/src/main/java/org/switchyard/console/client/gin/SwitchYardClientModule.java
@@ -32,6 +32,8 @@
import org.switchyard.console.client.ui.config.ConfigView;
import org.switchyard.console.client.ui.metrics.MetricsPresenter;
import org.switchyard.console.client.ui.metrics.MetricsView;
+import org.switchyard.console.client.ui.reference.ReferencePresenter;
+import org.switchyard.console.client.ui.reference.ReferenceView;
import org.switchyard.console.client.ui.runtime.RuntimePresenter;
import org.switchyard.console.client.ui.runtime.RuntimeView;
import org.switchyard.console.client.ui.service.ServicePresenter;
@@ -63,6 +65,8 @@ protected void configure() {
ArtifactPresenter.MyProxy.class);
bindPresenter(ServicePresenter.class, ServicePresenter.MyView.class, ServiceView.class,
ServicePresenter.MyProxy.class);
+ bindPresenter(ReferencePresenter.class, ReferencePresenter.MyView.class, ReferenceView.class,
+ ReferencePresenter.MyProxy.class);
bindPresenter(MetricsPresenter.class, MetricsPresenter.MyView.class, MetricsView.class,
MetricsPresenter.MyProxy.class);
bindPresenter(RuntimePresenter.class, RuntimePresenter.MyView.class, RuntimeView.class,
View
6 gwt/src/main/java/org/switchyard/console/client/gin/SwitchYardGinjector.java
@@ -24,6 +24,7 @@
import org.switchyard.console.client.ui.artifacts.ArtifactPresenter;
import org.switchyard.console.client.ui.config.ConfigPresenter;
import org.switchyard.console.client.ui.metrics.MetricsPresenter;
+import org.switchyard.console.client.ui.reference.ReferencePresenter;
import org.switchyard.console.client.ui.runtime.RuntimePresenter;
import org.switchyard.console.client.ui.service.ServicePresenter;
@@ -63,6 +64,11 @@
AsyncProvider<ServicePresenter> getServicePresenter();
/**
+ * @return the ReferencePresenter configured for the module.
+ */
+ AsyncProvider<ReferencePresenter> getReferencePresenter();
+
+ /**
* @return the MetricsPresenter configured for the module.
*/
AsyncProvider<MetricsPresenter> getSwitchYardMetricsPresenter();
View
21 gwt/src/main/java/org/switchyard/console/client/model/Application.java
@@ -20,6 +20,8 @@
import java.util.List;
+import org.jboss.as.console.client.shared.properties.PropertyRecord;
+
/**
* Application
*
@@ -40,6 +42,16 @@
public void setServices(List<Service> services);
/**
+ * @return the references used by this application.
+ */
+ public List<Reference> getReferences();
+
+ /**
+ * @param references the references used by this application.
+ */
+ public void setReferences(List<Reference> references);
+
+ /**
* @return the component services defined within this application.
*/
public List<ComponentService> getComponentServices();
@@ -80,4 +92,13 @@
*/
public void setValidators(List<Validator> validators);
+ /**
+ * @return the properties defined for this application
+ */
+ public List<PropertyRecord> getProperties();
+
+ /**
+ * @param properties the properties defined for this application.
+ */
+ public void setProperties(List<PropertyRecord> properties);
}
View
27 gwt/src/main/java/org/switchyard/console/client/model/Binding.java
@@ -26,25 +26,44 @@
* @author Rob Cernich
*/
public interface Binding {
-
+
+ /**
+ * @return the name of binding (e.g. soap1)
+ */
+ public String getName();
+
+ /**
+ * @param name the name of binding (e.g. soap1)
+ */
+ public void setName(String name);
+
/**
* @return the type of binding (e.g. soap)
*/
public String getType();
-
+
/**
* @param type the type of binding (e.g. soap)
*/
public void setType(String type);
-
+
/**
* @return the raw configuration of the binding
*/
public String getConfiguration();
-
+
/**
* @param configuration the raw configuration of the binding.
*/
public void setConfiguration(String configuration);
+ /**
+ * @return the state of the binding.
+ */
+ public State getState();
+
+ /**
+ * @param state the state of the binding.
+ */
+ public void setState(State state);
}
View
49 gwt/src/main/java/org/switchyard/console/client/model/GatewayMetrics.java
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 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 a gateway/binding.
+ */
+public interface GatewayMetrics extends MessageMetrics {
+
+ /**
+ * @return binding name
+ */
+ String getName();
+
+ /**
+ * @param value binding name
+ */
+ void setName(String value);
+
+ /**
+ * @return binding type
+ */
+ String getType();
+
+ /**
+ * @param value binding type
+ */
+ void setType(String value);
+
+}
View
60 gwt/src/main/java/org/switchyard/console/client/model/Reference.java
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011 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;
+
+import java.util.List;
+
+/**
+ * Reference
+ *
+ * Represents a SwitchYard reference.
+ */
+public interface Reference extends HasQName {
+
+ /**
+ * @return the interface name
+ */
+ public String getInterface();
+
+ /**
+ * @param interfaceName the interface name
+ */
+ public void setInterface(String interfaceName);
+
+ /**
+ * @return the gateways
+ */
+ List<Binding> getGateways();
+
+ /**
+ * @param gateways the gateways
+ */
+ public void setGateways(List<Binding> gateways);
+
+ /**
+ * @return the application name
+ */
+ public String getApplication();
+
+ /**
+ * @param application the application name
+ */
+ public void setApplication(String application);
+
+}
View
22 gwt/src/main/java/org/switchyard/console/client/model/ServiceMetrics.java
@@ -24,7 +24,7 @@
* ServiceMetrics
*
* <p/>
- * Message metrics specific to a service.
+ * Message metrics specific to a service/reference.
*
* @author Rob Cernich
*/
@@ -50,4 +50,24 @@
*/
void setReferences(List<ServiceMetrics> value);
+ /**
+ * @return metrics for associated gateways
+ */
+ List<GatewayMetrics> getGateways();
+
+ /**
+ * @param value metrics for associated gateways
+ */
+ void setGateways(List<GatewayMetrics> value);
+
+ /**
+ * @return the containing application
+ */
+ String getApplication();
+
+ /**
+ * @param application the containing application
+ */
+ void setApplication(String application);
+
}
View
33 gwt/src/main/java/org/switchyard/console/client/model/State.java
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 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;
+
+/**
+ * Used to represent the current state of the binding/gateway.
+ */
+public enum State {
+ /** No state. */
+ NONE,
+ /** Starting. */
+ STARTING,
+ /** Started. */
+ STARTED,
+ /** Stopping. */
+ STOPPING;
+}
View
70 gwt/src/main/java/org/switchyard/console/client/model/SwitchYardStore.java
@@ -21,6 +21,7 @@
import java.util.List;
+import org.jboss.as.console.client.shared.properties.PropertyRecord;
import org.switchyard.console.client.BeanFactory;
import org.switchyard.console.components.client.model.Component;
@@ -110,6 +111,13 @@
void loadAllServiceMetrics(AsyncCallback<List<ServiceMetrics>> asyncCallback);
/**
+ * Loads message metrics for the specified service.
+ *
+ * @param asyncCallback the callback
+ */
+ void loadAllReferenceMetrics(AsyncCallback<List<ServiceMetrics>> asyncCallback);
+
+ /**
* Loads message metrics for the entire system.
*
* @param asyncCallback the callback
@@ -123,4 +131,66 @@
*/
void loadArtifactReferences(AsyncCallback<List<ArtifactReference>> asyncCallback);
+ /**
+ * Load details for a specific reference.
+ *
+ * @param referenceName the name of the reference to load.
+ * @param applicationName the name of the application containing the
+ * reference.
+ * @param callback the callback.
+ */
+ void loadReference(String referenceName, String applicationName, AsyncCallback<Reference> callback);
+
+ /**
+ * Load references deployed on the SwitchYard subsystem.
+ *
+ * @param callback the callback.
+ */
+ void loadReferences(AsyncCallback<List<Reference>> callback);
+
+ /**
+ * Sets the property on the application.
+ *
+ * @param applicationName the application
+ * @param prop the property
+ * @param callback the callback
+ */
+ void setApplicationProperty(String applicationName, PropertyRecord prop, final AsyncCallback<Void> callback);
+
+ /**
+ * Resets all metrics in the system.
+ *
+ * @param callback the callback
+ */
+ void resetSystemMetrics(AsyncCallback<Void> callback);
+
+ /**
+ * Resets metrics for the named service/reference.
+ *
+ * @param name the name of the service/reference.
+ * @param applicationName the name of the containing application
+ * @param callback the callback.
+ */
+ void resetMetrics(String name, String applicationName, AsyncCallback<Void> callback);
+
+ /**
+ * Start the specified gateway/binding.
+ *
+ * @param name the gateway/binding name
+ * @param serviceName the service/reference name
+ * @param applicationName the application name
+ * @param callback the callback
+ */
+ void startGateway(String name, String serviceName, String applicationName, AsyncCallback<Void> callback);
+
+ /**
+ * Stop the specified gateway/binding.
+ *
+ * @param name the gateway/binding name
+ * @param serviceName the service/reference name
+ * @param applicationName the application name
+ * @param callback the callback
+ */
+ void stopGateway(String name, String serviceName, String applicationName, AsyncCallback<Void> callback);
+
}
View
308 gwt/src/main/java/org/switchyard/console/client/model/SwitchYardStoreImpl.java
@@ -19,6 +19,7 @@
package org.switchyard.console.client.model;
import static org.jboss.dmr.client.ModelDescriptionConstants.CHILD_TYPE;
+import static org.jboss.dmr.client.ModelDescriptionConstants.FAILED;
import static org.jboss.dmr.client.ModelDescriptionConstants.NAME;
import static org.jboss.dmr.client.ModelDescriptionConstants.OP;
import static org.jboss.dmr.client.ModelDescriptionConstants.OP_ADDR;
@@ -27,6 +28,7 @@
import static org.jboss.dmr.client.ModelDescriptionConstants.RECURSIVE;
import static org.jboss.dmr.client.ModelDescriptionConstants.RESULT;
import static org.jboss.dmr.client.ModelDescriptionConstants.SUBSYSTEM;
+import static org.jboss.dmr.client.ModelDescriptionConstants.TYPE;
import java.util.ArrayList;
import java.util.HashMap;
@@ -39,6 +41,7 @@
import org.jboss.as.console.client.shared.dispatch.DispatchAsync;
import org.jboss.as.console.client.shared.dispatch.impl.DMRAction;
import org.jboss.as.console.client.shared.dispatch.impl.DMRResponse;
+import org.jboss.as.console.client.shared.properties.PropertyRecord;
import org.jboss.as.console.client.shared.runtime.RuntimeBaseAddress;
import org.jboss.as.console.client.shared.subsys.Baseadress;
import org.jboss.dmr.client.ModelNode;
@@ -64,11 +67,18 @@
private static final String GET_VERSION = "get-version";
private static final String LIST_APPLICATIONS = "list-applications";
private static final String LIST_SERVICES = "list-services";
+ private static final String LIST_REFERENCES = "list-references";
private static final String MODULE = "module";
+ private static final String PROPERTY = "property";
private static final String READ_APPLICATION = "read-application";
private static final String READ_SERVICE = "read-service";
+ private static final String READ_REFERENCE = "read-reference";
private static final String SERVICE_NAME = "service-name";
+ private static final String SET_APPLICATION_PROPERTY = "set-application-property";
private static final String SHOW_METRICS = "show-metrics";
+ private static final String RESET_METRICS = "reset-metrics";
+ private static final String STOP_GATEWAY = "stop-gateway";
+ private static final String START_GATEWAY = "start-gateway";
private static final String SWITCHYARD = NameTokens.SUBSYSTEM;
private final DispatchAsync _dispatcher;
@@ -382,7 +392,7 @@ public void onSuccess(DMRResponse result) {
@Override
public void loadAllServiceMetrics(final AsyncCallback<List<ServiceMetrics>> callback) {
- // /subsystem=switchyard:show-metrics(service-name=*)
+ // /subsystem=switchyard:show-metrics(service-name=*, type=service)
final ModelNode operation = new ModelNode();
final ModelNode address = RuntimeBaseAddress.get();
@@ -390,6 +400,7 @@ public void loadAllServiceMetrics(final AsyncCallback<List<ServiceMetrics>> call
address.add(SUBSYSTEM, SWITCHYARD);
operation.get(OP_ADDR).set(address);
operation.get(SERVICE_NAME).set("*");
+ operation.get(TYPE).set("service");
_dispatcher.execute(new DMRAction(operation), new AsyncCallback<DMRResponse>() {
@@ -403,10 +414,8 @@ 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.onSuccess(metrics);
+ return;
}
callback.onFailure(new Exception("Could not load all service metrics."));
}
@@ -414,6 +423,40 @@ public void onSuccess(DMRResponse result) {
}
@Override
+ public void loadAllReferenceMetrics(final AsyncCallback<List<ServiceMetrics>> callback) {
+ // /subsystem=switchyard:show-metrics(service-name=*, type=reference)
+
+ final ModelNode operation = new ModelNode();
+ final ModelNode address = RuntimeBaseAddress.get();
+ operation.get(OP).set(SHOW_METRICS);
+ address.add(SUBSYSTEM, SWITCHYARD);
+ operation.get(OP_ADDR).set(address);
+ operation.get(SERVICE_NAME).set("*");
+ operation.get(TYPE).set("reference");
+
+ _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(FAILED)) {
+ callback.onFailure(new Exception("Could not load all reference metrics."));
+ } else if (response.hasDefined(RESULT)) {
+ final List<ServiceMetrics> metrics = createServiceMetrics(response.get(RESULT));
+ callback.onSuccess(metrics);
+ } else {
+ callback.onSuccess(null);
+ }
+ }
+ });
+ }
+
+ @Override
public void loadSystemMetrics(final AsyncCallback<MessageMetrics> callback) {
// /subsystem=switchyard:show-metrics()
@@ -446,11 +489,84 @@ public void onSuccess(DMRResponse result) {
}
@Override
+ public void loadReferences(final AsyncCallback<List<Reference>> callback) {
+ // /subsystem=switchyard:list-references()
+ final List<Reference> references = new ArrayList<Reference>();
+
+ final ModelNode operation = new ModelNode();
+ final ModelNode address = RuntimeBaseAddress.get();
+ address.add(SUBSYSTEM, SWITCHYARD);
+ operation.get(OP_ADDR).set(address);
+ operation.get(OP).set(LIST_REFERENCES);
+
+ _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().get(RESULT);
+ if (response.isDefined()) {
+ for (final ModelNode referenceNode : response.asList()) {
+ final Reference reference = createReferenceStub(referenceNode);
+ if (reference != null) {
+ references.add(reference);
+ }
+ }
+
+ }
+
+ callback.onSuccess(references);
+ }
+ });
+ }
+
+ @Override
+ public void loadReference(final String referenceName, final String applicationName,
+ final AsyncCallback<Reference> callback) {
+ // /subsystem=switchyard:read-reference(reference-name=referenceName,
+ // application-name=applicationName)
+
+ final ModelNode operation = new ModelNode();
+ final ModelNode address = RuntimeBaseAddress.get();
+ operation.get(OP).set(READ_REFERENCE);
+ address.add(SUBSYSTEM, SWITCHYARD);
+ operation.get(OP_ADDR).set(address);
+ operation.get(SERVICE_NAME).set(referenceName);
+ operation.get(APPLICATION_NAME).set(applicationName);
+
+ _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 Reference reference = createReference(response.get(RESULT).asList().get(0));
+ if (reference != null) {
+ callback.onSuccess(reference);
+ return;
+ }
+ }
+ callback.onFailure(new Exception("Could not load information for reference: " + referenceName
+ + " from application: " + applicationName));
+ }
+ });
+ }
+
+ @Override
public void loadArtifactReferences(final AsyncCallback<List<ArtifactReference>> callback) {
// /subsystem=switchyard:read-application()
final ModelNode operation = new ModelNode();
- final ModelNode address = Baseadress.get();
+ final ModelNode address = RuntimeBaseAddress.get();
operation.get(OP).set(READ_APPLICATION);
address.add(SUBSYSTEM, SWITCHYARD);
operation.get(OP_ADDR).set(address);
@@ -498,6 +614,168 @@ public void onSuccess(DMRResponse result) {
});
}
+ @Override
+ public void setApplicationProperty(final String applicationName, final PropertyRecord prop,
+ final AsyncCallback<Void> callback) {
+ // /subsystem=switchyard:set-application-property(name=applicationName,
+ // property=prop)
+
+ final ModelNode operation = new ModelNode();
+ final ModelNode address = RuntimeBaseAddress.get();
+ operation.get(OP).set(SET_APPLICATION_PROPERTY);
+ address.add(SUBSYSTEM, SWITCHYARD);
+ operation.get(OP_ADDR).set(address);
+ operation.get(NAME).set(applicationName);
+ operation.get(PROPERTY).add(prop.getKey(), prop.getValue());
+
+ _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(FAILED)) {
+ callback.onSuccess(null);
+ return;
+ }
+ callback.onFailure(new Exception("Failure setting property:" + prop.getKey()));
+ }
+ });
+ }
+
+ @Override
+ public void resetSystemMetrics(final AsyncCallback<Void> callback) {
+ // /subsystem=switchyard:reset-metrics()
+
+ final ModelNode operation = new ModelNode();
+ final ModelNode address = RuntimeBaseAddress.get();
+ operation.get(OP).set(RESET_METRICS);
+ address.add(SUBSYSTEM, SWITCHYARD);
+ operation.get(OP_ADDR).set(address);
+
+ _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(FAILED)) {
+ callback.onSuccess(null);
+ return;
+ }
+ callback.onFailure(new Exception("Failure resetting system metrics: "
+ + response.getFailureDescription()));
+ }
+ });
+ }
+
+ @Override
+ public void resetMetrics(final String name, final String applicationName, final AsyncCallback<Void> callback) {
+ // /subsystem=switchyard:reset-metrics(name=name,
+ // application-name=applicationName)
+
+ final ModelNode operation = new ModelNode();
+ final ModelNode address = RuntimeBaseAddress.get();
+ operation.get(OP).set(RESET_METRICS);
+ address.add(SUBSYSTEM, SWITCHYARD);
+ operation.get(OP_ADDR).set(address);
+ operation.get(NAME).set(name);
+ operation.get(APPLICATION_NAME).set(applicationName);
+
+ _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(FAILED)) {
+ callback.onSuccess(null);
+ return;
+ }
+ callback.onFailure(new Exception("Failure resetting metrics for " + name + ": "
+ + response.getFailureDescription()));
+ }
+ });
+ }
+
+ @Override
+ public void stopGateway(final String name, final String serviceName, final String applicationName,
+ final AsyncCallback<Void> callback) {
+ // /subsystem=switchyard:stop-gateway(name=name,
+ // service-name=serviceName, application-name=applicationName)
+
+ final ModelNode operation = new ModelNode();
+ final ModelNode address = RuntimeBaseAddress.get();
+ operation.get(OP).set(STOP_GATEWAY);
+ address.add(SUBSYSTEM, SWITCHYARD);
+ operation.get(OP_ADDR).set(address);
+ operation.get(NAME).set(name);
+ operation.get(SERVICE_NAME).set(serviceName);
+ operation.get(APPLICATION_NAME).set(applicationName);
+
+ _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(FAILED)) {
+ callback.onSuccess(null);
+ return;
+ }
+ callback.onFailure(new Exception("Failure stopping gateway for " + name + ": "
+ + response.getFailureDescription()));
+ }
+ });
+ }
+
+ @Override
+ public void startGateway(final String name, final String serviceName, final String applicationName,
+ final AsyncCallback<Void> callback) {
+ // /subsystem=switchyard:start-gateway(name=name,
+ // service-name=serviceName, application-name=applicationName)
+
+ final ModelNode operation = new ModelNode();
+ final ModelNode address = RuntimeBaseAddress.get();
+ operation.get(OP).set(START_GATEWAY);
+ address.add(SUBSYSTEM, SWITCHYARD);
+ operation.get(OP_ADDR).set(address);
+ operation.get(NAME).set(name);
+ operation.get(SERVICE_NAME).set(serviceName);
+ operation.get(APPLICATION_NAME).set(applicationName);
+
+ _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(FAILED)) {
+ callback.onSuccess(null);
+ return;
+ }
+ callback.onFailure(new Exception("Failure starting gateway for " + name + ": "
+ + response.getFailureDescription()));
+ }
+ });
+ }
+
private SystemDetails createSystemDetails(final ModelNode systemDetailsNode) {
try {
return AutoBeanCodex.decode(_factory, SystemDetails.class, systemDetailsNode.toJSONString(true)).as();
@@ -565,4 +843,22 @@ private MessageMetrics createMessageMetrics(final ModelNode metricsNode) {
}
}
+ private Reference createReferenceStub(final ModelNode referenceNode) {
+ try {
+ return AutoBeanCodex.decode(_factory, Reference.class, referenceNode.toJSONString(true)).as();
+ } catch (Exception e) {
+ Log.error("Failed to parse data source representation", e);
+ return null;
+ }
+ }
+
+ private Reference createReference(final ModelNode referenceNode) {
+ try {
+ return AutoBeanCodex.decode(_factory, Reference.class, referenceNode.toJSONString(true)).as();
+ } catch (Exception e) {
+ Log.error("Failed to parse data source representation", e);
+ return null;
+ }
+ }
+
}
View
65 gwt/src/main/java/org/switchyard/console/client/ui/application/ApplicationPresenter.java
@@ -22,11 +22,13 @@
import java.util.List;
import org.jboss.as.console.client.Console;
-import org.jboss.as.console.client.shared.subsys.RevealStrategy;
+import org.jboss.as.console.client.shared.properties.PropertyManagement;
+import org.jboss.as.console.client.shared.properties.PropertyRecord;
import org.jboss.ballroom.client.layout.LHSHighlightEvent;
import org.switchyard.console.client.NameTokens;
import org.switchyard.console.client.model.Application;
import org.switchyard.console.client.model.ArtifactReference;
+import org.switchyard.console.client.model.Reference;
import org.switchyard.console.client.model.Service;
import org.switchyard.console.client.model.SwitchYardStore;
import org.switchyard.console.client.ui.runtime.RuntimePresenter;
@@ -53,7 +55,8 @@
*
* @author Rob Cernich
*/
-public class ApplicationPresenter extends Presenter<ApplicationPresenter.MyView, ApplicationPresenter.MyProxy> {
+public class ApplicationPresenter extends Presenter<ApplicationPresenter.MyView, ApplicationPresenter.MyProxy>
+ implements PropertyManagement {
/**
* MyProxy
@@ -62,7 +65,7 @@
*/
@ProxyCodeSplit
@NameToken(NameTokens.APPLICATIONS_PRESENTER)
- @TabInfo(container = RuntimePresenter.class, label = "Applications", priority = 1)
+ @TabInfo(container = RuntimePresenter.class, label = NameTokens.APPLICATIONS_TEXT, priority = 1)
public interface MyProxy extends TabContentProxyPlace<ApplicationPresenter> {
}
@@ -89,7 +92,6 @@
}
private final PlaceManager _placeManager;
- private final RevealStrategy _revealStrategy;
private final SwitchYardStore _switchYardStore;
private String _applicationName;
@@ -100,16 +102,14 @@
* @param view the injected MyView.
* @param proxy the injected MyProxy.
* @param placeManager the injected PlaceManager.
- * @param revealStrategy the RevealStrategy
* @param switchYardStore the injected SwitchYardStore.
*/
@Inject
public ApplicationPresenter(EventBus eventBus, MyView view, MyProxy proxy, PlaceManager placeManager,
- RevealStrategy revealStrategy, SwitchYardStore switchYardStore) {
+ SwitchYardStore switchYardStore) {
super(eventBus, view, proxy);
_placeManager = placeManager;
- _revealStrategy = revealStrategy;
_switchYardStore = switchYardStore;
}
@@ -160,6 +160,57 @@ public void onNavigateToService(Service service, Application application) {
URL.encode(application.getName())), -1);
}
+ /**
+ * Notifies the presenter that the user wishes to view details about a
+ * specific reference.
+ *
+ * @param reference the reference.
+ * @param application the application containing the reference.
+ */
+ public void onNavigateToReference(Reference reference, Application application) {
+ if (reference == null || application == null) {
+ Console.error("Cannot reveal reference details. No reference or application specified.");
+ return;
+ }
+ _placeManager.revealRelativePlace(
+ new PlaceRequest(NameTokens.REFERENCES_PRESENTER).with(NameTokens.REFERENCE_NAME_PARAM,
+ URL.encode(reference.getName())).with(NameTokens.APPLICATION_NAME_PARAM,
+ URL.encode(application.getName())), -1);
+ }
+
+ @Override
+ public void onCreateProperty(String reference, PropertyRecord prop) {
+ }
+
+ @Override
+ public void onDeleteProperty(String reference, PropertyRecord prop) {
+ }
+
+ @Override
+ public void onChangeProperty(String reference, PropertyRecord prop) {
+ if (reference == null) {
+ return;
+ }
+ _switchYardStore.setApplicationProperty(reference, prop, new AsyncCallback<Void>() {
+ @Override
+ public void onSuccess(Void result) {
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ Console.error("Unknown error", caught.getMessage());
+ }
+ });
+ }
+
+ @Override
+ public void launchNewPropertyDialoge(String reference) {
+ }
+
+ @Override
+ public void closePropertyDialoge() {
+ }
+
@Override
protected void onBind() {
super.onBind();
View
96 gwt/src/main/java/org/switchyard/console/client/ui/application/ApplicationReferencesList.java
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011 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.application;
+
+import org.jboss.ballroom.client.widgets.tables.DefaultCellTable;
+import org.switchyard.console.client.model.Application;
+import org.switchyard.console.client.model.Reference;
+import org.switchyard.console.client.ui.common.AbstractDataTable;
+
+import com.google.gwt.cell.client.ClickableTextCell;
+import com.google.gwt.cell.client.FieldUpdater;
+import com.google.gwt.user.cellview.client.Column;
+import com.google.gwt.user.cellview.client.ColumnSortEvent;
+import com.google.gwt.view.client.ListDataProvider;
+import com.google.gwt.view.client.ProvidesKey;
+
+/**
+ * ApplicationReferencesList
+ *
+ * Wraps a table control for displaying an application's references.
+ *
+ * @author Rob Cernich
+ */
+public class ApplicationReferencesList extends AbstractDataTable<Reference> {
+
+ private static final ProvidesKey<Reference> KEY_PROVIDER = new ProvidesKey<Reference>() {
+ @Override
+ public Object getKey(Reference item) {
+ return item.getName();
+ }
+ };
+
+ private Application _application;
+ private final ApplicationPresenter _presenter;
+
+ ApplicationReferencesList(ApplicationPresenter presenter) {
+ super("References");
+ _presenter = presenter;
+ }
+
+ @Override
+ protected void createColumns(DefaultCellTable<Reference> table, ListDataProvider<Reference> dataProvider) {
+ Column<Reference, String> nameColumn = new Column<Reference, String>(new ClickableTextCell()) {
+ @Override
+ public String getValue(Reference reference) {
+ return reference.localName();
+ }
+ };
+ nameColumn.setFieldUpdater(new FieldUpdater<Reference, String>() {
+ @Override
+ public void update(int index, Reference object, String value) {
+ _presenter.onNavigateToReference(object, _application);
+ }
+ });
+ nameColumn.setSortable(true);
+
+ ColumnSortEvent.ListHandler<Reference> sortHandler = new ColumnSortEvent.ListHandler<Reference>(
+ dataProvider.getList());
+ sortHandler.setComparator(nameColumn, createColumnCommparator(nameColumn));
+
+ table.addColumn(nameColumn, "Name");
+
+ table.addColumnSortHandler(sortHandler);
+ table.getColumnSortList().push(nameColumn);
+ }
+
+ /**
+ * @param application the application providing the data.
+ */
+ public void setApplication(Application application) {
+ _application = application;
+ setData(application.getReferences());
+ }
+
+ @Override
+ protected ProvidesKey<Reference> createKeyProvider() {
+ return KEY_PROVIDER;
+ }
+
+}
View
20 gwt/src/main/java/org/switchyard/console/client/ui/application/ApplicationView.java
@@ -19,9 +19,12 @@
package org.switchyard.console.client.ui.application;
+import java.util.ArrayList;
import java.util.List;
import org.jboss.as.console.client.core.DisposableViewImpl;
+import org.jboss.as.console.client.shared.properties.PropertyEditor;
+import org.jboss.as.console.client.shared.properties.PropertyRecord;
import org.jboss.as.console.client.shared.viewframework.builder.OneToOneLayout;
import org.jboss.as.console.client.shared.viewframework.builder.SimpleLayout;
import org.jboss.ballroom.client.widgets.forms.Form;
@@ -49,6 +52,8 @@
private Form<Application> _applicationDetailsForm;
private ApplicationServicesEditor _servicesEditor;
+ private ApplicationReferencesList _referencesEditor;
+ private PropertyEditor _propertiesEditor;
private ArtifactReferencesList _artifactReferencesList;
private ApplicationTransformationsEditor _transformationsEditor;
private ApplicationsList _applicationsList;
@@ -79,6 +84,9 @@ public void onSelectionChange(SelectionChangeEvent event) {
formWidget.getElement().setAttribute("style", "margin:15px");
_servicesEditor = new ApplicationServicesEditor(_presenter);
+ _referencesEditor = new ApplicationReferencesList(_presenter);
+ // read only for now
+ _propertiesEditor = new PropertyEditor();
_artifactReferencesList = new ArtifactReferencesList();
_transformationsEditor = new ApplicationTransformationsEditor(_presenter);
_validatorsList = new ValidatorsList();
@@ -98,12 +106,17 @@ public void onSelectionChange(SelectionChangeEvent event) {
.setDescription(
"Displays details for a specific application. Select an application to see its implementation details.")
.setMaster(null, formWidget).addDetail("Services", _servicesEditor.asWidget())
- .addDetail("Artifact References", _artifactReferencesList.asWidget())
+ .addDetail("References", _referencesEditor.asWidget())
+ .addDetail("Properties", _propertiesEditor.asWidget())
+ .addDetail("Artifacts", _artifactReferencesList.asWidget())
.addDetail("Transformers", _transformationsEditor.asWidget())
.addDetail("Validators", _validatorsList.asWidget());
applicationDetailsLayout.build();
formWidget.getParent().setStyleName("fill-layout-width");
+ /* disable updating "key" field. */
+ _propertiesEditor.getPropertyTable().getColumn(0).setFieldUpdater(null);
+
SimpleLayout layout = new SimpleLayout()
.setPlain(true)
.setTitle("SwitchYard Applications")
@@ -117,7 +130,7 @@ public void onSelectionChange(SelectionChangeEvent event) {
@Override
public void setPresenter(ApplicationPresenter presenter) {
- this._presenter = presenter;
+ _presenter = presenter;
}
@Override
@@ -133,6 +146,9 @@ public void setApplication(Application application) {
_applicationsList.setSelection(application);
_artifactReferencesList.setData(application == null ? null : application.getArtifacts());
_servicesEditor.setApplication(application);
+ _referencesEditor.setApplication(application);
+ _propertiesEditor.setProperties(application == null ? null : application.getName(), application == null
+ || application.getProperties() == null ? new ArrayList<PropertyRecord>() : application.getProperties());
_transformationsEditor.setApplication(application);
_validatorsList.setData(application == null ? null : application.getValidators());
}
View
4 gwt/src/main/java/org/switchyard/console/client/ui/application/ComponentServicesList.java
@@ -24,7 +24,7 @@
import org.switchyard.console.client.model.Service;
import org.switchyard.console.client.ui.common.AbstractDataTable;
-import com.google.gwt.cell.client.ClickableTextCell;
+import com.google.gwt.cell.client.ButtonCell;
import com.google.gwt.cell.client.FieldUpdater;
import com.google.gwt.user.cellview.client.Column;
import com.google.gwt.user.cellview.client.ColumnSortEvent;
@@ -76,7 +76,7 @@ public String getValue(ComponentService service) {
interfaceColumn.setSortable(true);
Column<ComponentService, String> implementationColumn = new Column<ComponentService, String>(
- new ClickableTextCell()) {
+ new ButtonCell()) {
@Override
public String getValue(ComponentService dummy) {
return "View Details...";
View
2  gwt/src/main/java/org/switchyard/console/client/ui/artifacts/ArtifactPresenter.java
@@ -61,7 +61,7 @@
*/
@ProxyCodeSplit
@NameToken(NameTokens.ARTIFACTS_PRESENTER)
- @TabInfo(container = RuntimePresenter.class, label = "Artifacts", priority = 3)
+ @TabInfo(container = RuntimePresenter.class, label = NameTokens.ARTIFACT_REFERENCES_TEXT, priority = 4)
public interface MyProxy extends TabContentProxyPlace<ArtifactPresenter> {
}
View
231 gwt/src/main/java/org/switchyard/console/client/ui/common/PlainColumnView.java
@@ -0,0 +1,231 @@
+package org.switchyard.console.client.ui.common;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.as.console.client.shared.help.HelpSystem;
+import org.jboss.as.console.client.shared.help.MetricHelpPanel;
+import org.jboss.as.console.client.shared.help.StaticHelpPanel;
+import org.jboss.as.console.client.shared.runtime.Metric;
+import org.jboss.as.console.client.shared.runtime.Sampler;
+import org.jboss.as.console.client.shared.runtime.charts.Column;
+import org.jboss.as.console.client.shared.runtime.charts.StackedBar;
+
+import com.google.gwt.dom.client.Style;
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.HasHorizontalAlignment;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * Modified version from AS7 core.
+ *
+ * @author Heiko Braun
+ */
+public class PlainColumnView implements Sampler {
+
+ private Column[] _columns = null;
+ private FlexTable _grid;
+ private String _title;
+ private int _rowOffset = 1;
+
+ private List<StackedBar> _stacks = new LinkedList<StackedBar>();
+
+ // default width and height
+ private int _width = 100;
+ private Style.Unit _unit = Style.Unit.PCT;
+ private HelpSystem.AddressCallback _address = null;
+ private StaticHelpPanel _staticHelp;
+ private Map<Column, Integer> _columnIndexes = new HashMap<Column, Integer>();
+
+ /**
+ * Create a new PlainColumnView.
+ *
+ * @param title the title
+ */
+ public PlainColumnView(String title) {
+ this._title = title;
+ }
+
+ /**
+ * @param columns the columns to be displayed
+ * @return this
+ */
+ public PlainColumnView setColumns(Column... columns) {
+ this._columns = columns;
+ return this;
+ }
+
+ /**
+ * @param width the width of the view
+ * @param unit the units for the width
+ * @return this
+ */
+ public PlainColumnView setWidth(int width, Style.Unit unit) {
+ this._width = width;
+ this._unit = unit;
+ return this;
+ }
+
+ @Override
+ public Widget asWidget() {
+
+ VerticalPanel layout = new VerticalPanel();
+ layout.setStyleName("fill-layout-width");
+
+ layout.add(new HTML("<div class='metric-table-title'>" + _title + "</div>"));
+
+ _grid = new FlexTable();
+ _grid.getElement().setAttribute("width", _width + _unit.getType() + "");
+
+ // header columns
+ _grid.setHTML(0, 0, "Metric");
+ _grid.setHTML(0, 1, "Actual");
+ _grid.setHTML(0, 2, "&nbsp;");
+
+ _grid.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_RIGHT);
+
+ // actual values
+ int row = _rowOffset;
+ for (Column c : _columns) {
+ _grid.setHTML(row, 0, "<div class='metric-table-label'>" + c.getLabel() + ":</div>");
+ _grid.setHTML(row, 1, "");
+
+ _stacks.add(new StackedBar());
+
+ if (c.getComparisonColumn() != null) {
+ StackedBar stack = _stacks.get(row - _rowOffset);
+ _grid.setWidget(row, 2, stack.asWidget());
+ stack.setRatio(0, 0);
+ } else {
+ _grid.setText(row, 2, "");
+ }
+
+ _grid.getCellFormatter().setHorizontalAlignment(row, 1, HasHorizontalAlignment.ALIGN_RIGHT);
+
+ if (!c.isVisible()) {
+ _grid.getRowFormatter().setVisible(row, false);
+ }
+ if (c.isBaseline()) {
+ _grid.getRowFormatter().addStyleName(row, "metric-table-baseline");
+ }
+
+ _columnIndexes.put(c, row - _rowOffset);
+
+ row++;
+ }
+
+ _grid.getCellFormatter().setStyleName(0, 0, "metric-table-header");
+ _grid.getCellFormatter().setStyleName(0, 1, "metric-table-header");
+ _grid.getCellFormatter().setStyleName(0, 2, "metric-table-header");
+ _grid.getCellFormatter().setWidth(0, 2, "50%");
+
+ if (null == _staticHelp && _address != null) {
+ MetricHelpPanel helpPanel = new MetricHelpPanel(_address, this._columns);
+ // helpPanel.setAligned(true);
+ layout.add(helpPanel.asWidget());
+ } else if (_staticHelp != null) {
+ layout.add(_staticHelp.asWidget());
+ }
+
+ layout.add(_grid);
+
+ return layout;
+ }
+
+ @Override
+ public void addSample(Metric metric) {
+ int row = _rowOffset;
+ int baselineIndex = getBaseLineIndex();
+
+ // check if they match
+ if (baselineIndex > metric.numSamples()) {
+ throw new RuntimeException("Illegal baseline index " + baselineIndex + " on number of samples "
+ + metric.numSamples());
+ }
+
+ Long baseline = baselineIndex >= 0 ? Long.valueOf(metric.get(baselineIndex)) : -1;
+
+ for (Column c : _columns) {
+ int dataIndex = row - _rowOffset;
+ String actualValue = metric.get(dataIndex);
+
+ if (null == actualValue) {
+ throw new RuntimeException("Metric value at index " + dataIndex + " is null");
+ }
+
+ _grid.setText(row, 1, actualValue);
+
+ if (c.getComparisonColumn() != null) {
+ _stacks.get(dataIndex).setRatio(getComparisonValue(metric, c.getComparisonColumn()),
+ Double.valueOf(actualValue));
+ }
+ row++;
+ }
+
+ }
+
+ /**
+ * @return the baseline column index
+ */
+ public int getBaseLineIndex() {
+ int i = 0;
+ boolean didMatch = false;
+ for (Column c : _columns) {
+ if (c.isBaseline()) {
+ didMatch = true;
+ break;
+ }
+ i++;
+ }
+
+ return didMatch ? i : -1;
+ }
+
+ @Override
+ public void clearSamples() {
+ int row = _rowOffset;
+
+ for (Column c : _columns) {
+ int dataIndex = row - _rowOffset;
+
+ // clear the 'Actual' value
+ _grid.setText(row, 1, "");
+
+ // cleanup stackbar if used
+ if (c.getComparisonColumn() != null) {
+ _stacks.get(dataIndex).setRatio(0, 0);
+ } else if (c.getComparisonColumn() != null) {
+ throw new RuntimeException("Comparison column specified, but no baseline set!");
+ }
+
+ row++;
+ }
+ }
+
+ @Override
+ public long numSamples() {
+ return 1;
+ }
+
+ @Override
+ public void recycle() {
+
+ }
+
+ /**
+ * @param helpPanel the help panel
+ * @return this
+ */
+ public PlainColumnView setStaticHelp(StaticHelpPanel helpPanel) {
+ this._staticHelp = helpPanel;
+ return this;
+ }
+
+ private long getComparisonValue(Metric metric, Column comparisonColumn) {
+ return Long.parseLong(metric.get(_columnIndexes.get(comparisonColumn)));
+ }
+}
View
160 gwt/src/main/java/org/switchyard/console/client/ui/metrics/GatewayMetricsList.java
@@ -0,0 +1,160 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 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.metrics;
+
+import org.jboss.ballroom.client.widgets.tables.DefaultCellTable;
+import org.switchyard.console.client.model.GatewayMetrics;
+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;
+
+/**
+ * GatewayMetricsList
+ *
+ * Wraps a table control for displaying metrics for gateways on a
+ * service/reference.
+ */
+public class GatewayMetricsList extends AbstractDataTable<GatewayMetrics> {
+
+ private static final ProvidesKey<GatewayMetrics> KEY_PROVIDER = new ProvidesKey<GatewayMetrics>() {
+ @Override
+ public Object getKey(GatewayMetrics item) {
+ return item.getName();
+ }
+ };
+
+ private ServiceMetrics _serviceMetrics;
+
+ /**
+ * Create a new GatewayMetricsList.
+ */
+ public GatewayMetricsList() {
+ super("Gateway Metrics");
+ }
+
+ @Override
+ protected void createColumns(DefaultCellTable<GatewayMetrics> table,
+ ListDataProvider<GatewayMetrics> dataProvider) {
+ final TextColumn<GatewayMetrics> nameColumn = new TextColumn<GatewayMetrics>() {
+ @Override
+ public String getValue(GatewayMetrics metrics) {
+ return metrics.getName();
+ }
+ };
+ nameColumn.setSortable(true);
+
+ final TextColumn<GatewayMetrics> typeColumn = new TextColumn<GatewayMetrics>() {
+ @Override
+ public String getValue(GatewayMetrics metrics) {
+ return metrics.getType();
+ }
+ };
+ typeColumn.setSortable(true);
+
+ final Column<GatewayMetrics, Number> countColumn = new Column<GatewayMetrics, Number>(new NumberCell()) {
+ @Override
+ public Number getValue(GatewayMetrics metrics) {
+ return metrics.getTotalCount();
+ }
+ };
+ countColumn.setSortable(true);
+
+ final Column<GatewayMetrics, Number> averageTimeColumn = new Column<GatewayMetrics, Number>(
+ new NumberCell()) {
+ @Override
+ public Number getValue(GatewayMetrics metrics) {
+ return metrics.getAverageProcessingTime();
+ }
+ };
+ averageTimeColumn.setSortable(true);
+
+ final Column<GatewayMetrics, Double> totalTimePercentageColumn = new Column<GatewayMetrics, Double>(
+ new PercentageBarCell()) {
+ @Override
+ public Double getValue(GatewayMetrics metrics) {
+ if (_serviceMetrics == null || _serviceMetrics.getTotalProcessingTime() == 0) {
+ return 0.0;
+ }
+ return metrics.getTotalProcessingTime() / (double) _serviceMetrics.getTotalProcessingTime();
+ }
+ };
+ totalTimePercentageColumn.setSortable(true);
+
+ final Column<GatewayMetrics, Double> faultPercentageColumn = new Column<GatewayMetrics, Double>(
+ new PercentageBarCell()) {
+ @Override
+ public Double getValue(GatewayMetrics metrics) {
+ if (metrics.getTotalCount() == 0) {
+ return 0.0;
+ }
+ return metrics.getFaultCount() / (double) metrics.getTotalCount();
+ }
+ };
+ faultPercentageColumn.setSortable(true);
+
+ ColumnSortEvent.ListHandler<GatewayMetrics> sortHandler = new ColumnSortEvent.ListHandler<GatewayMetrics>(
+ dataProvider.getList());
+ sortHandler.setComparator(nameColumn, createColumnCommparator(nameColumn));
+ sortHandler.setComparator(typeColumn, createColumnCommparator(typeColumn));
+ 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(typeColumn, "Type");
+ 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.getGateways());
+ }
+ }
+
+ @Override
+ protected ProvidesKey<GatewayMetrics> createKeyProvider() {
+ return KEY_PROVIDER;
+ }
+
+}
View
2  gwt/src/main/java/org/switchyard/console/client/ui/metrics/MessageMetricsViewer.java
@@ -22,8 +22,8 @@
import org.jboss.as.console.client.shared.runtime.charts.Column;
import org.jboss.as.console.client.shared.runtime.charts.NumberColumn;
import org.jboss.as.console.client.shared.runtime.charts.TextColumn;
-import org.jboss.as.console.client.shared.runtime.plain.PlainColumnView;
import org.switchyard.console.client.model.MessageMetrics;
+import org.switchyard.console.client.ui.common.PlainColumnView;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
View
44 gwt/src/main/java/org/switchyard/console/client/ui/metrics/MetricsDetailsWidget.java
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 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.metrics;
+
+import org.switchyard.console.client.model.MessageMetrics;
+import org.switchyard.console.client.model.ServiceMetrics;
+
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * MetricsDetailsWidget
+ *
+ * <p/>
+ * Widget for displaying details for a set of metrics (specifically service or reference).
+ */
+public interface MetricsDetailsWidget {
+
+ /**
+ * @param metrics the metrics being detailed
+ * @param systemMetrics parent metrics to be used for ratios
+ */
+ public void setMetrics(ServiceMetrics metrics, MessageMetrics systemMetrics);
+
+ /**
+ * @return the widget displaying the details
+ */
+ public Widget asWidget();
+}
View
81 gwt/src/main/java/org/switchyard/console/client/ui/metrics/MetricsPresenter.java
@@ -33,7 +33,6 @@
import org.switchyard.console.client.model.SwitchYardStore;
import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.http.client.URL;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.inject.Inject;
import com.google.web.bindery.event.shared.EventBus;
@@ -43,8 +42,8 @@
import com.gwtplatform.mvp.client.annotations.ProxyCodeSplit;
import com.gwtplatform.mvp.client.proxy.Place;
import com.gwtplatform.mvp.client.proxy.PlaceManager;
-import com.gwtplatform.mvp.client.proxy.PlaceRequest;
import com.gwtplatform.mvp.client.proxy.Proxy;
+import com.gwtplatform.mvp.client.proxy.ResetPresentersEvent;
/**
* RuntimePresenter
@@ -85,14 +84,10 @@
void setServices(List<ServiceMetrics> serviceMetrics);
/**
- * @param service set the selected service
- */
- void setService(ServiceMetrics service);
-
- /**
- * @param serviceMetrics the metrics for the selected service.
+ * @param referenceMetrics metrics for all references deployed on the
+ * server.
*/
- void setServiceMetrics(ServiceMetrics serviceMetrics);
+ void setReferences(List<ServiceMetrics> referenceMetrics);
/**
* @param systemMetrics the metrics for the system.
@@ -108,7 +103,6 @@
private final PlaceManager _placeManager;
private final RevealStrategy _revealStrategy;
private final SwitchYardStore _switchYardStore;
- private String _serviceName;
/**
* Create a new RuntimePresenter.
@@ -131,18 +125,39 @@ public MetricsPresenter(EventBus eventBus, MyView view, MyProxy proxy, PlaceMana
}
/**
- * Notifies the presenter that the user has selected a service. The
- * presenter will load the service details and pass them back to the view to
- * be displayed.
+ * Resets system metrics.
+ */
+ public void resetSystemMetrics() {
+ _switchYardStore.resetSystemMetrics(new AsyncCallback<Void>() {
+ @Override
+ public void onSuccess(Void unused) {
+ getEventBus().fireEvent(new ResetPresentersEvent());
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ Console.error("Unknown error", caught.getMessage());
+ }
+ });
+ }
+
+ /**
+ * Resets metrics for the named service/reference.
*
- * @param serviceMetrics the selected service.
+ * @param metrics the service/reference metrics.
*/
- public void onServiceSelected(ServiceMetrics serviceMetrics) {
- PlaceRequest request = new PlaceRequest(NameTokens.METRICS_PRESENTER);
- if (serviceMetrics != null) {
- request = request.with(NameTokens.SERVICE_NAME_PARAM, URL.encode(serviceMetrics.getName()));
- }
- _placeManager.revealRelativePlace(request, -1);
+ public void resetMetrics(ServiceMetrics metrics) {
+ _switchYardStore.resetMetrics(metrics.getName(), metrics.getApplication(), new AsyncCallback<Void>() {
+ @Override
+ public void onSuccess(Void unused) {
+ getEventBus().fireEvent(new ResetPresentersEvent());
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ Console.error("Unknown error", caught.getMessage());
+ }
+ });
}
@Override
@@ -167,15 +182,6 @@ protected void onBind() {
}
@Override
- public void prepareFromRequest(PlaceRequest request) {
- super.prepareFromRequest(request);
- _serviceName = request.getParameter(NameTokens.SERVICE_NAME_PARAM, null);
- if (_serviceName != null) {
- _serviceName = URL.decode(_serviceName);
- }
- }
-
- @Override
protected void onReveal() {
super.onReveal();
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
@@ -199,10 +205,11 @@ protected void revealInParent() {
private void loadMetrics() {
getView().setServices(null);
+ getView().setReferences(null);
getView().clearMetrics();
loadSystemMetrics();
loadServicesList();
- loadServiceMetrics();
+ loadReferencesList();
}
private void loadServicesList() {
@@ -219,17 +226,11 @@ public void onFailure(Throwable caught) {
});
}
- private void loadServiceMetrics() {
- if (_serviceName == null) {
- getView().setServiceMetrics(_switchYardStore.getBeanFactory().serviceMetrics().as());
- return;
- }
- _switchYardStore.loadServiceMetrics(_serviceName, new AsyncCallback<ServiceMetrics>() {
-
+ private void loadReferencesList() {
+ _switchYardStore.loadAllReferenceMetrics(new AsyncCallback<List<ServiceMetrics>>() {
@Override
- public void onSuccess(ServiceMetrics result) {
- getView().setService(result);
- getView().setServiceMetrics(result);
+ public void onSuccess(List<ServiceMetrics> referenceMetrics) {
+ getView().setReferences(referenceMetrics);
}
@Override
View
93 gwt/src/main/java/org/switchyard/console/client/ui/metrics/MetricsView.java
@@ -21,16 +21,16 @@
import java.util.List;
import org.jboss.as.console.client.core.DisposableViewImpl;
-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.ServiceMetrics;
import org.switchyard.console.client.ui.metrics.MetricsPresenter.MyView;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
-import com.google.gwt.view.client.SelectionChangeEvent;
-import com.google.gwt.view.client.SelectionChangeEvent.Handler;
/**
* RuntimeView
@@ -45,54 +45,50 @@
private MetricsPresenter _presenter;
private MessageMetricsViewer _systemMetricsViewer;
private ServiceMetricsList _servicesList;
- private MessageMetricsViewer _serviceMetricsViewer;
- private ServiceReferenceMetricsList _serviceReferenceMetricsList;
- private ServiceOperationMetricsList _serviceOperationMetricsList;
+ private ServiceMetricsList _referencesList;
private MessageMetrics _systemMetrics;
- private ServiceMetrics _selectedService;
- @Override
- public Widget createWidget() {
+ /**
+ * Create a new MetricsView.
+ */
+ public MetricsView() {
_systemMetricsViewer = new MessageMetricsViewer(false);
- _servicesList = new ServiceMetricsList();
- _serviceMetricsViewer = new MessageMetricsViewer(true);
- _serviceReferenceMetricsList = new ServiceReferenceMetricsList();
- _serviceOperationMetricsList = new ServiceOperationMetricsList();
+ _servicesList = new ServiceMetricsList("Service Metrics");
+ _referencesList = new ServiceMetricsList("Reference Metrics") {
+ @Override
+ protected MetricsDetailsWidget createDetailsWidget() {
+ return new ReferenceDetailsWidget();
+ }
+ };
+ }
- _servicesList.addSelectionChangeHandler(new Handler() {
+ @Override
+ public Widget createWidget() {
+ final Button resetButton = new Button("Reset All Metrics", new ClickHandler() {
@Override
- public void onSelectionChange(SelectionChangeEvent event) {
- // prevent infinite recursion
- if (_servicesList.getSelection() != _selectedService) {
- _presenter.onServiceSelected(_servicesList.getSelection());
- }
+ public void onClick(ClickEvent event) {
+ _presenter.resetSystemMetrics();
}
});
-
- Widget servicesWidget = _servicesList.asWidget();
- OneToOneLayout serviceMetricsLayout = new OneToOneLayout()
- .setPlain(true)
- .setHeadline("Services")
- .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();
- servicesWidget.setStyleName("fill-layout-width");
-
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);
-
- return layout.build();
+ .addContent("reset", resetButton)
+ .addContent("spacer", new HTMLPanel("&nbsp;"))
+ .addContent("Service Message Metrics", _servicesList.asWidget())
+ .addContent("Reference Message Metrics", _referencesList.asWidget());
+
+ final Widget result = layout.build();
+ // hackery, prevent button from filling the row
+ resetButton.getElement().removeClassName("fill-layout-width");
+ return result;
}
@Override
public void setPresenter(MetricsPresenter presenter) {
_presenter = presenter;
+ _servicesList.setPresenter(presenter);
+ _referencesList.setPresenter(presenter);
}
@Override
@@ -101,21 +97,8 @@ public void setServices(List<ServiceMetrics> serviceMetrics) {
}
@Override
- 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());
- }
- _serviceReferenceMetricsList.setServiceMetrics(serviceMetrics);
- _serviceOperationMetricsList.setServiceMetrics(serviceMetrics);
+ public void setReferences(List<ServiceMetrics> referenceMetrics) {
+ _referencesList.setData(referenceMetrics);
}
@Override
@@ -127,18 +110,12 @@ public void setSystemMetrics(MessageMetrics systemMetrics) {
}
_systemMetricsViewer.setMessageMetrics(systemMetrics);
_servicesList.setSystemMetrics(systemMetrics);
- }
-
- @Override
- public void setService(ServiceMetrics service) {
- _selectedService = service;
- _servicesList.setSelection(service);
+ _referencesList.setSystemMetrics(systemMetrics);
}
@Override
public void clearMetrics() {
_systemMetricsViewer.clear();
- _serviceMetricsViewer.clear();
}
}
View
85 gwt/src/main/java/org/switchyard/console/client/ui/metrics/ReferenceDetailsWidget.java
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 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.metrics;
+
+import org.jboss.as.console.client.shared.viewframework.builder.OneToOneLayout;
+import org.switchyard.console.client.model.MessageMetrics;
+import org.switchyard.console.client.model.ServiceMetrics;
+
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * ReferenceDetailsWidget
+ *
+ * Provides a widget for displaying a {@link ServiceMetrics}.
+ */
+public class ReferenceDetailsWidget implements MetricsDetailsWidget {
+
+ private MessageMetricsViewer _referenceMetricsViewer;
+ private ServiceOperationMetricsList _referenceOperationMetricsList;
+ private GatewayMetricsList _gatewayMetricsList;
+
+ /**
+ * Create a new ReferenceDetailsWidget.
+ */
+ public ReferenceDetailsWidget() {
+ }
+
+ /**
+ * @return the widget
+ */
+ @Override
+ public Widget asWidget() {
+ _referenceMetricsViewer = new MessageMetricsViewer(true);
+ _referenceOperationMetricsList = new ServiceOperationMetricsList();
+ _gatewayMetricsList = new GatewayMetricsList();
+
+ OneToOneLayout serviceMetricsLayout = new OneToOneLayout().setPlain(true).setHeadline("Reference Metrics")
+ .setDescription("Displays message metrics for a selected reference.")
+ .setMaster(null, _referenceMetricsViewer.asWidget())
+ .addDetail("Gateway Metrics", _gatewayMetricsList.asWidget())
+ .addDetail("Operation Metrics", _referenceOperationMetricsList.asWidget());
+ return serviceMetricsLayout.build();
+ }
+
+ /**
+ * Updates the widget with the information for the specified service.
+ *
+ * @param metrics the metrics for the selected service.
+ * @param systemMetrics the metrics for the overall system.
+ */
+ @Override
+ public void setMetrics(ServiceMetrics metrics, MessageMetrics systemMetrics) {
+ if (metrics == null) {
+ _referenceMetricsViewer.clear();
+ _referenceOperationMetricsList.setServiceMetrics(null);
+ _gatewayMetricsList.setServiceMetrics(null);
+ return;
+ }
+ if (systemMetrics == null) {
+ _referenceMetricsViewer.setMessageMetrics(metrics);
+ } else {
+ _referenceMetricsViewer.setMessageMetrics(metrics, systemMetrics.getTotalCount(),
+ systemMetrics.getTotalProcessingTime());
+ }
+ _referenceOperationMetricsList.setServiceMetrics(metrics);
+ _gatewayMetricsList.setServiceMetrics(metrics);
+ }
+
+}
View
90 gwt/src/main/java/org/switchyard/console/client/ui/metrics/ServiceDetailsWidget.java
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 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.metrics;
+
+import org.jboss.as.console.client.shared.viewframework.builder.OneToOneLayout;
+import org.switchyard.console.client.model.MessageMetrics;
+import org.switchyard.console.client.model.ServiceMetrics;
+
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * ServiceDetailsWidget
+ *
+ * Provides a widget for displaying a {@link ServiceMetrics}.
+ */
+public class ServiceDetailsWidget implements MetricsDetailsWidget {
+
+ private MessageMetricsViewer _serviceMetricsViewer;
+ private ServiceReferenceMetricsList _serviceReferenceMetricsList;
+ private ServiceOperationMetricsList _serviceOperationMetricsList;
+ private GatewayMetricsList _gatewayMetricsList;
+
+ /**
+ * Create a new ServiceDetailsWidget.
+ */
+ public ServiceDetailsWidget() {
+ }
+
+ /**
+ * @return the widget
+ */
+ @Override
+ public Widget asWidget() {
+ _serviceMetricsViewer = new MessageMetricsViewer(true);
+ _serviceOperationMetricsList = new ServiceOperationMetricsList();
+ _serviceReferenceMetricsList = new ServiceReferenceMetricsList();
+ _gatewayMetricsList = new GatewayMetricsList();
+
+ OneToOneLayout serviceMetricsLayout = new OneToOneLayout().setPlain(true).setHeadline("Service Metrics")
+ .setDescription("Displays message metrics for a selected service.")
+ .setMaster(null, _serviceMetricsViewer.asWidget())
+ .addDetail("Gateway Metrics", _gatewayMetricsList.asWidget())
+ .addDetail("Operation Metrics", _serviceOperationMetricsList.asWidget())
+ .addDetail("Reference Metrics", _serviceReferenceMetricsList.asWidget());
+ return serviceMetricsLayout.build();
+ }
+
+ /**
+ * Updates the widget with the information for the specified service.
+ *
+ * @param metrics the metrics for the selected service.
+ * @param systemMetrics the metrics for the overall system.
+ */
+ @Override
+ public void setMetrics(ServiceMetrics metrics, MessageMetrics systemMetrics) {
+ if (metrics == null) {
+ _serviceMetricsViewer.clear();
+ _serviceReferenceMetricsList.setServiceMetrics(null);
+ _serviceOperationMetricsList.setServiceMetrics(null);
+ _gatewayMetricsList.setServiceMetrics(null);
+ return;
+ }
+ if (systemMetrics == null) {
+ _serviceMetricsViewer.setMessageMetrics(metrics);
+ } else {
+ _serviceMetricsViewer.setMessageMetrics(metrics, systemMetrics.getTotalCount(),
+ systemMetrics.getTotalProcessingTime());
+ }
+ _serviceReferenceMetricsList.setServiceMetrics(metrics);
+ _serviceOperationMetricsList.setServiceMetrics(metrics);
+ _gatewayMetricsList.setServiceMetrics(metrics);
+ }
+
+}
View
81 gwt/src/main/java/org/switchyard/console/client/ui/metrics/ServiceMetricsList.java
@@ -19,15 +19,19 @@
package org.switchyard.console.client.ui.metrics;
import org.jboss.ballroom.client.widgets.tables.DefaultCellTable;
+import org.jboss.ballroom.client.widgets.window.DefaultWindow;
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.ButtonCell;
+import com.google.gwt.cell.client.FieldUpdater;
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.user.client.ui.Widget;
import com.google.gwt.view.client.ListDataProvider;
import com.google.gwt.view.client.ProvidesKey;
@@ -49,12 +53,32 @@ public Object getKey(ServiceMetrics item) {
};
private MessageMetrics _systemMetrics;
+ private MetricsPresenter _presenter;
+ private DefaultWindow _detailsWindow;
+ private MetricsDetailsWidget _detailsWidget;
+ private String _title;
/**
* Create a new ServiceReferenceMetricsList.
+ *
+ * @param title for the list
*/
- public ServiceMetricsList() {
- super("Service Metrics");
+ public ServiceMetricsList(String title) {
+ super(title);
+ _title = title;
+ }
+
+ /**
+ * @param presenter the presenter.
+ */
+ public void setPresenter(MetricsPresenter presenter) {
+ _presenter = presenter;
+ }
+
+ @Override
+ public Widget asWidget() {
+ createDetailsWindow();
+ return super.asWidget();
}
@Override
@@ -115,6 +139,33 @@ public Double getValue(ServiceMetrics metrics) {
};
faultPercentageColumn.setSortable(true);
+
+ Column<ServiceMetrics, String> viewDetailsColumn = new Column<ServiceMetrics, String>(new ButtonCell()) {
+ @Override
+ public String getValue(ServiceMetrics dummy) {
+ return "Details...";
+ }
+ };
+ viewDetailsColumn.setFieldUpdater(new FieldUpdater<ServiceMetrics, String>() {
+ @Override
+ public void update(int index, ServiceMetrics metrics, String value) {
+ showDetails(metrics);
+ }
+ });
+
+ Column<ServiceMetrics, String> clearColumn = new Column<ServiceMetrics, String>(new ButtonCell()) {
+ @Override
+ public String getValue(ServiceMetrics dummy) {
+ return "Reset Metrics";
+ }
+ };
+ clearColumn.setFieldUpdater(new FieldUpdater<ServiceMetrics, String>() {
+ @Override
+ public void update(int index, ServiceMetrics metrics, String value) {
+ _presenter.resetMetrics(metrics);
+ }
+ });
+
ColumnSortEvent.ListHandler<ServiceMetrics> sortHandler = new ColumnSortEvent.ListHandler<ServiceMetrics>(
dataProvider.getList());
sortHandler.setComparator(nameColumn, createColumnCommparator(nameColumn));
@@ -130,6 +181,8 @@ public Double getValue(ServiceMetrics metrics) {
table.addColumn(averageTimeColumn, "Average Time");
table.addColumn(totalTimePercentageColumn, "Time %");
table.addColumn(faultPercentageColumn, "Fault %");
+ table.addColumn(viewDetailsColumn, "Details");
+ table.addColumn(clearColumn, "Reset");
table.addColumnSortHandler(sortHandler);
table.getColumnSortList().push(averageTimeColumn);
@@ -154,4 +207,28 @@ public void setSystemMetrics(MessageMetrics systemMetrics) {
return KEY_PROVIDER;
}
+ /**
+ * create the details widget
+ */
+ protected MetricsDetailsWidget createDetailsWidget() {
+ return new ServiceDetailsWidget();
+ }
+
+ private void showDetails(ServiceMetrics metrics) {
+ _detailsWidget.setMetrics(metrics, _systemMetrics);
+ _detailsWindow.center();
+ }
+
+ private void createDetailsWindow() {
+ _detailsWindow = new DefaultWindow(_title);
+ _detailsWindow.setGlassEnabled(true);
+ _detailsWindow.setAutoHideEnabled(true);
+ _detailsWindow.setAutoHideOnHistoryEventsEnabled(true);
+ _detailsWindow.setWidth("80%");
+ _detailsWindow.setHeight("80%");
+
+ _detailsWidget = createDetailsWidget();
+ _detailsWindow.setWidget(_detailsWidget.asWidget());
+ }
+
}
View
145 gwt/src/main/java/org/switchyard/console/client/ui/reference/ReferenceEditor.java
@@ -0,0 +1,145 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 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.reference;
+
+import org.jboss.ballroom.client.widgets.ContentGroupLabel;
+import org.jboss.ballroom.client.widgets.forms.Form;
+import org.jboss.ballroom.client.widgets.forms.TextItem;
+import org.switchyard.console.client.NameTokens;
+import org.switchyard.console.client.model.Reference;
+import org.switchyard.console.client.ui.service.GatewaysList;
+import org.switchyard.console.client.ui.widgets.ClickableTextItem;
+import org.switchyard.console.client.ui.widgets.ClickableTextItem.ValueAdapter;
+import org.switchyard.console.client.ui.widgets.LocalNameFormItem;
+import org.switchyard.console.client.ui.widgets.NamespaceFormItem;
+
+import com.google.gwt.http.client.URL;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+import com.gwtplatform.mvp.client.proxy.PlaceRequest;
+
+/**
+ * ReferenceEditor
+ *
+ * Editor for SwitchYard reference configuration.