org.rhq.enterprise.server.bundle
Class BundleManagerBean

java.lang.Object
  extended by org.rhq.enterprise.server.bundle.BundleManagerBean
All Implemented Interfaces:
BundleManagerLocal, BundleManagerRemote

public class BundleManagerBean
extends Object
implements BundleManagerLocal, BundleManagerRemote

Manages the creation and usage of bundles.

Author:
John Mazzitelli, Ian Springer, Jay Shaughnessy

Constructor Summary
BundleManagerBean()
           
 
Method Summary
 void _finalizePurge(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.bundle.BundleDeployment bundleDeployment, Map<org.rhq.core.domain.bundle.BundleResourceDeployment,String> failedToPurge)
          This is for internal use only - when BundleManagerRemote.purgeBundleDestination(Subject, int) is done, it calls this so the purge can be finalized.
 org.rhq.core.domain.bundle.BundleFile addBundleFile(org.rhq.core.domain.auth.Subject subject, int bundleVersionId, String name, String version, org.rhq.core.domain.content.Architecture architecture, InputStream fileStream)
          Adds a BundleFile to the BundleVersion and implicitly creates the backing PackageVersion.
 org.rhq.core.domain.bundle.BundleFile addBundleFileViaByteArray(org.rhq.core.domain.auth.Subject subject, int bundleVersionId, String name, String version, org.rhq.core.domain.content.Architecture architecture, byte[] fileBytes)
          A convenience method taking a byte array as opposed to a stream for the file bits.
 org.rhq.core.domain.bundle.BundleFile addBundleFileViaPackageVersion(org.rhq.core.domain.auth.Subject subject, int bundleVersionId, String name, int packageVersionId)
          A convenience method taking an existing PackageVersion as opposed to a stream for the file bits.
 org.rhq.core.domain.bundle.BundleFile addBundleFileViaURL(org.rhq.core.domain.auth.Subject subject, int bundleVersionId, String name, String version, org.rhq.core.domain.content.Architecture architecture, String bundleFileUrl)
          A convenience method taking a URL String whose content will be streamed to the server and used for the file bits.
 org.rhq.core.domain.bundle.BundleResourceDeploymentHistory addBundleResourceDeploymentHistory(org.rhq.core.domain.auth.Subject subject, int bundleDeploymentId, org.rhq.core.domain.bundle.BundleResourceDeploymentHistory history)
          Called internally to add history when action is taken against a deployment.
 org.rhq.core.domain.bundle.Bundle createBundle(org.rhq.core.domain.auth.Subject subject, String name, String description, int bundleTypeId)
          Mainly Used For Testing
 org.rhq.core.domain.bundle.BundleVersion createBundleAndBundleVersion(org.rhq.core.domain.auth.Subject subject, String bundleName, String bundleDescription, int bundleTypeId, String bundleVersionName, String bundleVersionDescription, String version, String recipe)
          Mainly Used For Testing Convienence method that combines #createBundle(Subject, String, int) and #createBundleVersion(Subject, int, String, String, String).
 org.rhq.core.domain.bundle.BundleDeployment createBundleDeployment(org.rhq.core.domain.auth.Subject subject, int bundleVersionId, int bundleDestinationId, String description, org.rhq.core.domain.configuration.Configuration configuration)
          Create a new bundle deployment.
 org.rhq.core.domain.bundle.BundleDeployment createBundleDeploymentInNewTrans(org.rhq.core.domain.auth.Subject subject, int bundleVersionId, int bundleDestinationId, String name, String description, org.rhq.core.domain.configuration.Configuration configuration)
          Similar to BundleManagerRemote.createBundleDeployment(Subject, int, int, String, Configuration) but supplies the internally generated deploymentName and has different transaction semantics.
 org.rhq.core.domain.bundle.BundleDestination createBundleDestination(org.rhq.core.domain.auth.Subject subject, int bundleId, String name, String description, String destBaseDirName, String deployDir, Integer groupId)
          Creates a bundle destination that describes a target for the bundle deployments.
 org.rhq.core.domain.bundle.BundleResourceDeployment createBundleResourceDeployment(org.rhq.core.domain.auth.Subject subject, int bundleDeploymentId, int resourceId)
          This is typically not called directly, typically scheduleBundleResourceDeployment() is called externally.
 org.rhq.core.domain.bundle.BundleType createBundleType(org.rhq.core.domain.auth.Subject subject, String name, int resourceTypeId)
          Not generally called.
 org.rhq.core.domain.bundle.BundleVersion createBundleVersion(org.rhq.core.domain.auth.Subject subject, int bundleId, String name, String description, String version, String recipe)
          Mainly Used For Testing
 org.rhq.core.domain.bundle.BundleVersion createBundleVersionViaByteArray(org.rhq.core.domain.auth.Subject subject, byte[] fileBytes)
          Creates a bundle version based on the actual bytes of a Bundle Distribution file.
 org.rhq.core.domain.bundle.BundleVersion createBundleVersionViaFile(org.rhq.core.domain.auth.Subject subject, File distributionFile)
          Creates a bundle version based on a Bundle Distribution file.
 org.rhq.core.domain.bundle.BundleVersion createBundleVersionViaRecipe(org.rhq.core.domain.auth.Subject subject, String recipe)
          Creates a bundle version based on single recipe string.
 org.rhq.core.domain.bundle.BundleVersion createBundleVersionViaURL(org.rhq.core.domain.auth.Subject subject, String distributionFileUrl)
          Creates a bundle version based on a Bundle Distribution file.
 void deleteBundle(org.rhq.core.domain.auth.Subject subject, int bundleId)
          Remove everything associated with the Bundle with the exception of files laid down by related deployments.
 void deleteBundleDeployment(org.rhq.core.domain.auth.Subject subject, int bundleDeploymentId)
          This is a simple attempt at delete, typically used for removing a poorly defined deployment before it is actually scheduled for deployment.
 void deleteBundleDestination(org.rhq.core.domain.auth.Subject subject, int destinationId)
          This is a simple attempt at delete, typically used for removing a poorly defined destination.
 void deleteBundles(org.rhq.core.domain.auth.Subject subject, int[] bundleIds)
          Remove everything associated with the Bundles with the exception of files laid down by related deployments.
 void deleteBundleVersion(org.rhq.core.domain.auth.Subject subject, int bundleVersionId, boolean deleteBundleIfEmpty)
          Remove everything associated with the BundleVersion with the exception of files laid down by related deployments.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.bundle.BundleDeployment> findBundleDeploymentsByCriteria(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.criteria.BundleDeploymentCriteria criteria)
           
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.bundle.BundleDeployment> findBundleDeploymentsByCriteriaWithDestinationFilter(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.criteria.BundleDeploymentCriteria criteria)
          Fetch bundle deployments by criteria and then filter on destinations on the result objects to limit what the user can see
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.bundle.BundleDestination> findBundleDestinationsByCriteria(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.criteria.BundleDestinationCriteria criteria)
           
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.bundle.BundleFile> findBundleFilesByCriteria(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.criteria.BundleFileCriteria criteria)
           
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.bundle.BundleResourceDeployment> findBundleResourceDeploymentsByCriteria(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.criteria.BundleResourceDeploymentCriteria criteria)
           
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.bundle.Bundle> findBundlesByCriteria(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.criteria.BundleCriteria criteria)
           
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.bundle.Bundle> findBundlesByCriteriaWithDestinationFilter(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.criteria.BundleCriteria criteria)
          Fetch bundles by criteria and then filter destination on the result objects to limit what the user can see
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite> findBundlesWithLatestVersionCompositesByCriteria(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.criteria.BundleCriteria criteria)
           
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.bundle.BundleVersion> findBundleVersionsByCriteria(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.criteria.BundleVersionCriteria criteria)
           
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.bundle.BundleVersion> findBundleVersionsByCriteriaWithDestinationFilter(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.criteria.BundleVersionCriteria criteria)
          Fetch bundle versions by criteria and then filter destination on the result objects to limit what the user can see
 List<org.rhq.core.domain.bundle.BundleType> getAllBundleTypes(org.rhq.core.domain.auth.Subject subject)
           
 HashMap<String,Boolean> getAllBundleVersionFilenames(org.rhq.core.domain.auth.Subject subject, int bundleVersionId)
           
 String getBundleDeploymentName(org.rhq.core.domain.auth.Subject subject, int bundleDestinationId, int bundleVersionId, int prevDeploymentId)
          Needed by the Bundle Deploy and Revert wizards GUI to generate a deployment name for display.
 org.rhq.core.domain.bundle.BundleType getBundleType(org.rhq.core.domain.auth.Subject subject, String bundleTypeName)
           
 Set<String> getBundleVersionFilenames(org.rhq.core.domain.auth.Subject subject, int bundleVersionId, boolean withoutBundleFileOnly)
          Determine the files required for a BundleVersion and return all of the filenames or optionally, just those that lack BundleFiles for the BundleVersion.
 org.rhq.core.domain.bundle.ResourceTypeBundleConfiguration getResourceTypeBundleConfiguration(org.rhq.core.domain.auth.Subject subject, int compatGroupId)
          Given the ID for a compatible group, this will return the bundle configuration metadata for that group's resource type.
 BundleScheduleRequest getScheduleRequest(org.rhq.core.domain.auth.Subject subject, int resourceDeploymentId, boolean isCleanDeployment, boolean isRevert)
          Not for general consumption.
 void purgeBundleDestination(org.rhq.core.domain.auth.Subject subject, int bundleDestinationId)
          Purges the destination's live deployment content from the remote platforms.
 org.rhq.core.domain.bundle.BundleDeployment scheduleBundleDeployment(org.rhq.core.domain.auth.Subject subject, int bundleDeploymentId, boolean isCleanDeployment)
          Deploy the bundle to the destination, as described in the provided deployment.
 org.rhq.core.domain.bundle.BundleDeployment scheduleRevertBundleDeployment(org.rhq.core.domain.auth.Subject subject, int bundleDestinationId, String deploymentDescription, boolean isCleanDeployment)
          For the specified destination, revert from the current live deployment to the deployment it had replaced.
 org.rhq.core.domain.bundle.BundleResourceDeployment setBundleResourceDeploymentStatus(org.rhq.core.domain.auth.Subject subject, int resourceDeploymentId, org.rhq.core.domain.bundle.BundleDeploymentStatus status)
          Called internally to set deployment status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BundleManagerBean

public BundleManagerBean()
Method Detail

getResourceTypeBundleConfiguration

public org.rhq.core.domain.bundle.ResourceTypeBundleConfiguration getResourceTypeBundleConfiguration(org.rhq.core.domain.auth.Subject subject,
                                                                                                     int compatGroupId)
                                                                                              throws Exception
Description copied from interface: BundleManagerRemote
Given the ID for a compatible group, this will return the bundle configuration metadata for that group's resource type. User interfaces will need to use this method in order to find out if a) the group can be a target for a bundle deployment and/or b) what different destination base locations are supported by the group.

Specified by:
getResourceTypeBundleConfiguration in interface BundleManagerRemote
Parameters:
subject - the user making the request
compatGroupId - the ID for a compatible group whose type's bundle config is to be returned
Returns:
the bundle configuration for the group's resource type
Throws:
Exception

addBundleResourceDeploymentHistory

public org.rhq.core.domain.bundle.BundleResourceDeploymentHistory addBundleResourceDeploymentHistory(org.rhq.core.domain.auth.Subject subject,
                                                                                                     int bundleDeploymentId,
                                                                                                     org.rhq.core.domain.bundle.BundleResourceDeploymentHistory history)
                                                                                              throws Exception
Description copied from interface: BundleManagerLocal
Called internally to add history when action is taken against a deployment. This executes in a New Transaction and supports deployBundle and Agent requests.

Specified by:
addBundleResourceDeploymentHistory in interface BundleManagerLocal
bundleDeploymentId - id of the deployment appending the history record
Returns:
the persisted history
Throws:
Exception

createBundle

public org.rhq.core.domain.bundle.Bundle createBundle(org.rhq.core.domain.auth.Subject subject,
                                                      String name,
                                                      String description,
                                                      int bundleTypeId)
                                               throws Exception
Description copied from interface: BundleManagerLocal
Mainly Used For Testing

Specified by:
createBundle in interface BundleManagerLocal
Parameters:
subject - user that must have proper permissions
name - not null or empty
description - optional long description of the bundle
bundleTypeId - valid bundleType
Returns:
the persisted Bundle (id is assigned)
Throws:
Exception

createBundleDeploymentInNewTrans

public org.rhq.core.domain.bundle.BundleDeployment createBundleDeploymentInNewTrans(org.rhq.core.domain.auth.Subject subject,
                                                                                    int bundleVersionId,
                                                                                    int bundleDestinationId,
                                                                                    String name,
                                                                                    String description,
                                                                                    org.rhq.core.domain.configuration.Configuration configuration)
                                                                             throws Exception
Description copied from interface: BundleManagerLocal
Similar to 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.

Specified by:
createBundleDeploymentInNewTrans in interface BundleManagerLocal
Throws:
Exception

createBundleDeployment

public org.rhq.core.domain.bundle.BundleDeployment createBundleDeployment(org.rhq.core.domain.auth.Subject subject,
                                                                          int bundleVersionId,
                                                                          int bundleDestinationId,
                                                                          String description,
                                                                          org.rhq.core.domain.configuration.Configuration configuration)
                                                                   throws Exception
Description copied from interface: BundleManagerRemote
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.

Specified by:
createBundleDeployment in interface BundleManagerRemote
Parameters:
subject - user that must have proper permissions
bundleVersionId - the BundleVersion being deployed by this deployment
bundleDestinationId - the BundleDestination for the deployment
description - an optional longer description describing this deployment
configuration - a Configuration (pojo) to be associated with this deployment. Although it is not enforceable must be that of the associated BundleVersion.
Returns:
the persisted deployment
Throws:
Exception

createBundleDestination

public org.rhq.core.domain.bundle.BundleDestination createBundleDestination(org.rhq.core.domain.auth.Subject subject,
                                                                            int bundleId,
                                                                            String name,
                                                                            String description,
                                                                            String destBaseDirName,
                                                                            String deployDir,
                                                                            Integer groupId)
                                                                     throws Exception
Description copied from interface: BundleManagerRemote
Creates a bundle destination that describes a target for the bundle deployments.

Specified by:
createBundleDestination in interface BundleManagerRemote
Parameters:
subject - user must have MANAGE_INVENTORY permission
bundleId - the Bundle to be deployed to this Destination
name - a name for this destination. not null or empty
description - an optional longer description describing this destination
destBaseDirName - The name of the base directory location where the bundle will be deployed. deployDir is relative to the directory that this name refers to. This name isn't the directory itself, it refers to the named location as defined in the agent plugin's descriptor for the resource's type
deployDir - the root dir for deployments to this destination
groupId - the target platforms for deployments to this destination
Returns:
the persisted destination
Throws:
Exception

getBundleDeploymentName

public String getBundleDeploymentName(org.rhq.core.domain.auth.Subject subject,
                                      int bundleDestinationId,
                                      int bundleVersionId,
                                      int prevDeploymentId)
Description copied from interface: BundleManagerLocal
Needed by the Bundle Deploy and Revert wizards GUI to generate a deployment name for display.

Specified by:
getBundleDeploymentName in interface BundleManagerLocal
bundleDestinationId - required
bundleVersionId - required for progressive deployment, -1 for revert
prevDeploymentId - required for revert deployment, -1 for progressive
Returns:

createBundleType

public org.rhq.core.domain.bundle.BundleType createBundleType(org.rhq.core.domain.auth.Subject subject,
                                                              String name,
                                                              int resourceTypeId)
                                                       throws Exception
Description copied from interface: BundleManagerLocal
Not generally called. For use by Server Side Plugins when registering a Bundle Plugin.

Specified by:
createBundleType in interface BundleManagerLocal
Parameters:
subject - must be InventoryManager
name - not null or empty
resourceTypeId - id of the ResourceType that handles this BundleType
Returns:
the persisted BundleType (id is assigned)
Throws:
Exception

createBundleAndBundleVersion

public org.rhq.core.domain.bundle.BundleVersion createBundleAndBundleVersion(org.rhq.core.domain.auth.Subject subject,
                                                                             String bundleName,
                                                                             String bundleDescription,
                                                                             int bundleTypeId,
                                                                             String bundleVersionName,
                                                                             String bundleVersionDescription,
                                                                             String version,
                                                                             String recipe)
                                                                      throws Exception
Description copied from interface: BundleManagerLocal
Mainly Used For Testing Convienence method that combines #createBundle(Subject, String, int) and #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.

Specified by:
createBundleAndBundleVersion in interface BundleManagerLocal
Parameters:
subject - user that must have proper permissions
bundleName - name of the bundle to use (if not found, it will be created)
bundleDescription - optional long description of the bundle
bundleTypeId - the bundle type for the new bundle (if it is created) for which this will be the first version
bundleVersionName - name of the bundle version
bundleVersionDescription - optional long description of the bundle version
version - optional. If not supplied set to 1.0 for first version, or incremented (as best as possible) for subsequent version
Returns:
the persisted BundleVersion (id is assigned)
Throws:
Exception

createBundleVersion

public org.rhq.core.domain.bundle.BundleVersion createBundleVersion(org.rhq.core.domain.auth.Subject subject,
                                                                    int bundleId,
                                                                    String name,
                                                                    String description,
                                                                    String version,
                                                                    String recipe)
                                                             throws Exception
Description copied from interface: BundleManagerLocal
Mainly Used For Testing

Specified by:
createBundleVersion in interface BundleManagerLocal
Parameters:
subject - user that must have proper permissions
bundleId - the bundle for which this will be the next version
name - not null or empty
description - optional long description of the bundle version
version - optional. If not supplied set to 1.0 for first version, or incremented (as best as possible) for subsequent version
Returns:
the persisted BundleVersion (id is assigned)
Throws:
Exception

createBundleVersionViaRecipe

public org.rhq.core.domain.bundle.BundleVersion createBundleVersionViaRecipe(org.rhq.core.domain.auth.Subject subject,
                                                                             String recipe)
                                                                      throws Exception
Description copied from interface: BundleManagerRemote
Creates a bundle version based on single recipe string. The recipe specifies the bundle name, version, version name and version description. If this is the initial version for the named bundle the bundle will be implicitly created. The bundle type is discovered by the bundle server plugin that can parse the recipe.

Specified by:
createBundleVersionViaRecipe in interface BundleManagerRemote
recipe - the recipe that defines the bundle version to be created
Returns:
the persisted BundleVersion with alot of the internal relationships filled in to help the caller understand all that this method did.
Throws:
Exception

createBundleVersionViaFile

public org.rhq.core.domain.bundle.BundleVersion createBundleVersionViaFile(org.rhq.core.domain.auth.Subject subject,
                                                                           File distributionFile)
                                                                    throws Exception
Description copied from interface: BundleManagerRemote
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. If this is the initial version for the named bundle the bundle will be implicitly created. The bundle type is discovered by inspecting the distribution file.

Specified by:
createBundleVersionViaFile in interface BundleManagerRemote
distributionFile - a local Bundle Distribution file. It must be read accessible by the RHQ server process.
Returns:
the persisted BundleVersion with alot of the internal relationships filled in to help the caller understand all that this method did. Bundle files specifically are returned.
Throws:
Exception

createBundleVersionViaByteArray

public org.rhq.core.domain.bundle.BundleVersion createBundleVersionViaByteArray(org.rhq.core.domain.auth.Subject subject,
                                                                                byte[] fileBytes)
                                                                         throws Exception
Description copied from interface: BundleManagerRemote
Creates a bundle version based on the actual bytes of a Bundle Distribution file. This is essentially the same as BundleManagerRemote.createBundleVersionViaFile(Subject, File) but the caller is providing the actual bytes of the file as opposed to the file itself. WARNING: obviously, this requires the entire distribution file to have been loaded fully in memory. For very large distribution files, this could cause OutOfMemoryErrors.

Specified by:
createBundleVersionViaByteArray in interface BundleManagerRemote
fileBytes - the file bits that make up the entire bundle distribution file
Returns:
the persisted BundleVersion with alot of the internal relationships filled in to help the caller understand all that this method did. Bundle files specifically are returned.
Throws:
Exception

createBundleVersionViaURL

public org.rhq.core.domain.bundle.BundleVersion createBundleVersionViaURL(org.rhq.core.domain.auth.Subject subject,
                                                                          String distributionFileUrl)
                                                                   throws Exception
Description copied from interface: BundleManagerRemote
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. If this is the initial version for the named bundle the bundle will be implicitly created. The bundle type is discovered by inspecting the distribution file.

Note, if the file is local it is more efficient to use BundleManagerRemote.createBundleVersionViaFile(Subject,File).

Specified by:
createBundleVersionViaURL in interface BundleManagerRemote
distributionFileUrl - a URL String to the Bundle Distribution file. It must be live, resolvable and read accessible by the RHQ server process.
Returns:
the persisted BundleVersion with alot of the internal relationships filled in to help the caller understand all that this method did. Bundle files specifically are returned.
Throws:
Exception

addBundleFile

public org.rhq.core.domain.bundle.BundleFile addBundleFile(org.rhq.core.domain.auth.Subject subject,
                                                           int bundleVersionId,
                                                           String name,
                                                           String version,
                                                           org.rhq.core.domain.content.Architecture architecture,
                                                           InputStream fileStream)
                                                    throws Exception
Description copied from interface: BundleManagerRemote
Adds a BundleFile to the BundleVersion and implicitly creates the backing PackageVersion. If the PackageVersion already exists use addBundleFile(Subject, int, String, int, boolean)

Specified by:
addBundleFile in interface BundleManagerRemote
Parameters:
subject - user that must have proper permissions
bundleVersionId - id of the BundleVersion incorporating this BundleFile
name - name of the BundleFile (and the resulting Package)
version - version of the backing package
architecture - architecture appropriate for the backing package. Defaults to noarch (i.e. any architecture).
fileStream - the file bits
Returns:
the new BundleFile
Throws:
Exception

addBundleFileViaByteArray

public org.rhq.core.domain.bundle.BundleFile addBundleFileViaByteArray(org.rhq.core.domain.auth.Subject subject,
                                                                       int bundleVersionId,
                                                                       String name,
                                                                       String version,
                                                                       org.rhq.core.domain.content.Architecture architecture,
                                                                       byte[] fileBytes)
                                                                throws Exception
Description copied from interface: BundleManagerRemote
A convenience method taking a byte array as opposed to a stream for the file bits. WARNING: obviously, this requires the entire bundle file to have been loaded fully in memory. For very large files, this could cause OutOfMemoryErrors.

Specified by:
addBundleFileViaByteArray in interface BundleManagerRemote
Throws:
Exception
See Also:
addBundleFile(Subject, int, String, String, Architecture, InputStream, boolean)}

addBundleFileViaURL

public org.rhq.core.domain.bundle.BundleFile addBundleFileViaURL(org.rhq.core.domain.auth.Subject subject,
                                                                 int bundleVersionId,
                                                                 String name,
                                                                 String version,
                                                                 org.rhq.core.domain.content.Architecture architecture,
                                                                 String bundleFileUrl)
                                                          throws Exception
Description copied from interface: BundleManagerRemote
A convenience method taking a URL String whose content will be streamed to the server and used for the file bits.

Specified by:
addBundleFileViaURL in interface BundleManagerRemote
Throws:
Exception
See Also:
addBundleFile(Subject, int, String, String, Architecture, InputStream, boolean)}

addBundleFileViaPackageVersion

public org.rhq.core.domain.bundle.BundleFile addBundleFileViaPackageVersion(org.rhq.core.domain.auth.Subject subject,
                                                                            int bundleVersionId,
                                                                            String name,
                                                                            int packageVersionId)
                                                                     throws Exception
Description copied from interface: BundleManagerRemote
A convenience method taking an existing PackageVersion as opposed to a stream for the file bits.

Specified by:
addBundleFileViaPackageVersion in interface BundleManagerRemote
Throws:
Exception
See Also:
addBundleFile(Subject, int, String, String, Architecture, InputStream, boolean)}

purgeBundleDestination

public void purgeBundleDestination(org.rhq.core.domain.auth.Subject subject,
                                   int bundleDestinationId)
                            throws Exception
Description copied from interface: BundleManagerRemote
Purges the destination's live deployment content from the remote platforms.

Specified by:
purgeBundleDestination in interface BundleManagerRemote
Parameters:
subject - user that must have proper permissions
bundleDestinationId - the ID of the destination that is to be purged of bundle content
Throws:
Exception

_finalizePurge

public void _finalizePurge(org.rhq.core.domain.auth.Subject subject,
                           org.rhq.core.domain.bundle.BundleDeployment bundleDeployment,
                           Map<org.rhq.core.domain.bundle.BundleResourceDeployment,String> failedToPurge)
                    throws Exception
Description copied from interface: BundleManagerLocal
This is for internal use only - when BundleManagerRemote.purgeBundleDestination(Subject, int) is done, it calls this so the purge can be finalized. This is required because this method is called with a transactional context, as opposed to the main purge method.

Specified by:
_finalizePurge in interface BundleManagerLocal
Throws:
Exception

scheduleBundleDeployment

public org.rhq.core.domain.bundle.BundleDeployment scheduleBundleDeployment(org.rhq.core.domain.auth.Subject subject,
                                                                            int bundleDeploymentId,
                                                                            boolean isCleanDeployment)
                                                                     throws Exception
Description copied from interface: BundleManagerRemote
Deploy the bundle to the destination, as described in the provided deployment. Deployment is asynchronous so return of this method does not indicate individual resource deployments are complete. The returned BundleDeployment can be used to track the history of the individual deployments.

TODO: Add the scheduling capability, currently it's Immediate.

Specified by:
scheduleBundleDeployment in interface BundleManagerRemote
Parameters:
subject - user that must have proper permissions
bundleDeploymentId - the BundleDeployment being used to guide the deployments
isCleanDeployment - if true perform a wipe of the deploy directory prior to the deployment. If false perform as an upgrade to the existing deployment, if any.
Returns:
the BundleDeployment record, updated with status and (resource) deployments.
Throws:
Exception

scheduleRevertBundleDeployment

public org.rhq.core.domain.bundle.BundleDeployment scheduleRevertBundleDeployment(org.rhq.core.domain.auth.Subject subject,
                                                                                  int bundleDestinationId,
                                                                                  String deploymentDescription,
                                                                                  boolean isCleanDeployment)
                                                                           throws Exception
Description copied from interface: BundleManagerRemote
For the specified destination, revert from the current live deployment to the deployment it had replaced. 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. Note that bundle deployment names are generated by this call. This provides useful, uniform naming for display. An optional, custom description can be added.

TODO: Add the scheduling capability, currently it's Immediate.

Specified by:
scheduleRevertBundleDeployment in interface BundleManagerRemote
Parameters:
subject - user that must have proper permissions
deploymentDescription - an optional longer description describing this deployment. If null defaults to the description of the previous deployment.
isCleanDeployment - if true perform a wipe of the deploy directory prior to the revert deployment. Backed up files will still be applied. If false perform as an upgrade to the existing deployment.
Returns:
the BundleDeployment record, updated with status and (resource) deployments.
Throws:
Exception

getScheduleRequest

public BundleScheduleRequest getScheduleRequest(org.rhq.core.domain.auth.Subject subject,
                                                int resourceDeploymentId,
                                                boolean isCleanDeployment,
                                                boolean isRevert)
                                         throws Exception
Description copied from interface: BundleManagerLocal
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 affect the persistence context.

Specified by:
getScheduleRequest in interface BundleManagerLocal
Throws:
Exception

createBundleResourceDeployment

public org.rhq.core.domain.bundle.BundleResourceDeployment createBundleResourceDeployment(org.rhq.core.domain.auth.Subject subject,
                                                                                          int bundleDeploymentId,
                                                                                          int resourceId)
                                                                                   throws Exception
Description copied from interface: BundleManagerLocal
This is typically not called directly, typically scheduleBundleResourceDeployment() is called externally. This executes in a New Transaction and supports scheduleBundleResourceDeployment.

Specified by:
createBundleResourceDeployment in interface BundleManagerLocal
Throws:
Exception

setBundleResourceDeploymentStatus

public org.rhq.core.domain.bundle.BundleResourceDeployment setBundleResourceDeploymentStatus(org.rhq.core.domain.auth.Subject subject,
                                                                                             int resourceDeploymentId,
                                                                                             org.rhq.core.domain.bundle.BundleDeploymentStatus status)
                                                                                      throws Exception
Description copied from interface: BundleManagerLocal
Called internally to set deployment status. Typically to a completion status when deployment ends.

Specified by:
setBundleResourceDeploymentStatus in interface BundleManagerLocal
resourceDeploymentId - id of the resource deployment appending the history record
Returns:
the updated BundleResourceDeployment
Throws:
Exception

getBundleVersionFilenames

public Set<String> getBundleVersionFilenames(org.rhq.core.domain.auth.Subject subject,
                                             int bundleVersionId,
                                             boolean withoutBundleFileOnly)
                                      throws Exception
Description copied from interface: BundleManagerRemote
Determine the files required for a BundleVersion and return all of the filenames or optionally, just those that lack BundleFiles for the BundleVersion. The recipe may be parsed as part of this call.

Specified by:
getBundleVersionFilenames in interface BundleManagerRemote
Parameters:
subject - user that must have proper permissions
bundleVersionId - the BundleVersion being queried
withoutBundleFileOnly - if true omit any filenames that already have a corresponding BundleFile for the BundleVersion.
Returns:
The List of filenames.
Throws:
Exception

getAllBundleVersionFilenames

public HashMap<String,Boolean> getAllBundleVersionFilenames(org.rhq.core.domain.auth.Subject subject,
                                                            int bundleVersionId)
                                                     throws Exception
Specified by:
getAllBundleVersionFilenames in interface BundleManagerLocal
Throws:
Exception

getAllBundleTypes

public List<org.rhq.core.domain.bundle.BundleType> getAllBundleTypes(org.rhq.core.domain.auth.Subject subject)
Specified by:
getAllBundleTypes in interface BundleManagerRemote

getBundleType

public org.rhq.core.domain.bundle.BundleType getBundleType(org.rhq.core.domain.auth.Subject subject,
                                                           String bundleTypeName)
Specified by:
getBundleType in interface BundleManagerRemote

findBundleDeploymentsByCriteria

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.bundle.BundleDeployment> findBundleDeploymentsByCriteria(org.rhq.core.domain.auth.Subject subject,
                                                                                                                      org.rhq.core.domain.criteria.BundleDeploymentCriteria criteria)
Specified by:
findBundleDeploymentsByCriteria in interface BundleManagerRemote

findBundleDeploymentsByCriteriaWithDestinationFilter

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.bundle.BundleDeployment> findBundleDeploymentsByCriteriaWithDestinationFilter(org.rhq.core.domain.auth.Subject subject,
                                                                                                                                           org.rhq.core.domain.criteria.BundleDeploymentCriteria criteria)
Fetch bundle deployments by criteria and then filter on destinations on the result objects to limit what the user can see

Specified by:
findBundleDeploymentsByCriteriaWithDestinationFilter in interface BundleManagerLocal
Parameters:
subject - Caller
criteria - criteria to fetch the deployments
Returns:
List of deployments with destinations filtered.

findBundleDestinationsByCriteria

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.bundle.BundleDestination> findBundleDestinationsByCriteria(org.rhq.core.domain.auth.Subject subject,
                                                                                                                        org.rhq.core.domain.criteria.BundleDestinationCriteria criteria)
Specified by:
findBundleDestinationsByCriteria in interface BundleManagerRemote

findBundleResourceDeploymentsByCriteria

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.bundle.BundleResourceDeployment> findBundleResourceDeploymentsByCriteria(org.rhq.core.domain.auth.Subject subject,
                                                                                                                                      org.rhq.core.domain.criteria.BundleResourceDeploymentCriteria criteria)
Specified by:
findBundleResourceDeploymentsByCriteria in interface BundleManagerRemote

findBundleVersionsByCriteria

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.bundle.BundleVersion> findBundleVersionsByCriteria(org.rhq.core.domain.auth.Subject subject,
                                                                                                                org.rhq.core.domain.criteria.BundleVersionCriteria criteria)
Specified by:
findBundleVersionsByCriteria in interface BundleManagerRemote

findBundleVersionsByCriteriaWithDestinationFilter

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.bundle.BundleVersion> findBundleVersionsByCriteriaWithDestinationFilter(org.rhq.core.domain.auth.Subject subject,
                                                                                                                                     org.rhq.core.domain.criteria.BundleVersionCriteria criteria)
Fetch bundle versions by criteria and then filter destination on the result objects to limit what the user can see

Specified by:
findBundleVersionsByCriteriaWithDestinationFilter in interface BundleManagerLocal
Parameters:
subject - Caller
criteria - criteria to fetch the bundles
Returns:
List of versions with destinations filtered.

findBundleFilesByCriteria

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.bundle.BundleFile> findBundleFilesByCriteria(org.rhq.core.domain.auth.Subject subject,
                                                                                                          org.rhq.core.domain.criteria.BundleFileCriteria criteria)
Specified by:
findBundleFilesByCriteria in interface BundleManagerRemote

findBundlesByCriteria

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.bundle.Bundle> findBundlesByCriteria(org.rhq.core.domain.auth.Subject subject,
                                                                                                  org.rhq.core.domain.criteria.BundleCriteria criteria)
Specified by:
findBundlesByCriteria in interface BundleManagerRemote

findBundlesByCriteriaWithDestinationFilter

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.bundle.Bundle> findBundlesByCriteriaWithDestinationFilter(org.rhq.core.domain.auth.Subject subject,
                                                                                                                       org.rhq.core.domain.criteria.BundleCriteria criteria)
Fetch bundles by criteria and then filter destination on the result objects to limit what the user can see

Specified by:
findBundlesByCriteriaWithDestinationFilter in interface BundleManagerLocal
Parameters:
subject - Caller
criteria - criteria to fetch the bundles
Returns:
List of bundles with destinations filtered.

findBundlesWithLatestVersionCompositesByCriteria

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite> findBundlesWithLatestVersionCompositesByCriteria(org.rhq.core.domain.auth.Subject subject,
                                                                                                                                                                 org.rhq.core.domain.criteria.BundleCriteria criteria)
Specified by:
findBundlesWithLatestVersionCompositesByCriteria in interface BundleManagerRemote

deleteBundles

public void deleteBundles(org.rhq.core.domain.auth.Subject subject,
                          int[] bundleIds)
                   throws Exception
Description copied from interface: BundleManagerRemote
Remove everything associated with the Bundles 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 of all bundles that have been deleted.

Specified by:
deleteBundles in interface BundleManagerRemote
bundleIds - IDs of all bundles to be deleted
Throws:
Exception - if any part of the removal fails.

deleteBundle

public void deleteBundle(org.rhq.core.domain.auth.Subject subject,
                         int bundleId)
                  throws Exception
Description copied from interface: BundleManagerRemote
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.

Specified by:
deleteBundle in interface BundleManagerRemote
Throws:
Exception - if any part of the removal fails.

deleteBundleDeployment

public void deleteBundleDeployment(org.rhq.core.domain.auth.Subject subject,
                                   int bundleDeploymentId)
                            throws Exception
Description copied from interface: BundleManagerLocal
This is a simple attempt at delete, typically used for removing a poorly defined deployment before it is actually scheduled for deployment. The status must be PENDING. It will fail if anything actually refers to it.

Specified by:
deleteBundleDeployment in interface BundleManagerLocal
Throws:
Exception - if any part of the removal fails.

deleteBundleDestination

public void deleteBundleDestination(org.rhq.core.domain.auth.Subject subject,
                                    int destinationId)
                             throws Exception
Description copied from interface: BundleManagerLocal
This is a simple attempt at delete, typically used for removing a poorly defined destination. It will fail if any actual deployments are referring to the destination.

Specified by:
deleteBundleDestination in interface BundleManagerLocal
Throws:
Exception - if any part of the removal fails.

deleteBundleVersion

public void deleteBundleVersion(org.rhq.core.domain.auth.Subject subject,
                                int bundleVersionId,
                                boolean deleteBundleIfEmpty)
                         throws Exception
Description copied from interface: BundleManagerRemote
Remove everything associated with the BundleVersion 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.

Specified by:
deleteBundleVersion in interface BundleManagerRemote
deleteBundleIfEmpty - if true and if this method deletes the last bundle version for its bundle, then that bundle entity itself will be completely purged
Throws:
Exception - if any part of the removal fails.


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.