1 19 20 package org.openharmonise.rm.search; 21 22 import java.util.logging.*; 23 import java.util.logging.Level ; 24 25 import org.openharmonise.commons.cache.*; 26 import org.openharmonise.commons.dsi.*; 27 28 29 36 public final class SearchResultsCache extends AbstractCache { 37 private static SearchResultsCache m_instance = null; 38 private static String CACHE_NAME = "SearchResults"; 39 40 43 private static final Logger m_logger = Logger.getLogger(SearchResultsCache.class.getName()); 44 45 50 private SearchResultsCache() throws CacheException { 51 super(CACHE_NAME); 52 } 53 54 60 public synchronized static SearchResultsCache getInstance() throws CacheException { 61 if (m_instance == null) { 62 m_instance = new SearchResultsCache(); 63 } 64 65 return m_instance; 66 } 67 68 74 public CachedResultSet getResults(String query) { 75 CachedResultSet returnResultSet = null; 76 final CachedResultSet cached_results; 77 try { 78 cached_results = (CachedResultSet) this.getObject(query); 79 if(cached_results != null){ 80 returnResultSet = (CachedResultSet)cached_results.clone(); 81 } 82 } catch (CacheException e) { 83 m_logger.log(Level.WARNING, e.getLocalizedMessage(), e); 84 } 85 86 return returnResultSet; 87 } 88 89 96 public void addToCache(String query, CachedResultSet results) { 97 super.addToCache(query, results); 98 } 99 100 101 104 protected Object getCacheableObject(Object query) throws Exception { 105 return null; 107 } 108 } | Popular Tags |