org.apache.tapestry.parse
Class SpecificationParser

java.lang.Object
  extended by org.apache.tapestry.parse.SpecificationParser

public class SpecificationParser
extends Object

Used to parse an application or component specification into a ApplicationSpecification or IComponentSpecification.

Version PUBLIC ID SYSTEM ID Description
1.3 -//Howard Lewis Ship//Tapestry Specification 1.3//EN http://tapestry.sf.net/dtd/Tapestry_1_3.dtd Version of specification introduced in release 2.2.
3.0 -//Howard Lewis Ship//Tapestry Specification 3.0//EN http://tapestry.sf.net/dtd/Tapestry_3_0.dtd Version of specification introduced in release 3.0.
Note: Future DTD versions will track Tapestry release numbers.

Version:
$Id: SpecificationParser.java 243791 2004-02-19 17:38:13Z hlship $
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 alias.
static String COMPONENT_ID_PATTERN
          Perl5 pattern for component ids.
static String COMPONENT_TYPE_PATTERN
          Perl5 pattern for component types.
static String EXTENDED_PROPERTY_NAME_PATTERN
          Like modified property name, but allows periods in the name as well.
static String EXTENSION_NAME_PATTERN
          Per5 pattern for extension names.
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
          Perl5 pattern for service names.
static String TAPESTRY_DTD_1_3_PUBLIC_ID
           
static String TAPESTRY_DTD_3_0_PUBLIC_ID
           
 
Constructor Summary
SpecificationParser(IResourceResolver resolver)
           
 
Method Summary
protected  void configureCommon(SpecificationDigester digester, String rootElementName)
          Configure the common elements shared by both <page-specification> and <component-specification>.
protected  void configureLibraryCommon(SpecificationDigester digester, String rootElementName)
          Configures a digester to parse the common elements of a <application> or <library-specification>.
protected  SpecificationDigester constructApplicationDigester()
          Constructs a digester configued to parse application specifications.
protected  SpecificationDigester constructBaseDigester(String rootElement)
          Constructs a digester, registerring the known DTDs and the global rules (for <property> and <description>).
protected  SpecificationDigester constructComponentDigester()
          Returns a digester configured to parse component specifications.
protected  SpecificationDigester constructLibraryDigester()
          Constructs a digester configured to parse library specifications.
protected  SpecificationDigester constructPageDigester()
          Returns a digester configured to parse page specifications.
 SpecFactory getFactory()
          Returns the current SpecFactory which instantiates Tapestry spec objects.
protected  Object parse(SpecificationDigester digester, IResourceLocation location)
          Parses a resource using a particular digester.
 IApplicationSpecification parseApplicationSpecification(IResourceLocation resourceLocation)
          Parses an resource containing an application specification and assembles an ApplicationSpecification from it.
 IComponentSpecification parseComponentSpecification(IResourceLocation resourceLocation)
          Parses an input stream containing a page or component specification and assembles an IComponentSpecification from it.
 ILibrarySpecification parseLibrarySpecification(IResourceLocation resourceLocation)
          Parses an input stream containing a library specification and assembles a LibrarySpecification from it.
 IComponentSpecification parsePageSpecification(IResourceLocation resourceLocation)
          Parses an input stream containing a page specification and assembles an IComponentSpecification from it.
 void setFactory(SpecFactory factory)
          Sets the SpecFactory which instantiates Tapestry spec objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TAPESTRY_DTD_1_3_PUBLIC_ID

public static final String TAPESTRY_DTD_1_3_PUBLIC_ID
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

EXTENDED_PROPERTY_NAME_PATTERN

public static final String EXTENDED_PROPERTY_NAME_PATTERN
Like modified property name, but allows periods in the name as well.

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

PAGE_NAME_PATTERN

public static final String PAGE_NAME_PATTERN
Perl5 pattern for page names. Letter followed by letter, number, dash, underscore or period.

Since:
2.2
See Also:
Constant Field Values

COMPONENT_ALIAS_PATTERN

public static final String COMPONENT_ALIAS_PATTERN
Perl5 pattern for component alias. Letter, followed by letter, number, or underscore. This is used to validate component types registered in the application or library specifications.

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

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

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

SERVICE_NAME_PATTERN

public static final String SERVICE_NAME_PATTERN
Perl5 pattern for service names. Letter followed by letter, number, dash, underscore or period.

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

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

COMPONENT_TYPE_PATTERN

public static final String COMPONENT_TYPE_PATTERN
Perl5 pattern for component types. Component types are an optional namespace prefix followed by a normal identifier.

Since:
2.2
See Also:
Constant Field Values
Constructor Detail

SpecificationParser

public SpecificationParser(IResourceResolver resolver)
Method Detail

parseComponentSpecification

public IComponentSpecification parseComponentSpecification(IResourceLocation resourceLocation)
                                                    throws DocumentParseException
Parses an input stream containing a page or component specification and assembles an IComponentSpecification from it.

Throws:
DocumentParseException - if the input stream cannot be fully parsed or contains invalid data.

parse

protected Object parse(SpecificationDigester digester,
                       IResourceLocation location)
                throws DocumentParseException
Parses a resource using a particular digester.

Throws:
DocumentParseException
Since:
3.0

parsePageSpecification

public IComponentSpecification parsePageSpecification(IResourceLocation resourceLocation)
                                               throws DocumentParseException
Parses an input stream containing a page specification and assembles an IComponentSpecification from it.

Throws:
DocumentParseException - if the input stream cannot be fully parsed or contains invalid data.
Since:
2.2

parseApplicationSpecification

public IApplicationSpecification parseApplicationSpecification(IResourceLocation resourceLocation)
                                                        throws DocumentParseException
Parses an resource containing an application specification and assembles an ApplicationSpecification from it.

Throws:
DocumentParseException - if the input stream cannot be fully parsed or contains invalid data.

parseLibrarySpecification

public ILibrarySpecification parseLibrarySpecification(IResourceLocation resourceLocation)
                                                throws DocumentParseException
Parses an input stream containing a library specification and assembles a LibrarySpecification from it.

Throws:
DocumentParseException - if the input stream cannot be fully parsed or contains invalid data.
Since:
2.2

setFactory

public void setFactory(SpecFactory factory)
Sets the SpecFactory which instantiates Tapestry spec objects.

Since:
1.0.9

getFactory

public SpecFactory getFactory()
Returns the current SpecFactory which instantiates Tapestry spec objects.

Since:
1.0.9

constructBaseDigester

protected SpecificationDigester constructBaseDigester(String rootElement)
Constructs a digester, registerring the known DTDs and the global rules (for <property> and <description>).

Since:
3.0

constructApplicationDigester

protected SpecificationDigester constructApplicationDigester()
Constructs a digester configued to parse application specifications.

Since:
3.0

constructLibraryDigester

protected SpecificationDigester constructLibraryDigester()
Constructs a digester configured to parse library specifications.

Since:
3.0

configureLibraryCommon

protected void configureLibraryCommon(SpecificationDigester digester,
                                      String rootElementName)
Configures a digester to parse the common elements of a <application> or <library-specification>.

Since:
3.0

constructPageDigester

protected SpecificationDigester constructPageDigester()
Returns a digester configured to parse page specifications.

Since:
3.0

constructComponentDigester

protected SpecificationDigester constructComponentDigester()
Returns a digester configured to parse component specifications.


configureCommon

protected void configureCommon(SpecificationDigester digester,
                               String rootElementName)
Configure the common elements shared by both <page-specification> and <component-specification>.