modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java | 2 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/AbstractWizard.java | 2 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/AbstractWizardStep.java | 5 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/Wizard.java | 1 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java | 38 +++ modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java | 13 + modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryConfigurationStep.java | 37 ++- modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASDiscoveryComponent.java | 96 ++++++---- modules/plugins/rhq-agent/src/main/java/org/rhq/plugins/agent/AgentDiscoveryComponent.java | 2 modules/plugins/script/src/main/java/org/rhq/plugins/script/ScriptDiscoveryComponent.java | 2 10 files changed, 142 insertions(+), 56 deletions(-)
New commits: commit 6245b0d8756929ada716e3c3c70d2089fc1d5a48 Author: Ian Springer ian.springer@redhat.com Date: Wed Dec 7 13:58:12 2011 -0500
[BZ 751418] Finish button is now disabled / grayed out on final step of resource import/create wizards until the config editor reports the config as being valid; note, to achieve this a new method isNextButtonEnabled() was added to the WizardStep interface and a new method updateButtonEnablement() was added to the WizardView class (https://bugzilla.redhat.com/show_bug.cgi?id=751418); also added javadoc to the WizardStep interface
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/AbstractWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/AbstractWizard.java index 1b9fa0c..2e75a05 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/AbstractWizard.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/AbstractWizard.java @@ -77,4 +77,6 @@ public abstract class AbstractWizard implements Wizard { public WizardView getView() { return view; } + + } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/AbstractWizardStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/AbstractWizardStep.java index 299d0f2..d0aabaf 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/AbstractWizardStep.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/AbstractWizardStep.java @@ -28,6 +28,10 @@ public abstract class AbstractWizardStep implements WizardStep {
abstract public String getName();
+ public boolean isNextButtonEnabled() { + return true; + } + public boolean nextPage() { return true; } @@ -35,4 +39,5 @@ public abstract class AbstractWizardStep implements WizardStep { public boolean previousPage() { return true; } + } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/Wizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/Wizard.java index 8b38b39..ff4dd08 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/Wizard.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/Wizard.java @@ -46,4 +46,5 @@ public interface Wizard { * This is called when the cancel button or the wizard window's "X" close button is clicked. */ void cancel(); + } \ No newline at end of file diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java index f5005c0..16c7ba0 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java @@ -1,6 +1,6 @@ /* * RHQ Management Platform - * Copyright (C) 2005-2010 Red Hat, Inc. + * Copyright (C) 2005-2011 Red Hat, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify @@ -25,17 +25,53 @@ import org.rhq.enterprise.gui.coregui.client.Messages; import org.rhq.enterprise.gui.coregui.client.util.selenium.Locatable;
/** + * A step in a {@link Wizard wizard}. + * * @author Greg Hinkle */ public interface WizardStep {
Messages MSG = CoreGUI.getMessages();
+ /** + * Returns the canvas containing this step's widget content. This method should <b>not</b> add the canvas to the + * parent canvas - the wizard framework will take care of that. + * + * @param parent the parent canvas to which the returned canvas will be added - + * + * @return the canvas containing this step's widget content + */ Canvas getCanvas(Locatable parent);
+ /** + * Returns true if this step's Next or Finish button should be enabled, or false if it should be disabled. + * + * @return true if this step's Next or Finish button should be enabled, or false if it should be disabled + */ + boolean isNextButtonEnabled(); + + /** + * Called when the user clicks this step's Next or Finish button. If all required data has been entered for the + * step and is valid, true should be returned, and the wizard will advance to the next step, otherwise false + * should be returned, and the wizard will not advance. + * + * @return true if all required data has been entered for the step and is valid, or false otherwise + */ boolean nextPage();
+ /** + * Called when the user clicks this step's Previous button. Should return true if the wizard should go to the + * previous step, or false if it should not. + * + * @return true if the wizard should go to the previous step, or false if it should not. + */ boolean previousPage();
+ /** + * Returns the title of this step, to be displayed in the wizard modal's title bar. + * + * @return the title of this step, to be displayed in the wizard modal's title bar + */ String getName(); + } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java index d5fe441..34291f0 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java @@ -48,6 +48,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow; * @author Greg Hinkle */ public class WizardView extends LocatableVLayout { + static private final Messages MSG = CoreGUI.getMessages();
static private final String CANCEL = MSG.common_button_cancel(); @@ -229,7 +230,7 @@ public class WizardView extends LocatableVLayout { .size()))); stepLabel.setWrap(false);
- WizardStep step = wizardSteps.get(currentStep); + final WizardStep step = wizardSteps.get(currentStep);
stepTitleLabel.setContents(step.getName());
@@ -255,7 +256,7 @@ public class WizardView extends LocatableVLayout { } currentCanvas = wizardSteps.get(currentStep).getCanvas(this);
- // if null advance to the next step by automatically "clicking" the Next button + // if null, advance to the next step by automatically "clicking" the Next button if (null == currentCanvas) { if (step.nextPage()) { wizardSteps.get(currentStep).nextPage(); @@ -282,7 +283,7 @@ public class WizardView extends LocatableVLayout {
cancelButton.setDisabled(false); previousButton.setDisabled(stepIndex == 0); - nextButton.setDisabled(false); + nextButton.setDisabled(!step.isNextButtonEnabled());
for (IButton button : customButtons) { button.setDisabled(false); @@ -356,4 +357,10 @@ public class WizardView extends LocatableVLayout { public void decrementStep() { setStep(currentStep - 1); } + + public void updateButtonEnablement() { + WizardStep step = wizard.getSteps().get(currentStep); + getNextButton().setDisabled(!step.isNextButtonEnabled()); + } + } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryConfigurationStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryConfigurationStep.java index 932f197..538aa7f 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryConfigurationStep.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryConfigurationStep.java @@ -29,6 +29,8 @@ import org.rhq.core.domain.configuration.Configuration; import org.rhq.core.domain.configuration.definition.ConfigurationDefinition; import org.rhq.enterprise.gui.coregui.client.CoreGUI; import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor; +import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeEvent; +import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeListener; import org.rhq.enterprise.gui.coregui.client.components.form.DurationItem; import org.rhq.enterprise.gui.coregui.client.components.form.TimeUnit; import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizardStep; @@ -44,14 +46,13 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout; * @author Jay Shaughnessy * @author Greg Hinkle */ -public class ResourceFactoryConfigurationStep extends AbstractWizardStep { +public class ResourceFactoryConfigurationStep extends AbstractWizardStep implements PropertyValueChangeListener {
- private boolean noConfigurationNeeded = false; // if true, it has been determined the user doesn't have to set any config private LocatableVLayout vLayout; private ConfigurationEditor editor; private Configuration startingConfig; private DurationItem timeoutItem; - AbstractResourceFactoryWizard wizard; + private AbstractResourceFactoryWizard wizard;
public ResourceFactoryConfigurationStep(AbstractResourceFactoryWizard wizard) { this.wizard = wizard; @@ -102,17 +103,19 @@ public class ResourceFactoryConfigurationStep extends AbstractWizardStep { ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService(); configurationService.getOptionValuesForConfigDefinition(def, new AsyncCallback<ConfigurationDefinition>() { + public void onSuccess(ConfigurationDefinition result) { + createAndAddConfigurationEditor(result); + }
public void onFailure(Throwable throwable) { - editor = new ConfigurationEditor(vLayout.extendLocatorId("Editor"), def, startingConfig); - editor.setAllPropertiesWritable(true); - vLayout.addMember(editor, 0); - + createAndAddConfigurationEditor(def); }
- public void onSuccess(ConfigurationDefinition result) { - editor = new ConfigurationEditor(vLayout.extendLocatorId("Editor"), result, startingConfig); + private void createAndAddConfigurationEditor(ConfigurationDefinition def) { + editor = new ConfigurationEditor(vLayout.extendLocatorId("Editor"), def, startingConfig); editor.setAllPropertiesWritable(true); + editor.addPropertyValueChangeListener(ResourceFactoryConfigurationStep.this); + wizard.getView().updateButtonEnablement(); vLayout.addMember(editor, 0); } }); @@ -122,9 +125,15 @@ public class ResourceFactoryConfigurationStep extends AbstractWizardStep { return vLayout; }
+ @Override + public boolean isNextButtonEnabled() { + return (editor != null) && editor.isValid(); + } + public boolean nextPage() { - if (noConfigurationNeeded == true || (editor != null && editor.validate())) { - wizard.setNewResourceConfiguration((noConfigurationNeeded) ? null : editor.getConfiguration()); + // Finish. + if ((editor != null) && editor.isValid()) { + wizard.setNewResourceConfiguration(editor.getConfiguration()); wizard.setNewResourceCreateTimeout(timeoutItem.getValueAsInteger()); wizard.execute(); return true; @@ -136,4 +145,10 @@ public class ResourceFactoryConfigurationStep extends AbstractWizardStep { public String getName() { return MSG.widget_resourceFactoryWizard_editConfigStepName(); } + + @Override + public void propertyValueChanged(PropertyValueChangeEvent event) { + wizard.getView().updateButtonEnablement(); + } + } \ No newline at end of file
commit b967a205193b3dbb70f507f7a3df74f0474cb06b Author: Ian Springer ian.springer@redhat.com Date: Wed Dec 7 13:50:58 2011 -0500
minor - remove manual boxing
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java index 9fa7dd2..b1364b0 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java @@ -64,7 +64,7 @@ public class BundleUploadDataStep extends AbstractWizardStep { mainLayout = new LocatableVLayout("BundleCreateUploadData"); }
- mainLayout.setMargin(Integer.valueOf(20)); + mainLayout.setMargin(20); mainLayout.setWidth100(); mainLayout.setHeight(10);
commit f736fd47d4d07204a9f9b8b0f98f8f74bc0fe9f2 Author: Ian Springer ian.springer@redhat.com Date: Wed Dec 7 13:49:40 2011 -0500
don't prepend RHQ Server resource name with "AS "; include JNP port in RHQ Server resource name; refactor formatServerName() to use a StringBuilder and be more readable
diff --git a/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASDiscoveryComponent.java b/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASDiscoveryComponent.java index 185ecff..62b39b6 100644 --- a/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASDiscoveryComponent.java +++ b/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASDiscoveryComponent.java @@ -66,7 +66,7 @@ import org.rhq.plugins.jbossas.util.JnpConfig; import org.rhq.plugins.jmx.JMXDiscoveryComponent;
/** - * Discovers JBossAS 3.2.x and 4.x server instances. + * Discovers instances of JBoss AS 3.2.3 through 4.2.x, and JBoss EAP and SOA-P 4.x. * * @author John Mazzitelli * @author Ian Springer @@ -296,8 +296,8 @@ public class JBossASDiscoveryComponent implements ResourceDiscoveryComponent, Ma
final JBossProductType productType = installInfo.getProductType(); String description = productType.DESCRIPTION + " " + installInfo.getMajorVersion(); - boolean isInServer = isRhqServer(absoluteConfigPath); - if (isInServer) { + boolean isRhqServer = isRhqServer(absoluteConfigPath); + if (isRhqServer) { description += " hosting the RHQ Server";
// RHQ-633 : We know this is an RHQ Server. Let's auto-configure for tracking its log file, which is not in @@ -324,13 +324,13 @@ public class JBossASDiscoveryComponent implements ResourceDiscoveryComponent, Ma } } } - final String PRODUCT_PREFIX = productType.name() + " "; - String name = PRODUCT_PREFIX - + formatServerName(bindingAddress, namingPort, discoveryContext.getSystemInformation().getHostname(), - absoluteConfigPath.getName(), isInServer); - - return new DiscoveredResourceDetails(discoveryContext.getResourceType(), key, name, PRODUCT_PREFIX - + installInfo.getVersion(), description, pluginConfiguration, processInfo); + + String name = formatServerName(bindingAddress, namingPort, discoveryContext.getSystemInformation().getHostname(), + absoluteConfigPath.getName(), productType, isRhqServer); + String version = productType.name() + " " + installInfo.getVersion(); + + return new DiscoveredResourceDetails(discoveryContext.getResourceType(), key, name, version, description, + pluginConfiguration, processInfo); }
/** @@ -379,7 +379,8 @@ public class JBossASDiscoveryComponent implements ResourceDiscoveryComponent, Ma try { installInfo = new JBossInstallationInfo(homeDir); } catch (IOException e) { - throw new IllegalStateException(e); + throw new IllegalStateException("Failed to determine installation info for JBoss home dir [" + + homeDir + "].", e); } File configDir = (File) server.getAttribute(configObjectName, "ServerHomeDir");
@@ -405,51 +406,70 @@ public class JBossASDiscoveryComponent implements ResourceDiscoveryComponent, Ma // Now set default values on any props that are still not set. setPluginConfigurationDefaults(pluginConfiguration);
- String resourceName = formatServerName(bindAddress, jnpPort, context.getSystemInformation() - .getHostname(), configName, isRhqServer(configDir)); + JBossProductType productType = installInfo.getProductType(); + String name = formatServerName(bindAddress, jnpPort, context.getSystemInformation().getHostname(), + configName, productType, isRhqServer(configDir)); + String description = productType.NAME + + " server that the RHQ Plugin Container is running within"; DiscoveredResourceDetails resource = new DiscoveredResourceDetails(context.getResourceType(), - configDir.getAbsolutePath(), resourceName, version, - "JBoss AS server that the RHQ Plugin Container is running within", pluginConfiguration, null); + configDir.getAbsolutePath(), name, version, description, pluginConfiguration, null);
return resource; } } catch (Exception e) { - /* JBoss MBean doesn't exist - not a JBoss server. */ - if (log.isDebugEnabled()) - log.debug("Not detected to be embedded in a JBoss AS Server", e); + // JBoss MBean doesn't exist - not a JBoss server. + log.debug("Not detected to be embedded in a JBoss AS Server", e); }
return null; }
public String formatServerName(String bindingAddress, String jnpPort, String hostname, String configurationName, - boolean isRhq) { + JBossProductType productType, boolean isRhq) { + StringBuilder serverName = new StringBuilder(); + + if (!isRhq) { + // prefix w/ product name (e.g. "AS" or "EAP") + serverName.append(productType.name()).append(' '); + } + + String bindingHostname = getBindingHostname(bindingAddress); + if (bindingHostname != null) { + serverName.append(bindingHostname); + } else { + serverName.append(hostname); + } + + if (jnpPort != null && !jnpPort.equals(CHANGE_ME)) { + serverName.append(':').append(jnpPort); + }
+ serverName.append(' '); if (isRhq) { - return hostname + " RHQ Server"; + serverName.append("RHQ Server"); } else { - String hostnameToUse = hostname; + serverName.append(configurationName); + }
- if (bindingAddress != null) { - try { - InetAddress bindAddr = InetAddress.getByName(bindingAddress); - if (!bindAddr.isAnyLocalAddress()) { - //if the binding address != 0.0.0.0 - hostnameToUse = bindAddr.getHostName(); - } - } catch (UnknownHostException e) { - //this should not happen? - log.warn("Unknown hostname passed in as the binding address for JBoss AS server discovery: " - + bindingAddress); - } - } + return serverName.toString(); + }
- if (jnpPort != null && !jnpPort.equals(CHANGE_ME)) { - hostnameToUse += ":" + jnpPort; + private String getBindingHostname(String bindingAddress) { + String bindingHostname = null; + if (bindingAddress != null) { + try { + InetAddress bindAddr = InetAddress.getByName(bindingAddress); + if (!bindAddr.isAnyLocalAddress()) { + //if the binding address != 0.0.0.0 + bindingHostname = bindAddr.getHostName(); + } + } catch (UnknownHostException e) { + //this should not happen? + log.warn("Unknown hostname passed in as the binding address for JBoss AS instance: " + + bindingAddress); } - - return hostnameToUse + " " + configurationName; } + return bindingHostname; }
private static String getJnpURL(JBossInstanceInfo cmdLine, File installHome, File configDir) {
commit 664dc6e66fc82257d60c51837c495d60f873505f Author: Ian Springer ian.springer@redhat.com Date: Wed Dec 7 13:46:44 2011 -0500
change log messages from INFO to DEBUG to be consistent w/ other plugins
diff --git a/modules/plugins/rhq-agent/src/main/java/org/rhq/plugins/agent/AgentDiscoveryComponent.java b/modules/plugins/rhq-agent/src/main/java/org/rhq/plugins/agent/AgentDiscoveryComponent.java index 0faecf2..bef2731 100644 --- a/modules/plugins/rhq-agent/src/main/java/org/rhq/plugins/agent/AgentDiscoveryComponent.java +++ b/modules/plugins/rhq-agent/src/main/java/org/rhq/plugins/agent/AgentDiscoveryComponent.java @@ -64,7 +64,7 @@ public class AgentDiscoveryComponent implements ResourceDiscoveryComponent, Reso * @see ResourceDiscoveryComponent#discoverResources(ResourceDiscoveryContext) */ public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) { - log.info("Discovering RHQ Agent..."); + log.debug("Discovering RHQ Agent...");
HashSet<DiscoveredResourceDetails> set = new HashSet<DiscoveredResourceDetails>();
diff --git a/modules/plugins/script/src/main/java/org/rhq/plugins/script/ScriptDiscoveryComponent.java b/modules/plugins/script/src/main/java/org/rhq/plugins/script/ScriptDiscoveryComponent.java index eb58227..8cbd84e 100644 --- a/modules/plugins/script/src/main/java/org/rhq/plugins/script/ScriptDiscoveryComponent.java +++ b/modules/plugins/script/src/main/java/org/rhq/plugins/script/ScriptDiscoveryComponent.java @@ -52,7 +52,7 @@ public class ScriptDiscoveryComponent implements ResourceDiscoveryComponent, Man private final Log log = LogFactory.getLog(ScriptDiscoveryComponent.class);
public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) { - log.info("Processing discovered management script resources"); + log.debug("Processing discovered management script resources...");
HashSet<DiscoveredResourceDetails> details = new HashSet<DiscoveredResourceDetails>();
rhq-commits@lists.fedorahosted.org