org.rhq.plugins.jbossas.util
Class FileContentDelegate

java.lang.Object
  extended by org.rhq.plugins.jbossas.util.FileContentDelegate
Direct Known Subclasses:
JarContentDelegate

public class FileContentDelegate
extends Object

Delegate class used for manipulating artifacts in a JON plugin.

Author:
Greg Hinkle, Jason Dobies

Field Summary
protected  File directory
           
 
Constructor Summary
FileContentDelegate(File directory, String fileEnding, String packageTypeName)
           
 
Method Summary
 void createContent(org.rhq.core.domain.content.PackageDetails details, File sourceContentFile, boolean unzip, boolean createBackup)
          Creates a new package described by the specified details.
 void deleteContent(org.rhq.core.domain.content.PackageDetails details)
          Deletes the underlying file for the specified package.
 Set<org.rhq.core.domain.content.transfer.ResourcePackageDetails> discoverDeployedPackages()
           
 InputStream getContent(org.rhq.core.domain.content.PackageDetails details)
          Returns a stream from which the content of the specified package can be read.
 File getDirectory()
           
 String getFileEnding()
           
 String getPackageTypeName()
           
 File getPath(org.rhq.core.domain.content.PackageDetails details)
           
 String getSHA(File deploymentFile)
          Retrieves the SHA256 for a deployed application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

directory

protected File directory
Constructor Detail

FileContentDelegate

public FileContentDelegate(File directory,
                           String fileEnding,
                           String packageTypeName)
Method Detail

getFileEnding

public String getFileEnding()

getPackageTypeName

public String getPackageTypeName()

getDirectory

public File getDirectory()

createContent

public void createContent(org.rhq.core.domain.content.PackageDetails details,
                          File sourceContentFile,
                          boolean unzip,
                          boolean createBackup)
Creates a new package described by the specified details. The destination of the content in the provided input stream will be determined by the package name.

Parameters:
details - describes the package being created
content - content to be written for the package. NOTE this Stream will be closed by this method.
unzip - if true, the content stream will be treated like a ZIP file and be unzipped as it is written, using the package name as the base directory; if false the
createBackup - If true, the original file will be backed up to file.bak
shaString - the SHA-256 of the specified input stream

getPath

public File getPath(org.rhq.core.domain.content.PackageDetails details)

getContent

public InputStream getContent(org.rhq.core.domain.content.PackageDetails details)
Returns a stream from which the content of the specified package can be read.

Parameters:
details - package being loaded
Returns:
buffered input stream containing the contents of the package; will not be null, an exception is thrown if the content cannot be loaded

deleteContent

public void deleteContent(org.rhq.core.domain.content.PackageDetails details)
Deletes the underlying file for the specified package.

Parameters:
details - package to delete

discoverDeployedPackages

public Set<org.rhq.core.domain.content.transfer.ResourcePackageDetails> discoverDeployedPackages()

getSHA

public String getSHA(File deploymentFile)
Retrieves the SHA256 for a deployed application. 1) If the app is exploded then return RHQ-Sha256 manifest attribute. 1.1) If RHQ-Sha256 is missing then compute it, save it and return the result. 2) If the app is an archive then compute SHA256 on fly and return it.

Parameters:
deploymentFile - deployment file
Returns:


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