org.codehaus.cargo.module.webapp.merge
Class WebXmlMerger

java.lang.Object
  extended by org.codehaus.cargo.util.log.LoggedObject
      extended by org.codehaus.cargo.module.XmlMerger
          extended by 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.

Version:
$Id: WebXmlMerger.java 1705 2008-09-02 13:14:55Z adriana $

Constructor Summary
WebXmlMerger()
          Constructor.
WebXmlMerger(Descriptor base)
          Constructor.
 
Method Summary
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.
protected  VendorWebAppDescriptor getVendorWebAppDescriptor(WebXml theWebXml, java.lang.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 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.
 
Methods inherited from class org.codehaus.cargo.module.XmlMerger
addMerger, getMergers
 
Methods inherited from class org.codehaus.cargo.util.log.LoggedObject
getLogger, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 interface DescriptorMerger
Overrides:
init in class XmlMerger
Parameters:
base - Descriptor to use
See Also:
init(Descriptor)

merge

public final void merge(Descriptor theMerge)
Merge the descriptor with a second item.

Specified by:
merge in interface DescriptorMerger
Overrides:
merge in class XmlMerger
Parameters:
theMerge - Descriptor to use
See Also:
merge(Descriptor)

getVendorWebAppDescriptor

protected VendorWebAppDescriptor getVendorWebAppDescriptor(WebXml theWebXml,
                                                           java.lang.Class clazz)
Get the vendor web app descriptor out of the web xml.

Parameters:
theWebXml - in the web xml
clazz - 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 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

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
java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.NoSuchMethodException
java.lang.IllegalArgumentException
java.lang.SecurityException

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


Copyright © 2004-2011 Codehaus. All Rights Reserved.