Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

org.objectweb.cjdbc.controller.cache.result.ResultCacheFactory Class Reference

List of all members.

Static Public Member Functions

AbstractResultCache getCacheInstance (int granularityValue, int maxEntries, int pendingTimeout) throws InstantiationException
CacheBehavior getCacheBehaviorInstance (String behaviorString, Hashtable options)

Detailed Description

Create a cache that conforms to AbstractResultCache, that is implementation independant

Author:
Nicolas Modrzyk

Definition at line 40 of file ResultCacheFactory.java.


Member Function Documentation

CacheBehavior org.objectweb.cjdbc.controller.cache.result.ResultCacheFactory.getCacheBehaviorInstance String  behaviorString,
Hashtable  options
[static]
 

Get an instance of a cache behavior for this cache

Parameters:
behaviorString representation of this cache behavior, xml tag
options for different cache rules
Returns:
an instance of a cache behavior

Definition at line 85 of file ResultCacheFactory.java.

00087   {
00088     if (behaviorString.equalsIgnoreCase(DatabasesXmlTags.ELT_NoCaching))
00089       return new NoCaching();
00090     if (behaviorString.equals(DatabasesXmlTags.ELT_EagerCaching))
00091     {
00092       // Timeout is in seconds: *1000      
00093       // 0, is no timeout, and 0x1000=0 !
00094       long timeout = 1000 * Long.parseLong((String) options
00095           .get(DatabasesXmlTags.ATT_timeout));
00096       return new EagerCaching(timeout);
00097     }
00098     if (behaviorString.equals(DatabasesXmlTags.ELT_RelaxedCaching))
00099     {
00100       // Timeout is in seconds: *1000
00101       long timeout = 1000 * Long.parseLong((String) options
00102           .get(DatabasesXmlTags.ATT_timeout));
00103       boolean keepIfNotDirty = new Boolean((String) options
00104           .get(DatabasesXmlTags.ATT_keepIfNotDirty)).booleanValue();
00105       return new RelaxedCaching(keepIfNotDirty, timeout);
00106     }
00107     else
00108       return null;
00109   }

AbstractResultCache org.objectweb.cjdbc.controller.cache.result.ResultCacheFactory.getCacheInstance int  granularityValue,
int  maxEntries,
int  pendingTimeout
throws InstantiationException [static]
 

Get an instance of the current cache implementation

Parameters:
granularityValue of the parsing
maxEntries to the cache
pendingTimeout before pending query timeout
Returns:
ResultCache implementation of the AbstractResultCache
Exceptions:
InstantiationException if parsing granularity is not valid

Definition at line 52 of file ResultCacheFactory.java.

00054   {
00055     AbstractResultCache currentRequestCache = null;
00056     switch (granularityValue)
00057     {
00058       case CachingGranularities.TABLE :
00059         currentRequestCache = new ResultCacheTable(maxEntries, pendingTimeout);
00060         break;
00061       case CachingGranularities.DATABASE :
00062         currentRequestCache = new ResultCacheDatabase(maxEntries,
00063             pendingTimeout);
00064         break;
00065       case CachingGranularities.COLUMN :
00066         currentRequestCache = new ResultCacheColumn(maxEntries, pendingTimeout);
00067         break;
00068       case CachingGranularities.COLUMN_UNIQUE :
00069         currentRequestCache = new ResultCacheColumnUnique(maxEntries,
00070             pendingTimeout);
00071         break;
00072       default :
00073         throw new InstantiationException("Invalid Granularity Value");
00074     }
00075     return currentRequestCache;
00076   }


The documentation for this class was generated from the following file:
Generated on Mon Apr 11 22:03:32 2005 for C-JDBC by  doxygen 1.3.9.1