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

CacheBehavior.java

00001 /**
00002  * C-JDBC: Clustered JDBC.
00003  * Copyright (C) 2002-2004 French National Institute For Research In Computer
00004  * Science And Control (INRIA).
00005  * Contact: c-jdbc@objectweb.org
00006  * 
00007  * This library is free software; you can redistribute it and/or modify it
00008  * under the terms of the GNU Lesser General Public License as published by the
00009  * Free Software Foundation; either version 2.1 of the License, or any later
00010  * version.
00011  * 
00012  * This library is distributed in the hope that it will be useful, but WITHOUT
00013  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
00015  * for more details.
00016  * 
00017  * You should have received a copy of the GNU Lesser General Public License
00018  * along with this library; if not, write to the Free Software Foundation,
00019  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00020  *
00021  * Initial developer(s): Nicolas Modrzyk
00022  * Contributor(s): Emmanuel Cecchet.
00023  */
00024 
00025 package org.objectweb.cjdbc.controller.cache.result;
00026 
00027 import org.objectweb.cjdbc.common.i18n.Translate;
00028 import org.objectweb.cjdbc.common.log.Trace;
00029 import org.objectweb.cjdbc.common.sql.SelectRequest;
00030 import org.objectweb.cjdbc.controller.cache.result.entries.CacheEntry;
00031 import org.objectweb.cjdbc.controller.virtualdatabase.ControllerResultSet;
00032 
00033 /**
00034  * Abstract class for the different cache actions. We need this class for adding
00035  * versatility in the parameters of each Caching action.
00036  * 
00037  * @author <a href="mailto:Nicolas.Modrzyk@inrialpes.fr">Nicolas Modrzyk </a>
00038  * @author <a href="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a>
00039  * @version 1.0
00040  */
00041 public abstract class CacheBehavior
00042 {
00043   Trace logger = Trace.getLogger(CacheBehavior.class.getName());
00044 
00045   protected CacheBehavior()
00046   {
00047     logger.debug(Translate.get("cachebehavior.new.action", getType()));
00048   }
00049 
00050   /**
00051    * The name of the class instance
00052    * 
00053    * @return class name of the current type
00054    */
00055   public String getType()
00056   {
00057     return this.getClass().getName();
00058   }
00059 
00060   /**
00061    * Builds a cache entry from a <code>SelectRequest</code> and a
00062    * <code>ControllerResultSet</code>. This cache entry can then be inserted
00063    * in the cache.
00064    * 
00065    * @param sqlQuery entry to add in the cache
00066    * @param result value to add in the cache
00067    * @param cache reference for EagerCaching in case the entry needs to remove
00068    *          itself from the cache.
00069    * @return the query cache entry to add to the cache
00070    */
00071   public abstract CacheEntry getCacheEntry(SelectRequest sqlQuery,
00072       ControllerResultSet result, AbstractResultCache cache);
00073 
00074   /**
00075    * Implementation specific xml dump of the cache behavior.
00076    * 
00077    * @return xml dump of the cache behavior
00078    * @see org.objectweb.cjdbc.common.xml.XmlComponent#getXml()
00079    */
00080   public abstract String getXml();
00081 }

Generated on Mon Apr 11 22:01:29 2005 for C-JDBC by  doxygen 1.3.9.1