KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > continuent > sequoia > controller > cache > result > CacheBehavior


1 /**
2  * Sequoia: Database clustering technology.
3  * Copyright (C) 2002-2004 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Contact: sequoia@continuent.org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  * Initial developer(s): Nicolas Modrzyk
20  * Contributor(s): Emmanuel Cecchet.
21  */

22
23 package org.continuent.sequoia.controller.cache.result;
24
25 import org.continuent.sequoia.common.i18n.Translate;
26 import org.continuent.sequoia.common.log.Trace;
27 import org.continuent.sequoia.controller.backend.result.ControllerResultSet;
28 import org.continuent.sequoia.controller.cache.result.entries.AbstractResultCacheEntry;
29 import org.continuent.sequoia.controller.requests.SelectRequest;
30
31 /**
32  * Abstract class for the different cache actions. We need this class for adding
33  * versatility in the parameters of each Caching action.
34  *
35  * @author <a HREF="mailto:Nicolas.Modrzyk@inrialpes.fr">Nicolas Modrzyk </a>
36  * @author <a HREF="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a>
37  * @version 1.0
38  */

39 public abstract class CacheBehavior
40 {
41   Trace logger = Trace.getLogger(CacheBehavior.class.getName());
42
43   protected CacheBehavior()
44   {
45     logger.debug(Translate.get("cachebehavior.new.action", getType()));
46   }
47
48   /**
49    * The name of the class instance
50    *
51    * @return class name of the current type
52    */

53   public String JavaDoc getType()
54   {
55     return this.getClass().getName();
56   }
57
58   /**
59    * Builds a cache entry from a <code>SelectRequest</code> and a
60    * <code>ControllerResultSet</code>. This cache entry can then be inserted
61    * in the cache.
62    *
63    * @param sqlQuery entry to add in the cache
64    * @param result value to add in the cache
65    * @param cache reference for EagerCaching in case the entry needs to remove
66    * itself from the cache.
67    * @return the query cache entry to add to the cache
68    */

69   public abstract AbstractResultCacheEntry getCacheEntry(
70       SelectRequest sqlQuery, ControllerResultSet result,
71       AbstractResultCache cache);
72
73   /**
74    * Implementation specific xml dump of the cache behavior.
75    *
76    * @return xml dump of the cache behavior
77    * @see org.continuent.sequoia.common.xml.XmlComponent#getXml()
78    */

79   public abstract String JavaDoc getXml();
80 }
Popular Tags