Package com.sun.enterprise.deployment.io
Class DeploymentDescriptorFile<T extends Descriptor>
- java.lang.Object
-
- com.sun.enterprise.deployment.io.DeploymentDescriptorFile<T>
-
- Direct Known Subclasses:
AppClientDeploymentDescriptorFile
,ApplicationDeploymentDescriptorFile
,ConfigurationDeploymentDescriptorFile
,ConnectorDeploymentDescriptorFile
,EjbDeploymentDescriptorFile
,JaxrpcMappingDeploymentDescriptorFile
,PermissionsDeploymentDescriptorFile
,PersistenceDeploymentDescriptorFile
,WebDeploymentDescriptorFile
,WebFragmentDeploymentDescriptorFile
,WebServicesDeploymentDescriptorFile
public abstract class DeploymentDescriptorFile<T extends Descriptor> extends Object
This abstract class defines common behaviour for classes responsible for loading/saving XML deployment descriptors- Author:
- Jerome Dochez
-
-
Field Summary
Fields Modifier and Type Field Description static String
FULL_VALIDATION
static String
PARSING_VALIDATION
-
Constructor Summary
Constructors Constructor Description DeploymentDescriptorFile()
Creates a new instance of DeploymentDescriptorFile
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ArchiveType
getArchiveType()
protected String
getDefaultSchemaSource()
abstract String
getDeploymentDescriptorPath()
Document
getDocument(T descriptor)
DocumentBuilder
getDocumentBuilder(boolean validating)
abstract RootXMLNode<T>
getRootXMLNode(T descriptor)
SAXParser
getSAXParser()
SAXParser
getSAXParser(boolean validating)
protected boolean
getXMLValidation()
String
getXMLValidationLevel()
T
read(InputStream is)
read and parse a J2EE Deployment Descriptor input file and return the constructed DOL descriptors for the J2EE ModuleT
read(T descriptor, File in)
read and parse a J2EE Deployment Descriptor input file and return the constructed DOL descriptors for the J2EE ModuleT
read(T descriptor, InputStream is)
read and parse a J2EE Deployment Descriptor input file and return the constructed DOL descriptors for the J2EE ModuleT
read(T descriptor, ReadableArchive in)
read and parse a J2EE Deployment Descriptor input file and return the constructed DOL descriptors for the J2EE Modulevoid
setArchiveType(ArchiveType type)
void
setErrorReportingString(String s)
Sets the error reporting stringvoid
setXMLValidation(boolean validate)
sets wether XML validation should be performed at load timevoid
setXMLValidationLevel(String level)
Sets the xml validation error reporting/recovering level.void
write(T descriptor, File out)
writes the descriptor classes into a new XML filevoid
write(T descriptor, OutputStream os)
writes the descriptor to an output streamvoid
write(T descriptor, String path)
writes the descriptor classes into a new XML file
-
-
-
Field Detail
-
FULL_VALIDATION
public static final String FULL_VALIDATION
- See Also:
- Constant Field Values
-
PARSING_VALIDATION
public static final String PARSING_VALIDATION
- See Also:
- Constant Field Values
-
-
Method Detail
-
getSAXParser
public SAXParser getSAXParser()
- Returns:
- a non validating SAX Parser to read an XML file (containing Deployment Descriptors) into DOL descriptors
-
getSAXParser
public 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 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(InputStream is) throws IOException, 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:
IOException
SAXParseException
-
read
public T read(T descriptor, File in) throws IOException, 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 toin
- the input stream for the XML file- Returns:
- the DOL descriptor for the J2EE Module
- Throws:
IOException
SAXParseException
-
read
public T read(T descriptor, ReadableArchive in) throws IOException, 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 toin
- the input archive abstraction for the XML file- Returns:
- the DOL descriptor for the J2EE Module
- Throws:
IOException
SAXParseException
-
read
public T read(T descriptor, InputStream is) throws IOException, 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 tois
- the input stream for the XML file- Returns:
- the DOL descriptor for the J2EE Module
- Throws:
IOException
SAXParseException
-
getDocument
public Document getDocument(T descriptor)
- Parameters:
descriptor
-- Returns:
- a Document for the passed descriptor
-
write
public void write(T descriptor, OutputStream os) throws IOException
writes the descriptor to an output stream- Parameters:
descriptor
- the descriptoros
- the output stream- Throws:
IOException
-
write
public void write(T descriptor, String path) throws IOException
writes the descriptor classes into a new XML file- Parameters:
descriptor
- the DOL descriptor to writepath
- the file to use- Throws:
IOException
-
write
public void write(T descriptor, File out) throws IOException
writes the descriptor classes into a new XML file- Parameters:
descriptor
- the DOL descriptor to writeout
- the file to use- Throws:
IOException
-
getDeploymentDescriptorPath
public abstract String getDeploymentDescriptorPath()
- Returns:
- the location of the deployment descriptor file for a particular type of Java EE 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 Java EE 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(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 String getXMLValidationLevel()
- Returns:
- the xml validation reporting level
-
getDefaultSchemaSource
protected String getDefaultSchemaSource()
- Returns:
- the default schema source for this deployment descriptors
-
setErrorReportingString
public void setErrorReportingString(String s)
Sets the error reporting string
-
getArchiveType
public ArchiveType getArchiveType()
- Returns:
- the archive type associated with this deployment descriptor file
-
setArchiveType
public void setArchiveType(ArchiveType type)
- Parameters:
the
- archive type to set on this deployment descriptor file
-
-