com.sun.enterprise.deployment.io
Class DeploymentDescriptorFile<T extends Descriptor>

java.lang.Object
  extended by com.sun.enterprise.deployment.io.DeploymentDescriptorFile<T>
Direct Known Subclasses:
AppClientDeploymentDescriptorFile, ApplicationDeploymentDescriptorFile, ConfigurationDeploymentDescriptorFile, ConnectorDeploymentDescriptorFile, EjbDeploymentDescriptorFile, JaxrpcMappingDeploymentDescriptorFile, PersistenceDeploymentDescriptorFile, WebDeploymentDescriptorFile, WebFragmentDeploymentDescriptorFile, WebServicesDeploymentDescriptorFile, WLWebServicesDeploymentDescriptorFile

public abstract class DeploymentDescriptorFile<T extends Descriptor>
extends java.lang.Object

This abstract class defines common behaviour for classes responsibles for loading/saving XML deployment descriptors

Author:
Jerome Dochez

Field Summary
static java.lang.String FULL_VALIDATION
           
static java.lang.String PARSING_VALIDATION
           
 
Constructor Summary
DeploymentDescriptorFile()
          Creates a new instance of DeploymentDescriptorFile
 
Method Summary
protected  java.lang.String getDefaultSchemaSource()
           
abstract  java.lang.String getDeploymentDescriptorPath()
           
 org.w3c.dom.Document getDocument(T descriptor)
           
 javax.xml.parsers.DocumentBuilder getDocumentBuilder(boolean validating)
           
abstract  RootXMLNode<T> getRootXMLNode(T descriptor)
           
 javax.xml.parsers.SAXParser getSAXParser()
           
 javax.xml.parsers.SAXParser getSAXParser(boolean validating)
           
protected  boolean getXMLValidation()
           
 java.lang.String getXMLValidationLevel()
           
 T read(java.io.InputStream is)
          read and parse a J2EE Deployment Descriptor input file and return the constructed DOL descriptors for the J2EE Module
 T read(T descriptor, java.io.File in)
          read and parse a J2EE Deployment Descriptor input file and return the constructed DOL descriptors for the J2EE Module
 T read(T descriptor, java.io.InputStream is)
          read and parse a J2EE Deployment Descriptor input file and return the constructed DOL descriptors for the J2EE Module
 T read(T descriptor, ReadableArchive in)
          read and parse a J2EE Deployment Descriptor input file and return the constructed DOL descriptors for the J2EE Module
 void setErrorReportingString(java.lang.String s)
          Sets the error reporting string
 void setXMLValidation(boolean validate)
          sets wether XML validation should be performed at load time
 void setXMLValidationLevel(java.lang.String level)
          Sets the xml validation error reporting/recovering level.
 void write(T descriptor, java.io.File out)
          writes the descriptor classes into a new XML file
 void write(T descriptor, java.io.OutputStream os)
          writes the descriptor to an output stream
 void write(T descriptor, java.lang.String path)
          writes the descriptor classes into a new XML file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FULL_VALIDATION

public static final java.lang.String FULL_VALIDATION
See Also:
Constant Field Values

PARSING_VALIDATION

public static final java.lang.String PARSING_VALIDATION
See Also:
Constant Field Values
Constructor Detail

DeploymentDescriptorFile

public DeploymentDescriptorFile()
Creates a new instance of DeploymentDescriptorFile

Method Detail

getSAXParser

public javax.xml.parsers.SAXParser getSAXParser()
Returns:
a non validating SAX Parser to read an XML file (containing Deployment Descriptors) into DOL descriptors

getSAXParser

public javax.xml.parsers.SAXParser getSAXParser(boolean validating)
Parameters:
validating - true if the parser should excercise DTD validation
Returns:
a SAX Parser to read an XML file (containing Deployment Descriptors) into DOL descriptors

getDocumentBuilder

public javax.xml.parsers.DocumentBuilder getDocumentBuilder(boolean validating)
Parameters:
validating - true if validation should happen
Returns:
a DOM parser to read XML File into a DOM tree

read

public T read(java.io.InputStream is)
                          throws java.io.IOException,
                                 org.xml.sax.SAXParseException
read and parse a J2EE Deployment Descriptor input file and return the constructed DOL descriptors for the J2EE Module

Parameters:
is - the input stream for the XML file
Returns:
the DOL descriptor for the J2EE Module
Throws:
java.io.IOException
org.xml.sax.SAXParseException

read

public T read(T descriptor,
              java.io.File in)
                          throws java.io.IOException,
                                 org.xml.sax.SAXParseException
read and parse a J2EE Deployment Descriptor input file and return the constructed DOL descriptors for the J2EE Module

Parameters:
descriptor - the read is incremental, the descriptor to apply the DDs to
in - the input stream for the XML file
Returns:
the DOL descriptor for the J2EE Module
Throws:
java.io.IOException
org.xml.sax.SAXParseException

read

public T read(T descriptor,
              ReadableArchive in)
                          throws java.io.IOException,
                                 org.xml.sax.SAXParseException
read and parse a J2EE Deployment Descriptor input file and return the constructed DOL descriptors for the J2EE Module

Parameters:
descriptor - the read is incremental, the descriptor to apply the DDs to
in - the input archive abstraction for the XML file
Returns:
the DOL descriptor for the J2EE Module
Throws:
java.io.IOException
org.xml.sax.SAXParseException

read

public T read(T descriptor,
              java.io.InputStream is)
                          throws java.io.IOException,
                                 org.xml.sax.SAXParseException
read and parse a J2EE Deployment Descriptor input file and return the constructed DOL descriptors for the J2EE Module

Parameters:
descriptor - if the read is incremental, the descriptor to apply the DDs to
is - the input stream for the XML file
Returns:
the DOL descriptor for the J2EE Module
Throws:
java.io.IOException
org.xml.sax.SAXParseException

getDocument

public org.w3c.dom.Document getDocument(T descriptor)
Parameters:
descriptor -
Returns:
a Document for the passed descriptor

write

public void write(T descriptor,
                  java.io.OutputStream os)
           throws java.io.IOException
writes the descriptor to an output stream

Parameters:
descriptor - the descriptor
os - the output stream
Throws:
java.io.IOException

write

public void write(T descriptor,
                  java.lang.String path)
           throws java.io.IOException
writes the descriptor classes into a new XML file

Parameters:
descriptor - the DOL descriptor to write
path - the file to use
Throws:
java.io.IOException

write

public void write(T descriptor,
                  java.io.File out)
           throws java.io.IOException
writes the descriptor classes into a new XML file

Parameters:
descriptor - the DOL descriptor to write
out - the file to use
Throws:
java.io.IOException

getDeploymentDescriptorPath

public abstract java.lang.String getDeploymentDescriptorPath()
Returns:
the location of the DeploymentDescriptor file for a particular type of J2EE Archive

getRootXMLNode

public abstract RootXMLNode<T> getRootXMLNode(T descriptor)
Parameters:
descriptor - the descriptor for which we need the node
Returns:
a RootXMLNode responsible for handling the deployment descriptors associated with this J2EE module

getXMLValidation

protected boolean getXMLValidation()
Returns:
true if XML validation should be performed at load time

setXMLValidation

public void setXMLValidation(boolean validate)
sets wether XML validation should be performed at load time

Parameters:
validate - true to validate

setXMLValidationLevel

public void setXMLValidationLevel(java.lang.String level)
Sets the xml validation error reporting/recovering level. The reporting level is active only when xml validation is turned on @see setXMLValidation. so far, two values can be passed, medium which reports the xml validation and continue and full which reports the xml validation and stop the xml parsing.


getXMLValidationLevel

public java.lang.String getXMLValidationLevel()
Returns:
the xml validation reporting level

getDefaultSchemaSource

protected java.lang.String getDefaultSchemaSource()
Returns:
the default schema source for this deployment descriptors

setErrorReportingString

public void setErrorReportingString(java.lang.String s)
Sets the error reporting string



Copyright © 2012 GlassFish Community. All Rights Reserved.