org.codehaus.cargo.module
Class AbstractDescriptorIo

java.lang.Object
  extended byorg.codehaus.cargo.module.AbstractDescriptorIo
Direct Known Subclasses:
DocumentMerger, DocumentStreamAdapter, EjbJarXmlIo, IbmEjbJarBndXmiIo, IbmWebBndXmiIo, JBossWebXmlIo, OrionEjbJarXmlIo, OrionWebXmlIo, ResinWebXmlIo, TomcatContextXmlIo, WeblogicEjbJarXmlIo, WeblogicXmlIo, WebXmlIo

public abstract class AbstractDescriptorIo
extends java.lang.Object

Provides convenience methods for reading and writing web deployment descriptors.

Version:
$Id: AbstractDescriptorIo.java 1160 2006-07-30 20:15:34Z vmassol $

Constructor Summary
protected AbstractDescriptorIo()
          Utility class should not have a public or default constructor.
 
Method Summary
static javax.xml.parsers.DocumentBuilder createDocumentBuilder()
           
static java.io.File[] writeAll(J2eeDescriptor descriptor, java.lang.String dir)
          Writes the WebXml and its associated vendor descriptors to the specified directory.
static void writeDescriptor(Descriptor descriptor, java.io.File file)
          Writes the specified document to a file.
static void writeDescriptor(Descriptor descriptor, java.io.File file, java.lang.String encoding)
          Writes the specified document to a file.
static void writeDescriptor(Descriptor descriptor, java.io.File file, java.lang.String encoding, boolean isIndent)
          Writes the specified document to a file.
static void writeDescriptor(Descriptor descriptor, java.io.OutputStream out, 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
 

Constructor Detail

AbstractDescriptorIo

protected AbstractDescriptorIo()
Utility class should not have a public or default constructor.

Method Detail

createDocumentBuilder

public static javax.xml.parsers.DocumentBuilder createDocumentBuilder()
                                                               throws javax.xml.parsers.ParserConfigurationException
Returns:
a new non-validating, non-namespace-aware DocumentBuilder instance
Throws:
javax.xml.parsers.ParserConfigurationException - in case of error

writeDescriptor

public static void writeDescriptor(Descriptor descriptor,
                                   java.io.File file)
                            throws java.io.IOException
Writes the specified document to a file.

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

writeDescriptor

public static void writeDescriptor(Descriptor descriptor,
                                   java.io.File file,
                                   java.lang.String encoding)
                            throws java.io.IOException
Writes the specified document to a file.

Parameters:
descriptor - 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

writeDescriptor

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

Parameters:
descriptor - 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

writeDescriptor

public static void writeDescriptor(Descriptor descriptor,
                                   java.io.OutputStream out,
                                   java.lang.String encoding,
                                   boolean isIndent)
                            throws java.io.IOException
Writes the specified document to an output stream.

Parameters:
descriptor - The descriptor to serialize
out - 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

writeAll

public static java.io.File[] writeAll(J2eeDescriptor descriptor,
                                      java.lang.String dir)
                               throws java.io.IOException
Writes the WebXml and its associated vendor descriptors to the specified directory.

Parameters:
descriptor - The descriptor to serialize
dir - Directory to store the descriptors in
Returns:
Array of files for every created file
Throws:
java.io.IOException - if a I/O error occurs


Copyright © 2004-2007 Codehaus. All Rights Reserved.