|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.onemind.jxp.JxpPageSource
org.onemind.jxp.CachingPageSource
public abstract class CachingPageSource
A caching page source will cache the page source
| Field Summary | |
|---|---|
private boolean |
_caching
flag to turn caching on/off * |
private java.lang.String |
_encoding
the encoding |
private boolean |
_invalidateCacheOnParseError
whether invalidate the cache on parse error * |
private org.onemind.commons.java.datastructure.MruMap |
_pageCache
the cache * |
private java.util.HashMap |
_pageStaticVariables
the page static variables |
| Constructor Summary | |
|---|---|
CachingPageSource()
Constructor (default use 200 cache limit, unlimit timeout) |
|
CachingPageSource(int cacheSize)
Constructor |
|
CachingPageSource(int cacheSize,
int timeout)
Constructor |
|
| Method Summary | |
|---|---|
(package private) java.lang.Object |
assignPageStaticVariable(CachedJxpPage page,
java.lang.String name,
java.lang.Object value)
|
(package private) java.lang.Object |
declarePageStaticVariable(JxpPage page,
java.lang.String name,
java.lang.Object value)
Declare a page static variable |
java.lang.String |
getEncoding()
Return the encoding |
java.lang.StringBuffer |
getErrorSource(JxpPage page,
int line,
int col)
Print the error source of this page on given line and column |
AstJxpDocument |
getJxpDocument(JxpPage page)
Get the jxp document for the JxpPage |
JxpPage |
getJxpPage(java.lang.String id)
Return a jxp page identified by the id |
(package private) java.lang.Object |
getPageStaticVariable(JxpPage page,
java.lang.String name)
Get the page static variable |
boolean |
hasJxpPage(java.lang.String id)
Return whether the jxp page identified by the id exists |
(package private) boolean |
hasPageStaticVariable(JxpPage page,
java.lang.String name)
Return whether there's a variable declared |
protected abstract boolean |
hasStream(java.lang.String pageName)
Whether there's input stream from given page name |
protected void |
invalidatePageCache(JxpPage page)
Invalidate the page cache |
boolean |
isCaching()
Return whether this is doing caching |
protected abstract boolean |
isExpired(CachedJxpPage page)
Whether a page is expired |
boolean |
isJxpPageCached(java.lang.String id)
Whehter the page identified by id is cached |
protected abstract java.io.InputStream |
loadStream(CachedJxpPage page)
Load the input stream for the page |
protected void |
purgeStaticVariables(CachedJxpPage page)
Purge the static variables for a page |
void |
setCaching(boolean b)
Set caching on/off |
void |
setEncoding(java.lang.String encoding)
Set the encoding |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private org.onemind.commons.java.datastructure.MruMap _pageCache
private boolean _caching
private boolean _invalidateCacheOnParseError
private java.util.HashMap _pageStaticVariables
private java.lang.String _encoding
| Constructor Detail |
|---|
public CachingPageSource()
public CachingPageSource(int cacheSize)
cacheSize - The default cache size
public CachingPageSource(int cacheSize,
int timeout)
cacheSize - The default cache sizetimeout - time to expire inactive cache| Method Detail |
|---|
public final JxpPage getJxpPage(java.lang.String id)
throws JxpPageNotFoundException
getJxpPage in class JxpPageSourceid - the id
JxpPageNotFoundException - if the page cannot be foundprotected final void invalidatePageCache(JxpPage page)
page - the pagepublic final boolean isCaching()
public final void setCaching(boolean b)
b - true if caching on
public final AstJxpDocument getJxpDocument(JxpPage page)
throws JxpPageParseException
getJxpDocument in class JxpPageSourcepage - the JxpPage
JxpPageParseExceptionprotected abstract boolean isExpired(CachedJxpPage page)
page - the page
protected abstract boolean hasStream(java.lang.String pageName)
pageName - the page name
protected abstract java.io.InputStream loadStream(CachedJxpPage page)
throws java.io.IOException
pageName - the page
java.io.IOExceptionpublic final boolean isJxpPageCached(java.lang.String id)
id - the id
final java.lang.Object declarePageStaticVariable(JxpPage page,
java.lang.String name,
java.lang.Object value)
page - the pagename - the namevalue - the value
final boolean hasPageStaticVariable(JxpPage page,
java.lang.String name)
page - the pagename - the name
final java.lang.Object getPageStaticVariable(JxpPage page,
java.lang.String name)
page - the pagename - the nama
public java.lang.StringBuffer getErrorSource(JxpPage page,
int line,
int col)
throws java.io.IOException
getErrorSource in class JxpPageSourcepage - the pageline - the linecol - the column
java.io.IOException - if there's IO problem
final java.lang.Object assignPageStaticVariable(CachedJxpPage page,
java.lang.String name,
java.lang.Object value)
page - name - value -
protected final void purgeStaticVariables(CachedJxpPage page)
page - the pagepublic final void setEncoding(java.lang.String encoding)
encoding - the encodingpublic final java.lang.String getEncoding()
public final boolean hasJxpPage(java.lang.String id)
hasJxpPage in class JxpPageSourceid - the id
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||