Mercurial > dive4elements > gnv-client
view geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainerFactory.java @ 891:a277ebde74e4
Added more JavaDoc
geo-backend/trunk@917 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Tue, 13 Apr 2010 11:28:47 +0000 |
parents | b757def3ff55 |
children | 8a652a451bc6 |
line wrap: on
line source
package de.intevation.gnv.geobackend.base.query.container; import java.util.Properties; import org.apache.log4j.Logger; import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException; /** * Factoryclass to provide a singleton-Instance of an * <code>QueryContainer</code>-Object * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class QueryContainerFactory { /** * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(QueryContainerFactory.class); /** * The singleton Instance of this Factory. */ private static QueryContainerFactory instance = null; /** * The ConnectionPool providing the Connections to the DatabaseBackends */ private QueryContainer queryContainer = null; /** * Basic-Constructor of this Class */ private QueryContainerFactory() { super(); } /** * This Method provides an singleton Instance of this Class. * @return an singleton Instance of this Class */ public static synchronized QueryContainerFactory getInstance(){ if (instance == null){ instance = new QueryContainerFactory(); } return instance; } /** * Getting the QueryContainer * @return the QueryContainer */ public QueryContainer getQueryContainer(){ return this.queryContainer; } /** * Initializes the QueryContainer. * Should only be called once on system startup * @param properties the Properties for the Individual Configuration of the QueryContainerbb * @throws QueryContainerException */ public synchronized void initializeQueryContainer(Properties properties) throws QueryContainerException{ log.debug("ConnectionPoolFactory.initializeConnectionPool"); if (this.queryContainer == null){ this.queryContainer = new DefaultQueryContainer(); this.queryContainer.initialize(properties); }else{ log.warn("ConnectionPool already initialized"); } } /** * Checks if the QueryContainer has already been initialized. * @return true if the QueryContainer is initialized. */ public boolean isInitialized(){ return this.queryContainer != null; } }