org.apache.torque.engine.database.transform
Class DTDResolver

java.lang.Object
  extended by org.apache.torque.engine.database.transform.DTDResolver
All Implemented Interfaces:
EntityResolver
Direct Known Subclasses:
ImpexDTDResolver

public class DTDResolver
extends Object
implements EntityResolver

A resolver to get the database.dtd file for the XML parser from the jar.

Version:
$Id: DTDResolver.java,v 1.1 2007-10-21 07:57:26 abyrne Exp $
Author:
Martin Poeschl, Kurt Schrader, Quinton McCombs

Field Summary
private static org.apache.commons.logging.Log log
          Logging class from commons.logging
static String WEB_SITE_DTD
          Where the DTD is located on the web.
static String WEB_SITE_DTD_3_2
          Where the 3.2 DTD is located on the web.
 
Constructor Summary
DTDResolver()
          constructor
 
Method Summary
private  InputSource readFromClasspath(String resourceName)
          Reads the resource with the given name from the classpath.
 InputSource resolveEntity(String publicId, String systemId)
          An implementation of the SAX EntityResolver interface to be called by the XML parser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WEB_SITE_DTD

public static final String WEB_SITE_DTD
Where the DTD is located on the web.

See Also:
Constant Field Values

WEB_SITE_DTD_3_2

public static final String WEB_SITE_DTD_3_2
Where the 3.2 DTD is located on the web.

See Also:
Constant Field Values

log

private static org.apache.commons.logging.Log log
Logging class from commons.logging

Constructor Detail

DTDResolver

public DTDResolver()
            throws SAXException
constructor

Throws:
SAXException
Method Detail

resolveEntity

public InputSource resolveEntity(String publicId,
                                 String systemId)
                          throws IOException,
                                 SAXException
An implementation of the SAX EntityResolver interface to be called by the XML parser. If the dtd is the current Torque DTD, the DTD is read from the generator jar. In all other cases, null is returned to indicate that the parser should open a regular connection to the systemId URI.

Specified by:
resolveEntity in interface EntityResolver
Parameters:
publicId - The public identifier of the external entity
systemId - The system identifier of the external entity
Returns:
An InputSource for the database.dtd file in the generator jar, or null.
Throws:
IOException
SAXException

readFromClasspath

private InputSource readFromClasspath(String resourceName)
                               throws SAXException
Reads the resource with the given name from the classpath.

Parameters:
resourceName - the name of the resource to read
Returns:
an Inputsource witht the content of the resource.
Throws:
SAXException - if the resource cannot be read.


Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.