Package org.apache.torque.generator.configuration.outlet

# Class OutletConfigurationSaxHandler

java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.apache.torque.generator.configuration.outlet.OutletConfigurationSaxHandler

All Implemented Interfaces:
  `ContentHandler`, `DTDHandler`, `EntityResolver`, `ErrorHandler`

public class OutletConfigurationSaxHandler extends DefaultHandler
A SAX handler which parses Outlet configuration files. Relies on delegate handlers for parsing the configuration for the different outlet types.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `OutletConfigurationSaxHandler(ConfigurationProvider configurationProvider, UnitDescriptor unitDescriptor, ConfigurationHandlers configurationHandlers)`
  Constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `characters(char[] ch, int start, int length)`
  `void`
  `endElement(String uri, String localName, String rawName)`
  `void`
  `error(SAXParseException exception)`
  `void`
  `fatalError(SAXParseException exception)`
  `List<MergepointMapping>`
  `getMergepointMappings()`
  Returns all mergepoint mappings which were configured outside the outlets in the parsed outlet configuration file.
  `OutletSaxHandler`
  `getOutletHandler(QualifiedName outletName, String outletType)`
  Returns the correct handler for a outlet tag.
  `List<Outlet>`
  `getOutlets()`
  Returns all outlets which were configured in the parsed outlet configuration file.
  `static String`
  `getOutletType(Attributes attributes)`
  Reads the outlet type from the attributes of the outlet XML tag.
  `InputSource`
  `resolveEntity(String publicId, String systemId)`
  EntityResolver implementation.
  `void`
  `startElement(String uri, String localName, String qName, Attributes attributes)`
  `void`
  `warning(SAXParseException exception)`

  ### Methods inherited from class org.xml.sax.helpers.DefaultHandler

  `endDocument, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.xml.sax.ContentHandler

  `declaration`

- ## Constructor Details

  - ### OutletConfigurationSaxHandler

    public OutletConfigurationSaxHandler(ConfigurationProvider configurationProvider, UnitDescriptor unitDescriptor, ConfigurationHandlers configurationHandlers)
    Constructor.
    Parameters:
      `configurationProvider` - The access object for the configuration files, not null.
      `unitDescriptor` - The description of the generation unit, not null.
      `configurationHandlers` - The available configuration handlers, not null.
    Throws:
      `NullPointerException` - if an argument is null.

- ## Method Details

  - ### getOutlets

    public List<Outlet> getOutlets()
    Returns all outlets which were configured in the parsed outlet configuration file.
    Returns:
      all created outlets, not null.

  - ### getMergepointMappings

    public List<MergepointMapping> getMergepointMappings()
    Returns all mergepoint mappings which were configured outside the outlets in the parsed outlet configuration file.
    Returns:
      all created mergepoint mappings, not null.

  - ### startElement

    public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
    Specified by:
      `startElement` in interface `ContentHandler`
    Overrides:
      `startElement` in class `DefaultHandler`
    Throws:
      `SAXException`

  - ### endElement

    public void endElement(String uri, String localName, String rawName) throws SAXException
    Specified by:
      `endElement` in interface `ContentHandler`
    Overrides:
      `endElement` in class `DefaultHandler`
    Throws:
      `SAXException`

  - ### characters

    public void characters(char[] ch, int start, int length) throws SAXException
    Specified by:
      `characters` in interface `ContentHandler`
    Overrides:
      `characters` in class `DefaultHandler`
    Throws:
      `SAXException`

  - ### getOutletHandler

    public OutletSaxHandler getOutletHandler(QualifiedName outletName, String outletType) throws SAXException
    Returns the correct handler for a outlet tag. The method uses the type attribute to determine which handler is needed. I.e. it looks up the handler factory type in the outlet types, and asks the factory for a handler.
    Parameters:
      `outletName` - the name for the outlet which configuration will be read in by the generated SaxHandlerFactory, or null if the name of the outlet should be determined from the parsed XML.
      `outletType` - the type of the outlet, not null.
    Returns:
      the handler for the tag, not null.
    Throws:
      `SAXException` - if no matching handler can be identified, or if an error occurs while creating the handler.

  - ### getOutletType

    public static String getOutletType(Attributes attributes) throws SAXException
    Reads the outlet type from the attributes of the outlet XML tag.
    Parameters:
      `attributes` - the attributes of the XML tag, not null.
    Returns:
      the outlet type, not null.
    Throws:
      `SAXException` - if the xsi:type attribute is not set.

  - ### resolveEntity

    public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
    EntityResolver implementation. Called by the XML parser
    Specified by:
      `resolveEntity` in interface `EntityResolver`
    Overrides:
      `resolveEntity` in class `DefaultHandler`
    Parameters:
      `publicId` - The public identifier of the external entity.
      `systemId` - The system identifier of the external entity.
    Returns:
      an InputSource for the entity, or null if the URI is not known.
    Throws:
      `SAXException`
      `IOException`
    See Also:
      - `ConfigurationEntityResolver.resolveEntity(String, String)`

  - ### error

    public void error(SAXParseException exception) throws SAXParseException
    Specified by:
      `error` in interface `ErrorHandler`
    Overrides:
      `error` in class `DefaultHandler`
    Throws:
      `SAXParseException`

  - ### fatalError

    public void fatalError(SAXParseException exception) throws SAXParseException
    Specified by:
      `fatalError` in interface `ErrorHandler`
    Overrides:
      `fatalError` in class `DefaultHandler`
    Throws:
      `SAXParseException`

  - ### warning

    public void warning(SAXParseException exception) throws SAXParseException
    Specified by:
      `warning` in interface `ErrorHandler`
    Overrides:
      `warning` in class `DefaultHandler`
    Throws:
      `SAXParseException`