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

java.lang.Object
  extended by org.ow2.jonas.generators.genbase.archive.J2EEArchive
All Implemented Interfaces:
Archive
Direct Known Subclasses:
Application, Client, EjbJar, WebApp

public abstract class J2EEArchive
extends Object
implements Archive

Base Class for all J2EE modules (application, ejbjar, client, webapp).

Author:
Guillaume Sauthier
See Also:
Archive

Constructor Summary
J2EEArchive(Archive archive)
          Creates a new J2EEArchive object.
 
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
 Archive getArchive()
           
 List getContainedFiles()
          Returns a List of all files contained in this archive.
abstract  Map getDescriptors()
          Returns a Map of name to Document for each modified Descriptor of the archive.
static I18n getI18n()
           
 InputStream getInputStream(String filename)
          Returns an InputStream corresponding to the given filename.
static org.objectweb.util.monolog.api.Logger getLogger()
           
 Manifest getManifest()
          Returns the Manifest of the Archive.
 ClassLoader getModuleClassloader()
           
 String getName()
          Returns the name of the Archive.
 File getRootFile()
          Returns the File corresponding to the root of the archive.
abstract  void initialize()
          Initialize the Archive.
protected  boolean isDTDsAllowed()
           
 boolean isPacked()
          Returns true if archive is packed or false if archive is unpacked.
abstract  boolean omit(String name)
          Returns true if filename must be omitted in the archive.
 void setArchive(Archive archive)
           
 void setModuleClassloader(ClassLoader moduleClassloader)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

J2EEArchive

public J2EEArchive(Archive archive)
Creates a new J2EEArchive object.

Parameters:
archive - Archive containing files
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.

getManifest

public Manifest getManifest()
Returns the Manifest of the Archive.

Specified by:
getManifest in interface Archive
Returns:
the Manifest of the Archive.

getInputStream

public InputStream getInputStream(String filename)
                           throws IOException
Returns an InputStream corresponding to the given filename.

Specified by:
getInputStream in interface Archive
Parameters:
filename - file name source of the InputStream
Returns:
the InputStream corresponding to the given filename.
Throws:
IOException - When Cannot get InputStream from filename

getContainedFiles

public 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.

Specified by:
getContainedFiles in interface Archive
Returns:
a List of all files contained in this archive.

isPacked

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

Specified by:
isPacked in interface Archive
Returns:
true if archive is packed or false if archive is unpacked.

getName

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

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

getDescriptors

public abstract Map getDescriptors()
Returns a Map of name to Document for each modified Descriptor of the archive.

Returns:
a Map of name to Document

omit

public abstract boolean omit(String name)
Returns true if filename must be omitted in the archive.

Parameters:
name - filename to be tested
Returns:
true if filename must be omitted.

getI18n

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

getLogger

public static org.objectweb.util.monolog.api.Logger getLogger()
Returns:
Returns the logger.

getArchive

public Archive getArchive()
Returns:
Returns the archive.

setArchive

public void setArchive(Archive archive)
Parameters:
archive - The archive to set.

initialize

public abstract void initialize()
                         throws GenBaseException
Initialize the Archive.

Throws:
GenBaseException - When initialization fails.

getModuleClassloader

public ClassLoader getModuleClassloader()
Returns:
Returns the module inner ClassLoader

setModuleClassloader

public void setModuleClassloader(ClassLoader moduleClassloader)
Parameters:
moduleClassloader - The moduleClassloader to set.

isDTDsAllowed

protected boolean isDTDsAllowed()
Returns:
true if the use of DTDs is allowed or if we have to use only web services

close

public void close()
Close this archive

Specified by:
close in interface Archive


Copyright © 2010 OW2 Consortium. All Rights Reserved.