|
||||||||||
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 sizepublic CachingPageSource(int cacheSize, int timeout)
cacheSize
- The default cache sizetimeout
- time to expire inactive cacheMethod Detail |
---|
public final JxpPage getJxpPage(java.lang.String id) throws JxpPageNotFoundException
getJxpPage
in class JxpPageSource
id
- 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 onpublic final AstJxpDocument getJxpDocument(JxpPage page) throws JxpPageParseException
getJxpDocument
in class JxpPageSource
page
- the JxpPage
JxpPageParseException
protected 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.IOException
public 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 valuefinal 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 JxpPageSource
page
- the pageline
- the linecol
- the column
java.io.IOException
- if there's IO problemfinal 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 JxpPageSource
id
- the id
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |