|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.torque.betwixt.Resolver
public class Resolver
This class resolves the where to find the versions of the Betwixt Bean Map and DTD files to use in converting XML data to Torque OM objects. These files are found by using the methods described below.
Note: Both these files can be created from the Torque DB schema by using adding the 'Betwixt add-on' to Torque's Generator and using the datadtd task.
The DTD file is locate using the following method:
First, the URI on the XML Import file's DOCTYPE definition is parsed to get the specified file name (allows for DTD versioning). This name is combined with the value of the dtdPackage property and the classpath is searched. If this file is not found, the value specified by the dtdFileName property is used. If neither file is found, the normal SAX parser will attempt to load the DTD using the DOCTYPE URI
The Betwixt mapping file is found by searching the classpath for a file with the mapFileName located in the mapFilePackage.
Constructor Summary | |
---|---|
Resolver()
A resolver to get the inputSource that a SAX parser will use for an import DTD definition. |
|
Resolver(java.lang.String dtdPackage)
|
Method Summary | |
---|---|
java.lang.String |
getBewtixtFileName()
Gets the correctly qualified Betwixt mapping file name to try to open via a resource lookup. |
java.lang.String |
getDtdFileName()
Get the file name of the DTD that that will be used to validate the XML import with. |
java.lang.String |
getDtdPackage()
Get the package directory the DTD will be located in. |
java.lang.String |
getDtdUri()
Gets the URI to locate the DTD via the Internet (if any) |
java.lang.String |
getMapFileName()
Get the name of the Betwixt multi (bean) mapping file to be used. |
java.lang.String |
getMapFilePackage()
Get the package directory the Betwixt mapping file will be located in. |
org.xml.sax.InputSource |
makeInputSource(java.lang.String packageFileName)
Try to find the specified resource on the classpath. |
org.xml.sax.InputSource |
resolveBetwixtFile()
Locate the required Betwixt map file on the classpath. |
java.lang.String |
resolveDtdUri()
Resolve the DTD file's URI to use in DOCTYPE elements in the following manner: |
org.xml.sax.InputSource |
resolveEntity(java.lang.String publicID,
java.lang.String systemID)
Return an InputSource that provides access to the indicated
entity. |
void |
setDtdFileName(java.lang.String dtdFileName)
Set the file name (no path ) of the DTD file to validate the XML against. |
void |
setDtdPackage(java.lang.String dtdPackage)
Set the package directory the DTD will be located in. |
void |
setDtdUri(java.lang.String dtdURI)
Sets the URI to locate the DTD via the Internet (if any). |
void |
setMapFileName(java.lang.String mapFileName)
Set the name of the Betwixt multi (bean) mapping file to be used. |
void |
setMapFilePackage(java.lang.String mapFilePackage)
Set the package directory the Betwixt mapping file will be located in. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Resolver()
public Resolver(java.lang.String dtdPackage)
Method Detail |
---|
public org.xml.sax.InputSource resolveEntity(java.lang.String publicID, java.lang.String systemID) throws org.xml.sax.SAXException, java.io.IOException
InputSource
that provides access to the indicated
entity. Assumes that systemId is in a URL format that ends in the dtd
file name, e.g. "http://www.my.org/dtds/myDTD.dtd".The file name and dtdPackage value are combine and the class path is searched for the DTD resource. If not found, a null is returned to indicate the parser should use it's normal resolving method.
resolveEntity
in interface org.xml.sax.EntityResolver
publicID
- a java.lang.String that contains the public identifier
of the desired entitysystemID
- a java.lang.String that contains the system identifier
(i.e., the URL) of the desired entity
org.xml.sax.SAXException
java.io.IOException
EntityResolver.resolveEntity(java.lang.String,
java.lang.String)
public org.xml.sax.InputSource resolveBetwixtFile() throws java.lang.Exception
java.lang.Exception
public java.lang.String getBewtixtFileName()
public org.xml.sax.InputSource makeInputSource(java.lang.String packageFileName) throws java.lang.Exception
packageFileName
-
java.lang.Exception
public java.lang.String resolveDtdUri() throws java.lang.IllegalStateException
If the dtdURI property is set, just use that. Otherwise, try to find the specified dtd file locally on the Classpath. If that fails, just the dtd file name.
java.lang.IllegalStateException
- if dtdFileName has not been set.public java.lang.String getDtdFileName()
public void setDtdFileName(java.lang.String dtdFileName)
dtdFileName
- The dtdFileName to set.public java.lang.String getDtdPackage()
public void setDtdPackage(java.lang.String dtdPackage)
dtdPackage
- The dtdPackage to setpublic java.lang.String getMapFileName()
public void setMapFileName(java.lang.String mapFileName)
mapFileName
- The mapFileName to set.public java.lang.String getMapFilePackage()
public void setMapFilePackage(java.lang.String mapFilePackage)
mapFilePackage
- The mapFilePackage to set.public java.lang.String getDtdUri()
public void setDtdUri(java.lang.String dtdURI)
dtdURI
- The DTD URI to use.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |