Mercurial > dive4elements > gnv-client
view geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java @ 1145:dfe1ac687c7f tip
added tags
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:16:15 +0200 |
parents | ebeb56428409 |
children |
line wrap: on
line source
/* * Copyright (c) 2010 by Intevation GmbH * * This program is free software under the LGPL (>=v2.1) * Read the file LGPL.txt coming with the software for details * or visit http://www.gnu.org/licenses/ if it does not exist. */ package de.intevation.gnv.geobackend.base.query; import de.intevation.gnv.geobackend.config.Configuration; import org.apache.log4j.Logger; /** * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ 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) { Configuration config = Configuration.getInstance(); if (config.isCacheEnabled()) { final QueryExecutorFactory factory = new CachingQueryExecutorFactory(); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { factory.shutdown(); } }); return instance = factory; } instance = new QueryExecutorFactory(); } return instance; } public void shutdown() { } /** * Getting the QueryExecutor * @return the QueryExecutor */ public QueryExecutor getQueryExecutor(){ return new DefaultQueryExceutor(); } }