org.objectweb.jonas_web.deployment.api
Class WebContainerDeploymentDesc

java.lang.Object
  extended byorg.objectweb.jonas_lib.deployment.api.DescriptionGroupDesc
      extended byorg.objectweb.jonas_lib.deployment.api.JndiEnvRefsGroupDesc
          extended byorg.objectweb.jonas_web.deployment.api.WebContainerDeploymentDesc
All Implemented Interfaces:
DescriptionGroup, JndiEnvRefsGroup

public class WebContainerDeploymentDesc
extends JndiEnvRefsGroupDesc

This class do the parsing of the web.xml file and jonas-web.xml files and contruct a data structure associated to these two files. 03/03 : Can read web.xml and jonas-web.xml if the url of the war is a directory.

Author:
Ludovic Bert, Florent Benoit, Philippe Coq

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.api.DescriptionGroupDesc
description, displayName, largeIcon, smallIcon
 
Method Summary
 java.lang.String getContextRoot()
          Get the context root of this web application.
static org.xml.sax.EntityResolver getEntityResolver()
          Get the current EntityResolver.
static org.xml.sax.ErrorHandler getErrorHandler()
          Get the current ErrorHandler.
 java.lang.String getHost()
          Get the host on which the web application must be deployed.
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.
 boolean getJava2DelegationModel()
          Context classloader must follow the java2 delegation model ?
static java.lang.String getJOnASXmlContent()
          Return the content of the jonas-web.xml file
static boolean getParsingWithValidation()
          Controls whether the parser is reporting all validity errors.
 java.lang.String getPort()
          Get the prefered port of the connector used to access the web application.
static SecurityConstraintListDesc getSecurityConstraintListDesc()
          Gets the constraint list
 java.util.List getSecurityRoleList()
          Gets the list of security roles
 java.lang.String getServletClassname(java.lang.String servName)
          Return the classname of the given servlet
 java.util.Collection getServletDescList()
          Gets the list of Servlets
 java.util.List getServletMappings(java.lang.String servName)
          Return the list of urlMapping of the given servlet
 java.lang.String[] getServletsName()
          Return a list of all servlets name available
static java.lang.String getXmlContent()
          Return the content of the web.xml file
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.
static void setEntityResolver(org.xml.sax.EntityResolver entityResolver)
          Set the specified EntityResolver.
static void setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
          Set the specified ErrorHandler.
static void setParsingWithValidation(boolean validation)
          Controls whether the parser is reporting all validity errors.
 java.lang.String toString()
          Return a String representation of the WebContainerDeploymentDesc.
 
Methods inherited from class org.objectweb.jonas_lib.deployment.api.JndiEnvRefsGroupDesc
getEjbLocalRefDesc, getEjbRefDesc, getEnvEntryDesc, getResourceEnvRefDesc, getResourceRefDesc, getServiceRefDesc
 
Methods inherited from class org.objectweb.jonas_lib.deployment.api.DescriptionGroupDesc
getDescription, getDisplayName, getLargeIcon, getSAXMsg, getSmallIcon
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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 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.

getContextRoot

public java.lang.String getContextRoot()
Get the context root of this web application.

Returns:
the context root of this web application.

getJava2DelegationModel

public boolean getJava2DelegationModel()
Context classloader must follow the java2 delegation model ?

Returns:
true if the context's classloader must follow the java 2 delegation model.

getHost

public java.lang.String getHost()
Get the host on which the web application must be deployed.

Returns:
the host on which the web application must be deployed.

getPort

public java.lang.String getPort()
Get the prefered port of the connector used to access the web application.

Returns:
the prefered port of the connector used to access the web application.

toString

public java.lang.String toString()
Return a String representation of the WebContainerDeploymentDesc.

Specified by:
toString in interface DescriptionGroup
Specified by:
toString in class DescriptionGroupDesc
Returns:
a String representation of the WebContainerDeploymentDesc.

getSecurityConstraintListDesc

public static SecurityConstraintListDesc getSecurityConstraintListDesc()
Gets the constraint list

Returns:
the constraint list

getSecurityRoleList

public java.util.List getSecurityRoleList()
Gets the list of security roles

Returns:
the list of security roles

getErrorHandler

public static org.xml.sax.ErrorHandler getErrorHandler()
Get the current ErrorHandler.

Returns:
the current ErrorHandler.

getEntityResolver

public static org.xml.sax.EntityResolver getEntityResolver()
Get the current EntityResolver.

Returns:
the current EntityResolver.

getParsingWithValidation

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

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

setErrorHandler

public static void setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
Set the specified ErrorHandler. If the application does not register an ErrorHandler, all error events reported by the reader are ignored.

Parameters:
errorHandler - the Error Handler to set.

setEntityResolver

public static void setEntityResolver(org.xml.sax.EntityResolver entityResolver)
Set the specified EntityResolver.

Parameters:
entityResolver - the Entity Resolver to set.

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.

getXmlContent

public static java.lang.String getXmlContent()
Return the content of the web.xml file

Returns:
the content of the web.xml file

getJOnASXmlContent

public static java.lang.String getJOnASXmlContent()
Return the content of the jonas-web.xml file

Returns:
the content of the jonas-web.xml file

getServletDescList

public java.util.Collection getServletDescList()
Gets the list of Servlets

Returns:
list of Servlets

getServletsName

public java.lang.String[] getServletsName()
Return a list of all servlets name available

Returns:
a list of all servlets name available

getServletClassname

public java.lang.String getServletClassname(java.lang.String servName)
Return the classname of the given servlet

Parameters:
servName - name of the given servlet
Returns:
the classname of the given servlet

getServletMappings

public java.util.List getServletMappings(java.lang.String servName)
Return the list of urlMapping of the given servlet

Parameters:
servName - name of the given servlet
Returns:
the list of urlMapping of the given servlet