org.codehaus.cargo.module.application
Class ApplicationXmlIo

java.lang.Object
  extended byorg.codehaus.cargo.module.application.ApplicationXmlIo

public final class ApplicationXmlIo
extends java.lang.Object

Provides convenience methods for reading and writing enterprise application deployment descriptors (application.xml).

Version:
$Id: ApplicationXmlIo.java 1119 2006-07-22 13:16:54Z vmassol $

Method Summary
static ApplicationXml parseApplicationXml(java.io.InputStream input, org.xml.sax.EntityResolver entityResolver)
          Parses a deployment descriptor provided as input stream.
static ApplicationXml parseApplicationXmlFromFile(java.io.File file, org.xml.sax.EntityResolver entityResolver)
          Parses a deployment descriptor stored in a regular file.
static void writeApplicationXml(ApplicationXml appXml, java.io.File file)
          Writes the specified document to a file.
static void writeApplicationXml(ApplicationXml appXml, java.io.File file, java.lang.String encoding)
          Writes the specified document to a file.
static void writeApplicationXml(ApplicationXml appXml, java.io.File file, java.lang.String encoding, boolean isIndent)
          Writes the specified document to a file.
static void writeApplicationXml(ApplicationXml appXml, java.io.OutputStream output, java.lang.String encoding, boolean isIndent)
          Writes the specified document to an output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

parseApplicationXmlFromFile

public static ApplicationXml parseApplicationXmlFromFile(java.io.File file,
                                                         org.xml.sax.EntityResolver entityResolver)
                                                  throws org.xml.sax.SAXException,
                                                         javax.xml.parsers.ParserConfigurationException,
                                                         java.io.IOException
Parses a deployment descriptor stored in a regular file.

Parameters:
file - The file to parse
entityResolver - A SAX entity resolver, or null to use the default
Returns:
The parsed descriptor
Throws:
org.xml.sax.SAXException - If the file could not be parsed
javax.xml.parsers.ParserConfigurationException - If the XML parser was not correctly configured
java.io.IOException - If an I/O error occurs

parseApplicationXml

public static ApplicationXml parseApplicationXml(java.io.InputStream input,
                                                 org.xml.sax.EntityResolver entityResolver)
                                          throws org.xml.sax.SAXException,
                                                 javax.xml.parsers.ParserConfigurationException,
                                                 java.io.IOException
Parses a deployment descriptor provided as input stream.

Parameters:
input - The input stream
entityResolver - A SAX entity resolver, or null to use the default
Returns:
The parsed descriptor
Throws:
org.xml.sax.SAXException - If the input could not be parsed
javax.xml.parsers.ParserConfigurationException - If the XML parser was not correctly configured
java.io.IOException - If an I/O error occurs

writeApplicationXml

public static void writeApplicationXml(ApplicationXml appXml,
                                       java.io.File file)
                                throws java.io.IOException
Writes the specified document to a file.

Parameters:
appXml - The descriptor to serialize
file - The file to write to
Throws:
java.io.IOException - If an I/O error occurs

writeApplicationXml

public static void writeApplicationXml(ApplicationXml appXml,
                                       java.io.File file,
                                       java.lang.String encoding)
                                throws java.io.IOException
Writes the specified document to a file.

Parameters:
appXml - The descriptor to serialize
file - The file to write to
encoding - The character encoding to use
Throws:
java.io.IOException - If an I/O error occurs

writeApplicationXml

public static void writeApplicationXml(ApplicationXml appXml,
                                       java.io.File file,
                                       java.lang.String encoding,
                                       boolean isIndent)
                                throws java.io.IOException
Writes the specified document to a file.

Parameters:
appXml - The descriptor to serialize
file - The file to write to
encoding - The character encoding to use
isIndent - Whether the written XML should be indented
Throws:
java.io.IOException - If an I/O error occurs

writeApplicationXml

public static void writeApplicationXml(ApplicationXml appXml,
                                       java.io.OutputStream output,
                                       java.lang.String encoding,
                                       boolean isIndent)
                                throws java.io.IOException
Writes the specified document to an output stream.

Parameters:
appXml - The descriptor to serialize
output - The output stream to write to
encoding - The character encoding to use
isIndent - Whether the written XML should be indented
Throws:
java.io.IOException - If an I/O error occurs


Copyright © 2004-2007 Codehaus. All Rights Reserved.