org.apache.tapestry.parse
Class SpecificationParser

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.apache.hivemind.parse.AbstractParser
          extended by org.apache.tapestry.parse.SpecificationParser
All Implemented Interfaces:
ISpecificationParser, ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class SpecificationParser
extends org.apache.hivemind.parse.AbstractParser
implements ISpecificationParser

Parses the different types of Tapestry specifications.

Not threadsafe; it is the callers responsibility to ensure thread safety.

Author:
Howard Lewis Ship

Field Summary
static String ASSET_NAME_PATTERN
          Perl5 pattern for asset names.
static String BEAN_NAME_PATTERN
          Perl5 pattern for helper bean names.
static String COMPONENT_ALIAS_PATTERN
          Perl5 pattern for component type (which was known as an "alias" in earlier versions of Tapestry).
static String COMPONENT_ID_PATTERN
          Perl5 pattern for component ids.
static String COMPONENT_TYPE_PATTERN
          Perl5 pattern for component types (i.e., the type attribute of the <component> element).
static String EXTENDED_IDENTIFIER_PATTERN
           
static String EXTENDED_PROPERTY_NAME_PATTERN
          Extended version of Tapestry.SIMPLE_PROPERTY_NAME_PATTERN, but allows a series of individual property names, seperated by periods.
static String EXTENSION_NAME_PATTERN
          Per5 pattern for extension names.
static String IDENTIFIER_PATTERN
           
static String LIBRARY_ID_PATTERN
          Perl5 pattern for library ids.
static String PAGE_NAME_PATTERN
          Perl5 pattern for page names.
static String PARAMETER_NAME_PATTERN
          Perl5 pattern that parameter names must conform to.
static String PROPERTY_NAME_PATTERN
          Perl5 pattern that property names (that can be connected to parameters) must conform to.
static String SERVICE_NAME_PATTERN
          Deprecated. As of release 4.0, the <service> element (in 3.0 DTDs) is no longer supported.
static String TAPESTRY_DTD_3_0_PUBLIC_ID
           
static String TAPESTRY_DTD_4_0_PUBLIC_ID
           
static String TAPESTRY_DTD_4_1_PUBLIC_ID
           
 
Constructor Summary
SpecificationParser(org.apache.hivemind.ClassResolver resolver)
          This constructor is a convienience used by some tests.
SpecificationParser(org.apache.hivemind.ErrorHandler errorHandler, Log log, org.apache.hivemind.ClassResolver resolver, SpecFactory factory)
          The full constructor, used within Tapestry.
 
Method Summary
protected  void begin(String elementName, Map attributes)
           
protected  void end(String elementName)
           
protected  void initializeParser(org.apache.hivemind.Resource resource, int startState)
           
 IApplicationSpecification parseApplicationSpecification(org.apache.hivemind.Resource resource)
          Parses an application specification from the provided Resource.
 IComponentSpecification parseComponentSpecification(org.apache.hivemind.Resource resource)
           
 ILibrarySpecification parseLibrarySpecification(org.apache.hivemind.Resource resource)
           
 IComponentSpecification parsePageSpecification(org.apache.hivemind.Resource resource)
           
protected  String peekContent()
           
protected  void resetParser()
           
 InputSource resolveEntity(String publicId, String systemId)
          Resolved an external entity, which is assumed to be the doctype.
 void setBindingSource(BindingSource bindingSource)
           
 void setValueConverter(ValueConverter valueConverter)
           
 
Methods inherited from class org.apache.hivemind.parse.AbstractParser
characters, endElement, error, fatalError, getElementPath, getLocation, getResource, getState, peekElementName, peekObject, pop, push, push, setDocumentLocator, setState, startElement, unexpectedElement, updateObject, warning
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ASSET_NAME_PATTERN

public static final String ASSET_NAME_PATTERN
Perl5 pattern for asset names. Letter, followed by letter, number or underscore. Also allows the special "$template" value.

Since:
2.2
See Also:
Constant Field Values

BEAN_NAME_PATTERN

public static final String BEAN_NAME_PATTERN
Perl5 pattern for helper bean names. Letter, followed by letter, number or underscore.

Since:
2.2
See Also:
Constant Field Values

IDENTIFIER_PATTERN

public static final String IDENTIFIER_PATTERN
See Also:
Constant Field Values

EXTENDED_IDENTIFIER_PATTERN

public static final String EXTENDED_IDENTIFIER_PATTERN
See Also:
Constant Field Values

COMPONENT_ALIAS_PATTERN

public static final String COMPONENT_ALIAS_PATTERN
Perl5 pattern for component type (which was known as an "alias" in earlier versions of Tapestry). This is either a simple property name, or a series of property names seperated by slashes (the latter being new in Tapestry 4.0). This defines a literal that can appear in a library or application specification.

Since:
2.2
See Also:
Constant Field Values

COMPONENT_ID_PATTERN

public static final String COMPONENT_ID_PATTERN
Perl5 pattern for component ids. Letter, followed by letter, number or underscore.

Since:
2.2
See Also:
Constant Field Values

COMPONENT_TYPE_PATTERN

public static final String COMPONENT_TYPE_PATTERN
Perl5 pattern for component types (i.e., the type attribute of the <component> element). Component types are an optional namespace prefix followed by a component type (within the library defined by the namespace). Starting in 4.0, the type portion is actually a series of identifiers seperated by slashes.

Since:
2.2
See Also:
Constant Field Values

EXTENDED_PROPERTY_NAME_PATTERN

public static final String EXTENDED_PROPERTY_NAME_PATTERN
Extended version of Tapestry.SIMPLE_PROPERTY_NAME_PATTERN, but allows a series of individual property names, seperated by periods. In addition, each name within the dotted sequence is allowed to contain dashes.

Since:
2.2
See Also:
Constant Field Values

EXTENSION_NAME_PATTERN

public static final String EXTENSION_NAME_PATTERN
Per5 pattern for extension names. Letter followed by letter, number, dash, period or underscore.

Since:
2.2
See Also:
Constant Field Values

LIBRARY_ID_PATTERN

public static final String LIBRARY_ID_PATTERN
Perl5 pattern for library ids. Letter followed by letter, number or underscore.

Since:
2.2
See Also:
Constant Field Values

PAGE_NAME_PATTERN

public static final String PAGE_NAME_PATTERN
Perl5 pattern for page names. Page names appear in library and application specifications, in the <page> element. Starting with 4.0, the page name may look more like a path name, consisting of a number of ids seperated by slashes. This is used to determine the folder which contains the page specification or the page's template.

Since:
2.2
See Also:
Constant Field Values

PARAMETER_NAME_PATTERN

public static final String PARAMETER_NAME_PATTERN
Perl5 pattern that parameter names must conform to. Letter, followed by letter, number or underscore.

Since:
2.2
See Also:
Constant Field Values

PROPERTY_NAME_PATTERN

public static final String PROPERTY_NAME_PATTERN
Perl5 pattern that property names (that can be connected to parameters) must conform to. Letter, followed by letter, number or underscore.

Since:
2.2
See Also:
Constant Field Values

SERVICE_NAME_PATTERN

public static final String SERVICE_NAME_PATTERN
Deprecated. As of release 4.0, the <service> element (in 3.0 DTDs) is no longer supported.
Perl5 pattern for service names. Letter followed by letter, number, dash, underscore or period.

Since:
2.2
See Also:
Constant Field Values

TAPESTRY_DTD_3_0_PUBLIC_ID

public static final String TAPESTRY_DTD_3_0_PUBLIC_ID
Since:
3.0
See Also:
Constant Field Values

TAPESTRY_DTD_4_0_PUBLIC_ID

public static final String TAPESTRY_DTD_4_0_PUBLIC_ID
Since:
4.0
See Also:
Constant Field Values

TAPESTRY_DTD_4_1_PUBLIC_ID

public static final String TAPESTRY_DTD_4_1_PUBLIC_ID
Since:
4.1
See Also:
Constant Field Values
Constructor Detail

SpecificationParser

public SpecificationParser(org.apache.hivemind.ClassResolver resolver)
This constructor is a convienience used by some tests.


SpecificationParser

public SpecificationParser(org.apache.hivemind.ErrorHandler errorHandler,
                           Log log,
                           org.apache.hivemind.ClassResolver resolver,
                           SpecFactory factory)
The full constructor, used within Tapestry.

Method Detail

begin

protected void begin(String elementName,
                     Map attributes)
Specified by:
begin in class org.apache.hivemind.parse.AbstractParser

end

protected void end(String elementName)
Specified by:
end in class org.apache.hivemind.parse.AbstractParser

initializeParser

protected void initializeParser(org.apache.hivemind.Resource resource,
                                int startState)
Overrides:
initializeParser in class org.apache.hivemind.parse.AbstractParser

parseApplicationSpecification

public IApplicationSpecification parseApplicationSpecification(org.apache.hivemind.Resource resource)
Description copied from interface: ISpecificationParser
Parses an application specification from the provided Resource.

Specified by:
parseApplicationSpecification in interface ISpecificationParser

parseComponentSpecification

public IComponentSpecification parseComponentSpecification(org.apache.hivemind.Resource resource)
Specified by:
parseComponentSpecification in interface ISpecificationParser

parseLibrarySpecification

public ILibrarySpecification parseLibrarySpecification(org.apache.hivemind.Resource resource)
Specified by:
parseLibrarySpecification in interface ISpecificationParser

parsePageSpecification

public IComponentSpecification parsePageSpecification(org.apache.hivemind.Resource resource)
Specified by:
parsePageSpecification in interface ISpecificationParser

peekContent

protected String peekContent()
Overrides:
peekContent in class org.apache.hivemind.parse.AbstractParser

resetParser

protected void resetParser()
Overrides:
resetParser in class org.apache.hivemind.parse.AbstractParser

resolveEntity

public InputSource resolveEntity(String publicId,
                                 String systemId)
                          throws SAXException
Resolved an external entity, which is assumed to be the doctype. Might need a check to ensure that specs without a doctype fail.

Specified by:
resolveEntity in interface EntityResolver
Overrides:
resolveEntity in class DefaultHandler
Throws:
SAXException

setBindingSource

public void setBindingSource(BindingSource bindingSource)
Since:
4.0

setValueConverter

public void setValueConverter(ValueConverter valueConverter)
Since:
4.0


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.