org.objectweb.jonas_lib.genbase.archive
Interface Archive

All Known Implementing Classes:
AbsArchive, Application, Client, DummyApplication, DummyWebApp, EjbJar, FileArchive, J2EEArchive, JarArchive, WebApp

public interface Archive

An Archive is a Wrapper around a Jar file (ear, war, jar) or around a directory structured lik a Jar file (unpacked jar file for example).

Author:
Guillaume Sauthier

Method Summary
 void addDirectory(java.io.File directory)
          add the content of the given directory into the root of the archive.
 void addDirectoryIn(java.lang.String dirName, java.io.File directory)
          add the content of the given directory into the given directory of the archive.
 void addFile(java.io.File file)
          add a lonely file into the root directory of the archive.
 void addFile(java.io.File file, java.lang.String name)
          add a file into the root directory of the archive with a specified name.
 void addFileIn(java.lang.String dirName, java.io.File file)
          add a lonely file into the given directory of the archive.
 void close()
          Close this archive
 java.util.List getContainedFiles()
          Returns a List of all files contained in this archive.
 java.io.InputStream getInputStream(java.lang.String filename)
          Returns an InputStream corresponding to the given filename.
 java.util.jar.Manifest getManifest()
          Returns the Manifest of the Archive.
 java.lang.String getName()
          Returns the name of the Archive.
 java.io.File getRootFile()
          Returns the File corresponding to the root of the archive.
 boolean isPacked()
          Returns true if archive is packed or false if archive is unpacked.
 

Method Detail

addDirectory

void addDirectory(java.io.File directory)
add the content of the given directory into the root of the archive.

Parameters:
directory - directory to add

addDirectoryIn

void addDirectoryIn(java.lang.String dirName,
                    java.io.File directory)
add the content of the given directory into the given directory of the archive.

Parameters:
dirName - archive directory name.
directory - directory to add.

addFile

void addFile(java.io.File file)
add a lonely file into the root directory of the archive.

Parameters:
file - the file to be added.

addFile

void addFile(java.io.File file,
             java.lang.String name)
add a file into the root directory of the archive with a specified name.

Parameters:
file - the file to be added.
name - filename

addFileIn

void addFileIn(java.lang.String dirName,
               java.io.File file)
add a lonely file into the given directory of the archive.

Parameters:
dirName - archive directory name.
file - the file to be added.

getRootFile

java.io.File getRootFile()
Returns the File corresponding to the root of the archive.

Returns:
the File corresponding to the root of the archive.

getManifest

java.util.jar.Manifest getManifest()
Returns the Manifest of the Archive.

Returns:
the Manifest of the Archive.

getInputStream

java.io.InputStream getInputStream(java.lang.String filename)
                                   throws java.io.IOException
Returns an InputStream corresponding to the given filename.

Parameters:
filename - file name source of the InputStream
Returns:
the InputStream corresponding to the given filename.
Throws:
java.io.IOException - When InputStream cannot be retrieved for filename.

getContainedFiles

java.util.List getContainedFiles()
Returns a List of all files contained in this archive. Original files in jar, added Files are all included as String in this Enumeration.

Returns:
a List of all files contained in this archive.

isPacked

boolean isPacked()
Returns true if archive is packed or false if archive is unpacked.

Returns:
true if archive is packed or false if archive is unpacked.

getName

java.lang.String getName()
Returns the name of the Archive.

Returns:
the name of the Archive.

close

void close()
           throws java.io.IOException
Close this archive

Throws:
java.io.IOException - if close fail