001    /**
002     * Copyright (C) 2010 The Roslin Institute <contact andy.law@roslin.ed.ac.uk>
003     *
004     * This file is part of the Ensembl Java API demonstration project developed by the
005     * Bioinformatics Group at The Roslin Institute, The Royal (Dick) School of
006     * Veterinary Studies, University of Edinburgh.
007     *
008     * This is free software: you can redistribute it and/or modify
009     * it under the terms of the GNU General Public License (version 3) as published by
010     * the Free Software Foundation.
011     *
012     * This software is distributed in the hope that it will be useful,
013     * but WITHOUT ANY WARRANTY; without even the implied warranty of
014     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
015     * GNU General Public License for more details.
016     *
017     * You should have received a copy of the GNU General Public License
018     * in this software distribution. If not, see <http://www.gnu.org/licenses/gpl-3.0.html/>.
019     */
020    
021    package uk.ac.roslin.ensembl.model.database;
022    
023    import uk.ac.roslin.ensembl.model.core.CollectionOfSpecies;
024    import uk.ac.roslin.ensembl.model.core.CollectionSpecies;
025    import java.util.Collection;
026    import java.util.HashMap;
027    import java.util.List;
028    import java.util.Properties;
029    import java.util.TreeSet;
030    
031    import uk.ac.roslin.ensembl.config.DBConnection.DataSource;
032    import uk.ac.roslin.ensembl.config.EnsemblComparaDivision;
033    import uk.ac.roslin.ensembl.exception.ConfigurationException;
034    import uk.ac.roslin.ensembl.exception.DAOException;
035    import uk.ac.roslin.ensembl.model.core.Species;
036    
037    public interface Registry {
038    
039        public Properties getConfigProperties();
040    
041        public DataSource getDatasourceType() ;
042    
043        public String findMybatisSchemaForSchemaVersion(DatabaseType type, String schema_version);
044    
045        public String getMostRecentEnsemblVersion() ;
046    
047        //public DatabaseDAO getDatabaseDAO();
048    
049        public Database makeDatabase(String db_name) throws ConfigurationException;
050    
051        public ComparisonDatabase getComparaDatabase(EnsemblComparaDivision comparaDivision, String db_version);
052    
053        public Database getDatabase(String species_name_or_alias) ;
054    
055        public Database getDatabase(String species_name_or_alias, String db_version) ;
056    
057        public Database getDatabase(String species_name_or_alias, DatabaseType database_type, String db_version) ;
058    
059        public Database getDatabaseForFullName(String fullname) ;
060    
061        public TreeSet<? extends Database> getDatabasesByType(DatabaseType type) ;
062    
063    
064        public Species getSpeciesByAlias(String alias_or_name) ;
065    
066        public Species getSpeciesByEnsemblName(String ensemblName) ;
067    
068        public Collection<? extends Species> getSpecies();
069    
070        public Collection<? extends CollectionSpecies> getCollectionSpecies();
071    
072        public void addSpecies(String dbStyleName, Species species ) ;
073    
074        public CollectionOfSpecies getCollection(String name, String dbVersion);
075    
076        public Collection<? extends CollectionOfSpecies> getCollectionRegistriesByName(String name) ;
077    
078        public Collection<? extends CollectionOfSpecies> getCollectionsByDBVersion(String dbVersion) ;
079    
080        public List<? extends CollectionOfSpecies> getCollections() ;
081    
082        public int getHighestEnsemblSchemaVersion() ;
083    
084        public int getHighestDBVersion() ;
085    
086        public String getMostRecentDBVersion();
087    
088        //handling aliases
089    
090        public String getEnsemblNameForAlias(String alias);
091    
092        public boolean addSessionAlias(String ensembl_genus_species_name, String alias) throws Exception;
093    
094        //Reporting
095    
096        public StringBuffer printRegistryReport();
097    
098        public String getAssembly(SingleSpeciesDatabase database) throws DAOException ;
099    
100        public HashMap<CollectionSpecies,String> getAssemblies(CollectionDatabase database) throws DAOException ;
101    
102        public void setCoreDBBuildLevels(SingleSpeciesCoreDatabase database) throws DAOException ;
103    
104    
105    }