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

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

Collaboration diagram for org.objectweb.cjdbc.controller.cache.result.ResultCacheRule:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ResultCacheRule (String queryString, boolean caseSensitive, boolean applyToSkeleton, long timestampResolution) throws RESyntaxException
RE getQueryPattern ()
CacheBehavior getCacheBehavior ()
void setCacheBehavior (CacheBehavior behavior)
long getTimestampResolution ()
CacheBehavior matches (AbstractRequest request)
String getXml ()

Package Attributes

Trace logger = Trace.getLogger(ResultCacheRule.class.getName())

Detailed Description

This is the to define cache rules in the cache. A ResultCacheRule is defined by a queryPattern, set to 'default' if default rule, and a CacheBehavior.

Author:
Nicolas Modrzyk

Emmanuel Cecchet

Version:
1.0

Definition at line 42 of file ResultCacheRule.java.


Constructor & Destructor Documentation

org.objectweb.cjdbc.controller.cache.result.ResultCacheRule.ResultCacheRule String  queryString,
boolean  caseSensitive,
boolean  applyToSkeleton,
long  timestampResolution
throws RESyntaxException
 

Creates a new ResultCacheRule

Parameters:
queryString for this rule
caseSensitive true if matching is case sensitive
applyToSkeleton true if rule apply to query skeleton
timestampResolution timestamp resolution for NOW() macro
Exceptions:
RESyntaxException if the query pattern is invalid

Definition at line 61 of file ResultCacheRule.java.

00067   {
00068     this.queryString = queryString;
00069     queryPattern = new RE(queryString);
00070     this.isCaseSensitive = caseSensitive;
00071     this.applyToSkeleton = applyToSkeleton;
00072     this.timestampResolution = timestampResolution;
00073   }


Member Function Documentation

CacheBehavior org.objectweb.cjdbc.controller.cache.result.ResultCacheRule.getCacheBehavior  ) 
 

Get the cache behavior

Returns:
the CacheBehavior for this ResultCacheRule

Definition at line 90 of file ResultCacheRule.java.

00091   {
00092     return behavior;
00093   }

RE org.objectweb.cjdbc.controller.cache.result.ResultCacheRule.getQueryPattern  ) 
 

Get the query pattern

Returns:
the queryPattern for this ResultCacheRule

Definition at line 80 of file ResultCacheRule.java.

00081   {
00082     return this.queryPattern;
00083   }

long org.objectweb.cjdbc.controller.cache.result.ResultCacheRule.getTimestampResolution  ) 
 

Retrieve the timestamp resolution of this scheduler

Returns:
timestampResolution

Definition at line 110 of file ResultCacheRule.java.

00111   {
00112     return this.timestampResolution;
00113   }

String org.objectweb.cjdbc.controller.cache.result.ResultCacheRule.getXml  ) 
 

See also:
org.objectweb.cjdbc.common.xml.XmlComponent.getXml()

Definition at line 132 of file ResultCacheRule.java.

References org.objectweb.cjdbc.controller.cache.result.CacheBehavior.getXml().

00133   {
00134     StringBuffer info = new StringBuffer();
00135     info.append(
00136       "<"
00137         + DatabasesXmlTags.ELT_ResultCacheRule
00138         + " "
00139         + DatabasesXmlTags.ATT_queryPattern
00140         + "=\""
00141         + queryString
00142         + "\" "
00143         + DatabasesXmlTags.ATT_caseSensitive
00144         + "=\""
00145         + isCaseSensitive
00146         + "\" "
00147         + DatabasesXmlTags.ATT_applyToSkeleton
00148         + "=\""
00149         + applyToSkeleton
00150         + "\" "
00151         + DatabasesXmlTags.ATT_timestampResolution
00152         + "=\""
00153         + timestampResolution / 1000
00154         + "\" >");
00155     info.append(behavior.getXml());
00156     info.append("</" + DatabasesXmlTags.ELT_ResultCacheRule + ">");
00157     return info.toString();
00158   }

CacheBehavior org.objectweb.cjdbc.controller.cache.result.ResultCacheRule.matches AbstractRequest  request  ) 
 

Parameters:
request we may want to add to the cache
Returns:
the behavior to get the entry

Definition at line 119 of file ResultCacheRule.java.

References org.objectweb.cjdbc.common.sql.AbstractRequest.getSQL().

00120   {
00121     if (queryPattern.match(request.getSQL()))
00122     {
00123       return behavior;
00124     }
00125     else
00126       return null;
00127   }

void org.objectweb.cjdbc.controller.cache.result.ResultCacheRule.setCacheBehavior CacheBehavior  behavior  ) 
 

Set the cache behavior

Parameters:
behavior behavior for this rule

Definition at line 100 of file ResultCacheRule.java.

00101   {
00102     this.behavior = behavior;
00103   }


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