org.rhq.plugins.jbossas5
Class FileContentDelegate

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

public class FileContentDelegate
extends java.lang.Object

Delegate class used for manipulating artifacts in a JON plugin.

Author:
Greg Hinkle, Jason Dobies

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

Field Detail

directory

protected java.io.File directory
Constructor Detail

FileContentDelegate

public FileContentDelegate(java.io.File directory,
                           java.lang.String fileEnding,
                           java.lang.String packageTypeName)
Method Detail

getFileEnding

public java.lang.String getFileEnding()

getPackageTypeName

public java.lang.String getPackageTypeName()

getDirectory

public java.io.File getDirectory()

createContent

public void createContent(PackageDetails details,
                          java.io.InputStream content,
                          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

getPath

public java.io.File getPath(PackageDetails details)

getContent

public java.io.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 java.util.Set<ResourcePackageDetails> discoverDeployedPackages()


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