KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > cache > NoCacheProvider


1 // $Id: NoCacheProvider.java,v 1.1 2005/04/15 18:19:32 steveebersole Exp $
2
package org.hibernate.cache;
3
4 import java.util.Properties JavaDoc;
5
6 /**
7  * Implementation of NoCacheProvider.
8  *
9  * @author Steve Ebersole
10  */

11 public class NoCacheProvider implements CacheProvider {
12     /**
13      * Configure the cache
14      *
15      * @param regionName the name of the cache region
16      * @param properties configuration settings
17      *
18      * @throws CacheException
19      */

20     public Cache buildCache(String JavaDoc regionName, Properties JavaDoc properties) throws CacheException {
21         throw new NoCachingEnabledException();
22     }
23
24     /**
25      * Generate a timestamp
26      */

27     public long nextTimestamp() {
28         // This, is used by SessionFactoryImpl to hand to the generated SessionImpl;
29
// was the only reason I could see that we cannot just use null as
30
// Settings.cacheProvider
31
return System.currentTimeMillis() / 100;
32     }
33
34     /**
35      * Callback to perform any necessary initialization of the underlying cache implementation during SessionFactory
36      * construction.
37      *
38      * @param properties current configuration settings.
39      */

40     public void start(Properties JavaDoc properties) throws CacheException {
41         // this is called by SessionFactory irregardless; we just disregard here;
42
// could also add a check to SessionFactory to only conditionally call start
43
}
44
45     /**
46      * Callback to perform any necessary cleanup of the underlying cache implementation during SessionFactory.close().
47      */

48     public void stop() {
49         // this is called by SessionFactory irregardless; we just disregard here;
50
// could also add a check to SessionFactory to only conditionally call stop
51
}
52
53     public boolean isMinimalPutsEnabledByDefault() {
54         // this is called from SettingsFactory irregardless; trivial to simply disregard
55
return false;
56     }
57
58 }
59
Popular Tags