|
|
|
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.torweg.pulse.configuration.PoorMansCache
public final class PoorMansCache
a simple cache for configurations stored in ConfigBeans and XSL
stylesheets.
The cache is a singleton and may be used concurrently. Cached values are
stored as SoftReferences to avoid java.lang.OutOfMemoryErrors
due to a growing cache.
| Method Summary | |
|---|---|
static void |
flushBundle(Bundle b)
flush all configs from a bundle from the cache. |
static ConfigBean |
getBundleConfig(java.lang.Class<? extends java.lang.Object> c, Bundle bundle)
Deprecated. |
static Configuration |
getBundleConfiguration(java.lang.Class<? extends java.lang.Object> c, Bundle bundle)
get the configuration registered for the given class of a bundle. |
static ConfigBean |
getConfig(java.lang.Class<? extends java.lang.Object> c)
Deprecated. |
static ConfigBean |
getConfig(java.io.File f)
Deprecated. |
static Configuration |
getConfiguration(java.lang.Class<? extends java.lang.Object> c)
get the configuration registered for the given class. |
static Configuration |
getConfiguration(java.io.File f)
get the Configuration defined in the given file. |
static java.io.InputStream |
getFromCache(VirtualFile f)
returns an InputStream for the given VirtualFile using
the in-memory cache, if possible and otherwise delegates to
VirtualFileSystem.getInputStream(VirtualFile). |
static PoorMansCache |
getInstance()
return the singleton instance of the config configBeanPool. |
static org.jdom.Document |
getJDOMResource(Bundle b,
java.io.File f)
Deprecated. |
static org.jdom.Document |
getJDOMResource(java.io.File f)
Deprecated. |
static XSLHandle |
getXSLHandle(java.io.File file)
returns an XSLHandle for a given File. |
static void |
init(java.io.File cp)
initialises the singleton instance of the config configBeanPool. |
boolean |
isModified()
true, if any config file served by the cache has been changed
since the last check. |
void |
restart()
reloads the cache. |
void |
shutdown()
shuts the cache down. |
void |
startup()
starts the cache. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Configuration getConfiguration(java.io.File f)
f - the config file to be read
ConfigurationException - if the configuration could not be builtpublic static Configuration getConfiguration(java.lang.Class<? extends java.lang.Object> c)
c - the class that needs its configuration
ConfigurationException - if the configuration could not be builtpublic static Configuration getBundleConfiguration(java.lang.Class<? extends java.lang.Object> c, Bundle bundle)
c - the class that needs its configurationbundle - the bundle
ConfigurationException - if the configuration could not be built@Deprecated public static ConfigBean getConfig(java.io.File f)
f - the config file to be read
null, if no configuration
could be found@Deprecated public static ConfigBean getConfig(java.lang.Class<? extends java.lang.Object> c)
c - the class that needs its configuration
null, if no configuration
could be found@Deprecated public static ConfigBean getBundleConfig(java.lang.Class<? extends java.lang.Object> c, Bundle bundle)
c - the class that needs its configurationbundle - the bundle
null, if no configuration
could be foundpublic static XSLHandle getXSLHandle(java.io.File file)
file - the XSL file
@Deprecated
public static org.jdom.Document getJDOMResource(java.io.File f)
throws java.io.FileNotFoundException
Document for the given XML file.
f - the file
Document for the given XML file.
java.io.FileNotFoundException - if the given XML File cannot be found
@Deprecated
public static org.jdom.Document getJDOMResource(Bundle b,
java.io.File f)
throws java.io.FileNotFoundException
Document for the given XML file of the
given Bundle.
f - the relative fileb - the Bundle
Document for the given XML file.
java.io.FileNotFoundException - if the given XML File cannot be found
public static java.io.InputStream getFromCache(VirtualFile f)
throws java.io.IOException
InputStream for the given VirtualFile using
the in-memory cache, if possible and otherwise delegates to
VirtualFileSystem.getInputStream(VirtualFile).
f - the virtual file
java.io.IOException - on errorspublic static PoorMansCache getInstance()
public static void init(java.io.File cp)
cp - the path to the main configuration directorypublic static void flushBundle(Bundle b)
b - the bundle for which all configs will be flushedpublic boolean isModified()
true, if any config file served by the cache has been changed
since the last check.
isModified in interface LifecycleResourcetrue, if any config file served by the cache has been
changed since the last check.public void startup()
Actually does nothing.
startup in interface LifecycleResourcepublic void shutdown()
Clears all internal lists and maps.
shutdown in interface LifecycleResourcepublic void restart()
Clears all ConfigBeans and subresources, and removes all modified
XSLHandles and JDOMHandles.
restart in interface LifecycleResource
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||