Mercurial > dive4elements > gnv-client
view geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPoolFactory.java @ 1127:ebeb56428409
Added license headers and license file.
geo-backend/trunk@1261 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 02 Nov 2010 17:52:22 +0000 |
parents | b757def3ff55 |
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.connectionpool; import de.intevation.gnv.geobackend.sde.connectionpool.ArcSDEConnectionPool; import java.util.Properties; import org.apache.log4j.Logger; /** * Factoryimplementation for the Interface ConnectionPool. * This factory delivers Instances of the Interface ConnectionPool. * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class ConnectionPoolFactory { /** * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(ConnectionPoolFactory.class); /** * The singleton Instance of this Factory. */ private static ConnectionPoolFactory instance = null; /** * The ConnectionPool providing the Connections to the DatabaseBackends */ private ConnectionPool connectionPool = null; /** * Basic-Constructor of this Class */ private ConnectionPoolFactory() { super(); } /** * This Method provides an singleton Instance of this Class. * @return an singleton Instance of this Class */ public static ConnectionPoolFactory getInstance(){ if (instance == null){ instance = new ConnectionPoolFactory(); } return instance; } /** * Getting the ConnectionPool * @return the ConnectionPool */ public ConnectionPool getConnectionPool(){ return this.connectionPool; } /** * Initializes the ConnectionPool. * Should only be called once on system startup * @param properties the Properties for the Individual Configuration of the ConnectionPool */ public void initializeConnectionPool(Properties properties){ log.debug("ConnectionPoolFactory.initializeConnectionPool"); if (this.connectionPool == null){ //TODO: Here it might be possible to switch the ConnectionPoolInstance using a FLAG. this.connectionPool = new ArcSDEConnectionPool(); this.connectionPool.initialize(properties); }else{ log.warn("ConnectionPool already initialized"); } } /** * Checks if the ConnectionPool has already been initialized. * @return true if the ConnectionPool is initialized. */ public boolean isInitialized(){ return this.connectionPool != null; } }