org.ow2.jonas.generators.genbase.archive
Class AbsArchive

java.lang.Object
  extended by org.ow2.jonas.generators.genbase.archive.AbsArchive
All Implemented Interfaces:
Archive
Direct Known Subclasses:
FileArchive, JarArchive

public abstract class AbsArchive
extends Object
implements Archive

An AbsArchive centralized commonly used methods for Jar and File support.

Author:
Guillaume Sauthier

Constructor Summary
AbsArchive(File file)
          Create a FileArchive where the root if the given file.
 
Method Summary
 void addDirectory(File directory)
          add the content of the given directory into the root of the archive.
 void addDirectoryIn(String dirName, File directory)
          add the content of the given directory into the given directory of the archive.
 void addFile(File file)
          add a lonely file into the root directory of the archive.
 void addFile(File file, String name)
          add a file into the root directory of the archive with a specified name.
 void addFileIn(String dirName, File file)
          add a lonely file into the given directory of the archive.
 void close()
          close this archive
 Map getFiles()
           
static I18n getI18n()
           
 Manifest getManifest()
          Returns the Manifest of the Archive.
 String getName()
          Returns the name of the Archive.
 File getRootFile()
          Returns the File corresponding to the root of the archive.
 void setManifest(Manifest manifest)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.ow2.jonas.generators.genbase.archive.Archive
getContainedFiles, getInputStream, isPacked
 

Constructor Detail

AbsArchive

public AbsArchive(File file)
Create a FileArchive where the root if the given file.

Parameters:
file - the directory base of the archive
Method Detail

addDirectory

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

Specified by:
addDirectory in interface Archive
Parameters:
directory - directory to add

addDirectoryIn

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

Specified by:
addDirectoryIn in interface Archive
Parameters:
dirName - archive directory name.
directory - directory to add.

addFile

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

Specified by:
addFile in interface Archive
Parameters:
file - the file to be added.

addFile

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

Specified by:
addFile in interface Archive
Parameters:
file - the file to be added.
name - filename

addFileIn

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

Specified by:
addFileIn in interface Archive
Parameters:
dirName - archive directory name.
file - the file to be added.

getRootFile

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

Specified by:
getRootFile in interface Archive
Returns:
the File corresponding to the root of the archive.

getName

public String getName()
Returns the name of the Archive.

Specified by:
getName in interface Archive
Returns:
the name of the Archive.

getManifest

public Manifest getManifest()
Description copied from interface: Archive
Returns the Manifest of the Archive.

Specified by:
getManifest in interface Archive
Returns:
Returns the manifest.

setManifest

public void setManifest(Manifest manifest)
Parameters:
manifest - The manifest to set.

getI18n

public static I18n getI18n()
Returns:
Returns the i18n.

getFiles

public Map getFiles()
Returns:
Returns the files.

close

public void close()
close this archive

Specified by:
close in interface Archive


Copyright © 2010 OW2 Consortium. All Rights Reserved.