Class WebXmlMerger
- java.lang.Object
-
- org.codehaus.cargo.util.log.LoggedObject
-
- org.codehaus.cargo.module.XmlMerger
-
- org.codehaus.cargo.module.webapp.merge.WebXmlMerger
-
- All Implemented Interfaces:
DescriptorMerger
,Loggable
public class WebXmlMerger extends XmlMerger
Helper class that can merge two web deployment descriptors.
-
-
Constructor Summary
Constructors Constructor Description WebXmlMerger()
Constructor.WebXmlMerger(Descriptor base)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkServletVersions(WebXml theWebXml)
Checks the versions of the servlet API in each descriptor, and logs a warning if a mismatch might result in the loss of definitions.WebXml
getResult()
Retrieves merged descriptor.protected VendorWebAppDescriptor
getVendorWebAppDescriptor(WebXml theWebXml, Class clazz)
Get the vendor web app descriptor out of the web xml.void
init(Descriptor base)
Initialise the merger with the base (first) item to be merged.void
merge(Descriptor theMerge)
Merge the descriptor with a second item.protected void
mergeFilters(WebXml theWebXml)
Merges the filter definitions from the specified descriptor into the original descriptor.protected void
mergeMimeMappings(WebXml theWebXml)
Merges the servlet definitions from the specified descriptor into the original descriptor.protected void
mergeSecurityRoles(WebXml theWebXml)
Merges the security roles from the provided descriptor into the original descriptor.protected void
mergeServlets(WebXml theWebXml)
Merges the servlet definitions from the specified descriptor into the original descriptor.void
setMergeStrategy(String tag, MergeStrategy strategy)
Set the merging strategy for a particular tag.-
Methods inherited from class org.codehaus.cargo.module.XmlMerger
addMerger, getMergers
-
Methods inherited from class org.codehaus.cargo.util.log.LoggedObject
getLogger, setLogger
-
-
-
-
Constructor Detail
-
WebXmlMerger
public WebXmlMerger()
Constructor.
-
WebXmlMerger
public WebXmlMerger(Descriptor base)
Constructor.- Parameters:
base
- Descriptor to use
-
-
Method Detail
-
init
public void init(Descriptor base)
Initialise the merger with the base (first) item to be merged.- Specified by:
init
in interfaceDescriptorMerger
- Overrides:
init
in classXmlMerger
- Parameters:
base
- Descriptor to use
-
setMergeStrategy
public void setMergeStrategy(String tag, MergeStrategy strategy)
Set the merging strategy for a particular tag.- Parameters:
tag
- Tag to setstrategy
- Strategy to use
-
merge
public void merge(Descriptor theMerge)
Merge the descriptor with a second item.- Specified by:
merge
in interfaceDescriptorMerger
- Overrides:
merge
in classXmlMerger
- Parameters:
theMerge
- Descriptor to use
-
getResult
public WebXml getResult()
Retrieves merged descriptor.- Returns:
- WebXml object
-
getVendorWebAppDescriptor
protected VendorWebAppDescriptor getVendorWebAppDescriptor(WebXml theWebXml, Class clazz)
Get the vendor web app descriptor out of the web xml.- Parameters:
theWebXml
- in the web xmlclazz
- the class of vendor descriptor- Returns:
- the VendorWebAppDescriptor, or null if it does not exist in theWebXml
-
checkServletVersions
protected final void checkServletVersions(WebXml theWebXml)
Checks the versions of the servlet API in each descriptor, and logs a warning if a mismatch might result in the loss of definitions.- Parameters:
theWebXml
- The descriptor that will be merged with the original
-
mergeFilters
protected final void mergeFilters(WebXml theWebXml)
Merges the filter definitions from the specified descriptor into the original descriptor.- Parameters:
theWebXml
- The descriptor that contains the filter definitions that are to be merged into the original descriptor
-
mergeServlets
protected final void mergeServlets(WebXml theWebXml) throws CargoException
Merges the servlet definitions from the specified descriptor into the original descriptor.- Parameters:
theWebXml
- The descriptor that contains the servlet definitions that are to be merged into the original descriptor- Throws:
CargoException
- if there is any merge problem
-
mergeSecurityRoles
protected final void mergeSecurityRoles(WebXml theWebXml)
Merges the security roles from the provided descriptor into the original descriptor.- Parameters:
theWebXml
- The descriptor that contains the security roles that are to be merged into the original descriptor
-
mergeMimeMappings
protected final void mergeMimeMappings(WebXml theWebXml)
Merges the servlet definitions from the specified descriptor into the original descriptor.- Parameters:
theWebXml
- The descriptor that contains the filter definitions that are to be merged into the original descriptor
-
-