org.apache.hivemind.parse
Class XmlResourceProcessor

java.lang.Object
  extended by org.apache.hivemind.parse.XmlResourceProcessor

public class XmlResourceProcessor
extends java.lang.Object

The XmlResourceProcessor processes XML resources using the DescriptorParser which is used as a SAX ContentHandler. The result of processing a resource is a ModuleDescriptor.

Since:
1.1
Author:
Knut Wannheden
See Also:
DescriptorParser, ModuleDescriptorProvider

Field Summary
protected  ErrorHandler _errorHandler
           
protected  ClassResolver _resolver
           
 
Constructor Summary
XmlResourceProcessor(ClassResolver resolver, ErrorHandler errorHandler)
           
 
Method Summary
protected  ModuleDescriptor parseResource(Resource resource, javax.xml.parsers.SAXParser parser, DescriptorParser contentHandler)
          Returns the ModuleDescriptor obtained by parsing the specified Resource using the given SAXParser and DescriptorParser.
 ModuleDescriptor processResource(Resource resource)
          Initializes the parser, processes the Resource, resets the parser, and finally returns the parsed ModuleDescriptor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_resolver

protected ClassResolver _resolver

_errorHandler

protected ErrorHandler _errorHandler
Constructor Detail

XmlResourceProcessor

public XmlResourceProcessor(ClassResolver resolver,
                            ErrorHandler errorHandler)
Method Detail

processResource

public ModuleDescriptor processResource(Resource resource)
Initializes the parser, processes the Resource, resets the parser, and finally returns the parsed ModuleDescriptor.

Throws:
ApplicationRuntimeException - Thrown if errors are encountered while parsing the resource.

parseResource

protected ModuleDescriptor parseResource(Resource resource,
                                         javax.xml.parsers.SAXParser parser,
                                         DescriptorParser contentHandler)
                                  throws org.xml.sax.SAXException,
                                         java.io.IOException
Returns the ModuleDescriptor obtained by parsing the specified Resource using the given SAXParser and DescriptorParser. Called by processResource(Resource) after the DescriptorParser has been initialized. Suitable for overriding by subclasses.

Throws:
org.xml.sax.SAXException
java.io.IOException