modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeParser.java | 2 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployNowStep.java | 36 +---- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java | 68 ++++------ modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectPlatformsStep.java | 24 --- modules/enterprise/server/plugins/filetemplate-bundle/src/main/java/org/rhq/enterprise/server/plugins/filetemplate/BundleServerPluginComponent.java | 5 5 files changed, 52 insertions(+), 83 deletions(-)
New commits: commit 9b6a9419e52a21fce453ac6f638541298f9e3a94 Merge: 5ca5f89... 986f0d2... Author: Jay Shaughnessy jshaughn@redhat.com Date: Mon Mar 22 21:25:08 2010 -0400
Merge branch 'gwt' into gwt-jay
commit 5ca5f894d2473a61d93c8bee15ab40bd41468683 Author: Jay Shaughnessy jshaughn@redhat.com Date: Mon Mar 22 21:22:22 2010 -0400
First version of deploy wizard that actually deploys something!
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployNowStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployNowStep.java index e3bc504..55d1a7f 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployNowStep.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployNowStep.java @@ -27,15 +27,14 @@ import com.smartgwt.client.widgets.form.fields.events.ChangedEvent; import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep; -import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync; -import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
public class DeployNowStep implements WizardStep {
- private DynamicForm form; - private final BundleDeployWizard wizard; + static private final String DEPLOY_LATER = "later"; + static private final String DEPLOY_NOW = "now";
- private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService(); + private final BundleDeployWizard wizard; + private DynamicForm form;
public DeployNowStep(BundleDeployWizard bundleCreationWizard) { this.wizard = bundleCreationWizard; @@ -52,16 +51,17 @@ public class DeployNowStep implements WizardStep { form.setNumCols(2); form.setColWidths("50%", "*");
- LinkedHashMap<String, Boolean> values = new LinkedHashMap<String, Boolean>(); - values.put("Deploy Now", Boolean.TRUE); - values.put("Save Definition and Deploy Later", Boolean.FALSE); - final RadioGroupItem radioGroupItem = new RadioGroupItem("options", "Deploy Options"); + RadioGroupItem radioGroupItem = new RadioGroupItem("deployTime", "Deployment Time"); + LinkedHashMap<String, String> radioGroupValues = new LinkedHashMap<String, String>(); + radioGroupValues.put(DEPLOY_NOW, "Deploy Now"); + radioGroupValues.put(DEPLOY_LATER, "Save Definition and Deploy Later"); radioGroupItem.setRequired(true); - radioGroupItem.setValueMap(values); + radioGroupItem.setValueMap(radioGroupValues); + radioGroupItem.setValue(DEPLOY_NOW); + wizard.setDeployNow(true); radioGroupItem.addChangedHandler(new ChangedHandler() { public void onChanged(ChangedEvent event) { - wizard.setDeployNow((Boolean) event.getValue()); - enableNextButtonWhenAppropriate(); + wizard.setDeployNow(DEPLOY_NOW.equals(event.getValue())); } });
@@ -74,19 +74,7 @@ public class DeployNowStep implements WizardStep { return form.validate(); }
- public boolean isNextEnabled() { - return (null != this.wizard.getDeployNow()); - } - public boolean isPreviousEnabled() { return true; } - - private void enableNextButtonWhenAppropriate() { - this.wizard.getView().getNextButton().setDisabled(!isNextEnabled()); - } - - private boolean isNotEmpty(String s) { - return (s != null && s.trim().length() > 0); - } } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java index bbf30bf..f06e278 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java @@ -46,6 +46,10 @@ public class DeployStep implements WizardStep { this.wizard = bundleCreationWizard; }
+ public String getName() { + return "Deploy Bundle to Target Platforms"; + } + public Canvas getCanvas() { if (canvas == null) { canvas = new VLayout(); @@ -66,7 +70,7 @@ public class DeployStep implements WizardStep {
if (wizard.isNewDefinition()) { bundleServer.createBundleDeployDefinition(wizard.getBundleVersion().getId(), wizard.getName(), wizard - .getDescription(), wizard.getConfig(), false, -1, false, + .getDescription(), wizard.getConfig(), false, -1, false, // new AsyncCallback<BundleDeployDefinition>() { public void onSuccess(BundleDeployDefinition result) { deployingImage.setSrc("/images/status_complete.gif"); @@ -75,62 +79,52 @@ public class DeployStep implements WizardStep { new Message("Created deploy definition [" + result.getName() + "] description [" + result.getDescription(), Severity.Info)); wizard.setBundleDeployDefinition(result); - enableNextButtonWhenAppropriate(); + + bundleServer.scheduleBundleDeployment(wizard.getBundleDeployDefinition().getId(), wizard + .getPlatformId(), // + new AsyncCallback<BundleDeployment>() { + public void onSuccess(BundleDeployment result) { + deployingImage.setSrc("/images/status_complete.gif"); + deployingMessage.setText("Bundle Deployment Scheduled!"); + CoreGUI.getMessageCenter().notify( + new Message("Schedule bundle deployment [" + + wizard.getBundleDeployDefinition().getName() + "] resource [" + + result.getResource() + "]", Severity.Info)); + wizard.setBundleDeployment(result); + } + + public void onFailure(Throwable caught) { + deployingImage.setSrc("/images/status_error.gif"); + deployingMessage.setText("Failed to Schedule Deployment!"); + CoreGUI.getErrorHandler().handleError( + "Failed to schedule deployment: " + caught.getMessage(), caught); + wizard.setBundleDeployment(null); + } + }); }
public void onFailure(Throwable caught) { deployingImage.setSrc("/images/status_error.gif"); - deployingMessage.setText("Failed to create deply definition!"); + deployingMessage.setText("Failed to create deploy definition!"); CoreGUI.getErrorHandler().handleError( "Failed to create deploy definition: " + caught.getMessage(), caught); - enableNextButtonWhenAppropriate(); } }); } - - bundleServer.scheduleBundleDeployment(wizard.getBundleDeployDefinition().getId(), wizard.getPlatformId(), - new AsyncCallback<BundleDeployment>() { - public void onSuccess(BundleDeployment result) { - deployingImage.setSrc("/images/status_complete.gif"); - deployingMessage.setText("Bundle Deployment Scheduled!"); - CoreGUI.getMessageCenter().notify( - new Message("Schedule bundle deployment [" + wizard.getBundleDeployDefinition().getName() - + "] resource [" + result.getResource() + "]", Severity.Info)); - wizard.setBundleDeployment(result); - enableNextButtonWhenAppropriate(); - } - - public void onFailure(Throwable caught) { - deployingImage.setSrc("/images/status_error.gif"); - deployingMessage.setText("Failed to Schedule Deployment!"); - CoreGUI.getErrorHandler().handleError("Failed to schedule deployment: " + caught.getMessage(), - caught); - wizard.setBundleDeployment(null); - enableNextButtonWhenAppropriate(); - } - }); }
return canvas; }
- public boolean nextPage() { - return this.wizard.getBundleVersion() != null; - } - - public String getName() { - return "Deploy Bundle to Target Platforms"; - } - public boolean isNextEnabled() { - return this.wizard.getBundleDeployment() != null; + return false; }
public boolean isPreviousEnabled() { return true; }
- private void enableNextButtonWhenAppropriate() { - this.wizard.getView().getNextButton().setDisabled(!isNextEnabled()); + public boolean nextPage() { + return false; } } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectPlatformsStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectPlatformsStep.java index d523fbe..94a4707 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectPlatformsStep.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectPlatformsStep.java @@ -25,20 +25,20 @@ import com.smartgwt.client.widgets.form.fields.events.ChangedEvent; import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep; -import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync; -import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
public class SelectPlatformsStep implements WizardStep {
- private DynamicForm form; private final BundleDeployWizard wizard; - - private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService(); + private DynamicForm form;
public SelectPlatformsStep(BundleDeployWizard bundleCreationWizard) { this.wizard = bundleCreationWizard; }
+ public String getName() { + return "Select Target Platforms"; + } + public Canvas getCanvas() { if (form == null) { form = new DynamicForm(); @@ -55,9 +55,7 @@ public class SelectPlatformsStep implements WizardStep { if (value == null) { value = ""; } - wizard.setSubtitle(value.toString()); wizard.setPlatformId(Integer.valueOf(value.toString())); - enableNextButtonWhenAppropriate(); } });
@@ -71,19 +69,7 @@ public class SelectPlatformsStep implements WizardStep { return form.validate(); }
- public String getName() { - return "Select Target Platforms"; - } - - public boolean isNextEnabled() { - return (null != this.wizard.getPlatformId()); - } - public boolean isPreviousEnabled() { return true; } - - private void enableNextButtonWhenAppropriate() { - this.wizard.getView().getNextButton().setDisabled(!isNextEnabled()); - } }
commit 2717080092cbcd4c08f5c0ac7940e284401bc11c Author: Jay Shaughnessy jshaughn@redhat.com Date: Mon Mar 22 21:21:46 2010 -0400
Make sure display name is set for recipe config items, otherwise the ConfigurationEditor will display nulls.
diff --git a/modules/enterprise/server/plugins/filetemplate-bundle/src/main/java/org/rhq/enterprise/server/plugins/filetemplate/BundleServerPluginComponent.java b/modules/enterprise/server/plugins/filetemplate-bundle/src/main/java/org/rhq/enterprise/server/plugins/filetemplate/BundleServerPluginComponent.java index 342b5b1..a4d7bc9 100644 --- a/modules/enterprise/server/plugins/filetemplate-bundle/src/main/java/org/rhq/enterprise/server/plugins/filetemplate/BundleServerPluginComponent.java +++ b/modules/enterprise/server/plugins/filetemplate-bundle/src/main/java/org/rhq/enterprise/server/plugins/filetemplate/BundleServerPluginComponent.java @@ -85,8 +85,9 @@ public class BundleServerPluginComponent implements ServerPluginComponent, Bundl if (recipeContext.getReplacementVariables() != null) { configDef = new ConfigurationDefinition("replacementVariables", null); for (String replacementVar : recipeContext.getReplacementVariables()) { - PropertyDefinitionSimple prop = new PropertyDefinitionSimple(replacementVar, null, false, - PropertySimpleType.STRING); + PropertyDefinitionSimple prop = new PropertyDefinitionSimple(replacementVar, + "Needed by bundle recipe.", false, PropertySimpleType.STRING); + prop.setDisplayName(replacementVar); configDef.put(prop); } }
commit 2c7d193fcb8a1e92e6171af2a151ff1208ab0df0 Author: Jay Shaughnessy jshaughn@redhat.com Date: Mon Mar 22 21:20:27 2010 -0400
make sure the replacement string is escaped such that regex characters are taken as literals (to handle, for example, windows paths)
diff --git a/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeParser.java b/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeParser.java index d48c3ba..ae6c0a5 100644 --- a/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeParser.java +++ b/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeParser.java @@ -188,7 +188,7 @@ public class RecipeParser { }
// If we didn't find a replacement for the key then leave the original value unchanged - matcher.appendReplacement(buffer, next); + matcher.appendReplacement(buffer, Matcher.quoteReplacement(next)); } matcher.appendTail(buffer); return buffer.toString();
rhq-commits@lists.fedorahosted.org