@ThreadSafe public final class WikiCache extends File
~/votorola/in/wiki
. Cache files are created with broad permissions and
may be overwritten by any runtime owner (vote-server account, servlet container and
others). The administrator may safely delete the contained files at runtime without
causing unrecoverable errors, but should not delete the directory itself until after
shutting down all runtime processes.pathSeparator, pathSeparatorChar, separator, separatorChar
Constructor and Description |
---|
WikiCache(VoteServer _voteServer)
Constructs a WikiCache.
|
Modifier and Type | Method and Description |
---|---|
WikiCache |
churn()
Replaces any stale pages in the cache with fresh copies from the wiki.
|
long |
lastChurnTime()
Returns the time of the last churn based on the timestamp of the churn's serial
file.
|
FileInputStream |
openRDF_JSON(String fullPageName)
Opens an input stream for the RDF of the specified wiki page in JSON format, UTF-8
character encoding.
|
FileInputStream |
openRDF_JSON(String fullPageName,
boolean toChurn)
Opens an input stream for the RDF of the specified wiki page in JSON format, UTF-8
character encoding.
|
String |
readRDF_JSON(String fullPageName)
Fetches the RDF of the specified wiki page in JSON format.
|
String |
readRDF_JSON(String fullPageName,
boolean toChurn)
Fetches the RDF of the specified wiki page in JSON format.
|
canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toPath, toString, toURI, toURL
WikiCache(VoteServer _voteServer) throws IOException
IOException
public WikiCache churn() throws IOException
--churn
option. However it should not be
called too often as it has the side effect of clearing the poll cache. You may
instead want to query the pollwiki directly; Semantic MediaWiki 1.7 introduces a
MediaWiki API extension that might be more convenient than the RDF interface.
Note: only changes to page content are detected. A property change owing to a change in the content of a template will not be detected. This is a BUG and the current workaround is to manually delete the page in the cache.
IOException
lastChurnTime()
,
PollService.VoteServerScope.Run.ensurePoll(String)
public long lastChurnTime()
public FileInputStream openRDF_JSON(String fullPageName) throws IOException
fullPageName
- the full name of the page, including any namespace.IOException
public FileInputStream openRDF_JSON(String fullPageName, boolean toChurn) throws IOException
fullPageName
- the full name of the page, including any namespace.toChurn
- whether or not to bypass the cache and fetch the RDF straight
from the wiki. If true, any previously cached file will be ignored and (if
the fetch succeeds) overrwritten.IOException
public String readRDF_JSON(String fullPageName) throws IOException
fullPageName
- the full name of the page, including any namespace.IOException
public String readRDF_JSON(String fullPageName, boolean toChurn) throws IOException
fullPageName
- the full name of the page, including any namespace.toChurn
- whether or not to bypass the cache and fetch the RDF straight
from the wiki. If true, any previously cached file will be ignored and (if
the fetch succeeds) overrwritten.IOException