com.primix.tapestry.engine
Class DefaultSpecificationSource

java.lang.Object
  |
  +--com.primix.tapestry.engine.DefaultSpecificationSource
All Implemented Interfaces:
IRenderDescription, ISpecificationSource

public class DefaultSpecificationSource
extends java.lang.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,v 1.11 2001/09/11 21:41:12 hship Exp $
Author:
Howard Ship

Field Summary
protected  java.util.Map cache
          Contains previously parsed specification.
protected  ApplicationSpecification specification
           
 
Constructor Summary
DefaultSpecificationSource(IResourceResolver resolver, ApplicationSpecification specification)
           
 
Method Summary
 ComponentSpecification getSpecification(java.lang.String type)
          Gets a specification.
protected  ComponentSpecification parseSpecification(java.lang.String resourcePath)
           
 void renderDescription(IResponseWriter writer)
          Object should render a description of itself to the writer.
 void reset()
          Clears the specification cache.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

specification

protected ApplicationSpecification specification

cache

protected java.util.Map cache
Contains previously parsed specification.
Constructor Detail

DefaultSpecificationSource

public DefaultSpecificationSource(IResourceResolver resolver,
                                  ApplicationSpecification specification)
Method Detail

reset

public void reset()
Clears the specification cache. This is used during debugging.
Specified by:
reset in interface ISpecificationSource

getSpecification

public ComponentSpecification getSpecification(java.lang.String type)
                                        throws ResourceUnavailableException
Gets a specification. The type is either a component specification path, or an alias to a component (registerred in the application specification). The former always starts with a slash, the latter never does.

If an alias (i.e, starts with a slash), then the value is passed through ApplicationSpecification.getComponentAlias(String) to get a resource on the classpath that is parsed.

Specified by:
getSpecification in interface ISpecificationSource
Following copied from interface: com.primix.tapestry.ISpecificationSource
Throws:
ResourceUnavailableException - if the specification cannot be located or loaded.

parseSpecification

protected ComponentSpecification parseSpecification(java.lang.String resourcePath)
                                             throws ResourceUnavailableException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

renderDescription

public void renderDescription(IResponseWriter 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