org.apache.jetspeed.tools.deploy
Class JetspeedWebApplicationRewriter

java.lang.Object
  extended by org.apache.jetspeed.tools.deploy.JetspeedWebApplicationRewriter
Direct Known Subclasses:
JetspeedWebApplicationRewriter2_3, JetspeedWebApplicationRewriter2_4

public abstract class JetspeedWebApplicationRewriter
extends Object

Utilities for manipulating the web.xml deployment descriptor

Version:
$Id: WebDescriptorUtilities.java,v 1.2 2004/05/12 22:25:04 taylor Exp $
Author:
Scott T. Weaver , Matt Avery , David Sean Taylor

Field Summary
private  boolean changed
           
private  org.jdom.Document document
           
static String JETSPEED_CONTAINER
           
static String JETSPEED_SERVLET_CLASS
           
static String JETSPEED_SERVLET_DESCRIPTION
           
static String JETSPEED_SERVLET_DISPLAY_NAME
           
static String NAMESPACE_PREFIX
           
private  String portletApplication
           
private  boolean portletTaglibAdded
           
protected static String WEB_XML_PATH
           
 
Constructor Summary
JetspeedWebApplicationRewriter(org.jdom.Document doc)
           
JetspeedWebApplicationRewriter(org.jdom.Document doc, String portletApplication)
           
 
Method Summary
protected abstract  String getJetspeedServletMappingXPath()
          Returns the jetspeed servlet mapping xpath.
protected abstract  String getJetspeedServletXPath()
          Returns the jetspeed servlet xpath.
protected abstract  String getPortletTagLibXPath()
          Returns the portlet taglib xpath.
protected  org.jdom.xpath.XPath getXPath(String path)
          Returns the xpath containing the namespace prefix 'js' mapped to the document default namespace.
protected  void insertContextNameParam(org.jdom.Element jetspeedServletElement)
           
protected  void insertElementCorrectly(org.jdom.Element root, org.jdom.Element toInsert, String[] elementsBefore)
           insertElementCorrectly
protected abstract  void insertJetspeedServlet(org.jdom.Element root)
          Inserts the jetspeed servlet into web.xml
protected abstract  void insertJetspeedServletMapping(org.jdom.Element root)
          Inserts the jetspeed servlet mapping into web.xml
protected  void insertLoadOnStartup(org.jdom.Element jetspeedServletElement)
           
protected abstract  void insertPortletTagLib(org.jdom.Element root)
          Inserts the portlet taglib into web.xml
 boolean isChanged()
           
 boolean isPortletTaglibAdded()
           
 void processWebXML()
           processWebXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JETSPEED_CONTAINER

public static final String JETSPEED_CONTAINER
See Also:
Constant Field Values

JETSPEED_SERVLET_CLASS

public static final String JETSPEED_SERVLET_CLASS
See Also:
Constant Field Values

JETSPEED_SERVLET_DISPLAY_NAME

public static final String JETSPEED_SERVLET_DISPLAY_NAME
See Also:
Constant Field Values

JETSPEED_SERVLET_DESCRIPTION

public static final String JETSPEED_SERVLET_DESCRIPTION
See Also:
Constant Field Values

NAMESPACE_PREFIX

public static final String NAMESPACE_PREFIX
See Also:
Constant Field Values

WEB_XML_PATH

protected static final String WEB_XML_PATH
See Also:
Constant Field Values

document

private org.jdom.Document document

portletApplication

private String portletApplication

changed

private boolean changed

portletTaglibAdded

private boolean portletTaglibAdded
Constructor Detail

JetspeedWebApplicationRewriter

public JetspeedWebApplicationRewriter(org.jdom.Document doc,
                                      String portletApplication)

JetspeedWebApplicationRewriter

public JetspeedWebApplicationRewriter(org.jdom.Document doc)
Method Detail

processWebXML

public void processWebXML()
                   throws Exception

processWebXML

Infuses this PortletApplicationWar's web.xml file with servlet and a servlet-mapping element for the JetspeedContainer servlet. This is only done if the descriptor does not already contain these items.

Throws:
MetaDataException - if there is a problem infusing
Exception

insertContextNameParam

protected void insertContextNameParam(org.jdom.Element jetspeedServletElement)

insertLoadOnStartup

protected void insertLoadOnStartup(org.jdom.Element jetspeedServletElement)

isChanged

public boolean isChanged()

insertElementCorrectly

protected void insertElementCorrectly(org.jdom.Element root,
                                      org.jdom.Element toInsert,
                                      String[] elementsBefore)
                               throws Exception

insertElementCorrectly

Parameters:
root - JDom element representing the < web-app >
toInsert - JDom element to insert into the web.xml hierarchy.
elementsBefore - an array of web.xml elements that should be defined before the element we want to insert. This order should be the order defined by the web.xml's DTD type definition.
Throws:
Exception

isPortletTaglibAdded

public boolean isPortletTaglibAdded()
Returns:
Returns the portletTaglibAdded.

getXPath

protected org.jdom.xpath.XPath getXPath(String path)
                                 throws org.jdom.JDOMException
Returns the xpath containing the namespace prefix 'js' mapped to the document default namespace.

Parameters:
path -
Returns:
XPath
Throws:
org.jdom.JDOMException

getJetspeedServletXPath

protected abstract String getJetspeedServletXPath()
Returns the jetspeed servlet xpath. The returned path must contain the namespace prefix 'js'.

Returns:
jetspeed servlet xpath

getJetspeedServletMappingXPath

protected abstract String getJetspeedServletMappingXPath()
Returns the jetspeed servlet mapping xpath. The returned path must contain the namespace prefix 'js'.

Returns:
jetspeed servlet mapping xpath

getPortletTagLibXPath

protected abstract String getPortletTagLibXPath()
Returns the portlet taglib xpath. The returned path must contain the namespace prefix 'js'.

Returns:
portlet taglib xpath

insertJetspeedServlet

protected abstract void insertJetspeedServlet(org.jdom.Element root)
                                       throws Exception
Inserts the jetspeed servlet into web.xml

Parameters:
root -
Throws:
Exception

insertJetspeedServletMapping

protected abstract void insertJetspeedServletMapping(org.jdom.Element root)
                                              throws Exception
Inserts the jetspeed servlet mapping into web.xml

Parameters:
root -
Throws:
Exception

insertPortletTagLib

protected abstract void insertPortletTagLib(org.jdom.Element root)
                                     throws Exception
Inserts the portlet taglib into web.xml

Parameters:
root -
Throws:
Exception


Copyright © 1999-2007 Apache Software Foundation. All Rights Reserved.