Coverage Report - org.webmacro.resource.CacheManager
 
Classes in this File Line Coverage Branch Coverage Complexity
CacheManager
N/A
N/A
1
 
 1  
 /*
 2  
  * Copyright (C) 1998-2001 Semiotek Inc.  All Rights Reserved.
 3  
  *
 4  
  * Redistribution and use in source and binary forms, with or without
 5  
  * modification, are permitted under the terms of either of the following
 6  
  * Open Source licenses:
 7  
  *
 8  
  * The GNU General Public License, version 2, or any later version, as
 9  
  * published by the Free Software Foundation
 10  
  * (http://www.fsf.org/copyleft/gpl.html);
 11  
  *
 12  
  *  or
 13  
  *
 14  
  * The Semiotek Public License (http://webmacro.org/LICENSE.)
 15  
  *
 16  
  * This software is provided "as is", with NO WARRANTY, not even the
 17  
  * implied warranties of fitness to purpose, or merchantability. You
 18  
  * assume all risks and liabilities associated with its use.
 19  
  *
 20  
  * See www.webmacro.org for more information on the WebMacro project.
 21  
  */
 22  
 
 23  
 
 24  
 package org.webmacro.resource;
 25  
 
 26  
 import org.webmacro.Broker;
 27  
 import org.webmacro.InitException;
 28  
 import org.webmacro.ResourceException;
 29  
 import org.webmacro.util.Settings;
 30  
 
 31  
 /**
 32  
  * The CacheManager sits between the template provider and WM.  This
 33  
  * interface specifies all the functions of the cache manager, allowing
 34  
  * a complete separation of the fetching of resources from how they are
 35  
  * cached.  CachingProvider looks in the properties file to figure out
 36  
  * what cache manager to load.
 37  
  * @author Brian Goetz
 38  
  * @since 0.96
 39  
  */
 40  
 
 41  
 public interface CacheManager
 42  
 {
 43  
 
 44  
     /**
 45  
      * Same as defined in Provider, except with an additional type
 46  
      * parameter so it knows what type of resource it is caching
 47  
      */
 48  
     public void init (Broker b, Settings config, String resourceType)
 49  
             throws InitException;
 50  
 
 51  
     /**
 52  
      * Same as defined in Provider
 53  
      */
 54  
     public void flush ();
 55  
 
 56  
     /**
 57  
      * Same as defined in Provider
 58  
      */
 59  
     public void destroy ();
 60  
 
 61  
     /**
 62  
      * Called to get a resource from the cache.  The helper object is used
 63  
      * to load the resource if the resource was not in the cache.
 64  
      */
 65  
     public Object get (final Object query, ResourceLoader helper)
 66  
             throws ResourceException;
 67  
 
 68  
     /**
 69  
      * Called to get a resource from the cache.  Returns null if not present.
 70  
      */
 71  
     public Object get (final Object query);
 72  
 
 73  
     /**
 74  
      * Called to put a resource into the cache.
 75  
      */
 76  
     public void put (final Object query, Object resource);
 77  
 
 78  
     /**
 79  
      * Invalidates an entry in the cache. Depending on the
 80  
      * the implementation, the actual removal from the cache
 81  
      * may or may not be immediate.
 82  
      */
 83  
     public void invalidate (final Object query);
 84  
 
 85  
     /**
 86  
      * Does this cache manager support reloading of resources if the
 87  
      * underlying resource has changed?
 88  
      */
 89  
     public boolean supportsReload ();
 90  
 
 91  
 }