modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
| 2
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
| 25 ++-
modules/core/domain/src/main/java/org/rhq/core/domain/bundle/Bundle.java
| 24 ++
modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java
| 24 ++
modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeploymentStatus.java
| 48 +++++
modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java
| 14 -
modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeploymentStatus.java
| 47 -----
modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageCategory.java
| 51 +++---
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
| 20 ++
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeployDefinitionCriteria.java
| 9 -
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
| 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java
| 1
modules/enterprise/remoting/scripts/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js
| 8
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
| 21 +-
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
| 81 ++++------
15 files changed, 236 insertions(+), 147 deletions(-)
New commits:
commit ae88c7ce59839f71a1f5a58d713671c2d0aef03d
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Sun Mar 28 19:54:52 2010 -0400
see if setting an initial value fixes the single-value drop down issue.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java
index 52f7c5b..700104f 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java
@@ -136,6 +136,7 @@ public class SelectBundleVersionStep implements WizardStep {
radioGroupItem.redraw();
selectVersionItem.setValueMap(selectVersionValues);
+ selectVersionItem.setValue(latestVersion.getVersion());
selectVersionItem.redraw();
form.markForRedraw();
commit 4575847ce04b52cfc2f1b5fe47a1fe0b562a600b
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Sun Mar 28 19:36:32 2010 -0400
re-enable single deployment test
diff --git
a/modules/enterprise/remoting/scripts/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js
b/modules/enterprise/remoting/scripts/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js
index 34986f1..bf1c901 100644
---
a/modules/enterprise/remoting/scripts/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js
+++
b/modules/enterprise/remoting/scripts/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js
@@ -26,7 +26,7 @@
* said platform.
*/
-var TestsEnabled = false;
+var TestsEnabled = true;
var bundleName = 'testScriptBundle';
@@ -83,9 +83,9 @@ function testDeployment() {
}
function testGroupDeployment() {
-// if ( !TestsEnabled ) {
-// return;
-// }
+ if ( !TestsEnabled ) {
+ return;
+ }
// delete the test bundle if it exists
cleanupTestBundle();
commit 25ca25ee29ce5c69678be92d60c72f2da6100e4c
Merge: 5ee5728... a13969c...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Sun Mar 28 15:56:19 2010 -0400
Merge branch 'gwt' into gwt-jay
commit 5ee572891e50172aeeee1619ea15814d1bea61e1
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Sun Mar 28 15:54:32 2010 -0400
Domain Model Change and Refactor
Change from a single PackageType for a BundleType to a PackageType per
Bundle.
The former approach originally worked with the idea that
Package.classification set to bundleName could be used to distinguish
between BundleFile packages with the same name but contained in different
bundles. But the fact that classification was never designed to
be used as part of the natural key for a package would have forced a large
refactor potentially conflicting with the current use of classification.
The alternatives were to add a Package.subType to package and make it part
of the natural key. This would have been specific to the needs of bundling
and again added changes to the underlying content domain model. Instead
it was deemed reasonable to have a devoted PackageType per Bundle. This
model does create a potentially large number of packageTypes
(one per bundle) on the BundleType's ResourceType. But it's not clear that
creates any problem. It has the advantage of leveraging the Package
design without introducing any more complexity. Also, Bundle deletion now
can cause cascade removals of the packages for its package type.
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
index 005bafb..90a71a7 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
@@ -501,6 +501,7 @@
<column name="DESCRIPTION" size="500"
type="VARCHAR2" required="false"/>
<column name="BUNDLE_TYPE_ID" type="INTEGER"
required="true" references="RHQ_BUNDLE_TYPE"/>
<column name="REPO_ID" type="INTEGER"
required="true" references="RHQ_REPO"/>
+ <column name="PACKAGE_TYPE_ID" type="INTEGER"
required="true" references="RHQ_PACKAGE_TYPE"/>
<!-- This index is for constraint, not performance -->
<index name="RHQ_BUNDLE_UNIQUE" unique="true">
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 326f3ba..2bb52d7 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -2852,6 +2852,7 @@
<schemaSpec version="2.78.1">
<schema-addColumn table="RHQ_BUNDLE"
column="REPO_ID" columnType="INTEGER" />
+ <schema-alterColumn table="RHQ_BUNDLE"
column="REPO_ID" nullable="FALSE" />
<schema-directSQL>
<statement desc="Creating RHQ_BUNDLE foreign key relation to
RHQ_REPO">
ALTER TABLE RHQ_BUNDLE
@@ -2922,13 +2923,13 @@
<schema-directSQL>
<statement desc="Creating RHQ_BUNDLE_GROUP_DEPLOY foreign key
relation to RHQ_RESOURCE_GROUP">
ALTER TABLE RHQ_BUNDLE_GROUP_DEPLOY
- ADD CONSTRAINT RHQ_RESOURCE_GROUP_FK
+ ADD CONSTRAINT RHQ_RESOURCE_GROUP_ID_FK
FOREIGN KEY (GROUP_ID)
REFERENCES RHQ_RESOURCE_GROUP (ID)
</statement>
<statement desc="Creating RHQ_BUNDLE_GROUP_DEPLOY foreign key
relation to RHQ_BUNDLE_DEPLOY_DEF">
ALTER TABLE RHQ_BUNDLE_GROUP_DEPLOY
- ADD CONSTRAINT RHQ_BUNDLE_DEPLOY_DEF_FK
+ ADD CONSTRAINT RHQ_BUNDLE_DEPLOY_DEF_ID_FK
FOREIGN KEY (BUNDLE_DEPLOY_DEF_ID)
REFERENCES RHQ_BUNDLE_DEPLOY_DEF (ID)
</statement>
@@ -2938,7 +2939,7 @@
<schema-directSQL>
<statement desc="Creating RHQ_BUNDLE_DEPLOY foreign key
relation to RHQ_BUNDLE_GROUP_DEPLOY">
ALTER TABLE RHQ_BUNDLE_DEPLOY
- ADD CONSTRAINT RHQ_BUNDLE_GROUP_DEPLOY_FK
+ ADD CONSTRAINT RHQ_BUNDLE_GROUP_DEPLOY_ID_FK
FOREIGN KEY (BUNDLE_GROUP_DEPLOY_ID)
REFERENCES RHQ_BUNDLE_GROUP_DEPLOY (ID)
</statement>
@@ -2950,6 +2951,19 @@
<schema-alterColumn table="RHQ_BUNDLE_DEPLOY"
column="STATUS" nullable="FALSE" />
</schemaSpec>
+ <schemaSpec version="2.78.7">
+ <schema-addColumn table="RHQ_BUNDLE"
column="PACKAGE_TYPE_ID" columnType="INTEGER" />
+ <schema-alterColumn table="RHQ_BUNDLE"
column="PACKAGE_TYPE_ID" nullable="FALSE" />
+ <schema-directSQL>
+ <statement desc="Creating RHQ_BUNDLE foreign key relation to
RHQ_PACKAGE_TYPE">
+ ALTER TABLE RHQ_BUNDLE
+ ADD CONSTRAINT RHQ_PACKAGE_TYPE_ID_FK
+ FOREIGN KEY (PACKAGE_TYPE_ID)
+ REFERENCES RHQ_PACKAGE_TYPE (ID)
+ </statement>
+ </schema-directSQL>
+ </schemaSpec>
+
<schemaSpec version="2.79">
<schema-directSQL>
<statement desc="Normalizing resource group
descriptions">
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/Bundle.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/Bundle.java
index 1573d6d..261a54e 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/Bundle.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/Bundle.java
@@ -44,6 +44,7 @@ import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.content.Repo;
/**
@@ -89,6 +90,10 @@ public class Bundle implements Serializable {
@OneToOne(fetch = FetchType.LAZY, optional = false)
private Repo repo;
+ @JoinColumn(name = "PACKAGE_TYPE_ID", referencedColumnName =
"ID", nullable = false)
+ @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL, optional = false)
+ private PackageType packageType;
+
@OneToMany(mappedBy = "bundle", fetch = FetchType.LAZY, cascade =
CascadeType.ALL)
private List<BundleVersion> bundleVersions = new
ArrayList<BundleVersion>();
@@ -138,6 +143,14 @@ public class Bundle implements Serializable {
this.bundleType = bundleType;
}
+ public PackageType getPackageType() {
+ return packageType;
+ }
+
+ public void setPackageType(PackageType packageType) {
+ this.packageType = packageType;
+ }
+
public Repo getRepo() {
return repo;
}
@@ -161,7 +174,7 @@ public class Bundle implements Serializable {
@Override
public String toString() {
- return "Bundle[id=" + id + ",name=" + name +
",bundleType=" + bundleType + "]";
+ return "Bundle[id=" + id + ",name=" + name +
",bundleType=" + bundleType + ",packageType=" + packageType +
"]";
}
@Override
@@ -169,6 +182,7 @@ public class Bundle implements Serializable {
final int prime = 31;
int result = 1;
result = (prime * result) + ((name == null) ? 0 : name.hashCode());
+ result = (prime * result) + ((bundleType == null) ? 0 : bundleType.hashCode());
return result;
}
@@ -192,6 +206,14 @@ public class Bundle implements Serializable {
return false;
}
+ if (bundleType == null) {
+ if (other.bundleType != null) {
+ return false;
+ }
+ } else if (!bundleType.equals(other.bundleType)) {
+ return false;
+ }
+
return true;
}
}
\ No newline at end of file
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageCategory.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageCategory.java
index 9a7bce8..2b7017f 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageCategory.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageCategory.java
@@ -1,25 +1,25 @@
- /*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
package org.rhq.core.domain.content;
/**
@@ -53,7 +53,12 @@ public enum PackageCategory {
/**
* A log file
*/
- LOG("Log");
+ LOG("Log"),
+
+ /**
+ * A bundle file, deployable as part of a bundle deploy.
+ */
+ BUNDLE("Bundle");
// Attributes --------------------------------------------
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
index a6b2292..9495b80 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
@@ -36,11 +36,14 @@ public class BundleCriteria extends Criteria {
private Integer filterId;
private Integer filterBundleTypeId; // needs override
- private String filterBundleTypeName; // needs override
+ private String filterBundleTypeName; // needs override
private String filterDescription;
private String filterName;
+ private Integer filterPackageTypeId; // needs override
+ private String filterPackageTypeName; // needs override
private boolean fetchBundleVersions;
+ private boolean fetchPackageType;
private boolean fetchRepo;
private PageOrdering sortName;
@@ -49,6 +52,9 @@ public class BundleCriteria extends Criteria {
public BundleCriteria() {
filterOverrides.put("bundleTypeId", "bundleType.id = ?");
filterOverrides.put("bundleTypeName", "bundleType.name like
?");
+ filterOverrides.put("packageTypeId", "packageType.id = ?");
+ filterOverrides.put("packageTypeName", "packageType.name like
?");
+
}
@Override
@@ -76,10 +82,22 @@ public class BundleCriteria extends Criteria {
this.filterName = filterName;
}
+ public void addFilterPackageTypeId(Integer filterPackageTypeId) {
+ this.filterPackageTypeId = filterPackageTypeId;
+ }
+
+ public void addFilterPackageTypeName(String filterPackageTypeName) {
+ this.filterPackageTypeName = filterPackageTypeName;
+ }
+
public void fetchBundleVersions(boolean fetchBundleVersions) {
this.fetchBundleVersions = fetchBundleVersions;
}
+ public void fetchPackageType(boolean fetchPackageType) {
+ this.fetchPackageType = fetchPackageType;
+ }
+
public void fetchRepo(boolean fetchRepo) {
this.fetchRepo = fetchRepo;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeployDefinitionCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeployDefinitionCriteria.java
index 54b4930..96a8594 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeployDefinitionCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeployDefinitionCriteria.java
@@ -23,8 +23,6 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
-import org.rhq.core.domain.bundle.BundleDeployDefinition;
-
/**
* @author Jay Shaughnessy
*/
@@ -42,12 +40,13 @@ public class BundleDeployDefinitionCriteria extends Criteria {
private boolean fetchBundleVersion;
private boolean fetchConfiguration;
private boolean fetchDeployments;
+ private boolean fetchGroupDeployments;
public BundleDeployDefinitionCriteria() {
}
@Override
- public Class getPersistentClass() {
+ public Class<?> getPersistentClass() {
return BundleDeployDefinitionCriteria.class;
}
@@ -79,4 +78,8 @@ public class BundleDeployDefinitionCriteria extends Criteria {
this.fetchDeployments = fetchDeployments;
}
+ public void fetchGroupDeployments(boolean fetchGroupDeployments) {
+ this.fetchGroupDeployments = fetchGroupDeployments;
+ }
+
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
index 47f500c..7db3060 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
@@ -23,6 +23,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.rhq.core.domain.bundle.BundleDeployment;
+import org.rhq.core.domain.bundle.BundleDeploymentStatus;
/**
* @author Jay Shaughnessy
@@ -38,6 +39,7 @@ public class BundleDeploymentCriteria extends Criteria {
private String filterBundleDeployDefinitionName; // requires override
private Integer filterResourceId; // requires override
private String filterResourceName; // requires override
+ private BundleDeploymentStatus filterStatus;
private boolean fetchBundleDeployDefinition;
private boolean fetchResource;
@@ -51,7 +53,7 @@ public class BundleDeploymentCriteria extends Criteria {
}
@Override
- public Class getPersistentClass() {
+ public Class<?> getPersistentClass() {
return BundleDeployment.class;
}
@@ -75,6 +77,10 @@ public class BundleDeploymentCriteria extends Criteria {
this.filterResourceName = filterResourceName;
}
+ public void addFilterStatus(BundleDeploymentStatus filterStatus) {
+ this.filterStatus = filterStatus;
+ }
+
public void fetchBundleDeployDefinition(boolean fetchBundleDeployDefinition) {
this.fetchBundleDeployDefinition = fetchBundleDeployDefinition;
}
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 7b41da0..05c8fb6 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
@@ -58,6 +58,7 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.content.Architecture;
import org.rhq.core.domain.content.Package;
+import org.rhq.core.domain.content.PackageCategory;
import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.content.PackageVersion;
import org.rhq.core.domain.content.Repo;
@@ -143,7 +144,7 @@ public class BundleManagerBean implements BundleManagerLocal,
BundleManagerRemot
Bundle bundle = new Bundle(name, bundleType);
bundle.setDescription(description);
- // create and add the required Repo. the Repo is a detached object ehich helps in
its eventual
+ // create and add the required Repo. the Repo is a detached object which helps in
its eventual
// removal.
Repo repo = new Repo(name);
repo.setCandidate(false);
@@ -151,6 +152,13 @@ public class BundleManagerBean implements BundleManagerLocal,
BundleManagerRemot
repo = repoManager.createRepo(subject, repo);
bundle.setRepo(repo);
+ // add the required PackageType. the PackageType is an attached object which
helps in cascade removal
+ // of packages in the bundle's repo.
+ ResourceType resourceType = entityManager.find(ResourceType.class,
bundleType.getResourceType().getId());
+ PackageType packageType = new PackageType(name, resourceType);
+ packageType.setCategory(PackageCategory.BUNDLE);
+ bundle.setPackageType(packageType);
+
log.info("Creating bundle: " + bundle);
entityManager.persist(bundle);
@@ -349,7 +357,7 @@ public class BundleManagerBean implements BundleManagerLocal,
BundleManagerRemot
// Create the PackageVersion the BundleFile is tied to. This implicitly creates
the
// Package for the PackageVersion.
Bundle bundle = bundleVersion.getBundle();
- PackageType packageType = getBundleTypePackageType(bundle.getBundleType());
+ PackageType packageType = bundle.getPackageType();
architecture = (null == architecture) ? contentManager.getNoArchitecture() :
architecture;
if (architecture.getId() == 0) {
Query q = entityManager.createNamedQuery(Architecture.QUERY_FIND_BY_NAME);
@@ -424,15 +432,6 @@ public class BundleManagerBean implements BundleManagerLocal,
BundleManagerRemot
return bundleFile;
}
- private PackageType getBundleTypePackageType(BundleType bundleType) {
-
- Query packageTypeQuery =
entityManager.createNamedQuery(PackageType.QUERY_FIND_BY_RESOURCE_TYPE_ID_AND_NAME);
- packageTypeQuery.setParameter("typeId",
bundleType.getResourceType().getId());
- packageTypeQuery.setParameter("name", bundleType.getName());
-
- return (PackageType) packageTypeQuery.getSingleResult();
- }
-
public BundleDeployment scheduleBundleDeployment(Subject subject, int
bundleDeployDefinitionId, int resourceId)
throws Exception {
BundleDeployDefinition deployDef =
entityManager.find(BundleDeployDefinition.class, bundleDeployDefinitionId);
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 a98d66e..427714b 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
@@ -134,13 +134,9 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
// clean up any tests that don't already clean up after themselves
- q = em.createQuery("SELECT bdh FROM BundleDeploymentHistory bdh
");//WHERE bdh.name LIKE '" + TEST_PREFIX + "%'");
- doomed = q.getResultList();
- for (Object removeMe : doomed) {
- em.remove(em.getReference(BundleDeploymentHistory.class,
((BundleDeploymentHistory) removeMe).getId()));
- }
-
- // remove bundleversions which cascade remove bundlefiles and
bundledeploydefs
+ // remove bundleversions which cascade remove bundlefiles and
bundledeploydefs
+ // bundledeploydefs cascade remove bundledeployments and
bundlegroupdeployments
+ // bundledeployments cascade remove bundledeploymenthistory
q = em.createQuery("SELECT bv FROM BundleVersion bv WHERE bv.name LIKE
'" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
@@ -153,12 +149,11 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
for (Object removeMe : doomed) {
em.remove(em.getReference(BundleFile.class, ((BundleFile)
removeMe).getId()));
}
- // remove any orphaned bgds
- q = em.createQuery("SELECT bgd FROM BundleGroupDeployment bgd WHERE
bgd.bundleDeployDefinition.name LIKE '"
- + TEST_PREFIX + "%'");
+ // remove any orphaned deployment history
+ q = em.createQuery("SELECT bdh FROM BundleDeploymentHistory bdh
");//WHERE bdh.name LIKE '" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
- em.remove(em.getReference(BundleGroupDeployment.class,
((BundleGroupDeployment) removeMe).getId()));
+ em.remove(em.getReference(BundleDeploymentHistory.class,
((BundleDeploymentHistory) removeMe).getId()));
}
// remove any orphaned bds
q = em.createQuery("SELECT bd FROM BundleDeployment bd WHERE
bd.bundleDeployDefinition.name LIKE '"
@@ -167,17 +162,27 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
for (Object removeMe : doomed) {
em.remove(em.getReference(BundleDeployment.class, ((BundleDeployment)
removeMe).getId()));
}
+ // remove any orphaned bgds
+ q = em.createQuery("SELECT bgd FROM BundleGroupDeployment bgd WHERE
bgd.bundleDeployDefinition.name LIKE '"
+ + TEST_PREFIX + "%'");
+ doomed = q.getResultList();
+ for (Object removeMe : doomed) {
+ em.remove(em.getReference(BundleGroupDeployment.class,
((BundleGroupDeployment) removeMe).getId()));
+ }
// remove any orphaned bdds
q = em.createQuery("SELECT bdd FROM BundleDeployDefinition bdd WHERE
bdd.name LIKE '" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
em.remove(em.getReference(BundleDeployDefinition.class,
((BundleDeployDefinition) removeMe).getId()));
}
- // remove packages which cascade remove packageversions
- q = em.createQuery("SELECT p FROM Package p WHERE p.name LIKE
'" + TEST_PREFIX + "%'");
+
+ // remove bundles which cascade remove repos and packageTypes
+ // packagetypes cascade remove packages
+ // package cascade remove packageversions
+ q = em.createQuery("SELECT b FROM Bundle b WHERE b.name LIKE '"
+ TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
- em.remove(em.getReference(Package.class, ((Package) removeMe).getId()));
+ em.remove(em.getReference(Bundle.class, ((Bundle) removeMe).getId()));
}
em.flush();
// remove any orphaned pvs
@@ -187,20 +192,26 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
for (Object removeMe : doomed) {
em.remove(em.getReference(PackageVersion.class, ((PackageVersion)
removeMe).getId()));
}
- // remove bundles which cascade remove repos
- q = em.createQuery("SELECT b FROM Bundle b WHERE b.name LIKE '"
+ TEST_PREFIX + "%'");
+ // remove any oprphaned packages
+ q = em.createQuery("SELECT p FROM Package p WHERE p.name LIKE
'" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
- em.remove(em.getReference(Bundle.class, ((Bundle) removeMe).getId()));
+ em.remove(em.getReference(Package.class, ((Package) removeMe).getId()));
+ }
+ // remove any orphaned packagetypes
+ q = em.createQuery("SELECT pt FROM PackageType pt WHERE pt.name LIKE
'" + TEST_PREFIX + "%'");
+ doomed = q.getResultList();
+ for (Object removeMe : doomed) {
+ em.remove(em.getReference(PackageType.class, ((PackageType)
removeMe).getId()));
}
- em.flush();
// remove any orphaned repos
q = em.createQuery("SELECT r FROM Repo r WHERE r.name LIKE '" +
TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
em.remove(em.getReference(Repo.class, ((Repo) removeMe).getId()));
}
- // remove ResourceTypes which cascade remove BundleTypes and PackageTypes
+
+ // remove ResourceTypes which cascade remove BundleTypes
q = em.createQuery("SELECT rt FROM ResourceType rt WHERE rt.name LIKE
'" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
@@ -213,12 +224,7 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
for (Object removeMe : doomed) {
em.remove(em.getReference(BundleType.class, ((BundleType)
removeMe).getId()));
}
- // remove any orphaned packagetypes
- q = em.createQuery("SELECT pt FROM PackageType pt WHERE pt.name LIKE
'" + TEST_PREFIX + "%'");
- doomed = q.getResultList();
- for (Object removeMe : doomed) {
- em.remove(em.getReference(PackageType.class, ((PackageType)
removeMe).getId()));
- }
+
// remove Agents left over from test resources
q = em.createQuery("SELECT a FROM Agent a WHERE a.name LIKE '"
+ TEST_PREFIX + "%'");
doomed = q.getResultList();
@@ -526,7 +532,9 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
@Test(enabled = TESTS_ENABLED)
public void testAddBundleFilesToDifferentBundles() throws Exception {
- Bundle b1 = createBundle("one");
+ // create a bundle type to use for both bundles.
+ BundleType bt = createBundleType("one");
+ Bundle b1 = createBundle("one", bt);
assertNotNull(b1);
BundleVersion bv1 = createBundleVersion(b1.getName(), "1.0", b1);
assertNotNull(bv1);
@@ -534,7 +542,7 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
null, "Bundle #1 File # 1".getBytes(), false);
// create a second bundle but create file of the same name as above
- Bundle b2 = createBundle("two");
+ Bundle b2 = createBundle("two", bt);
assertNotNull(b2);
BundleVersion bv2 = createBundleVersion(b2.getName(), "1.0", b2);
assertNotNull(bv2);
@@ -743,7 +751,6 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
private BundleType createBundleType(String name) throws Exception {
final String fullName = TEST_PREFIX + "-type-" + name;
ResourceType rt = createResourceType(name);
- PackageType pt = createPackageType(name, rt);
BundleType bt = bundleManager.createBundleType(overlord, fullName, rt.getId());
assert bt.getId() > 0;
@@ -800,20 +807,6 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
return rt;
}
- private PackageType createPackageType(String name, ResourceType rt) throws Exception
{
- // the package type is named the same as the bundle type
- final String fullName = TEST_PREFIX + "-type-" + name;
- PackageType pt = new PackageType(fullName, rt);
-
- TransactionManager txMgr = getTransactionManager();
- txMgr.begin();
- EntityManager em = getEntityManager();
- em.persist(pt);
- em.close();
- txMgr.commit();
- return pt;
- }
-
// lifted from ResourceManagerBeanTest
private Resource createTestResource() throws Exception {
getTransactionManager().begin();
commit 74202995ca16b2edf797d7bf721e09e7b706fe22
Merge: e09ae65... 994a9db...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Mar 26 14:48:35 2010 -0400
Merge branch 'gwt' into gwt-jay
commit e09ae659e017da3d4f32755e88685663680c782f
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Mar 26 14:47:48 2010 -0400
intermittent checkin
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundlDeploymentStatus.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundlDeploymentStatus.java
deleted file mode 100644
index 5c8cac5..0000000
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundlDeploymentStatus.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.rhq.core.domain.bundle;
-
-/**
- * Simple statuses for Bundle (Group) Deploy requests. When a request is first initiated,
it will be considered in the
- * {@link #INPROGRESS} state. When the request has completed, it will have been either a
{@link #SUCCESS} or
- * {@link #FAILURE}. For group deploy requests the status values are the same. Any
individual failure will be
- * reflected as a group failure.
- *
- * @author Jay Shaughnessy
- */
-public enum BundlDeploymentStatus {
- INPROGRESS("In Progress"), //
- SUCCESS("Success"), //
- FAILURE("Failure"), //
- NOCHANGE("No Change");
-
- private String displayName;
-
- BundlDeploymentStatus(String displayName) {
- this.displayName = displayName;
- }
-
- public String toString() {
- return displayName;
- }
-}
\ No newline at end of file
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java
index 28d5adc..f1bb4d1 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java
@@ -88,7 +88,7 @@ public class BundleDeployment implements Serializable {
@Column(name = "STATUS", nullable = false)
@Enumerated(EnumType.STRING)
- protected BundlDeploymentStatus status;
+ protected BundleDeploymentStatus status;
@Column(name = "CTIME")
private Long ctime = -1L;
@@ -100,9 +100,7 @@ public class BundleDeployment implements Serializable {
}
public BundleDeployment(BundleDeployDefinition bundleDeploymentDef, Resource
resource) {
- this.bundleDeployDefinition = bundleDeploymentDef;
- this.resource = resource;
- this.status = BundlDeploymentStatus.INPROGRESS;
+ this(bundleDeploymentDef, resource, null);
}
public BundleDeployment(BundleDeployDefinition bundleDeploymentDef, Resource
resource,
@@ -110,6 +108,7 @@ public class BundleDeployment implements Serializable {
this.bundleDeployDefinition = bundleDeploymentDef;
this.resource = resource;
this.bundleGroupDeployment = bundleGroupDeployment;
+ this.status = BundleDeploymentStatus.INPROGRESS;
}
public BundleDeployDefinition getBundleDeployDefinition() {
@@ -172,11 +171,11 @@ public class BundleDeployment implements Serializable {
*
* @return the request status
*/
- public BundlDeploymentStatus getStatus() {
+ public BundleDeploymentStatus getStatus() {
return status;
}
- public void setStatus(BundlDeploymentStatus status) {
+ public void setStatus(BundleDeploymentStatus status) {
this.status = status;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeploymentStatus.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeploymentStatus.java
new file mode 100644
index 0000000..66f8f68
--- /dev/null
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeploymentStatus.java
@@ -0,0 +1,48 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.bundle;
+
+/**
+ * Simple statuses for Bundle (Group) Deploy requests. When a request is first initiated,
it will be considered in the
+ * {@link #INPROGRESS} state. When the request has completed, it will have been either a
{@link #SUCCESS} or
+ * {@link #FAILURE}. For group deploy requests the status values are the same. Any
individual failure will be
+ * reflected as a group failure.
+ *
+ * @author Jay Shaughnessy
+ */
+public enum BundleDeploymentStatus {
+ INPROGRESS("In Progress"), //
+ SUCCESS("Success"), //
+ FAILURE("Failure"), //
+ NOCHANGE("No Change");
+
+ private String displayName;
+
+ BundleDeploymentStatus(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public String toString() {
+ return displayName;
+ }
+}
\ No newline at end of file
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java
index 6f8364d..d1fbc24 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java
@@ -66,7 +66,7 @@ public class BundleGroupDeployment implements Serializable {
@Column(name = "STATUS", nullable = false)
@Enumerated(EnumType.STRING)
- protected BundlDeploymentStatus status;
+ protected BundleDeploymentStatus status;
@Column(name = "ERROR_MESSAGE")
protected String errorMessage;
@@ -91,7 +91,7 @@ public class BundleGroupDeployment implements Serializable {
this.subjectName = subjectName;
this.bundleDeployDefinition = bundleDeployDefinition;
this.group = group;
- this.status = BundlDeploymentStatus.INPROGRESS;
+ this.status = BundleDeploymentStatus.INPROGRESS;
}
public int getId() {
@@ -108,11 +108,11 @@ public class BundleGroupDeployment implements Serializable {
*
* @return the request status
*/
- public BundlDeploymentStatus getStatus() {
+ public BundleDeploymentStatus getStatus() {
return status;
}
- public void setStatus(BundlDeploymentStatus status) {
+ public void setStatus(BundleDeploymentStatus status) {
this.status = status;
}
@@ -135,7 +135,7 @@ public class BundleGroupDeployment implements Serializable {
/**
* If not <code>null</code>, this is an error message (possibly a full
stack trace) to indicate the overall error
* that occurred when the configuration update failed. This will normally be
<code>null</code> unless the
- * {@link #getStatus() status} indicates a {@link BundlDeploymentStatus#FAILURE}.
+ * {@link #getStatus() status} indicates a {@link BundleDeploymentStatus#FAILURE}.
*
* @return overall error that occurred
*/
@@ -155,7 +155,7 @@ public class BundleGroupDeployment implements Serializable {
this.errorMessage = errorMessage;
if (this.errorMessage != null) {
- setStatus(BundlDeploymentStatus.FAILURE);
+ setStatus(BundleDeploymentStatus.FAILURE);
}
}
@@ -212,7 +212,7 @@ public class BundleGroupDeployment implements Serializable {
public long getDuration() {
long start = this.createdTime;
long end;
- if ((status == null) || (status == BundlDeploymentStatus.INPROGRESS)) {
+ if ((status == null) || (status == BundleDeploymentStatus.INPROGRESS)) {
end = System.currentTimeMillis();
} else {
end = this.modifiedTime;
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 5990e61..a98d66e 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
@@ -555,9 +555,9 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
assert b1f1.getId() != b2f1.getId() : "should have been different bundle
files";
assert b1f1.getPackageVersion().getId() != b2f1.getPackageVersion().getId() :
"should be different PV";
- assert b1f1.getPackageVersion().getGeneralPackage().getId() ==
b2f1.getPackageVersion().getGeneralPackage()
+ assert b1f1.getPackageVersion().getGeneralPackage().getId() !=
b2f1.getPackageVersion().getGeneralPackage()
.getId() : "package IDs should be different";
- assert
b1f1.getPackageVersion().getGeneralPackage().equals(b2f1.getPackageVersion().getGeneralPackage())
: "should be different packages";
+ assert
!b1f1.getPackageVersion().getGeneralPackage().equals(b2f1.getPackageVersion().getGeneralPackage())
: "should be different packages";
}
@Test(enabled = TESTS_ENABLED)
commit 3c3f0cf8380fad1be4200a4a97e2cb26037178af
Merge: 771a00d... 7258569...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Mar 26 13:47:38 2010 -0400
Merge branch 'gwt' into gwt-jay
commit 771a00d5accc4234353bb257cd46994275b15912
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Mar 26 13:46:26 2010 -0400
Intermittent check-in for deployment status work
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
index f3bdf49..005bafb 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
@@ -586,6 +586,7 @@
<column name="ID" default="sequence-only"
initial="10001" primarykey="true" required="true"
type="INTEGER"/>
<column name="BUNDLE_DEPLOY_DEF_ID" type="INTEGER"
required="true" references="RHQ_BUNDLE_DEPLOY_DEF" />
<column name="RESOURCE_ID" type="INTEGER"
required="true" references="RHQ_RESOURCE" />
+ <column name="STATUS" type="VARCHAR2"
required="true" size="16"/>
<column name="CTIME" type="LONG"
required="true"/>
<column name="BUNDLE_GROUP_DEPLOY_ID" type="INTEGER"
required="false" references="RHQ_BUNDLE_GROUP_DEPLOY"/>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 18db292..326f3ba 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -2945,6 +2945,11 @@
</schema-directSQL>
</schemaSpec>
+ <schemaSpec version="2.78.6">
+ <schema-addColumn table="RHQ_BUNDLE_DEPLOY"
column="STATUS" columnType="VARCHAR2" precision="16" />
+ <schema-alterColumn table="RHQ_BUNDLE_DEPLOY"
column="STATUS" nullable="FALSE" />
+ </schemaSpec>
+
<schemaSpec version="2.79">
<schema-directSQL>
<statement desc="Normalizing resource group
descriptions">
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundlDeploymentStatus.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundlDeploymentStatus.java
new file mode 100644
index 0000000..5c8cac5
--- /dev/null
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundlDeploymentStatus.java
@@ -0,0 +1,48 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.bundle;
+
+/**
+ * Simple statuses for Bundle (Group) Deploy requests. When a request is first initiated,
it will be considered in the
+ * {@link #INPROGRESS} state. When the request has completed, it will have been either a
{@link #SUCCESS} or
+ * {@link #FAILURE}. For group deploy requests the status values are the same. Any
individual failure will be
+ * reflected as a group failure.
+ *
+ * @author Jay Shaughnessy
+ */
+public enum BundlDeploymentStatus {
+ INPROGRESS("In Progress"), //
+ SUCCESS("Success"), //
+ FAILURE("Failure"), //
+ NOCHANGE("No Change");
+
+ private String displayName;
+
+ BundlDeploymentStatus(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public String toString() {
+ return displayName;
+ }
+}
\ No newline at end of file
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java
index 4bb964d..28d5adc 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java
@@ -29,6 +29,8 @@ import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
@@ -84,6 +86,10 @@ public class BundleDeployment implements Serializable {
@ManyToOne
private BundleGroupDeployment bundleGroupDeployment;
+ @Column(name = "STATUS", nullable = false)
+ @Enumerated(EnumType.STRING)
+ protected BundlDeploymentStatus status;
+
@Column(name = "CTIME")
private Long ctime = -1L;
@@ -96,6 +102,7 @@ public class BundleDeployment implements Serializable {
public BundleDeployment(BundleDeployDefinition bundleDeploymentDef, Resource
resource) {
this.bundleDeployDefinition = bundleDeploymentDef;
this.resource = resource;
+ this.status = BundlDeploymentStatus.INPROGRESS;
}
public BundleDeployment(BundleDeployDefinition bundleDeploymentDef, Resource
resource,
@@ -159,6 +166,20 @@ public class BundleDeployment implements Serializable {
this.bundleGroupDeployment = bundleGroupDeployment;
}
+ /**
+ * The status of the request which indicates that the request is either still in
progress, or it has completed and
+ * either succeeded or failed.
+ *
+ * @return the request status
+ */
+ public BundlDeploymentStatus getStatus() {
+ return status;
+ }
+
+ public void setStatus(BundlDeploymentStatus status) {
+ this.status = status;
+ }
+
@Override
public String toString() {
StringBuilder str = new StringBuilder("BundleDeployment: ");
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java
index 8a0365f..6f8364d 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java
@@ -66,7 +66,7 @@ public class BundleGroupDeployment implements Serializable {
@Column(name = "STATUS", nullable = false)
@Enumerated(EnumType.STRING)
- protected BundleGroupDeploymentStatus status;
+ protected BundlDeploymentStatus status;
@Column(name = "ERROR_MESSAGE")
protected String errorMessage;
@@ -91,7 +91,7 @@ public class BundleGroupDeployment implements Serializable {
this.subjectName = subjectName;
this.bundleDeployDefinition = bundleDeployDefinition;
this.group = group;
- this.status = BundleGroupDeploymentStatus.INPROGRESS;
+ this.status = BundlDeploymentStatus.INPROGRESS;
}
public int getId() {
@@ -108,11 +108,11 @@ public class BundleGroupDeployment implements Serializable {
*
* @return the request status
*/
- public BundleGroupDeploymentStatus getStatus() {
+ public BundlDeploymentStatus getStatus() {
return status;
}
- public void setStatus(BundleGroupDeploymentStatus status) {
+ public void setStatus(BundlDeploymentStatus status) {
this.status = status;
}
@@ -135,7 +135,7 @@ public class BundleGroupDeployment implements Serializable {
/**
* If not <code>null</code>, this is an error message (possibly a full
stack trace) to indicate the overall error
* that occurred when the configuration update failed. This will normally be
<code>null</code> unless the
- * {@link #getStatus() status} indicates a {@link
BundleGroupDeploymentStatus#FAILURE}.
+ * {@link #getStatus() status} indicates a {@link BundlDeploymentStatus#FAILURE}.
*
* @return overall error that occurred
*/
@@ -155,7 +155,7 @@ public class BundleGroupDeployment implements Serializable {
this.errorMessage = errorMessage;
if (this.errorMessage != null) {
- setStatus(BundleGroupDeploymentStatus.FAILURE);
+ setStatus(BundlDeploymentStatus.FAILURE);
}
}
@@ -212,7 +212,7 @@ public class BundleGroupDeployment implements Serializable {
public long getDuration() {
long start = this.createdTime;
long end;
- if ((status == null) || (status == BundleGroupDeploymentStatus.INPROGRESS)) {
+ if ((status == null) || (status == BundlDeploymentStatus.INPROGRESS)) {
end = System.currentTimeMillis();
} else {
end = this.modifiedTime;
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeploymentStatus.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeploymentStatus.java
deleted file mode 100644
index 94f9113..0000000
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeploymentStatus.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.rhq.core.domain.bundle;
-
-/**
- * Simple statuses for Bundle Group Deploy requests. When a request is first initiated,
it will be considered in the
- * {@link #INPROGRESS} state. When the request has completed, it will have been either a
{@link #SUCCESS} or
- * {@link #FAILURE}.
- *
- * @author Jay Shaughnessy
- */
-public enum BundleGroupDeploymentStatus {
- INPROGRESS("In Progress"), //
- SUCCESS("Success"), //
- FAILURE("Failure"), //
- NOCHANGE("No Change");
-
- private String displayName;
-
- BundleGroupDeploymentStatus(String displayName) {
- this.displayName = displayName;
- }
-
- public String toString() {
- return displayName;
- }
-}
\ No newline at end of file