org.jboss.on.plugins.tomcat.helper
Class FileContentDelegate

java.lang.Object
  extended by org.jboss.on.plugins.tomcat.helper.FileContentDelegate

public class FileContentDelegate
extends Object

Delegate class used for manipulating artifacts in a Tomcat plugin.

Author:
Jay Shaughnessy, Greg Hinkle, Jason Dobies

Constructor Summary
FileContentDelegate(File directory)
           
 
Method Summary
 void createContent(File destination, File content, boolean unzip)
          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()
          Getter for deployment directory.
 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
 

Constructor Detail

FileContentDelegate

public FileContentDelegate(File directory)
Method Detail

getDirectory

public File getDirectory()
Getter for deployment directory.

Returns:
deploy directory

createContent

public void createContent(File destination,
                          File content,
                          boolean unzip)
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:
contentFile - the file to write the content to
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 content will be written to directly to a file using the package name as the file name

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:

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()


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