info.aduna.gee.publication.servlets.cache
Class CoverInfoCache

java.lang.Object
  extended by info.aduna.gee.publication.servlets.cache.CoverInfoCache

public class CoverInfoCache
extends Object

Class CoverInfoCache


Field Summary
protected static HashMap _coversPerHost
          A mapping of hostnames to (Array)Lists of CoverInfo objects.
 
Constructor Summary
CoverInfoCache()
           
 
Method Summary
protected static ArrayList _fillCache(String host)
          Fills the cache for the indicated host with the info from the coverdb.
static ArrayList ensureCoversLoaded(String host)
          Ensures the list of covers for a certain host is loaded.
static boolean exists(String host, String coverName)
           
static CoverInfo get(String host, String coverName)
          Gets a CoverInfo object from this cache.
static List getAll(String host)
          Gets a list of all CoverInfo objects for a certain host.
static void put(String host, CoverInfo coverInfo)
          Puts a (new) cover into the CoverInfoCache and the underlying coverdb.
static void refresh(String host)
          Refreshes (throws away) the cached info for a certain host.
static void remove(String host, CoverInfo coverInfo)
          Removes a cover from the CoverInfoCache and the coverdb.
static int searchCover(List covers, String name)
          Searches a cover in the supplied list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_coversPerHost

protected static HashMap _coversPerHost
A mapping of hostnames to (Array)Lists of CoverInfo objects.

Constructor Detail

CoverInfoCache

public CoverInfoCache()
Method Detail

refresh

public static void refresh(String host)
Refreshes (throws away) the cached info for a certain host.

Parameters:
host - the name of the server to refresh the cache for

ensureCoversLoaded

public static ArrayList ensureCoversLoaded(String host)
Ensures the list of covers for a certain host is loaded.

Parameters:
host - the name of the server to ensure the loaded list for
Returns:
the list of CoverInfo objects (guaranteed non-null).

exists

public static boolean exists(String host,
                             String coverName)

get

public static CoverInfo get(String host,
                            String coverName)
Gets a CoverInfo object from this cache.


getAll

public static List getAll(String host)
Gets a list of all CoverInfo objects for a certain host. The returned List is the object used by this cache, so be carefull with that (DON'T CHANGE)! Also, the returned List is unsynchronized!


put

public static void put(String host,
                       CoverInfo coverInfo)
Puts a (new) cover into the CoverInfoCache and the underlying coverdb. Any info with the same covername will be overwritten.


remove

public static void remove(String host,
                          CoverInfo coverInfo)
Removes a cover from the CoverInfoCache and the coverdb.


_fillCache

protected static ArrayList _fillCache(String host)
Fills the cache for the indicated host with the info from the coverdb. If the coverdb for that host does not exist, an empty ArrayList will be inserted.


searchCover

public static int searchCover(List covers,
                              String name)
Searches a cover in the supplied list.

Returns:
the index of the CoverInfo in the list, or -1 if not found.


Copyright © 1997-2008 Aduna. All Rights Reserved.