Java Doc for CacheManager.java in  » Report » pentaho-report » org » pentaho » core » cache » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Report » pentaho report » org.pentaho.core.cache 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.pentaho.core.cache.CacheManager

CacheManager
public class CacheManager implements ILogoutListener(Code)
This class provides an access point for pluggable caching mechanisms. Right now, it only supports the caching mechanisms implemented in org.hibernate.cache.

To use the cache manager, you need to include the following information in your pentaho.xml.

 <cache-provider>
 <class>org.hibernate.cache.xxxxxxxx</class>
 <region>pentahoCache</region>
 <properties>
 <property name="someProperty">someValue</property>
 </properties>
 </cache-provider>
 

The specified class must implement the org.hibernate.cache.CacheProvider interface.

Each implementation of the org.hibernate.cache.CacheProvider has slightly different requirements with respect to the required input parameters - so, please see the classes in that package for more information (available from the Sourceforge Hibernate project). Also, some cache providers (notably the org.hibernate.cache.EhCacheProvider) completely ignore the passed in properties, and only configure themselves by locating a configuration file (e.g. ehcache.xml) on the classpath.

The cache manager supports session-based caching (that is, caching of data that is user-specific) as well as global-based caching (that is, caching of data that is system-wide). To differentiate between session-based and global-based caching, there are different methods that get called depending upon the storage type.

Data that is cached for user sessions require an IPentahoSession object to be passed in. The cache manager uses the IPentahoSession.getId() to classify saved objects underneath a specific user session. No information is actually stored in the user session object. For an example of this, see
putInSessionCache(IPentahoSession session, String key, Object value)

Data that is server-wide (i.e. global) uses different methods for storage/retrieval/management. For an example of this, see
getFromGlobalCache(Object key)

Example Usage:

 String globalCachable = "String to cache";
 String globalCacheKey = "StringKey";
 CacheManager cacheManager = PentahoSystem.getCacheManager();
 cacheManager.putInGlobalCache(globalCacheKey, globalCachable);
 

Important Considerations

  • Most caches require objects that go into the cache as well as their respective object key implement Serializable. It is a safe assumption that both the Key and the Value should implement Serializable.
  • Some caches are read-only. Other caches are read-write. What does this mean? It means that once you put an object in the cache, you can't put an object into the cache with the same key. You'd need to remove it first


See Also:   org.hibernate.cache.CacheProvider
See Also:   org.hibernate.cache.Cache
author:
   mbatchel




Constructor Summary
public  CacheManager()
    

Method Summary
public  booleancacheEnabled()
     Returns the enablement state of the cache.
public  voidcacheStop()
     Stops the cache by calling the cacheProvider stop method.
public  voidclearCache()
     Entirely clears the cache.
protected  CacheProvidergetCacheProvider()
    
public  ObjectgetFromGlobalCache(Object key)
     Gets an object from the cache without translating the passed in key.
public  ObjectgetFromSessionCache(IPentahoSession session, String key)
     Gets an object from the user session specific cache.
public  voidkillSessionCache(IPentahoSession session)
     Removes any session-based data for the specified IPentahoSession.
public  voidkillSessionCaches()
     Removes all cached items that are session-based.
public  voidonLogout(IPentahoSession session)
    
public  voidputInGlobalCache(Object key, Object value)
     Puts an object directly into the cache without translating the passed in key.
public  voidputInSessionCache(IPentahoSession session, String key, Object value)
     Puts an object in the session-specific cache.
public  voidremoveFromGlobalCache(Object key)
    
public  voidremoveFromSessionCache(IPentahoSession session, String key)
    
protected  voidsetupCacheProvider()
    


Constructor Detail
CacheManager
public CacheManager()(Code)
The constructor performs the following tasks:

  • Gets the Pentaho System Settings
  • Reads the cache-provider/class element.
  • Reads the cache-provider/region element.
  • Reads in any properties under cache-provider/properties/*
  • Attempts to instance the cache provider classes specified
  • Starts the cache (see the org.hibernate.cache.CacheProvider interface)
  • Calls the buildCache method (see the org.hibernate.cache.CacheProvider interface)





Method Detail
cacheEnabled
public boolean cacheEnabled()(Code)
Returns the enablement state of the cache. true if the cache has been initialized and is ready for use.



cacheStop
public void cacheStop()(Code)
Stops the cache by calling the cacheProvider stop method. This method should be called either when the VM goes away, or when the web context goes away. This performs required cleanup in the underlying cache implementation. In some cases, failure to stop the cache will cause cached items saved to disk to be un-recoverable.



clearCache
public void clearCache()(Code)
Entirely clears the cache.



getCacheProvider
protected CacheProvider getCacheProvider()(Code)
Returns the underlying cache provider (implements org.hibernate.cache.CacheProvider cacheProvider.



getFromGlobalCache
public Object getFromGlobalCache(Object key)(Code)
Gets an object from the cache without translating the passed in key.
Parameters:
  key - The key that the data object was stored with The corresponding data object



getFromSessionCache
public Object getFromSessionCache(IPentahoSession session, String key)(Code)
Gets an object from the user session specific cache. If the object doesn't exist in the cache, null is returned.
Parameters:
  session - The users IPentahoSession
Parameters:
  key - The key that maps to the data to get from the cache Object that was stored in the cache



killSessionCache
public void killSessionCache(IPentahoSession session)(Code)
Removes any session-based data for the specified IPentahoSession.
Parameters:
  session - The session whose objects needs to be removed from the cache.



killSessionCaches
public void killSessionCaches()(Code)
Removes all cached items that are session-based.



onLogout
public void onLogout(IPentahoSession session)(Code)



putInGlobalCache
public void putInGlobalCache(Object key, Object value)(Code)
Puts an object directly into the cache without translating the passed in key.

Important note - most cache implementations require both the key and the value to be serializable.


Parameters:
  key - Object by which the data is indexed
Parameters:
  value - The data to store in the cache.




putInSessionCache
public void putInSessionCache(IPentahoSession session, String key, Object value)(Code)
Puts an object in the session-specific cache. The session specified must have a valid session id.

Take special care that, in a TestCase, you don't have multiple StandaloneSession objects with the same session key. Consider using UUIDUtil to generate a unique sessionId for each standalone session.
Parameters:
  session - The users IPentahoSession
Parameters:
  key - The key by which you want to retrieve the data back out
Parameters:
  value - The data item to place into the cache




removeFromGlobalCache
public void removeFromGlobalCache(Object key)(Code)
Removes an object from the cache
Parameters:
  key - The key that the data object was stored with



removeFromSessionCache
public void removeFromSessionCache(IPentahoSession session, String key)(Code)
Removes a data item from the user session specific cache
Parameters:
  session - The users IPentahoSession
Parameters:
  key - The key that maps to the value needing removed



setupCacheProvider
protected void setupCacheProvider()(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.