3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.cdm
.database
;
13 import java
.sql
.SQLException
;
15 import javax
.sql
.DataSource
;
17 import org
.apache
.commons
.dbcp
.BasicDataSource
;
18 import org
.apache
.commons
.pool
.impl
.GenericObjectPool
;
19 import org
.apache
.log4j
.Logger
;
21 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalCode
;
25 * @created Sep 22, 2009
28 public class NomenclaturalCodeAwareDataSource
extends BasicDataSource
{
29 private static final Logger logger
= Logger
30 .getLogger(NomenclaturalCodeAwareDataSource
.class);
32 private NomenclaturalCode nomenclaturalCode
;
34 public NomenclaturalCode
getNomenclaturalCode() {
35 return nomenclaturalCode
;
38 public void setNomenclaturalCode(NomenclaturalCode nomenclaturalCode
) {
39 this.nomenclaturalCode
= nomenclaturalCode
;
42 /* FIXME This is a workaround to solve a problem with dbcp connection pooling.
43 * Remove this when dbcp connection pool gets configured correctly
46 * @see org.apache.commons.dbcp.BasicDataSource#createDataSource()
49 protected synchronized DataSource
createDataSource() throws SQLException
{
50 super.createDataSource();
51 connectionPool
.setWhenExhaustedAction(GenericObjectPool
.WHEN_EXHAUSTED_GROW
);