org.apache.tapestry.engine
Class DefaultSpecificationSource

java.lang.Object
  extended by org.apache.tapestry.engine.DefaultSpecificationSource
All Implemented Interfaces:
ISpecificationSource, IRenderDescription

public class DefaultSpecificationSource
extends Object
implements ISpecificationSource, IRenderDescription

Default implementation of ISpecificationSource that expects to use the normal class loader to locate component specifications from within the classpath.

Caches specifications in memory forever, or until reset() is invoked.

An instance of this class acts like a singleton and is shared by multiple sessions, so it must be threadsafe.

Version:
$Id: DefaultSpecificationSource.java 243791 2004-02-19 17:38:13Z hlship $
Author:
Howard Lewis Ship

Constructor Summary
DefaultSpecificationSource(IResourceResolver resolver, IApplicationSpecification specification, Pool pool)
           
 
Method Summary
protected  void discardParser(SpecificationParser parser)
           
 INamespace getApplicationNamespace()
          Returns the INamespace for the application.
 IComponentSpecification getComponentSpecification(IResourceLocation resourceLocation)
          Gets a component specification.
 INamespace getFrameworkNamespace()
          Returns the INamespace for the framework itself.
 ILibrarySpecification getLibrarySpecification(IResourceLocation resourceLocation)
          Returns a LibrarySpecification with the given path.
 IComponentSpecification getPageSpecification(IResourceLocation resourceLocation)
          Retrieves a component specification, parsing it as necessary.
protected  SpecificationParser getParser()
           
protected  ILibrarySpecification parseLibrarySpecification(IResourceLocation resourceLocation)
           
protected  IComponentSpecification parseSpecification(IResourceLocation resourceLocation, boolean asPage)
           
 void renderDescription(IMarkupWriter writer)
          Object should render a description of itself to the writer.
 void reset()
          Clears the specification cache.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultSpecificationSource

public DefaultSpecificationSource(IResourceResolver resolver,
                                  IApplicationSpecification specification,
                                  Pool pool)
Method Detail

reset

public void reset()
Clears the specification cache. This is used during debugging.

Specified by:
reset in interface ISpecificationSource

parseSpecification

protected IComponentSpecification parseSpecification(IResourceLocation resourceLocation,
                                                     boolean asPage)

parseLibrarySpecification

protected ILibrarySpecification parseLibrarySpecification(IResourceLocation resourceLocation)

toString

public String toString()
Overrides:
toString in class Object

renderDescription

public void renderDescription(IMarkupWriter writer)
Description copied from interface: IRenderDescription
Object should render a description of itself to the writer.

Specified by:
renderDescription in interface IRenderDescription
Since:
1.0.6

getComponentSpecification

public IComponentSpecification getComponentSpecification(IResourceLocation resourceLocation)
Gets a component specification.

Specified by:
getComponentSpecification in interface ISpecificationSource
Parameters:
resourceLocation - the complete resource path to the specification.
Throws:
ApplicationRuntimeException - if the specification cannot be obtained.

getPageSpecification

public IComponentSpecification getPageSpecification(IResourceLocation resourceLocation)
Description copied from interface: ISpecificationSource
Retrieves a component specification, parsing it as necessary.

Specified by:
getPageSpecification in interface ISpecificationSource
Parameters:
resourceLocation - the location where the specification may be read from.

getLibrarySpecification

public ILibrarySpecification getLibrarySpecification(IResourceLocation resourceLocation)
Description copied from interface: ISpecificationSource
Returns a LibrarySpecification with the given path.

Specified by:
getLibrarySpecification in interface ISpecificationSource
Parameters:
resourceLocation - the resource path of the specification to return

getParser

protected SpecificationParser getParser()
Since:
2.2

discardParser

protected void discardParser(SpecificationParser parser)
Since:
3.0

getApplicationNamespace

public INamespace getApplicationNamespace()
Description copied from interface: ISpecificationSource
Returns the INamespace for the application.

Specified by:
getApplicationNamespace in interface ISpecificationSource

getFrameworkNamespace

public INamespace getFrameworkNamespace()
Description copied from interface: ISpecificationSource
Returns the INamespace for the framework itself.

Specified by:
getFrameworkNamespace in interface ISpecificationSource