org.objectweb.jonas_web.deployment.lib
Class WebDeploymentDescManager

java.lang.Object
  extended by org.objectweb.jonas_lib.deployment.lib.AbsDeploymentDescManager
      extended by org.objectweb.jonas_web.deployment.lib.WebDeploymentDescManager
All Implemented Interfaces:
DeploymentDescManager

public class WebDeploymentDescManager
extends AbsDeploymentDescManager

This class provide a way for managing the WebContainerDeploymentDesc. Note that there is an intance of the WebDeploymentDescManager on each JOnAS server.

Author:
Ludovic Bert, Florent Benoit

Field Summary
static java.lang.String JONAS_WEB_FILE_NAME
          The path to the jonas-web.xml file.
static java.lang.String WEB_FILE_NAME
          The path to the web.xml file.
 
Fields inherited from class org.objectweb.jonas_lib.deployment.lib.AbsDeploymentDescManager
LINK_SEPARATOR
 
Method Summary
 int getCacheSize()
          Get the size of the cache (number of entries in the cache).
static WebContainerDeploymentDesc getDeploymentDesc(java.lang.String filename, java.lang.ClassLoader loader)
          Get the specified web deployment descriptor.
 WebContainerDeploymentDesc getDeploymentDesc(java.net.URL url, java.lang.ClassLoader loaderForCls, java.lang.ClassLoader earLoader)
          Get the specified web deployment descriptor.
static WebDeploymentDescManager getInstance()
          Get an instance of the WebDeploymentDescManager.
static WebContainerDeploymentDesc getInstance(java.lang.String warFileName, java.lang.ClassLoader classLoaderForCls)
          Get an instance of a WEB deployment descriptor by parsing the web.xml and jonas-web.xml deployment descriptors.
static WebContainerDeploymentDesc getInstance(java.lang.String warFileName, java.lang.ClassLoader classLoaderForCls, java.lang.String altWebXmlFilename)
          Get an instance of a WEB deployment descriptor by parsing the web.xml and jonas-web.xml deployment descriptors.
static boolean getParsingWithValidation()
          Controls whether the parser is reporting all validity errors.
static JonasWebApp loadJonasWebApp(java.io.Reader reader, java.lang.String fileName)
          Load the jonas-web.xml file.
static WebApp loadWebApp(java.io.Reader reader, java.lang.String fileName)
          Load the web.xml file.
 void removeCache(java.lang.ClassLoader earClassLoader)
          Make a cleanup of the cache of deployment descriptor.
 void setAltDD(java.lang.ClassLoader earClassLoader, java.net.URL[] urls, java.net.URL[] altDDs)
          Set the alt deployment desc which are used instead of the web.xml file which is in the war file.
static void setParsingWithValidation(boolean validation)
          Controls whether the parser is reporting all validity errors.
 
Methods inherited from class org.objectweb.jonas_lib.deployment.lib.AbsDeploymentDescManager
xmlContent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WEB_FILE_NAME

public static final java.lang.String WEB_FILE_NAME
The path to the web.xml file.

See Also:
Constant Field Values

JONAS_WEB_FILE_NAME

public static final java.lang.String JONAS_WEB_FILE_NAME
The path to the jonas-web.xml file.

See Also:
Constant Field Values
Method Detail

getInstance

public static WebDeploymentDescManager getInstance()
Get an instance of the WebDeploymentDescManager.

Returns:
the instance of the WebDeploymentDescManager.

getDeploymentDesc

public WebContainerDeploymentDesc getDeploymentDesc(java.net.URL url,
                                                    java.lang.ClassLoader loaderForCls,
                                                    java.lang.ClassLoader earLoader)
                                             throws DeploymentDescException
Get the specified web deployment descriptor.

Parameters:
url - the url where to load xml deployment descriptors.
loaderForCls - classloader used to load web classes.
earLoader - the ear classloader.
Returns:
WebContainerDeploymentDesc the web deployment descriptor.
Throws:
DeploymentDescException - when WebContainerDeploymentDesc cannot be created with the given files.

removeCache

public void removeCache(java.lang.ClassLoader earClassLoader)
Make a cleanup of the cache of deployment descriptor. This method must be invoked after the ear deployment by the EAR service.

Parameters:
earClassLoader - the ClassLoader of the ear application to remove from the cache.

setAltDD

public void setAltDD(java.lang.ClassLoader earClassLoader,
                     java.net.URL[] urls,
                     java.net.URL[] altDDs)
Set the alt deployment desc which are used instead of the web.xml file which is in the war file. The alt-dd tag is in the application.xml file of the ear files and is used ony in the EAR case. ie : deployment of wars packaged into EAR applications. alt-dd tag is optionnal

Parameters:
earClassLoader - the ear classloader which is used for mapped the URLs of the wars to the Alt dd.
urls - the urls of the wars
altDDs - the alt-dd name for the specified war URLs

getCacheSize

public int getCacheSize()
Get the size of the cache (number of entries in the cache). This method is used only for the tests.

Returns:
the size of the cache (number of entries in the cache).

getDeploymentDesc

public static WebContainerDeploymentDesc getDeploymentDesc(java.lang.String filename,
                                                           java.lang.ClassLoader loader)
                                                    throws WebContainerDeploymentDescException
Get the specified web deployment descriptor.

Parameters:
filename - the filename where to load xml deployment descriptors.
loader - classloader used to load web classes.
Returns:
WebContainerDeploymentDesc the web deployment descriptor.
Throws:
WebContainerDeploymentDescException - when WebContainerDeploymentDesc cannot be created with the given files.

getInstance

public static WebContainerDeploymentDesc getInstance(java.lang.String warFileName,
                                                     java.lang.ClassLoader classLoaderForCls,
                                                     java.lang.String altWebXmlFilename)
                                              throws DeploymentDescException
Get an instance of a WEB deployment descriptor by parsing the web.xml and jonas-web.xml deployment descriptors.

Parameters:
warFileName - the fileName of the war file for the deployment descriptors.
classLoaderForCls - the classloader for the classes.
altWebXmlFilename - the fileName to the web.xml for the alt-dd tag in the Ear Case. This is used for specify an alternate DDesc file.
Returns:
a WEB deployment descriptor by parsing the web.xml and jonas-web.xml deployment descriptors.
Throws:
DeploymentDescException - if the deployment descriptors are corrupted.

getInstance

public static WebContainerDeploymentDesc getInstance(java.lang.String warFileName,
                                                     java.lang.ClassLoader classLoaderForCls)
                                              throws DeploymentDescException
Get an instance of a WEB deployment descriptor by parsing the web.xml and jonas-web.xml deployment descriptors.

Parameters:
warFileName - the fileName of the war file for the deployment descriptors.
classLoaderForCls - the classloader for the classes.
Returns:
a WEB deployment descriptor by parsing the web.xml and jonas-web.xml deployment descriptors.
Throws:
DeploymentDescException - if the deployment descriptors are corrupted.

loadWebApp

public static WebApp loadWebApp(java.io.Reader reader,
                                java.lang.String fileName)
                         throws DeploymentDescException
Load the web.xml file.

Parameters:
reader - the reader of the XML file.
fileName - the name of the file (web.xml).
Returns:
a structure containing the result of the web.xml parsing.
Throws:
DeploymentDescException - if the deployment descriptor is corrupted.

loadJonasWebApp

public static JonasWebApp loadJonasWebApp(java.io.Reader reader,
                                          java.lang.String fileName)
                                   throws DeploymentDescException
Load the jonas-web.xml file.

Parameters:
reader - the Reader of the XML file.
fileName - the name of the file (jonas-web.xml).
Returns:
a structure containing the result of the jonas-web.xml parsing.
Throws:
DeploymentDescException - if the deployment descriptor is corrupted.

getParsingWithValidation

public static boolean getParsingWithValidation()
Controls whether the parser is reporting all validity errors.

Returns:
if true, all external entities will be read.

setParsingWithValidation

public static void setParsingWithValidation(boolean validation)
Controls whether the parser is reporting all validity errors.

Parameters:
validation - if true, all external entities will be read.