public abstract class DescriptorIO
extends java.lang.Object
DescriptorIO
manages the
operations required to create, load, and persist an instance of an
XML deployment descriptor. Each concrete subclass of
DescriptorIO
is intended to support a single version
of a particular deployment descriptor.Methods that take a descriptor object require that the descriptor object be of the correct type. Methods that return a descriptor object will return an object that can be cast to the descriptor object type.
Modifier | Constructor and Description |
---|---|
protected |
DescriptorIO(java.lang.Class descriptorClass,
java.lang.String rootElem,
java.lang.String publicID,
java.lang.String systemID) |
Modifier and Type | Method and Description |
---|---|
void |
checkDescriptorClass(java.lang.Object descriptor)
Runtime type checking.
|
protected int |
compareVersions(java.lang.String systemID1,
java.lang.String systemID2)
Compares two system ID version strings.
|
java.lang.Class |
getDescriptorClass()
Returns the class of the descriptor type that is managed by
the
DescriptorIO implementation. |
protected abstract java.lang.String |
getMinimumRequiredVersion(java.lang.Object descriptor)
Correct subclass implementation is required to guarantee proper
behavior for multi-version support.
|
java.lang.String |
getPublicID()
Returns the XML public ID of the descriptor.
|
java.lang.String |
getRootElement()
Returns the XML root element name of the descriptor.
|
java.lang.String |
getSystemID()
Returns the XML system ID of the descriptor.
|
oracle.xml.parser.v2.XMLDocument |
getXMLDocument(java.lang.Object descriptor) |
oracle.xml.parser.v2.XMLDocument |
getXMLDocument(java.lang.Object descriptor,
java.lang.String encoding) |
java.lang.Object |
load(java.io.Reader reader) |
java.lang.Object |
load(java.io.Reader reader,
oracle.xml.parser.v2.DTD dtd,
int reportLevel,
Object2DomLogger logger) |
java.lang.Object |
load(java.net.URL url) |
protected oracle.xml.parser.v2.XMLDocument |
loadXml(java.net.URL url) |
protected abstract int |
mapVersionToInt(java.lang.String systemID)
Maps a version string to an integer to simplify the algorithm
for comparing version strings.
|
void |
maybeUpdateDoctype(oracle.xml.parser.v2.XMLDocument doc,
java.lang.Object descriptor)
Checks whether the doctype declaration of the XMLDocument is
appropriate for the descriptor object.
|
protected abstract DescriptorIO |
newDescriptorIO(java.lang.String systemID)
Correct subclass implementation is required to guarantee proper
behavior for multi-version support.
|
void |
save(java.lang.Object descriptor,
java.io.PrintWriter printWriter) |
void |
save(java.lang.Object descriptor,
java.net.URL url) |
void |
saveWithXMLDiff(java.lang.Object descriptor,
java.net.URL url) |
void |
setDoctype(oracle.xml.parser.v2.XMLDocument xmlDocument) |
java.lang.String |
toString(java.lang.Object descriptor) |
protected DescriptorIO(java.lang.Class descriptorClass, java.lang.String rootElem, java.lang.String publicID, java.lang.String systemID)
public java.lang.Class getDescriptorClass()
DescriptorIO
implementation.public java.lang.String getRootElement()
public java.lang.String getPublicID()
public java.lang.String getSystemID()
public void save(java.lang.Object descriptor, java.net.URL url) throws java.io.IOException
java.io.IOException
public void saveWithXMLDiff(java.lang.Object descriptor, java.net.URL url) throws java.io.IOException
java.io.IOException
public void save(java.lang.Object descriptor, java.io.PrintWriter printWriter) throws java.io.IOException
java.io.IOException
public java.lang.String toString(java.lang.Object descriptor)
public java.lang.Object load(java.net.URL url) throws java.io.IOException
java.io.IOException
public java.lang.Object load(java.io.Reader reader) throws java.io.IOException
java.io.IOException
public java.lang.Object load(java.io.Reader reader, oracle.xml.parser.v2.DTD dtd, int reportLevel, Object2DomLogger logger) throws java.io.IOException
java.io.IOException
public oracle.xml.parser.v2.XMLDocument getXMLDocument(java.lang.Object descriptor)
java.lang.NullPointerException
- if the specified descriptor
is null
.public oracle.xml.parser.v2.XMLDocument getXMLDocument(java.lang.Object descriptor, java.lang.String encoding)
public void setDoctype(oracle.xml.parser.v2.XMLDocument xmlDocument)
public void checkDescriptorClass(java.lang.Object descriptor) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- if the specified descriptor
object is of the wrong type or is null
.public void maybeUpdateDoctype(oracle.xml.parser.v2.XMLDocument doc, java.lang.Object descriptor)
protected abstract java.lang.String getMinimumRequiredVersion(java.lang.Object descriptor)
protected int compareVersions(java.lang.String systemID1, java.lang.String systemID2)
protected abstract int mapVersionToInt(java.lang.String systemID)
Higher ints correspond to newer versions. Lower ints correspond to older versions. The actual int value returned is not important. Only the relative ordering of the ints is important.
protected abstract DescriptorIO newDescriptorIO(java.lang.String systemID)
protected oracle.xml.parser.v2.XMLDocument loadXml(java.net.URL url) throws org.xml.sax.SAXException, java.io.IOException
org.xml.sax.SAXException
java.io.IOException