author | František Kučera <franta-hg@frantovo.cz> |
Sat Oct 08 23:32:18 2011 +0200 (2011-10-08) | |
changeset 63 | d883d4ab7b9d |
child 64 | 72950b29569e |
permissions | -rw-r--r-- |
franta-hg@63 | 1 |
/* |
franta-hg@63 | 2 |
* SONEWS News Server |
franta-hg@63 | 3 |
* see AUTHORS for the list of contributors |
franta-hg@63 | 4 |
* |
franta-hg@63 | 5 |
* This program is free software: you can redistribute it and/or modify |
franta-hg@63 | 6 |
* it under the terms of the GNU General Public License as published by |
franta-hg@63 | 7 |
* the Free Software Foundation, either version 3 of the License, or |
franta-hg@63 | 8 |
* (at your option) any later version. |
franta-hg@63 | 9 |
* |
franta-hg@63 | 10 |
* This program is distributed in the hope that it will be useful, |
franta-hg@63 | 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
franta-hg@63 | 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
franta-hg@63 | 13 |
* GNU General Public License for more details. |
franta-hg@63 | 14 |
* |
franta-hg@63 | 15 |
* You should have received a copy of the GNU General Public License |
franta-hg@63 | 16 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
franta-hg@63 | 17 |
*/ |
franta-hg@63 | 18 |
package org.sonews.storage.impl; |
franta-hg@63 | 19 |
|
franta-hg@63 | 20 |
import java.sql.SQLException; |
franta-hg@63 | 21 |
import org.sonews.storage.Storage; |
franta-hg@63 | 22 |
import org.sonews.storage.StorageBackendException; |
franta-hg@63 | 23 |
|
franta-hg@63 | 24 |
/** |
franta-hg@63 | 25 |
* |
franta-hg@63 | 26 |
* @author František Kučera (frantovo.cz) |
franta-hg@63 | 27 |
*/ |
franta-hg@63 | 28 |
public class DrupalDatabaseProvider extends JDBCDatabaseProvider { |
franta-hg@63 | 29 |
|
franta-hg@63 | 30 |
@Override |
franta-hg@63 | 31 |
public Storage storage(Thread thread) |
franta-hg@63 | 32 |
throws StorageBackendException { |
franta-hg@63 | 33 |
try { |
franta-hg@63 | 34 |
if (!instances.containsKey(Thread.currentThread())) { |
franta-hg@63 | 35 |
DrupalDatabase db = new DrupalDatabase(); |
franta-hg@63 | 36 |
db.arise(); |
franta-hg@63 | 37 |
instances.put(Thread.currentThread(), db); |
franta-hg@63 | 38 |
return db; |
franta-hg@63 | 39 |
} else { |
franta-hg@63 | 40 |
return instances.get(Thread.currentThread()); |
franta-hg@63 | 41 |
} |
franta-hg@63 | 42 |
} catch (SQLException ex) { |
franta-hg@63 | 43 |
throw new StorageBackendException(ex); |
franta-hg@63 | 44 |
} |
franta-hg@63 | 45 |
} |
franta-hg@63 | 46 |
} |