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, String packageTypeName)
           
 
Method Summary
 void createContent(File contentFile, InputStream content, boolean unzip)
          Creates a new package described by the specified details.
 void deleteContent(PackageDetails details)
          Deletes the underlying file for the specified package.
 Set<ResourcePackageDetails> discoverDeployedPackages()
           
 InputStream getContent(PackageDetails details)
          Returns a stream from which the content of the specified package can be read.
 File getDirectory()
           
 String getPackageTypeName()
           
 File getPath(PackageDetails details)
           
 
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,
                           String packageTypeName)
Method Detail

getPackageTypeName

public String getPackageTypeName()

getDirectory

public File getDirectory()

createContent

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

getPath

public File getPath(PackageDetails details)

getContent

public InputStream getContent(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(PackageDetails details)
Deletes the underlying file for the specified package.

Parameters:
details - package to delete

discoverDeployedPackages

public Set<ResourcePackageDetails> discoverDeployedPackages()


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