| 1 | =head1 NAME | ||
| 2 | |||
| 3 | Bio::Das::ProServer::SourceAdaptor::Transport::edgeexpress | ||
| 4 | A transport layer for EdgeExpressDB | ||
| 5 | |||
| 6 | =head1 VERSION | ||
| 7 | |||
| 8 | $Revision: 1.7 $ | ||
| 9 | |||
| 10 | =head1 SYNOPSIS | ||
| 11 | |||
| 12 | =head1 DESCRIPTION | ||
| 13 | |||
| 14 | Transport helper class for EdgeExpressDB database access | ||
| 15 | and persistance | ||
| 16 | |||
| 17 | =head1 DIAGNOSTICS | ||
| 18 | |||
| 19 | =head1 CONFIGURATION AND ENVIRONMENT | ||
| 20 | |||
| 21 | [my_eedb] | ||
| 22 | transport = edgeexpress | ||
| 23 | eedb_url = mysql://<user>:<pass>@<host>:<port optional>/<database_name> | ||
| 24 | |||
| 25 | =head1 DEPENDENCIES | ||
| 26 | |||
| 27 | =over | ||
| 28 | |||
| 29 | =item L<DBI> | ||
| 30 | |||
| 31 | =item L<DBD::mysql> | ||
| 32 | |||
| 33 | =item L<Bio::Das::ProServer::SourceAdaptor::Transport::generic> | ||
| 34 | |||
| 35 | =item L<MQdb::Database> | ||
| 36 | |||
| 37 | =back | ||
| 38 | |||
| 39 | =head1 INCOMPATIBILITIES | ||
| 40 | |||
| 41 | =head1 BUGS AND LIMITATIONS | ||
| 42 | |||
| 43 | =head1 AUTHOR | ||
| 44 | |||
| 45 | Jessica Severin <severin@gsc.riken.jp>. | ||
| 46 | |||
| 47 | =head1 LICENSE AND COPYRIGHT | ||
| 48 | |||
| 49 | =head1 APPENDIX | ||
| 50 | |||
| 51 | The rest of the documentation details each of the object methods. | ||
| 52 | Internal methods are usually preceded with a _ | ||
| 53 | |||
| 54 | =head1 METHODS | ||
| 55 | |||
| 56 | =cut | ||
| 57 | |||
| 58 | ######### | ||
| 59 | # Author: Jessica Severin | ||
| 60 | # Maintainer: Jessica Severin | ||
| 61 | # Created: 2008-08-27 | ||
| 62 | # | ||
| 63 | # Transport layer for EdgeExpressDB | ||
| 64 | # | ||
| 65 | package Bio::Das::ProServer::SourceAdaptor::Transport::edgeexpress; | ||
| 66 | use strict; | ||
| 67 | use warnings; | ||
| 68 | use base qw(Bio::Das::ProServer::SourceAdaptor::Transport::generic); | ||
| 69 | use DBI; | ||
| 70 | use Carp; | ||
| 71 | use English qw(-no_match_vars); | ||
| 72 | use MQdb::Database; | ||
| 73 | |||
| 74 | our $VERSION = do { my @r = (q$Revision: 1.7 $ =~ /\d+/mxg); sprintf '%d.'.'%03d' x $#r, @r }; | ||
| 75 | |||
| 76 | =head2 init | ||
| 77 | |||
| 78 | Description: Subclass override of init() method. Reads the 'config' and initializes the | ||
| 79 | database and transport layer | ||
| 80 | Caller : superclass (not public method) | ||
| 81 | |||
| 82 | =cut | ||
| 83 | |||
| 84 | sub init { | ||
| 85 | my $self = shift; | ||
| 86 | my $config = $self->config(); | ||
| 87 | my $eeDB = MQdb::Database->new_from_url($config->{eedb_url}); | ||
| 88 | if($eeDB) { | ||
| 89 | printf("MQdb::Database = %s\n", $eeDB->url); | ||
| 90 | } else { | ||
| 91 | printf("ERROR configuring edgeexpress database connection [%s]\n", $config->{eedb_url}); | ||
| 92 | } | ||
| 93 | $self->{'_eedb_database'} = $eeDB; | ||
| 94 | return $self; | ||
| 95 | } | ||
| 96 | |||
| 97 | =head2 database | ||
| 98 | |||
| 99 | Description: returns the Database object connected to the configured EdgeExpressDB | ||
| 100 | Example : from a SourceAdaptor subclass | ||
| 101 | $eeDB = $self->transport->database; | ||
| 102 | Returntype : MQdb::Database object connected to EdgeExpressDB | ||
| 103 | Exceptions : none | ||
| 104 | Caller : Bio::Das::ProServer::SourceAdaptor::edgeexpress class | ||
| 105 | |||
| 106 | =cut | ||
| 107 | |||
| 108 | sub database { | ||
| 109 | my $self = shift; | ||
| 110 | return $self->{'_eedb_database'}; | ||
| 111 | } | ||
| 112 | |||
| 113 | |||
| 114 | 1; | ||
| 115 | |||
| 116 | __END__ |