org.objectweb.jonas_ws.wsgen.utils
Class XMLUtils

java.lang.Object
  extended byorg.objectweb.jonas_ws.wsgen.utils.XMLUtils

public class XMLUtils
extends java.lang.Object

XML Utils Class. Holds methods for easier DOM parsing, XML modifications, ...

Author:
Guillaume Sauthier

Method Summary
static void addClient(org.w3c.dom.Document app, Archive client)
          Add a client module in an application Document
static void addEjb(org.w3c.dom.Document app, Archive ejbjar)
          Add an ejb module in an application Document
static void addWebApp(org.w3c.dom.Document app, Archive webapp, java.lang.String ctx)
          Add an web module in an application Document
static void cleanDummyApplication(org.w3c.dom.Document doc)
          default application.xml contains a fake ejb module needed to be parsed without error but not needed for a normal application.
static org.w3c.dom.Element getBeanElement(org.w3c.dom.Element base, java.lang.String bName)
          Returns the session/entity/ message-driven XML Element with given name.
static org.w3c.dom.Element getJonasServiceRef(org.w3c.dom.Element base, java.lang.String srName)
          Returns the jonas-service-ref XML Element with given name.
static org.w3c.dom.Element getServletElement(org.w3c.dom.Element base, java.lang.String sName)
          Returns the matching servlet XML Element with given name.
static org.w3c.dom.Document newDocument(java.io.InputStream is)
          Creates a new Document from a given InputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newDocument

public static org.w3c.dom.Document newDocument(java.io.InputStream is)
                                        throws javax.xml.parsers.ParserConfigurationException,
                                               org.xml.sax.SAXException,
                                               java.io.IOException
Creates a new Document from a given InputStream.

Parameters:
is - the InputStream to be parsed
Returns:
the Document instance.
Throws:
javax.xml.parsers.ParserConfigurationException - ParserConfigurationException
org.xml.sax.SAXException - SAXException
java.io.IOException - IOException

getBeanElement

public static org.w3c.dom.Element getBeanElement(org.w3c.dom.Element base,
                                                 java.lang.String bName)
Returns the session/entity/ message-driven XML Element with given name.

Parameters:
base - jonas-ejb-jar Element.
bName - the bean name to be found.
Returns:
the session/entity/ message-driven XML Element.

getServletElement

public static org.w3c.dom.Element getServletElement(org.w3c.dom.Element base,
                                                    java.lang.String sName)
Returns the matching servlet XML Element with given name.

Parameters:
base - web-app Element.
sName - the servlet name to be found.
Returns:
the matching servlet XML Element.

getJonasServiceRef

public static org.w3c.dom.Element getJonasServiceRef(org.w3c.dom.Element base,
                                                     java.lang.String srName)
Returns the jonas-service-ref XML Element with given name.

Parameters:
base - web-app/ bean Element containing jonas-service-ref Element(s).
srName - the service-ref name to be found.
Returns:
the jonas-service-ref XML Element.

cleanDummyApplication

public static void cleanDummyApplication(org.w3c.dom.Document doc)
default application.xml contains a fake ejb module needed to be parsed without error but not needed for a normal application. Than we remove it.

Parameters:
doc - application.xml document

addEjb

public static void addEjb(org.w3c.dom.Document app,
                          Archive ejbjar)
Add an ejb module in an application Document

Parameters:
app - application.xml Document
ejbjar - EJBJar archive

addClient

public static void addClient(org.w3c.dom.Document app,
                             Archive client)
Add a client module in an application Document

Parameters:
app - application.xml Document
client - Client archive

addWebApp

public static void addWebApp(org.w3c.dom.Document app,
                             Archive webapp,
                             java.lang.String ctx)
Add an web module in an application Document

Parameters:
app - application.xml Document
webapp - WebApp archive
ctx - context-root