|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.primix.tapestry.pageload.PageSource
A source for pages for a particular application. Each application
should have its own PageSource
, storing it into the
ServletContext
using a unique key (usually built from
the application name).
The PageSource
acts as a pool for IPage
instances.
Pages are retrieved from the pool using getPage(IEngine, String, IMonitor)
and are later returned to the pool using releasePage(IPage)
.
In addition, this class acts as a cache of serveral common objects:
This caching allows common objects to be created once, and used across all components and pages. Without pooling, objects would often be duplicated.
TBD: Pooled pages stay forever. Need a strategy for cleaning up the pool, tracking which pages have been in the pool the longest, etc. A mechanism for reporting pool statistics would be useful.
Constructor Summary | |
PageSource(IResourceResolver resolver)
|
Method Summary | |
protected MultiKey |
buildKey(IEngine engine,
java.lang.String pageName)
Builds a key for a named page in the application's current locale. |
protected MultiKey |
buildKey(IPage page)
Builds a key from an existing page, using the page's name and locale. |
IAsset |
getContextAsset(java.lang.String assetPath)
Gets a cached asset. |
IAsset |
getExternalAsset(java.lang.String URL)
Gets a cached asset. |
IBinding |
getFieldBinding(java.lang.String fieldName)
Gets a field binding for the named field (the name includes the class name and the field). |
IPage |
getPage(IEngine engine,
java.lang.String pageName,
IMonitor monitor)
Gets the page from a pool, or otherwise loads the page. |
IAsset |
getPrivateAsset(java.lang.String resourcePath)
Gets a cached asset. |
IResourceResolver |
getResourceResolver()
|
IBinding |
getStaticBinding(java.lang.String value)
Like getFieldBinding(String) , except for StaticBinding s. |
void |
releasePage(IPage page)
Returns the page to the appropriate pool. |
void |
renderDescription(IResponseWriter writer)
Object should render a description of itself to the writer. |
void |
reset()
Invoked (during testing primarily) to release the entire pool of pages, and the caches of bindings and assets. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public PageSource(IResourceResolver resolver)
Method Detail |
public IResourceResolver getResourceResolver()
protected MultiKey buildKey(IEngine engine, java.lang.String pageName)
protected MultiKey buildKey(IPage page)
public IPage getPage(IEngine engine, java.lang.String pageName, IMonitor monitor) throws PageLoaderException
getPage
in interface IPageSource
public void releasePage(IPage page)
releasePage
in interface IPageSource
public void reset()
reset
in interface IPageSource
public IBinding getFieldBinding(java.lang.String fieldName)
getFieldBinding
in interface IPageSource
public IBinding getStaticBinding(java.lang.String value)
getFieldBinding(String)
, except for StaticBinding
s.getStaticBinding
in interface IPageSource
public IAsset getExternalAsset(java.lang.String URL)
IPageSource
getExternalAsset
in interface IPageSource
public IAsset getContextAsset(java.lang.String assetPath)
IPageSource
getContextAsset
in interface IPageSource
public IAsset getPrivateAsset(java.lang.String resourcePath)
IPageSource
getPrivateAsset
in interface IPageSource
public java.lang.String toString()
toString
in class java.lang.Object
public void renderDescription(IResponseWriter writer)
IRenderDescription
renderDescription
in interface IRenderDescription
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |