Mercurial > dive4elements > gnv-client
view geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java @ 884:12f88239fb33
Updated Javadocs to the Listed Classes.
Also done some Codecleanup and removed unused Methods from the Code.
geo-backend/trunk@842 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 26 Mar 2010 15:23:03 +0000 |
parents | f0b6d0e2a0f6 |
children | 1c3efbd2fc5a |
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); final QueryExecutorFactory factory = (QueryExecutorFactory)clazz.newInstance(); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { factory.shutdown(); } }); return instance = factory; } 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; } public void shutdown() { } /** * Getting the QueryExecutor * @return the QueryExecutor */ public QueryExecutor getQueryExecutor(){ return new DefaultQueryExceutor(); } }