Mercurial > dive4elements > gnv-client
view geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java @ 541:3cbf11c67fdc
Experimental caching of SQL results via Ehache
geo-backend/trunk@462 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 18 Dec 2009 16:13:52 +0000 |
parents | 5a583cff97ea |
children | f0b6d0e2a0f6 |
line wrap: on
line source
/** * */ package de.intevation.gnv.geobackend.base.query; import org.apache.log4j.Logger; /** * @author Tim Englich <tim.englich@intevation.de> * */ public class QueryExecutorFactory { public static final String QUERY_EXECUTOR_FACTORY = "query.executor.factory"; /** * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(QueryExecutorFactory.class); /** * The singleton Instance of this Factory. */ private static QueryExecutorFactory instance = null; /** * Basic-Constructor of this Class */ public QueryExecutorFactory() { super(); } /** * This Method provides an singleton Instance of this Class. * @return an singleton Instance of this Class */ public static synchronized QueryExecutorFactory getInstance(){ if (instance == null) { String className = System.getProperty(QUERY_EXECUTOR_FACTORY); if (className != null) { try { Class clazz = Class.forName(className); instance = (QueryExecutorFactory)clazz.newInstance(); return instance; } catch (ClassNotFoundException cnfe) { log.error(cnfe); } catch (InstantiationException ie) { log.error(ie); } catch(IllegalAccessException iae) { log.error(iae); } catch (ClassCastException cce) { log.error(cce); } } instance = new QueryExecutorFactory(); } return instance; } /** * Getting the QueryExecutor * @return the QueryExecutor */ public QueryExecutor getQueryExecutor(){ return new DefaultQueryExceutor(); } }