MySQLServerProvider.pm
Go to the documentation of this file.
00001 
00002 =head1 LICENSE
00003 
00004 Copyright [2009-2016] EMBL-European Bioinformatics Institute
00005 
00006 Licensed under the Apache License, Version 2.0 (the "License");
00007 you may not use this file except in compliance with the License.
00008 You may obtain a copy of the License at
00009 
00010      http://www.apache.org/licenses/LICENSE-2.0
00011 
00012 Unless required by applicable law or agreed to in writing, software
00013 distributed under the License is distributed on an "AS IS" BASIS,
00014 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015 See the License for the specific language governing permissions and
00016 limitations under the License.
00017 
00018 =cut
00019 
00020 =head1 CONTACT
00021 
00022   Please email comments or questions to the public Ensembl
00023   developers list at <dev@ensembl.org>.
00024 
00025   Questions may also be sent to the Ensembl help desk at
00026   <helpdesk@ensembl.org>.
00027 
00028 =cut
00029 
00030 =head1 NAME
00031 
00032 Bio::EnsEMBL::MetaData::DBSQL::MySQLServerProvider
00033 
00034 =head1 SYNOPSIS
00035 
00036   my $provider = Bio::EnsEMBL::MetaData::DBSQL::MySQLServerProvider->new();
00037   my $args = $provider->args_for_genome($info);
00038   my $dba = Bio::EnsEMBL::DBSQL::DBAdaptor->new(%$args);
00039 
00040 =head1 DESCRIPTION
00041 
00042 Provides public DB argument for a supplied info object or division
00043 
00044 =cut
00045 
00046 package Bio::EnsEMBL::MetaData::DBSQL::MySQLServerProvider;
00047 
00048 use strict;
00049 use warnings;
00050 
00051 use Bio::EnsEMBL::Utils::PublicMySQLServer qw(eg_args e_args);
00052 
00053 =head1 CONSTRUCTOR
00054 =head2 new 
00055   Description: Creates a new provider object
00056   Returntype : Bio::EnsEMBL::MetaData::DBSQL::MySQLServerProvider
00057   Exceptions : none
00058   Caller     : internal
00059   Status     : Stable
00060 =cut
00061 
00062 sub new {
00063   my ( $proto, @args ) = @_;
00064   my $class = ref($proto) || $proto;
00065   my $self = bless( {}, $class );
00066   return $self;
00067 }
00068 
00069 =head1 METHODS
00070 =head2 args_for_genome
00071   Description: Return the host arguments to build a DBAdaptor for a supplied info object
00072   Argument   : Bio::EnsEMBL::MetaData::GenomeInfo
00073   Returntype : Hashref
00074   Exceptions : none
00075   Caller     : 
00076   Status     : Stable
00077 =cut
00078 sub args_for_genome {
00079   my ($self, $info) = @_;
00080   return $self->args_for_division($info->division());
00081 }
00082 
00083 =head2 args_for_division
00084   Description: Return the host arguments to build a DBAdaptor for a supplied division
00085   Argument   : String
00086   Returntype : Hashref
00087   Exceptions : none
00088   Caller     : 
00089   Status     : Stable
00090 =cut
00091 sub args_for_division {
00092   my ($self, $division) = @_;
00093   if($division eq 'Ensembl') {
00094     return e_args();    
00095   } else {
00096     return eg_args();
00097   }
00098   return;
00099 }
00100 
00101 1;
00102