Class ResourceCacheManager
- java.lang.Object
-
- com.microstrategy.web.app.utils.cache.ResourceCacheManager
-
public class ResourceCacheManager extends java.lang.Object
TheResourceCacheManager
is basically a wrapper of theResourceCache
. It provides helper methods to accessResource
objects without having to catch CacheException or to create CacheHints on the fly. Copyright © 2002 MicroStrategy, Inc.- Since:
- MicroStrategy Web 7.5.1
- See Also:
ResourceCache
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.Object
getCachedObject(java.lang.String key)
Deprecated.This class should only be used to access Resources.FileLoader
getFileLoader()
Deprecated.FileLoader usage is now recommended as a singleton.static ResourceCacheManager
getInstance()
Returns the instance of the ResourceCacheManager classResource
getResourceObject(java.lang.String filePath)
Obtains the cached object held by theResourceCache
mapping tableResource
getResourceObject(java.lang.String filePath, java.lang.String encode, java.lang.String localeID)
Obtains the cached object held by theResourceCache
mapping tableorg.w3c.dom.Document
getResourceObjectDocument(java.lang.String filePath)
Obtains the DOM Document contents of the cached object held by theResourceCache
mapping table.org.w3c.dom.Document
getResourceObjectDocument(java.lang.String filePath, java.lang.String encode, java.lang.String localeID)
Obtains the DOM Document contents of the cached object held by theResourceCache
mapping table.java.lang.String
getResourceObjectString(java.lang.String filePath)
Obtains the string contents of the cached object held by theResourceCache
mapping tablejava.lang.String
getResourceObjectString(java.lang.String filePath, java.lang.String encode, java.lang.String localeID)
Obtains the string contents of the cached object held by theResourceCache
mapping tablevoid
init(FileLoader fileLoader)
Deprecated.FileLoader usage is now recommended as a singleton.void
storeObjectToCache(java.lang.String key, java.lang.Object resourceObject)
Deprecated.Should not be called explicitly.void
storeResourceObject(java.lang.String key, java.lang.Object resourceObject)
Deprecated.Should not be called explicitly.void
storeResourceObject(java.lang.String key, java.lang.String encode, java.lang.String localeID, java.lang.Object resourceObject)
Deprecated.Should not be called explicitly.
-
-
-
Method Detail
-
getInstance
public static ResourceCacheManager getInstance()
Returns the instance of the ResourceCacheManager class- Returns:
- the
ResourceCacheManager
instance
-
init
public void init(FileLoader fileLoader)
Deprecated.FileLoader usage is now recommended as a singleton. The FileLoader should now always be accessed by:FileLoader.getInstance();
Initializes theResourceCache
object with the FileLoader to use.
This method has been deprecated. The FileLoader is now moved to a singleton pattern, therefore now it might be accessed by:FileLoader.getInstance();
, so this method should not be called explicitly, as theFileLoader
provided might not be the one actually used.- Parameters:
fileLoader
- a {link FileLoader} intance
-
getResourceObject
public Resource getResourceObject(java.lang.String filePath)
Obtains the cached object held by theResourceCache
mapping table- Parameters:
filePath
- Location of the corresponding Resource- Returns:
- the cached object, or null if the file doesn't exist or there is a problem while loading it.
-
getCachedObject
public java.lang.Object getCachedObject(java.lang.String key)
Deprecated.This class should only be used to access Resources. UsegetResourceObject(String)
Obtains the cached object held by theResourceCache
mapping table- Parameters:
key
- Unique identifier for the cached object.- Returns:
- the cached object, or null if the file doesn't exist or there is a problem while loading it.
-
getResourceObject
public Resource getResourceObject(java.lang.String filePath, java.lang.String encode, java.lang.String localeID)
Obtains the cached object held by theResourceCache
mapping table- Parameters:
filePath
- Location of the corresponding Resourceencode
- the encoding used to open the file resource objectlocaleID
- for the file. Notice this parameter is actually not used anymore.- Returns:
- the cached object, or null if the file doesn't exist or there is a problem while loading it.
-
getResourceObjectString
public java.lang.String getResourceObjectString(java.lang.String filePath)
Obtains the string contents of the cached object held by theResourceCache
mapping table- Parameters:
filePath
- Location of the corresponding Resource- Returns:
- the String contents of the cached object
-
getResourceObjectString
public java.lang.String getResourceObjectString(java.lang.String filePath, java.lang.String encode, java.lang.String localeID)
Obtains the string contents of the cached object held by theResourceCache
mapping table- Parameters:
filePath
- Location of the corresponding Resourceencode
- the encoding used to open the file resource objectlocaleID
- for the file. Notice this parameter is actually not used anymore.- Returns:
- the String contents of the cached object
-
getResourceObjectDocument
public org.w3c.dom.Document getResourceObjectDocument(java.lang.String filePath)
Obtains the DOM Document contents of the cached object held by theResourceCache
mapping table. Not thread safe to use theDocument
object without synchronization. Strongly suggest synchronizing on the owningResource
object. This method will likely be deprecated in the future. Please usegetResourceObject(String)
instead.- Parameters:
filePath
- Location of the corresponding Resource- Returns:
- the DOM Document contents of the cached object
- See Also:
getResourceObject(String)
-
getResourceObjectDocument
public org.w3c.dom.Document getResourceObjectDocument(java.lang.String filePath, java.lang.String encode, java.lang.String localeID)
Obtains the DOM Document contents of the cached object held by theResourceCache
mapping table. Not thread safe to use theDocument
object without synchronization. Strongly suggest synchronizing on the owningResource
object. This method will likely be deprecated in the future. Please usegetResourceObject(String, String, String)
instead.- Parameters:
filePath
- Location of the corresponding Resourceencode
- the encoding used to open the file resource objectlocaleID
- for the file. Notice this parameter is actually not used anymore.- Returns:
- the DOM Document contents of the cached object
- See Also:
getResourceObject(String, String, String)
-
storeResourceObject
public void storeResourceObject(java.lang.String key, java.lang.Object resourceObject)
Deprecated.Should not be called explicitly. To cache objects, callers should implement their own CacheStores in the cache table the object provided. This method should not be called explicitly anymore. It is recommended that classes that want to cache their own elements, should create their own Cache by extending the CacheBase or any of its subclasses.- Parameters:
key
- The unique identifier of the object in the cache tableresourceObject
- the object to store
-
storeObjectToCache
public void storeObjectToCache(java.lang.String key, java.lang.Object resourceObject)
Deprecated.Should not be called explicitly. To cache objects, callers should implement their own CacheStores in the cache table the object provided. This method should not be called explicitly anymore. It is recommended that classes that want to cache their own elements, should create their own Cache by extending the CacheBase or any of its subclasses.- Parameters:
key
- The unique identifier of the object in the cache tableresourceObject
- the object to store
-
storeResourceObject
public void storeResourceObject(java.lang.String key, java.lang.String encode, java.lang.String localeID, java.lang.Object resourceObject)
Deprecated.Should not be called explicitly. To cache objects, callers should implement their own CacheStores in the cache table the object provided. This method should not be called explicitly anymore. It is recommended that classes that want to cache their own elements, should create their own Cache by extending the CacheBase or any of its subclasses.- Parameters:
key
- The unique identifier of the object in the cache tableencode
- The unique identifier of the object in the cache tablelocaleID
- The unique identifier of the object in the cache tableresourceObject
- the object to store
-
getFileLoader
public FileLoader getFileLoader()
Deprecated.FileLoader usage is now recommended as a singleton. You can access it by:FileLoader.getInstance();
Gets the file loader that the cache mapping will use to load files from the file system.
- Returns:
- FileLoader a
FileLoader
instace
-
-