dev/null |binary
modules/cli-tests/src/test/resources/cli-test-bundle.zip |binary
modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js | 64 ----------
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleFileCriteria.java | 6
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java | 7 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java | 50 +++++++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java | 53 --------
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java | 16 --
8 files changed, 57 insertions(+), 139 deletions(-)
New commits:
commit 748d7be5b5e87a61177d8955572ca1b0089b01e3
Merge: ee9ee42... ea437dc...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Apr 30 11:02:35 2010 -0400
Merge branch 'gwt' into gwt-jay
commit ee9ee42b7f8a8576cbf6510cc8a8dd34e815a0c6
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Apr 30 11:01:13 2010 -0400
cli script for deploy - change to dist file approach (not yet working)
diff --git a/modules/cli-tests/src/test/resources/cli-test-bundle.zip b/modules/cli-tests/src/test/resources/cli-test-bundle.zip
new file mode 100644
index 0000000..9c46339
Binary files /dev/null and b/modules/cli-tests/src/test/resources/cli-test-bundle.zip differ
diff --git a/modules/cli-tests/src/test/resources/testBundle.war b/modules/cli-tests/src/test/resources/testBundle.war
deleted file mode 100644
index 01377f3..0000000
Binary files a/modules/cli-tests/src/test/resources/testBundle.war and /dev/null differ
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 f3dccc0..98832c5 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
@@ -37,51 +37,6 @@ executeAllTests();
rhq.logout();
-function testDeployment() {
- if ( !TestsEnabled ) {
- return;
- }
-
- // delete the test bundle if it exists
- cleanupTestBundle();
-
- // create the test bundle
- var testBundle = BundleManager.createBundle( bundleName, bundleName, getBundleType() );
-
- // define the recipe for bundleVersion 1.0
- var recipe = "file -s testBundle.war -d @@bundleTest.deployHome@@/testBundle.war"
-
- // create bundleVersion 1.0
- var testBundleVersion = BundleManager.createBundleVersion( testBundle.getId(), bundleName, bundleName, null, recipe);
-
- // add the single bundleFile, the test war file
- var fileBytes = scriptUtil.getFileBytes("./src/test/resources/testBundle.war");
- var bundleFile = BundleManager.addBundleFileViaByteArray(testBundleVersion.getId(), "testBundle.war",
- "1.0", null, fileBytes);
-
- // create the config, setting the required properties from the recipe
- var config = new Configuration();
- var property = new PropertySimple("bundleTest.deployHome", "/tmp/bundle-test");
- config.put( property );
-
- // create a deployment using the above config
- var testDeployment = BundleManager.createBundleDeployment(testBundleVersion.getId(), "Deployment Test", "Deployment Test of testBundle WAR", "/tmp/bundle-test", config);
-
- // Find a target platform
- var rc = new ResourceCriteria();
- rc.addFilterResourceTypeName("in"); // wINdows, lINux
- var winPlatforms = ResourceManager.findResourcesByCriteria(rc);
- var platformId = winPlatforms.get(0).getId();
-
- var bd = BundleManager.scheduleBundleResourceDeployment(testDeployment.getId(), platformId);
- Assert.assertNotNull( bd );
-
-
- // delete the test bundle if it exists (after allowing agent audit messages to complete)
- sleep( 5000 );
- cleanupTestBundle();
-}
-
function testGroupDeployment() {
if ( !TestsEnabled ) {
return;
@@ -90,20 +45,11 @@ function testGroupDeployment() {
// delete the test bundle if it exists
cleanupTestBundle();
- // create the test bundle
- var testBundle = BundleManager.createBundle( bundleName, bundleName, getBundleType() );
-
- // define the recipe for bundleVersion 1.0
- var recipe = "file -s testBundle.war -d @@bundleTest.deployHome@@/group/testBundle.war"
-
- // create bundleVersion 1.0
- var testBundleVersion = BundleManager.createBundleVersion( testBundle.getId(), bundleName, bundleName, null, recipe);
-
- // add the single bundleFile, the test war file
- var fileBytes = scriptUtil.getFileBytes("./src/test/resources/testBundle.war");
- var bundleFile = BundleManager.addBundleFileViaByteArray(testBundleVersion.getId(), "testBundle.war",
- "1.0", null, fileBytes);
-
+ // create the test bundle version
+ var distributionFile = new java.io.File("./src/test/resources/cli-test-bundle.zip");
+ distributionFile = new java.io.File(distributionFile.getAbsolutePath());
+ var testBundleVersion = BundleManager.createBundleVersionViaFile( distributionFile );
+
// create the config, setting the required properties from the recipe
var config = new Configuration();
var property = new PropertySimple("bundleTest.deployHome", "/tmp/bundle-test");
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 70182b1..1c40606 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
@@ -103,7 +103,7 @@ import org.rhq.enterprise.server.util.HibernateDetachUtility.SerializationType;
* @author Jay Shaughnessy
*/
@Stateless
-public class BundleManagerBean implements BundleManagerLocal {
+public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemote {
private final Log log = LogFactory.getLog(this.getClass());
private final String AUDIT_ACTION_DEPLOYMENT = "Deployment";
commit d7007306e8a1c37c842148b613d8d04cff2be459
Merge: a5855e2... b224609...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Apr 29 17:09:55 2010 -0400
Merge branch 'gwt' into gwt-jay
Conflicts:
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
diff --cc modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index 39497ac,5ac268c..70182b1
--- 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
@@@ -408,20 -408,20 +408,22 @@@ public class BundleManagerBean implemen
// the bundle distribution
try {
Map<String, File> bundleFiles = info.getBundleFiles();
- for (String fileName : bundleFiles.keySet()) {
- File file = bundleFiles.get(fileName);
- InputStream is = null;
- try {
- is = new FileInputStream(file);
- // peg the file version to the bundle version. In the future we may allow a distribution
- // to refer to existing versions of a file.
- BundleFile bundleFile = bundleManager.addBundleFile(subject, bundleVersion.getId(), fileName,
- bundleVersion.getVersion(), null, is);
- log.debug("Added bundle file [" + bundleFile + "] to BundleVersion [" + bundleVersion + "]");
- } finally {
- safeClose(is);
- if (null != file) {
- file.delete();
+ if (bundleFiles != null) {
+ for (String fileName : bundleFiles.keySet()) {
+ File file = bundleFiles.get(fileName);
+ InputStream is = null;
+ try {
+ is = new FileInputStream(file);
++ // peg the file version to the bundle version. In the future we may allow a distribution
++ // to refer to existing versions of a file.
+ BundleFile bundleFile = bundleManager.addBundleFile(subject, bundleVersion.getId(), fileName,
- "1.0", null, is);
++ bundleVersion.getVersion(), null, is);
+ log.debug("Added bundle file [" + bundleFile + "] to BundleVersion [" + bundleVersion + "]");
+ } finally {
+ safeClose(is);
+ if (null != file) {
+ file.delete();
+ }
}
}
}
commit a5855e2fc1aee2d11fdf53446eada6e1ee232d9a
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Apr 29 17:06:19 2010 -0400
- Fix a temp file name for the distro
- peg bundle file package versions to the bundle version for files in the distro
- move legacy create bundle [version] api methods to local. remote now
offers only distribution based create.
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 1445779..39497ac 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
@@ -103,7 +103,7 @@ import org.rhq.enterprise.server.util.HibernateDetachUtility.SerializationType;
* @author Jay Shaughnessy
*/
@Stateless
-public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemote {
+public class BundleManagerBean implements BundleManagerLocal {
private final Log log = LogFactory.getLog(this.getClass());
private final String AUDIT_ACTION_DEPLOYMENT = "Deployment";
@@ -351,7 +351,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
BundleVersion bundleVersion = null;
try {
- tempDistributionFile = File.createTempFile("bundle-" + distributionFileUrl.hashCode(), ".zip");
+ tempDistributionFile = File.createTempFile("bundle-distribution", ".zip");
is = distributionFileUrl.openStream();
os = new FileOutputStream(tempDistributionFile);
@@ -413,8 +413,10 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
InputStream is = null;
try {
is = new FileInputStream(file);
+ // peg the file version to the bundle version. In the future we may allow a distribution
+ // to refer to existing versions of a file.
BundleFile bundleFile = bundleManager.addBundleFile(subject, bundleVersion.getId(), fileName,
- "1.0", null, is);
+ bundleVersion.getVersion(), null, is);
log.debug("Added bundle file [" + bundleFile + "] to BundleVersion [" + bundleVersion + "]");
} finally {
safeClose(is);
@@ -838,7 +840,6 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
return types;
}
- @SuppressWarnings("unchecked")
public BundleType getBundleType(Subject subject, String bundleTypeName) {
// the list of types will be small, no need to support paging
Query q = entityManager.createNamedQuery(BundleType.QUERY_FIND_BY_NAME);
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 a90fd1f..ee4c373 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
@@ -23,11 +23,13 @@ import java.util.HashMap;
import javax.ejb.Local;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.bundle.Bundle;
import org.rhq.core.domain.bundle.BundleDeploymentStatus;
import org.rhq.core.domain.bundle.BundleGroupDeployment;
import org.rhq.core.domain.bundle.BundleResourceDeployment;
import org.rhq.core.domain.bundle.BundleResourceDeploymentHistory;
import org.rhq.core.domain.bundle.BundleType;
+import org.rhq.core.domain.bundle.BundleVersion;
/**
* Local interface to the manager responsible for creating and managing bundles.
@@ -58,6 +60,50 @@ public interface BundleManagerLocal extends BundleManagerRemote {
BundleResourceDeploymentHistory history) throws Exception;
/**
+ * Mainly Used For Testing
+ *
+ * @param subject user that must have proper permissions
+ * @param name not null or empty
+ * @param description optional long description of the bundle
+ * @param bundleTypeId valid bundleType
+ * @return the persisted Bundle (id is assigned)
+ */
+ Bundle createBundle(Subject subject, String name, String description, int bundleTypeId) throws Exception;
+
+ /**
+ * Mainly Used For Testing
+ *
+ * Convienence method that combines {@link #createBundle(Subject, String, int)} and {@link #createBundleVersion(Subject, int, String, String, String)}.
+ * This will first check to see if a bundle with the given type/name exists - if it doesn't, it will be created. If it does, it will be reused.
+ * This will then create the bundle version that will be associated with the bundle that was created or found.
+ *
+ * @param subject user that must have proper permissions
+ * @param bundleName name of the bundle to use (if not found, it will be created)
+ * @param bundleDescription optional long description of the bundle
+ * @param bundleTypeId the bundle type for the new bundle (if it is created) for which this will be the first version
+ * @param bundleVersionName name of the bundle version
+ * @param bundleVersionDescription optional long description of the bundle version
+ * @param version optional. If not supplied set to 1.0 for first version, or incremented (as best as possible) for subsequent version
+ * @return the persisted BundleVersion (id is assigned)
+ */
+ BundleVersion createBundleAndBundleVersion(Subject subject, String bundleName, String bundleDescription,
+ int bundleTypeId, String bundleVersionName, String bundleVersionDescription, String version, String recipe)
+ throws Exception;
+
+ /**
+ * Mainly Used For Testing
+ *
+ * @param subject user that must have proper permissions
+ * @param bundleId the bundle for which this will be the next version
+ * @param name not null or empty
+ * @param description optional long description of the bundle version
+ * @param version optional. If not supplied set to 1.0 for first version, or incremented (as best as possible) for subsequent version
+ * @return the persisted BundleVersion (id is assigned)
+ */
+ BundleVersion createBundleVersion(Subject subject, int bundleId, String name, String description, String version,
+ String recipe) throws Exception;
+
+ /**
* Not generally called. For use by Server Side Plugins when registering a Bundle Plugin.
*
* @param subject must be InventoryManager
@@ -71,8 +117,8 @@ public interface BundleManagerLocal extends BundleManagerRemote {
* This is typically not called directly, typically scheduleBundleResourceDeployment() is called externally. This executes
* in a New Transaction and supports scheduleBundleResourceDeployment.
*/
- BundleResourceDeployment createBundleResourceDeployment(Subject subject, int bundleDeploymentId,
- int resourceId, int groupDeploymentId) throws Exception;
+ BundleResourceDeployment createBundleResourceDeployment(Subject subject, int bundleDeploymentId, int resourceId,
+ int groupDeploymentId) throws Exception;
/**
* This is typically not called directly, typically scheduleBundleGroupDeployment() is called externally.
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 df720dd..3ebf90b 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
@@ -121,19 +121,6 @@ public interface BundleManagerRemote {
/**
* @param subject user that must have proper permissions
- * @param name not null or empty
- * @param description optional long description of the bundle
- * @param bundleTypeId valid bundleType
- * @return the persisted Bundle (id is assigned)
- */
- Bundle createBundle( //
- @WebParam(name = "subject") Subject subject, //
- @WebParam(name = "name") String name, //
- @WebParam(name = "description") String description, //
- @WebParam(name = "bundleTypeId") int bundleTypeId) throws Exception;
-
- /**
- * @param subject user that must have proper permissions
* @param BundleVersionId the BundleVersion being deployed by this deployment
* @param name a name for this deployment. not null or empty
* @param description an optional longer description describing this deployment
@@ -152,22 +139,6 @@ public interface BundleManagerRemote {
@WebParam(name = "configuration") Configuration configuration) throws Exception;
/**
- * @param subject user that must have proper permissions
- * @param bundleId the bundle for which this will be the next version
- * @param name not null or empty
- * @param description optional long description of the bundle version
- * @param version optional. If not supplied set to 1.0 for first version, or incremented (as best as possible) for subsequent version
- * @return the persisted BundleVersion (id is assigned)
- */
- BundleVersion createBundleVersion( //
- @WebParam(name = "subject") Subject subject, //
- @WebParam(name = "bundleId") int bundleId, //
- @WebParam(name = "name") String name, //
- @WebParam(name = "description") String description, //
- @WebParam(name = "version") String version, //
- @WebParam(name = "recipe") String recipe) throws Exception;
-
- /**
* Creates a bundle version based on a Bundle Distribution file. Typically a zip file, the bundle distribution
* contains the recipe for a supported bundle type, along with 0, 1 or more bundle files that will be associated
* with the bundle version. The recipe specifies the bundle name, version, version name and version description.
@@ -204,30 +175,6 @@ public interface BundleManagerRemote {
@WebParam(name = "distributionFileUrl") URL distributionFileUrl) throws Exception;
/**
- * Convienence method that combines {@link #createBundle(Subject, String, int)} and {@link #createBundleVersion(Subject, int, String, String, String)}.
- * This will first check to see if a bundle with the given type/name exists - if it doesn't, it will be created. If it does, it will be reused.
- * This will then create the bundle version that will be associated with the bundle that was created or found.
- *
- * @param subject user that must have proper permissions
- * @param bundleName name of the bundle to use (if not found, it will be created)
- * @param bundleDescription optional long description of the bundle
- * @param bundleTypeId the bundle type for the new bundle (if it is created) for which this will be the first version
- * @param bundleVersionName name of the bundle version
- * @param bundleVersionDescription optional long description of the bundle version
- * @param version optional. If not supplied set to 1.0 for first version, or incremented (as best as possible) for subsequent version
- * @return the persisted BundleVersion (id is assigned)
- */
- BundleVersion createBundleAndBundleVersion( //
- @WebParam(name = "subject") Subject subject, //
- @WebParam(name = "bundleName") String bundleName, //
- @WebParam(name = "bundleDescription") String bundleDescription, //
- @WebParam(name = "bundleTypeId") int bundleTypeId, //
- @WebParam(name = "bundleVersionName") String bundleVersionName, //
- @WebParam(name = "bundleVersionDescription") String bundleVersionDescription, //
- @WebParam(name = "version") String version, //
- @WebParam(name = "recipe") String recipe) throws Exception;
-
- /**
* Remove everything associated with the Bundle with the exception of files laid down by related deployments.
* Deployed files are left as is on the deployment platforms but the bundle mechanism will no longer track
* the deployment.
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 b33d69a..6e952ef 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
@@ -339,21 +339,12 @@ public class WebservicesManagerBean implements WebservicesRemote {
return bundleManager.addBundleFileViaPackageVersion(subject, bundleVersionId, name, packageVersionId);
}
- public Bundle createBundle(Subject subject, String name, String description, int bundleTypeId) throws Exception {
- return bundleManager.createBundle(subject, name, description, bundleTypeId);
- }
-
public BundleDeployment createBundleDeployment(Subject subject, int bundleVersionId, String name,
String description, String installDir, Configuration configuration) throws Exception {
return bundleManager.createBundleDeployment(subject, bundleVersionId, name, description, installDir,
configuration);
}
- public BundleVersion createBundleVersion(Subject subject, int bundleId, String name, String description,
- String version, String recipe) throws Exception {
- return bundleManager.createBundleVersion(subject, bundleId, name, description, version, recipe);
- }
-
public BundleVersion createBundleVersionViaFile(Subject subject, File distributionFile) throws Exception {
return bundleManager.createBundleVersionViaFile(subject, distributionFile);
}
@@ -362,13 +353,6 @@ public class WebservicesManagerBean implements WebservicesRemote {
return bundleManager.createBundleVersionViaURL(subject, distributionFileUrl);
}
- public BundleVersion createBundleAndBundleVersion(Subject subject, String bundleName, String bundleDescription,
- int bundleTypeId, String bundleVersionName, String bundleVersionDescription, String version, String recipe)
- throws Exception {
- return bundleManager.createBundleAndBundleVersion(subject, bundleName, bundleDescription, bundleTypeId,
- bundleVersionName, bundleVersionDescription, version, recipe);
- }
-
public void deleteBundle(Subject subject, int bundleId) throws Exception {
bundleManager.deleteBundle(subject, bundleId);
}
commit c88e830f7c7d3ce85f8bef25d06a4aa51c4838ae
Merge: 000c296... 69038cf...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Apr 29 16:15:49 2010 -0400
Merge branch 'gwt' into gwt-jay
commit 000c296cb1d05990cafe7c54a9188af7528ff306
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Apr 29 16:14:21 2010 -0400
get rid of obsolete generalPackage criteria
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleFileCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleFileCriteria.java
index e774ca6..130b2b6 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleFileCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleFileCriteria.java
@@ -40,13 +40,11 @@ public class BundleFileCriteria extends Criteria {
private boolean fetchBundleVersion;
private boolean fetchPackageVersion;
- private boolean fetchGeneralPackage;
public BundleFileCriteria() {
super();
filterOverrides.put("bundleVersionId", "bundleVersion.id = ?");
- filterOverrides.put("packageId", "generalPackage.id = ?");
filterOverrides.put("packageVersionId", "packageVersion.id = ?");
}
@@ -71,10 +69,6 @@ public class BundleFileCriteria extends Criteria {
this.fetchBundleVersion = fetchBundleVersion;
}
- public void fetchPackage(boolean fetchGeneralPackage) {
- this.fetchGeneralPackage = fetchGeneralPackage;
- }
-
public void fetchPackageVersion(boolean fetchPackageVersion) {
this.fetchPackageVersion = fetchPackageVersion;
}