001/** 002 * Copyright (C) 2010-2015 The Roslin Institute <contact andy.law@roslin.ed.ac.uk> 003 * 004 * This file is part of JEnsembl: a Java API to Ensembl data sources developed by the 005 * Bioinformatics Group at The Roslin Institute, The Royal (Dick) School of 006 * Veterinary Studies, University of Edinburgh. 007 * 008 * Project hosted at: http://jensembl.sourceforge.net 009 * 010 * This is free software: you can redistribute it and/or modify 011 * it under the terms of the GNU General Public License (version 3) as published by 012 * the Free Software Foundation. 013 * 014 * This software is distributed in the hope that it will be useful, 015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 017 * GNU General Public License for more details. 018 * 019 * You should have received a copy of the GNU General Public License 020 * in this software distribution. If not, see: http://opensource.org/licenses/gpl-3.0.html 021 */ 022package uk.ac.roslin.ensembl.test; 023 024import uk.ac.roslin.ensembl.config.DBConnection.DataSource; 025import uk.ac.roslin.ensembl.dao.database.DBRegistry; 026 027/** 028 * 029 * @author tpaterso 030 */ 031public class RegistryProvider { 032 033 private static DBRegistry eReg = null; 034 private static DBRegistry gReg = null; 035 private static DBRegistry bReg = null; 036 private static boolean initE = false; 037 private static boolean initG = false; 038 private static boolean initB = false; 039 040 041 private static void initE() { 042 try { 043 eReg = DBRegistry.createRegistryForDataSource(DataSource.ENSEMBLDB); 044 } catch (Exception e) { 045 eReg = null; 046 } 047 048 initE = true; 049 } 050 private static void initG() { 051 052 try { 053 gReg = DBRegistry.createRegistryForDataSource(DataSource.ENSEMBLGENOMES); 054 } catch (Exception e) { 055 gReg = null; 056 } 057 initG = true; 058 } 059 private static void initB() { 060 061 try { 062 //this is too big now 063 //bReg = DBRegistry.createRegistryForDataSource(DataSource.ENSEMBLBACTERIA); 064 bReg = DBRegistry.createRegistryForDataSourceCurrentRelease(DataSource.ENSEMBLBACTERIA); 065 } catch (Exception e) { 066 bReg = null; 067 } 068 initB = true; 069 } 070 071 public static DBRegistry geteReg() { 072 if (!initE) {initE();} 073 return eReg; 074 } 075 076 public static DBRegistry getgReg() { 077 if (!initG) {initG();} 078 return gReg; 079 } 080 081 public static DBRegistry getbReg() { 082 if (!initB) {initB();} 083 return bReg; 084 } 085 086 087}