Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.objectstyle.cayenne.util
Class AbstractHandler

    java.lang.Object
      org.xml.sax.helpers.DefaultHandler
          org.objectstyle.cayenne.util.AbstractHandler

All Implemented Interfaces:
  org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

Deprecated. since 1.2 - this is moved to a non-public class in conf package.

    public class AbstractHandler

extends org.xml.sax.helpers.DefaultHandler

The common superclass for all SAX event handlers used to parse the configuration file. Each method just throws an exception, so subclasses should override what they can handle. Each type of XML element (map, node, etc.) has a specific subclass. In the constructor, this class takes over the handling of SAX events from the parent handler and returns control back to the parent in the endElement method.

The idea to use nested handlers for XML document parsing (and code to implement it) were taken from org.apache.tools.ant.ProjectHelper from Jakarta-Ant project (Copyright: Apache Software Foundation). This may not be the best way to build objects from XML, but it is rather consistent. For each nested element in the XML tree a dedicated handler is created (subclass of this AbstractHandler). Once the element is parsed, control is handled back to the parent handler.

Author:
  Andrei Adamchik

Field Summary
`protected org.xml.sax.ContentHandler` | `parentHandler` Deprecated. Previous handler for the document.
`protected org.xml.sax.XMLReader` | `parser` Deprecated. Current parser.

Constructor Summary
`AbstractHandler(org.xml.sax.XMLReader parser, org.xml.sax.ContentHandler parentHandler)` Deprecated. Creates a handler and sets the parser to use it for the current element.

Method Summary
`void` | `characters(char[] buf, int start, int count)` Deprecated. Handles text within an element.
`void` | `endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)` Deprecated. Handles the end of an element.
`protected void` | `finished()` Deprecated. Called when this element and all elements nested into it have been handled.
`org.xml.sax.XMLReader` | `getParser()` Deprecated. Returns currently used XMLReader.
`void` | `startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)` Deprecated. Handles the start of an element.

Methods inherited from class org.xml.sax.helpers.DefaultHandler
`endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### parser

    protected org.xml.sax.XMLReader parser

  Deprecated.
  Current parser.

### parentHandler

    protected org.xml.sax.ContentHandler parentHandler

  Deprecated.
  Previous handler for the document. When the next element is finished, control returns to this handler.

Constructor Detail

### AbstractHandler

    public AbstractHandler(org.xml.sax.XMLReader parser,
                           org.xml.sax.ContentHandler parentHandler)

  Deprecated.
  Creates a handler and sets the parser to use it for the current element.

  Parameters:
    `parser` - Currently used XML parser. Must not be `null`.
    `parentHandler` - The handler which should be restored to the parser at the end of the element. Must not be `null`.

Method Detail

### getParser

    public org.xml.sax.XMLReader getParser()

  Deprecated.
  Returns currently used XMLReader.

### startElement

    public void startElement(java.lang.String namespaceURI,
                             java.lang.String localName,
                             java.lang.String qName,
                             org.xml.sax.Attributes atts)
                      throws org.xml.sax.SAXException

  Deprecated.
  Handles the start of an element. This base implementation just throws an exception.

  Specified by:
    `startElement` in interface `org.xml.sax.ContentHandler`
  Overrides:
    `startElement` in class `org.xml.sax.helpers.DefaultHandler`
  Throws:
    `org.xml.sax.SAXException` - if this method is not overridden, or in case of error in an overridden version

### characters

    public void characters(char[] buf,
                           int start,
                           int count)
                    throws org.xml.sax.SAXException

  Deprecated.
  Handles text within an element. This base implementation just throws an exception.

  Specified by:
    `characters` in interface `org.xml.sax.ContentHandler`
  Overrides:
    `characters` in class `org.xml.sax.helpers.DefaultHandler`
  Parameters:
    `buf` - A character array of the text within the element. Will not be `null`.
    `start` - The start element in the array.
    `count` - The number of characters to read from the array.
  Throws:
    `org.xml.sax.SAXException` - if this method is not overridden, or in case of error in an overridden version

### finished

    protected void finished()

  Deprecated.
  Called when this element and all elements nested into it have been handled.

### endElement

    public void endElement(java.lang.String namespaceURI,
                           java.lang.String localName,
                           java.lang.String qName)
                    throws org.xml.sax.SAXException

  Deprecated.
  Handles the end of an element. Any required clean-up is performed by the finished() method and then the original handler is restored to the parser.

  Specified by:
    `endElement` in interface `org.xml.sax.ContentHandler`
  Overrides:
    `endElement` in class `org.xml.sax.helpers.DefaultHandler`
  Throws:
    `org.xml.sax.SAXException`
  See Also:
    `finished()`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2006 ObjectStyle.org All Rights Reserved.