modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js | 6 modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerUpgrade.js | 4 modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerUpgradeAnt.js | 4 modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerZip.js | 4 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java | 9 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java | 7 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentConfigStep.java | 24 +- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java | 100 ++++----- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/AbstractBundleRevertWizard.java | 9 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java | 80 ++++--- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/RevertStep.java | 4 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java | 12 - modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java | 27 +- modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java | 110 +++++++++- modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java | 18 + modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java | 12 - modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java | 10 modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java | 4 18 files changed, 279 insertions(+), 165 deletions(-)
New commits: commit 7c682ff39a29c6b7d6d962afad385cce1df17410 Merge: 7a14d13... 7cf1692... Author: Jay Shaughnessy jshaughn@redhat.com Date: Fri May 28 13:22:15 2010 -0400
Merge branch 'bundle' into bundle-jay
commit 7a14d13f9bf7c9d73af9acc1d1abef1e4dfaf5ea Author: Jay Shaughnessy jshaughn@redhat.com Date: Fri May 28 13:21:17 2010 -0400
Bundle Deployment - Generate static deployment names - Changed API such that all deployment creation (not just wizard) generates standard naming. - Refactored deploy/revert wizards based on new naming approach - updated tests and test scripts - Also, updated GetDeploymentConfigStep to *not* incrementStep in getCanvas call if there is no config. That approach no mightily messes up the wizards.
diff --git a/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js b/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js index c3ffe08..4241f3b 100644 --- a/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js +++ b/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js @@ -78,15 +78,15 @@ function testDeployment() { var testDest = BundleManager.createBundleDestination( testBundleVersion.getBundle().getId(), "Deployment Test Dest", "test Dest", "/tmp/bundle-test", groupId);
// create a deployment using the above config - var testDeployment = BundleManager.createBundleDeployment(testBundleVersion.getId(), testDest.getId(), "Deployment Test", "Deployment Test of testBundle WAR", new Configuration()); + var testDeployment = BundleManager.createBundleDeployment(testBundleVersion.getId(), testDest.getId(), "Deployment Test of testBundle WAR", new Configuration());
// deploy to the destination var bd = BundleManager.scheduleBundleDeployment(testDeployment.getId(), false); Assert.assertNotNull( bd );
// delete the test bundle if it exists (after allowing agent audit messages to complete) - sleep( 5000 ); - cleanupTestBundle(); + //sleep( 5000 ); + //cleanupTestBundle(); }
function getBundleType() { diff --git a/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerUpgrade.js b/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerUpgrade.js index 19e6e4d..8f36bc6 100644 --- a/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerUpgrade.js +++ b/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerUpgrade.js @@ -89,12 +89,12 @@ function testGroupDeployment() { var testDest = BundleManager.createBundleDestination(testBundleVersion1.getBundle().getId(), "upgrade destination", "upgrade destination", "/tmp/upgrade-bundle-test", groupId);
// create a deployment of 1.0 using the 1.0 config - var testDeployment = BundleManager.createBundleDeployment(testBundleVersion1.getId(), testDest.getId(), "Upgrade Deployment Test 1", "Creating initial deployment to be upgraded", config1); + var testDeployment = BundleManager.createBundleDeployment(testBundleVersion1.getId(), testDest.getId(), "Creating initial deployment to be upgraded", config1); var bgd = BundleManager.scheduleBundleDeployment(testDeployment.getId(), true); Assert.assertNotNull( bgd, "Failed to create 1.0 deployment" );
// upgrade the deployment to 2.0 using the 2.0 config - testDeployment = BundleManager.createBundleDeployment(testBundleVersion2.getId(), testDest.getId(), "Upgrade Deployment Test 2", "Testing upgrade deployment", config2); + testDeployment = BundleManager.createBundleDeployment(testBundleVersion2.getId(), testDest.getId(), "Testing upgrade deployment", config2); bgd = BundleManager.scheduleBundleDeployment(testDeployment.getId(), false); Assert.assertNotNull( bgd, "Failed to upgrade to 2.0 deployment" ); } diff --git a/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerUpgradeAnt.js b/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerUpgradeAnt.js index db33709..a88faa4 100644 --- a/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerUpgradeAnt.js +++ b/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerUpgradeAnt.js @@ -90,12 +90,12 @@ function testGroupDeployment() { var testDest = BundleManager.createBundleDestination(testBundleVersion1.getBundle().getId(), "upgrade destination", "upgrade destination", "/tmp/upgrade-bundle-ant-test", groupId);
// create a deployment of 1.0 using the 1.0 config - var testDeployment = BundleManager.createBundleDeployment(testBundleVersion1.getId(), testDest.getId(), "Upgrade Deployment with Ant Test 1", "Creating initial ant bundle deployment to be upgraded", config1); + var testDeployment = BundleManager.createBundleDeployment(testBundleVersion1.getId(), testDest.getId(), "Creating initial ant bundle deployment to be upgraded", config1); var bgd = BundleManager.scheduleBundleDeployment(testDeployment.getId(), true); Assert.assertNotNull( bgd, "Failed to create 1.0 deployment" );
// upgrade the deployment to 2.0 using the 2.0 config - testDeployment = BundleManager.createBundleDeployment(testBundleVersion2.getId(), testDest.getId(), "Upgrade Deployment with Ant Test 2", "Testing ant bundle upgrade deployment", config2); + testDeployment = BundleManager.createBundleDeployment(testBundleVersion2.getId(), testDest.getId(), "Testing ant bundle upgrade deployment", config2); bgd = BundleManager.scheduleBundleDeployment(testDeployment.getId(), false); Assert.assertNotNull( bgd, "Failed to upgrade to 2.0 deployment" ); } diff --git a/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerZip.js b/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerZip.js index db342e4..1e260b5 100644 --- a/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerZip.js +++ b/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerZip.js @@ -83,7 +83,7 @@ function testDeployment() { config.put( property );
// create a deployment using the above config - var testDeployment = BundleManager.createBundleDeployment(testBundleVersion.getId(), testDest.getId(), "Deployment Zip Test", "Deployment Test of dummy ZIP", config); + var testDeployment = BundleManager.createBundleDeployment(testBundleVersion.getId(), testDest.getId(), "Deployment Test of dummy ZIP", config);
var bd = BundleManager.scheduleBundleDeployment(testDeployment.getId(), false); Assert.assertNotNull( bd ); @@ -97,7 +97,7 @@ function testDeployment() { config2.put( property );
// create a deployment using the above config - var testRedeploy = BundleManager.createBundleDeployment(testBundleVersion.getId(), testDest.getId(), "Redeployment Zip Test", "Redeploy Test of dummy ZIP", config2); + var testRedeploy = BundleManager.createBundleDeployment(testBundleVersion.getId(), testDest.getId(), "Redeploy Test of dummy ZIP", config2);
var bd2 = BundleManager.scheduleBundleDeployment(testRedeploy.getId(), false); Assert.assertNotNull( bd2 ); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java index 815b647..88b67be 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java @@ -37,7 +37,6 @@ public abstract class AbstractBundleDeployWizard extends AbstractBundleWizard { private BundleVersion bundleVersion; private boolean initialDeployment = false; private Configuration newDeploymentConfig; - private String newDeploymentName; private String newDeploymentDescription; private BundleDeployment newDeployment; private boolean isCleanDeployment = false; @@ -61,14 +60,6 @@ public abstract class AbstractBundleDeployWizard extends AbstractBundleWizard { this.bundleVersion = bundleVersion; }
- public String getNewDeploymentName() { - return newDeploymentName; - } - - public void setNewDeploymentName(String newDeploymentName) { - this.newDeploymentName = newDeploymentName; - } - public String getNewDeploymentDescription() { return newDeploymentDescription; } 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 52248ab..0e52ab1 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 @@ -71,9 +71,8 @@ public class DeployStep implements WizardStep { canvas.addMember(deployingImage); canvas.addMember(deployingMessage);
- bundleServer.createBundleDeployment(wizard.getBundleVersion().getId(), wizard.getDestination() - .getId(), wizard.getNewDeploymentName(), wizard.getNewDeploymentDescription(), wizard - .getNewDeploymentConfig(), false, -1, false, // + bundleServer.createBundleDeployment(wizard.getBundleVersion().getId(), wizard.getDestination().getId(), + wizard.getNewDeploymentDescription(), wizard.getNewDeploymentConfig(), false, -1, false, // new AsyncCallback<BundleDeployment>() { public void onSuccess(BundleDeployment result) { deployingImage.setSrc("/images/status_complete.gif"); @@ -90,7 +89,7 @@ public class DeployStep implements WizardStep { deployingImage.setSrc("/images/status_complete.gif"); deployingMessage.setText("Bundle Deployment Scheduled!"); CoreGUI.getMessageCenter().notify( - new Message("Scheduled bundle deployment [" + wizard.getNewDeploymentName() + new Message("Scheduled bundle deployment [" + result.getName() + "] resource group [" + result.getDestination().getGroup() + "]", Severity.Info)); wizard.setNewDeployment(result); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentConfigStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentConfigStep.java index f3c2281..505948b 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentConfigStep.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentConfigStep.java @@ -19,16 +19,18 @@ package org.rhq.enterprise.gui.coregui.client.bundle.deploy;
import com.smartgwt.client.widgets.Canvas; +import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.configuration.Configuration; import org.rhq.core.domain.configuration.definition.ConfigurationDefinition; +import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel; import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor; import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
public class GetDeploymentConfigStep implements WizardStep {
private final BundleDeployWizard wizard; - private ConfigurationEditor editor; + private VLayout editor;
public GetDeploymentConfigStep(BundleDeployWizard wizard) { this.wizard = wizard; @@ -40,16 +42,22 @@ public class GetDeploymentConfigStep implements WizardStep {
public Canvas getCanvas() { if (null == editor) { - ConfigurationDefinition configDef = this.wizard.getBundleVersion().getConfigurationDefinition(); + ConfigurationDefinition configDef = wizard.getBundleVersion().getConfigurationDefinition();
// if there are no prop defs for this config def then we can skip this step entirely. just // set an empty config. if (configDef.getPropertyDefinitions().isEmpty()) { - this.wizard.setNewDeploymentConfig(new Configuration()); - this.wizard.getView().incrementStep(); + wizard.setNewDeploymentConfig(new Configuration()); + // This has started behaving badly. Instead of moving ahead let's give them a message + // and a chance to go back to the previous screen. + // this.wizard.getView().incrementStep(); + HeaderLabel label = new HeaderLabel("No configuration needed for this bundle version"); + label.setWidth100(); + editor = new VLayout(); + editor.addMember(label); } else { // otherwise, pop up the config editor to get the needed config - Configuration startingConfig = (null == this.wizard.getLiveDeployment()) ? new Configuration() + Configuration startingConfig = (null == wizard.getLiveDeployment()) ? new Configuration() : getNormalizedLiveConfig(configDef); editor = new ConfigurationEditor(configDef, startingConfig); } @@ -59,7 +67,7 @@ public class GetDeploymentConfigStep implements WizardStep { }
private Configuration getNormalizedLiveConfig(ConfigurationDefinition configDef) { - Configuration config = this.wizard.getLiveDeployment().getConfiguration(); + Configuration config = wizard.getLiveDeployment().getConfiguration(); if (null == config) { config = new Configuration(); } else { @@ -73,7 +81,9 @@ public class GetDeploymentConfigStep implements WizardStep { }
public boolean nextPage() { - wizard.setNewDeploymentConfig(editor.getConfiguration()); + if (null == wizard.getNewDeploymentConfig()) { + wizard.setNewDeploymentConfig(((ConfigurationEditor) editor).getConfiguration()); + } return true; } } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java index 36c7cde..1c00b7d 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java @@ -18,6 +18,7 @@ */ package org.rhq.enterprise.gui.coregui.client.bundle.deploy;
+import com.google.gwt.user.client.rpc.AsyncCallback; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.form.DynamicForm; import com.smartgwt.client.widgets.form.fields.CheckboxItem; @@ -26,7 +27,10 @@ import com.smartgwt.client.widgets.form.fields.TextAreaItem; 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.CoreGUI; 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;
/** * @author Jay Shaughnessy @@ -36,6 +40,7 @@ public class GetDeploymentInfoStep implements WizardStep {
private DynamicForm form; private final BundleDeployWizard wizard; + private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
public GetDeploymentInfoStep(BundleDeployWizard wizard) { this.wizard = wizard; @@ -52,67 +57,52 @@ public class GetDeploymentInfoStep implements WizardStep { form.setNumCols(2); form.setColWidths("50%", "*");
- final StaticTextItem nameTextItem = new StaticTextItem("name", "Deployment Name"); - nameTextItem.setWidth(300); - wizard.setNewDeploymentName(getDeploymentName()); - wizard.setSubtitle(wizard.getNewDeploymentName()); - nameTextItem.setValue(wizard.getNewDeploymentName()); - - final TextAreaItem descriptionTextAreaItem = new TextAreaItem("description", "Deployment Description"); - descriptionTextAreaItem.setWidth(300); - descriptionTextAreaItem.addChangedHandler(new ChangedHandler() { - public void onChanged(ChangedEvent event) { - Object value = event.getValue(); - if (value == null) { - value = ""; - } - wizard.setNewDeploymentDescription(value.toString()); - } - }); - - final CheckboxItem cleanDeploymentCBItem = new CheckboxItem("cleanDeployment", - "Clean Deployment? (wipe deploy directory on destination platform)"); - cleanDeploymentCBItem.setValue(wizard.isCleanDeployment()); - cleanDeploymentCBItem.addChangedHandler(new ChangedHandler() { - public void onChanged(ChangedEvent event) { - wizard.setCleanDeployment((Boolean) event.getValue()); - } - }); - - form.setItems(nameTextItem, descriptionTextAreaItem, cleanDeploymentCBItem); - } + bundleServer.getBundleDeploymentName(wizard.getDestination().getId(), wizard.getBundleVersion().getId(), + -1, // + new AsyncCallback<String>() { + + public void onSuccess(String result) { + final StaticTextItem nameTextItem = new StaticTextItem("name", "Deployment Name"); + nameTextItem.setWidth(300); + wizard.setSubtitle(result); + nameTextItem.setValue(result); + + final TextAreaItem descriptionTextAreaItem = new TextAreaItem("description", + "Deployment Description"); + descriptionTextAreaItem.setWidth(300); + descriptionTextAreaItem.addChangedHandler(new ChangedHandler() { + public void onChanged(ChangedEvent event) { + Object value = event.getValue(); + if (value == null) { + value = ""; + } + wizard.setNewDeploymentDescription(value.toString()); + } + }); + + final CheckboxItem cleanDeploymentCBItem = new CheckboxItem("cleanDeployment", + "Clean Deployment? (wipe deploy directory on destination platform)"); + cleanDeploymentCBItem.setValue(wizard.isCleanDeployment()); + cleanDeploymentCBItem.addChangedHandler(new ChangedHandler() { + public void onChanged(ChangedEvent event) { + wizard.setCleanDeployment((Boolean) event.getValue()); + } + }); + + form.setItems(nameTextItem, descriptionTextAreaItem, cleanDeploymentCBItem);
- return form; - } + }
- private String getDeploymentName() { - String deploymentName = "none"; - - int deploy = 1; - String version = wizard.getBundleVersion().getVersion(); - String dest = wizard.getDestination().getName(); - - if (wizard.isInitialDeployment()) { - deploymentName = "Deployment [" + deploy + "] of Version [" + version + "] to [" + dest + "]"; - } else { - String liveName = wizard.getLiveDeployment().getName(); - String liveVersion = wizard.getLiveDeployment().getBundleVersion().getVersion(); - if (liveVersion.equals(version)) { - // redeploy - int iStart = liveName.indexOf("[") + 1, iEnd = liveName.indexOf("]"); - deploy = Integer.valueOf(liveName.substring(iStart, iEnd)) + 1; - deploymentName = "Deployment [" + deploy + "] of Version [" + version + "] to [" + dest + "]"; - } else { - // upgrade - deploymentName = "Deployment [" + deploy + "] of Version [" + version + "] to [" + dest - + "]. Upgrade from Version [" + liveVersion + "]"; - } + public void onFailure(Throwable caught) { + CoreGUI.getErrorHandler().handleError("Failed to get deployment name.", caught); + } + }); }
- return deploymentName; + return form; }
public boolean nextPage() { - return true; + return form.validate(); } } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/AbstractBundleRevertWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/AbstractBundleRevertWizard.java index 05f8f96..9d01d2c 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/AbstractBundleRevertWizard.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/AbstractBundleRevertWizard.java @@ -30,21 +30,12 @@ public abstract class AbstractBundleRevertWizard extends AbstractBundleWizard {
// the things we build up in the wizard private BundleDestination destination; - private String deploymentName; private String deploymentDescription; private BundleDeployment deployment; private boolean isCleanDeployment = false; private BundleDeployment liveDeployment; private BundleDeployment previousDeployment;
- public String getDeploymentName() { - return deploymentName; - } - - public void setDeploymentName(String deploymentName) { - this.deploymentName = deploymentName; - } - public String getDeploymentDescription() { return deploymentDescription; } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java index 827c3e3..5608172 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java @@ -18,6 +18,7 @@ */ package org.rhq.enterprise.gui.coregui.client.bundle.revert;
+import com.google.gwt.user.client.rpc.AsyncCallback; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.form.DynamicForm; import com.smartgwt.client.widgets.form.fields.CheckboxItem; @@ -26,7 +27,10 @@ import com.smartgwt.client.widgets.form.fields.TextAreaItem; 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.CoreGUI; 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;
/** * @author Jay Shaughnessy @@ -36,6 +40,7 @@ public class GetRevertInfoStep implements WizardStep {
private DynamicForm form; private final BundleRevertWizard wizard; + private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
public GetRevertInfoStep(BundleRevertWizard wizard) { this.wizard = wizard; @@ -52,42 +57,51 @@ public class GetRevertInfoStep implements WizardStep { form.setNumCols(2); form.setColWidths("50%", "*");
- final StaticTextItem nameTextItem = new StaticTextItem("name", "Revert Deployment Name"); - nameTextItem.setRequired(true); - nameTextItem.setWidth(300); - wizard.setDeploymentName("[REVERT To] " + this.wizard.getPreviousDeployment().getName()); - wizard.setSubtitle(wizard.getDeploymentName()); - nameTextItem.setValue(wizard.getDeploymentName()); + bundleServer.getBundleDeploymentName(wizard.getDestination().getId(), -1, wizard.getPreviousDeployment() + .getId(), // + new AsyncCallback<String>() {
- final TextAreaItem descriptionTextAreaItem = new TextAreaItem("description", - "Revert Deployment Description"); - descriptionTextAreaItem.setWidth(300); - String liveDesc = this.wizard.getLiveDeployment().getDescription(); - liveDesc = (null == liveDesc) ? this.wizard.getLiveDeployment().getName() : liveDesc; - String prevDesc = this.wizard.getPreviousDeployment().getDescription(); - prevDesc = (null == prevDesc) ? this.wizard.getPreviousDeployment().getName() : prevDesc; - wizard.setDeploymentDescription("[REVERT From]\n" + liveDesc + "\n\n[REVERT To]\n" + prevDesc); - descriptionTextAreaItem.setValue(wizard.getDeploymentDescription()); - descriptionTextAreaItem.addChangedHandler(new ChangedHandler() { - public void onChanged(ChangedEvent event) { - Object value = event.getValue(); - if (value == null) { - value = ""; - } - wizard.setDeploymentDescription(value.toString()); - } - }); + public void onSuccess(String result) { + final StaticTextItem nameTextItem = new StaticTextItem("name", "Revert Deployment Name"); + nameTextItem.setWidth(300); + wizard.setSubtitle(result); + nameTextItem.setValue(result); + + final TextAreaItem descriptionTextAreaItem = new TextAreaItem("description", + "Revert Deployment Description"); + descriptionTextAreaItem.setWidth(300); + String liveDesc = wizard.getLiveDeployment().getDescription(); + liveDesc = (null == liveDesc) ? wizard.getLiveDeployment().getName() : liveDesc; + String prevDesc = wizard.getPreviousDeployment().getDescription(); + prevDesc = (null == prevDesc) ? wizard.getPreviousDeployment().getName() : prevDesc; + wizard.setDeploymentDescription("[REVERT From]\n" + liveDesc + "\n\n[REVERT To]\n" + prevDesc); + descriptionTextAreaItem.setValue(wizard.getDeploymentDescription()); + descriptionTextAreaItem.addChangedHandler(new ChangedHandler() { + public void onChanged(ChangedEvent event) { + Object value = event.getValue(); + if (value == null) { + value = ""; + } + wizard.setDeploymentDescription(value.toString()); + } + });
- final CheckboxItem cleanDeploymentCBItem = new CheckboxItem("cleanDeployment", - "Clean Deployment? (wipe deploy directory prior to the revert deploy)"); - cleanDeploymentCBItem.setValue(wizard.isCleanDeployment()); - cleanDeploymentCBItem.addChangedHandler(new ChangedHandler() { - public void onChanged(ChangedEvent event) { - wizard.setCleanDeployment((Boolean) event.getValue()); - } - }); + final CheckboxItem cleanDeploymentCBItem = new CheckboxItem("cleanDeployment", + "Clean Deployment? (wipe deploy directory prior to the revert deploy)"); + cleanDeploymentCBItem.setValue(wizard.isCleanDeployment()); + cleanDeploymentCBItem.addChangedHandler(new ChangedHandler() { + public void onChanged(ChangedEvent event) { + wizard.setCleanDeployment((Boolean) event.getValue()); + } + });
- form.setItems(nameTextItem, descriptionTextAreaItem, cleanDeploymentCBItem); + form.setItems(nameTextItem, descriptionTextAreaItem, cleanDeploymentCBItem); + } + + public void onFailure(Throwable caught) { + CoreGUI.getErrorHandler().handleError("Failed to get revert deployment name.", caught); + } + }); }
return form; diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/RevertStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/RevertStep.java index 6388ac8..04bec9f 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/RevertStep.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/RevertStep.java @@ -72,13 +72,13 @@ public class RevertStep implements WizardStep { canvas.addMember(deployingMessage);
bundleServer.scheduleRevertBundleDeployment(this.wizard.getDestination().getId(), this.wizard - .getDeploymentName(), this.wizard.getDeploymentDescription(), this.wizard.isCleanDeployment(), // + .getDeploymentDescription(), this.wizard.isCleanDeployment(), // new AsyncCallback<BundleDeployment>() { public void onSuccess(BundleDeployment result) { deployingImage.setSrc("/images/status_complete.gif"); deployingMessage.setText("Revert Deployment Scheduled!"); CoreGUI.getMessageCenter().notify( - new Message("Scheduled revert bundle deployment [" + wizard.getDeploymentName() + new Message("Scheduled revert bundle deployment [" + result.getName() + "] resource group [" + result.getDestination().getGroup() + "]", Severity.Info)); wizard.setDeployment(result); } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java index 11b6851..ad56819 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java @@ -48,9 +48,9 @@ public interface BundleGWTService extends RemoteService {
BundleVersion createBundleVersionViaRecipe(String recipe) throws Exception;
- BundleDeployment createBundleDeployment(int bundleVersionId, int bundleDestinationId, String name, - String description, Configuration configuration, boolean enforcePolicy, int enforcementInterval, - boolean pinToBundle) throws Exception; + BundleDeployment createBundleDeployment(int bundleVersionId, int bundleDestinationId, String description, + Configuration configuration, boolean enforcePolicy, int enforcementInterval, boolean pinToBundle) + throws Exception;
BundleDestination createBundleDestination(int bundleId, String name, String description, String deployDir, int groupId) throws Exception; @@ -82,9 +82,11 @@ public interface BundleGWTService extends RemoteService {
ArrayList<BundleType> getAllBundleTypes() throws Exception;
+ String getBundleDeploymentName(int bundleDestinationId, int bundleVersionId, int prevDeploymentId); + BundleDeployment scheduleBundleDeployment(int bundleDeploymentId, boolean isCleanDeployment) throws Exception;
- BundleDeployment scheduleRevertBundleDeployment(int bundleDestinationId, String deploymentName, - String deploymentDescription, boolean isCleanDeployment) throws Exception; + BundleDeployment scheduleRevertBundleDeployment(int bundleDestinationId, String deploymentDescription, + boolean isCleanDeployment) throws Exception;
} \ No newline at end of file diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java index e48eb04..cfb8d18 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java @@ -66,13 +66,13 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund } }
- public BundleDeployment createBundleDeployment(int bundleVersionId, int bundleDestinationId, String name, - String description, Configuration configuration, boolean enforcePolicy, int enforcementInterval, - boolean pinToBundle) throws Exception { + public BundleDeployment createBundleDeployment(int bundleVersionId, int bundleDestinationId, String description, + Configuration configuration, boolean enforcePolicy, int enforcementInterval, boolean pinToBundle) + throws Exception {
try { BundleDeployment result = bundleManager.createBundleDeployment(getSessionSubject(), bundleVersionId, - bundleDestinationId, name, description, configuration); + bundleDestinationId, description, configuration); return SerialUtility.prepare(result, "createBundleDeployment"); } catch (Exception e) { throw new Exception(ThrowableUtil.getAllMessages(e)); @@ -147,10 +147,21 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund HashMap<String, Boolean> results = new HashMap<String, Boolean>(); try { results.putAll(bundleManager.getAllBundleVersionFilenames(getSessionSubject(), bundleVersionId)); + return SerialUtility.prepare(results, "getAllBundleVersionFilenames"); + } catch (Exception e) { + throw new RuntimeException(ThrowableUtil.getAllMessages(e)); + } + } + + public String getBundleDeploymentName(int bundleDestinationId, int bundleVersionId, int prevDeploymentId) { + String result; + try { + result = bundleManager.getBundleDeploymentName(getSessionSubject(), bundleDestinationId, bundleVersionId, + prevDeploymentId); + return SerialUtility.prepare(result, "getBundleDeploymentName"); } catch (Exception e) { throw new RuntimeException(ThrowableUtil.getAllMessages(e)); } - return SerialUtility.prepare(results, "getAllBundleVersionFilenames"); }
public BundleDeployment scheduleBundleDeployment(int bundleDeploymentId, boolean isCleanDeployment) @@ -164,11 +175,11 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund } }
- public BundleDeployment scheduleRevertBundleDeployment(int bundleDeploymentId, String deploymentName, - String deploymentDescription, boolean isCleanDeployment) throws Exception { + public BundleDeployment scheduleRevertBundleDeployment(int bundleDeploymentId, String deploymentDescription, + boolean isCleanDeployment) throws Exception { try { BundleDeployment result = bundleManager.scheduleRevertBundleDeployment(getSessionSubject(), - bundleDeploymentId, deploymentName, deploymentDescription, isCleanDeployment); + bundleDeploymentId, deploymentDescription, isCleanDeployment); return SerialUtility.prepare(result, "scheduleRevertBundleDeployment"); } catch (Exception e) { throw new RuntimeException(ThrowableUtil.getAllMessages(e)); diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java index 4b72dcf..50eaef9 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java @@ -204,17 +204,22 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot public BundleDeployment createBundleDeploymentInNewTrans(Subject subject, int bundleVersionId, int bundleDestinationId, String name, String description, Configuration configuration) throws Exception {
- return bundleManager.createBundleDeployment(subject, bundleVersionId, bundleDestinationId, name, description, - configuration); + BundleVersion bundleVersion = entityManager.find(BundleVersion.class, bundleVersionId); + if (null == bundleVersion) { + throw new IllegalArgumentException("Invalid bundleVersionId: " + bundleVersionId); + } + BundleDestination bundleDestination = entityManager.find(BundleDestination.class, bundleDestinationId); + if (null == bundleDestination) { + throw new IllegalArgumentException("Invalid bundleDestinationId: " + bundleVersionId); + } + + return createBundleDeploymentImpl(subject, bundleVersion, bundleDestination, name, description, configuration); }
@RequiredPermission(Permission.MANAGE_BUNDLE) public BundleDeployment createBundleDeployment(Subject subject, int bundleVersionId, int bundleDestinationId, - String name, String description, Configuration configuration) throws Exception { + String description, Configuration configuration) throws Exception {
- if (null == name || "".equals(name.trim())) { - throw new IllegalArgumentException("Invalid bundleDeploymentName: " + name); - } BundleVersion bundleVersion = entityManager.find(BundleVersion.class, bundleVersionId); if (null == bundleVersion) { throw new IllegalArgumentException("Invalid bundleVersionId: " + bundleVersionId); @@ -223,6 +228,16 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot if (null == bundleDestination) { throw new IllegalArgumentException("Invalid bundleDestinationId: " + bundleVersionId); } + + String name = getBundleDeploymentNameImpl(subject, bundleDestination, bundleVersion, null); + return this.createBundleDeploymentImpl(subject, bundleVersion, bundleDestination, name, description, + configuration); + } + + private BundleDeployment createBundleDeploymentImpl(Subject subject, BundleVersion bundleVersion, + BundleDestination bundleDestination, String name, String description, Configuration configuration) + throws Exception { + ConfigurationDefinition configDef = bundleVersion.getConfigurationDefinition(); if (null != configDef) { if (null == configuration) { @@ -271,6 +286,84 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot return dest; }
+ public String getBundleDeploymentName(Subject subject, int bundleDestinationId, int bundleVersionId, + int prevDeploymentId) { + BundleDestination bundleDestination = entityManager.find(BundleDestination.class, bundleDestinationId); + if (null == bundleDestination) { + throw new IllegalArgumentException("Invalid bundleDestinationId: " + bundleVersionId); + } + + BundleVersion bundleVersion = null; + BundleDeployment prevDeployment = null; + + if (bundleVersionId > 0) { + bundleVersion = entityManager.find(BundleVersion.class, bundleVersionId); + if (null == bundleVersion) { + throw new IllegalArgumentException("Invalid bundleVersionId: " + bundleVersionId); + } + } else if (prevDeploymentId > 0) { + prevDeployment = entityManager.find(BundleDeployment.class, prevDeploymentId); + if (null == prevDeployment) { + throw new IllegalArgumentException("Invalid prevDeploymentId: " + prevDeploymentId); + } + } else { + throw new IllegalArgumentException("Must specify either a valid bundleVersionId [" + bundleVersionId + + "] or prevDeploymentId [" + prevDeploymentId + "]"); + } + + return getBundleDeploymentNameImpl(subject, bundleDestination, bundleVersion, prevDeployment); + } + + private String getBundleDeploymentNameImpl(Subject subject, BundleDestination bundleDestination, + BundleVersion bundleVersion, BundleDeployment prevDeployment) { + + BundleDeploymentCriteria criteria = new BundleDeploymentCriteria(); + criteria.addFilterDestinationId(bundleDestination.getId()); + criteria.addFilterIsLive(true); + criteria.fetchBundleVersion(true); + List<BundleDeployment> liveDeployments = bundleManager.findBundleDeploymentsByCriteria(subject, criteria); + BundleDeployment liveDeployment = (liveDeployments.isEmpty()) ? null : liveDeployments.get(0); + + String deploymentName = null; + + if (null != bundleVersion) { + boolean isInitialDeployment = (null == liveDeployment); + int deploy = 1; + String version = bundleVersion.getVersion(); + String dest = bundleDestination.getName(); + + if (isInitialDeployment) { + deploymentName = "Deployment [" + deploy + "] of Version [" + version + "] to [" + dest + "]"; + } else { + String liveName = liveDeployment.getName(); + String liveVersion = liveDeployment.getBundleVersion().getVersion(); + if (liveVersion.equals(version)) { + // redeploy + int iStart = liveName.indexOf("[") + 1, iEnd = liveName.indexOf("]"); + deploy = Integer.valueOf(liveName.substring(iStart, iEnd)) + 1; + deploymentName = "Deployment [" + deploy + "] of Version [" + version + "] to [" + dest + "]"; + } else { + // upgrade + deploymentName = "Deployment [" + deploy + "] of Version [" + version + "] to [" + dest + + "]. Upgrade from Version [" + liveVersion + "]"; + } + } + } else { + // revert + if (null == liveDeployment) { + throw new IllegalArgumentException("Invalid Revert, no live deployment for destination" + + bundleDestination); + } + + String liveName = liveDeployment.getName(); + int iStart = liveName.indexOf("[") + 1, iEnd = liveName.indexOf("]"); + int deploy = Integer.valueOf(liveName.substring(iStart, iEnd)) + 1; + deploymentName = "Deployment [" + deploy + "] Revert To: " + prevDeployment.getName(); + } + + return deploymentName; + } + @RequiredPermission(Permission.MANAGE_BUNDLE) public BundleType createBundleType(Subject subject, String name, int resourceTypeId) throws Exception { if (null == name || "".equals(name.trim())) { @@ -670,12 +763,13 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
@RequiredPermission(Permission.MANAGE_BUNDLE) public BundleDeployment scheduleRevertBundleDeployment(Subject subject, int bundleDestinationId, - String deploymentName, String deploymentDescription, boolean isCleanDeployment) throws Exception { + String deploymentDescription, boolean isCleanDeployment) throws Exception {
BundleDeploymentCriteria c = new BundleDeploymentCriteria(); c.addFilterDestinationId(bundleDestinationId); c.addFilterIsLive(true); c.fetchReplacedBundleDeployment(true); + c.fetchDestination(true); List<BundleDeployment> liveDeployments = bundleManager.findBundleDeploymentsByCriteria(subject, c); if (1 != liveDeployments.size()) { throw new IllegalArgumentException("No live deployment found for destinationId [" + bundleDestinationId @@ -702,7 +796,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot // fresh and can be tracked. The key difference in the schedule request is that we set isRevert=true, // tell the bundle handler that we are in fact reverting from the current live deployment. The // deployment creation is done in a new transaction so it can then be scheduled. - String name = (null != deploymentName) ? deploymentName : prevDeployment.getName(); + String name = getBundleDeploymentNameImpl(subject, liveDeployment.getDestination(), null, prevDeployment); String desc = (null != deploymentDescription) ? deploymentDescription : prevDeployment.getDescription(); Configuration config = (null == prevDeployment.getConfiguration()) ? null : prevDeployment.getConfiguration() .deepCopy(false); diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java index a5937b4..c917d80 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java @@ -123,9 +123,9 @@ public interface BundleManagerLocal extends BundleManagerRemote { throws Exception;
/** - * Equivalent to a all to {@link BundleManagerRemote#createBundleDeployment(Subject, int, int, String, String, Configuration)} - * with different transaction semantics. Useful when an slsb method needs to both create a deployment and schedules - * it prior to returning to an external caller. + * Similar to {@link BundleManagerRemote#createBundleDeployment(Subject, int, int, String, Configuration)} but + * supplies the internally generated deploymentName and has different transaction semantics. Useful when an + * slsb method needs to both create a deployment and schedules it prior to returning to an external caller. */ public BundleDeployment createBundleDeploymentInNewTrans(Subject subject, int bundleVersionId, int bundleDestinationId, String name, String description, Configuration configuration) throws Exception; @@ -133,6 +133,18 @@ public interface BundleManagerLocal extends BundleManagerRemote { // added here because the same method in @Remote was commented out to bypass a WSProvide issue HashMap<String, Boolean> getAllBundleVersionFilenames(Subject subject, int bundleVersionId) throws Exception;
+ /** + * Needed by the Bundle Deploy and Revert wizards GUI to generate a deployment name for display. + * + * @param subject + * @param bundleDestinationId required + * @param bundleVersionId required for progressive deployment, -1 for revert + * @param prevDeploymentId required for revert deployment, -1 for progressive + * @return + */ + public String getBundleDeploymentName(Subject subject, int bundleDestinationId, int bundleVersionId, + int prevDeploymentId); + /** * Not for general consumption. A special case method to build the pojo that can be sent to the agent to * schedule the deployment request. Uses NOT_SUPPORTED transaction attribute to avoid having the cleaned pojo diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java index 03d6297..3ce410d 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java @@ -120,10 +120,13 @@ public interface BundleManagerRemote { @WebParam(name = "packageVersionId") int packageVersionId) throws Exception;
/** + * Create a new bundle deployment. Note that bundle deployment names are generated by this + * call. This provides useful, uniform naming for display. An optional, custom description + * can be added. This call defines a deployment. The defined deployment can then be + * scheduled in a separate call. * @param subject user that must have proper permissions * @param BundleVersionId the BundleVersion being deployed by this deployment * @param BundleDestinationId the BundleDestination for the deployment - * @param name a name for this deployment. not null or empty * @param description an optional longer description describing this deployment * @param configuration a Configuration (pojo) to be associated with this deployment. Although * it is not enforceable must be that of the associated BundleVersion. @@ -134,7 +137,6 @@ public interface BundleManagerRemote { @WebParam(name = "subject") Subject subject, // @WebParam(name = "bundleVersionId") int bundleVersionId, // @WebParam(name = "bundleDestinationId") int bundleDestinationId, // - @WebParam(name = "name") String name, // @WebParam(name = "description") String description, // @WebParam(name = "configuration") Configuration configuration) throws Exception;
@@ -338,13 +340,12 @@ public interface BundleManagerRemote { * A revert first rolls back to the previous deployment (bundle version and configuration) and then rolls forward * by replacing changed files that had been backed up during the most recent (live) deployment. * The returned BundleDeployment represents the new live deployment and can be used to track the history of the - * individual revert deployments. + * individual revert deployments. Note that bundle deployment names are generated by this + * call. This provides useful, uniform naming for display. An optional, custom description can be added. * <br/><br/> * TODO: Add the scheduling capability, currently it's Immediate. * <br/> * @param subject user that must have proper permissions - * @param deploymentName a name for this revert deployment. If null defaults to the name of the previous - * deployment. * @param deploymentDescription an optional longer description describing this deployment. If null defaults * to the description of the previous deployment. * @param isCleanDeployment if true perform a wipe of the deploy directory prior to the revert deployment. Backed up @@ -356,7 +357,6 @@ public interface BundleManagerRemote { BundleDeployment scheduleRevertBundleDeployment( // @WebParam(name = "subject") Subject subject, // @WebParam(name = "bundleDestinationId") int bundleDestinationId, // - @WebParam(name = "deploymentName") String deploymentName, // @WebParam(name = "deploymentDescription") String deploymentDescription, // @WebParam(name = "isCleanDeployment") boolean isCleanDeployment) throws Exception;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java index d336e87..2463e89 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java @@ -341,8 +341,8 @@ public class WebservicesManagerBean implements WebservicesRemote { }
public BundleDeployment createBundleDeployment(Subject subject, int bundleVersionId, int bundleDestinationId, - String name, String description, Configuration configuration) throws Exception { - return bundleManager.createBundleDeployment(subject, bundleVersionId, bundleDestinationId, name, description, + String description, Configuration configuration) throws Exception { + return bundleManager.createBundleDeployment(subject, bundleVersionId, bundleDestinationId, description, configuration); }
@@ -421,9 +421,9 @@ public class WebservicesManagerBean implements WebservicesRemote { }
public BundleDeployment scheduleRevertBundleDeployment(Subject subject, int bundleDestinationId, - String deploymentName, String deploymentDescription, boolean isCleanDeployment) throws Exception { - return bundleManager.scheduleRevertBundleDeployment(subject, bundleDestinationId, deploymentName, - deploymentDescription, isCleanDeployment); + String deploymentDescription, boolean isCleanDeployment) throws Exception { + return bundleManager.scheduleRevertBundleDeployment(subject, bundleDestinationId, deploymentDescription, + isCleanDeployment); }
//BUNDLEMANAGER: END ---------------------------------- diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java index f668692..4b9dd37 100644 --- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java +++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java @@ -966,8 +966,8 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase { private BundleDeployment createDeployment(String name, BundleVersion bv, BundleDestination dest, Configuration config) throws Exception { final String fullName = TEST_PREFIX + "-bundledeployment-" + name; - BundleDeployment bd = bundleManager.createBundleDeployment(overlord, bv.getId(), dest.getId(), fullName, - fullName, config); + BundleDeployment bd = bundleManager + .createBundleDeployment(overlord, bv.getId(), dest.getId(), fullName, config);
assert bd.getId() > 0; assert bd.getName().endsWith(fullName);