org.apache.hivemind.parse
Class DescriptorParser

java.lang.Object
  |
  +--org.xml.sax.helpers.DefaultHandler
        |
        +--org.apache.hivemind.parse.AbstractParser
              |
              +--org.apache.hivemind.parse.DescriptorParser
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public final class DescriptorParser
extends AbstractParser

Used to parse HiveMind module deployment descriptors.

TODO: The parser ignores element content except inside <contribution> and <invoke-factory> ... it probably should forbid non-whitespace content.

Author:
Howard Lewis Ship

Field Summary
static java.lang.String ID_PATTERN
          Format for configuration point ids, service point ids and schema ids.
static java.lang.String MODULE_ID_PATTERN
          Module ids are a sequence of simple ids seperated by periods.
static java.lang.String VERSION_PATTERN
           
 
Constructor Summary
DescriptorParser(ErrorHandler errorHandler, RegistryAssembly assembly)
           
 
Method Summary
 void begin(java.lang.String elementName, java.util.Map attributes)
          Invoked when an element's start tag is recognized.
 void end(java.lang.String elementName)
          Invoked when an element's close tag is recognized.
 ModuleDescriptor parse(Resource resource, ClassResolver resolver)
          Enters a new state, pushing an object onto the stack.
 
Methods inherited from class org.apache.hivemind.parse.AbstractParser
characters, endElement, error, fatalError, getElementPath, getLocation, getResource, getState, initializeParser, peekContent, peekElementName, peekObject, pop, push, push, resetParser, setDocumentLocator, setState, startElement, unexpectedElement, updateObject, warning
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID_PATTERN

public static final java.lang.String ID_PATTERN
Format for configuration point ids, service point ids and schema ids. Consists of an optional leading underscore, followed by alphanumerics and underscores. Normal naming convention is to use a single CamelCase word, like a Java class name.

See Also:
Constant Field Values

MODULE_ID_PATTERN

public static final java.lang.String MODULE_ID_PATTERN
Module ids are a sequence of simple ids seperated by periods. In practice, they look like Java package names.

See Also:
Constant Field Values

VERSION_PATTERN

public static final java.lang.String VERSION_PATTERN
See Also:
Constant Field Values
Constructor Detail

DescriptorParser

public DescriptorParser(ErrorHandler errorHandler,
                        RegistryAssembly assembly)
Method Detail

begin

public void begin(java.lang.String elementName,
                  java.util.Map attributes)
Description copied from class: AbstractParser
Invoked when an element's start tag is recognized. The element and attributes are provided to the subclass for further processing.

Specified by:
begin in class AbstractParser

end

public void end(java.lang.String elementName)
Description copied from class: AbstractParser
Invoked when an element's close tag is recognized. The element is provided. The content of the element (the unparsed whitespace within the element's tags) is available via AbstractParser.peekContent().

Specified by:
end in class AbstractParser

parse

public ModuleDescriptor parse(Resource resource,
                              ClassResolver resolver)
Enters a new state, pushing an object onto the stack. If the object implements ILocationHolder then its location property is set to the current location.