Class ResourceCacheManager


  • public class ResourceCacheManager
    extends java.lang.Object
    The ResourceCacheManager is basically a wrapper of the ResourceCache. It provides helper methods to access Resource 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 class
      Resource getResourceObject​(java.lang.String filePath)
      Obtains the cached object held by the ResourceCache mapping table
      Resource getResourceObject​(java.lang.String filePath, java.lang.String encode, java.lang.String localeID)
      Obtains the cached object held by the ResourceCache mapping table
      org.w3c.dom.Document getResourceObjectDocument​(java.lang.String filePath)
      Obtains the DOM Document contents of the cached object held by the ResourceCache 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 the ResourceCache mapping table.
      java.lang.String getResourceObjectString​(java.lang.String filePath)
      Obtains the string contents of the cached object held by the ResourceCache mapping table
      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 the ResourceCache mapping table
      void 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • init

        @Deprecated
        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 the ResourceCache 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 the FileLoader 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 the ResourceCache 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

        @Deprecated
        public java.lang.Object getCachedObject​(java.lang.String key)
        Deprecated.
        This class should only be used to access Resources. Use getResourceObject(String)
        Obtains the cached object held by the ResourceCache 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 the ResourceCache mapping table
        Parameters:
        filePath - Location of the corresponding Resource
        encode - the encoding used to open the file resource object
        localeID - 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 the ResourceCache 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 the ResourceCache mapping table
        Parameters:
        filePath - Location of the corresponding Resource
        encode - the encoding used to open the file resource object
        localeID - 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 the ResourceCache mapping table. Not thread safe to use the Document object without synchronization. Strongly suggest synchronizing on the owning Resource object. This method will likely be deprecated in the future. Please use getResourceObject(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 the ResourceCache mapping table. Not thread safe to use the Document object without synchronization. Strongly suggest synchronizing on the owning Resource object. This method will likely be deprecated in the future. Please use getResourceObject(String, String, String) instead.
        Parameters:
        filePath - Location of the corresponding Resource
        encode - the encoding used to open the file resource object
        localeID - 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

        @Deprecated
        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 Cache
        Stores 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 table
        resourceObject - the object to store
      • storeObjectToCache

        @Deprecated
        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 Cache
        Stores 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 table
        resourceObject - the object to store
      • storeResourceObject

        @Deprecated
        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 Cache
        Stores 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 table
        encode - The unique identifier of the object in the cache table
        localeID - The unique identifier of the object in the cache table
        resourceObject - the object to store
      • getFileLoader

        @Deprecated
        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