[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Tue Jun 15 00:37:55 UTC 2004


mwilkinson
Mon Jun 14 20:37:55 EDT 2004
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv11975/MOBY

Modified Files:
	CommonSubs.pm central_db_connection.pm 
Log Message:
using config file here too

moby-live/Perl/MOBY CommonSubs.pm,1.51,1.52 central_db_connection.pm,1.2,1.3
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2004/05/04 23:54:16	1.51
+++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2004/06/15 00:37:55	1.52
@@ -200,6 +200,7 @@
     getResponseArticles
     getCrossReferences
     genericServiceInputParser
+    genericServiceInputParserAsObject
     complexServiceInputParser
     whichDeepestParentObject
     getServiceNotes
@@ -233,6 +234,7 @@
     getResponseArticles
     getCrossReferences
     genericServiceInputParser
+    genericServiceInputParserAsObject
     complexServiceInputParser
     whichDeepestParentObject
     getServiceNotes
@@ -327,6 +329,48 @@
 
 
 
+=head2 serviceInputParser
+
+ name     : DO NOT USE!!
+ function : to take a MOBY message and break the objects out of it.  This is identical
+            to the genericServiceInputParser method above, except that it returns the data as
+            Objects rather than XML::DOM nodes.  This is an improvement!
+ usage    : my @inputs = serviceInputParser($MOBY_mssage));
+ args     : $message - this is the SOAP payload; i.e. the XML document containing the MOBY message
+ returns  : @inputs - the structure of @inputs is a list of listrefs.
+            Each listref has three components:
+                1. COLLECTION|SIMPLE|SECONDARY (i.e. constants 1, 2, 3)
+                2. queryID (undef for Secondary parameters)
+                3. $data - either MOBY::Client::SimpleArticle, CollectionArticle, or SecondaryArticle
+
+=cut
+
+
+sub serviceInputParser {
+    my ($message) = @_;  # get the incoming MOBY query XML
+    my @inputs;           # set empty response
+    my @queries = getInputs($message);  # returns XML::DOM nodes <mobyData>...</mobyData>
+
+
+# mark, this doesn't work for complex services.  We need to allow more than one input per invocation
+    foreach my $query(@queries){
+        my $queryID = getInputID($query);  # get the queryID attribute of the mobyData
+        my @input_articles = getArticlesAsObjects($query); # get the Simple/Collection articles making up this query <Simple>...</Simple> or <Collection>...</Collection> or <Parameter>...</Parameter
+        foreach my $article(@input_articles){       # input is a listref
+            if ($article->isCollection){
+                my @simples = getCollectedSimples($article->XML);
+                push @inputs, [COLLECTION,$queryID, \@simples];
+            } elsif ($article->isSimple){
+                push @inputs, [SIMPLE,$queryID,$article];
+            } elsif ($article->isSecondary){
+                push @inputs, [SECONDARY,$queryID,$article];
+            }
+        }
+    }
+    return @inputs;
+}
+
+
 =head2 complexServiceInputParser
 
  name     : complexServiceInputParser
@@ -487,46 +531,6 @@
 
 
 
-=head2 genericServiceInputParserAsObject
-
- name     : DO NOT USE!
- function : to take a MOBY message and break the objects out of it.  This is identical
-            to the subroutine above, except that it returns the data as
-            Objects rather than XML::DOM nodes
- usage    : my @inputs = genericServiceInputParser($MOBY_mssage));
- args     : $message - this is the SOAP payload; i.e. the XML document containing the MOBY message
- returns  : @inputs - the structure of @inputs is a list of listrefs.
-            Each listref has three components:
-                1. COLLECTION|SIMPLE|SECONDARY (i.e. constants 1, 2, 3)
-                2. queryID (undef for Secondary parameters)
-                3. $data - either MOBY::Client::SimpleArticle, CollectionArticle, or SecondaryArticle
-
-=cut
-
-
-sub genericServiceInputParserAsObject {
-    my ($message) = @_;  # get the incoming MOBY query XML
-    my @inputs;           # set empty response
-    my @queries = getInputs($message);  # returns XML::DOM nodes <mobyData>...</mobyData>
-
-    foreach my $query(@queries){
-        my $queryID = getInputID($query);  # get the queryID attribute of the mobyData
-        my @input_articles = getArticlesAsObjects($query); # get the Simple/Collection articles making up this query <Simple>...</Simple> or <Collection>...</Collection> or <Parameter>...</Parameter
-        foreach my $article(@input_articles){       # input is a listref
-            if ($article->isCollection){
-                my @simples = getCollectedSimples($article->XML);
-                push @inputs, [COLLECTION,$queryID, \@simples];
-            } elsif ($article->isSimple){
-                push @inputs, [SIMPLE,$queryID,$article];
-            } elsif ($article->isSecondary){
-                push @inputs, [SECONDARY,$queryID,$article];
-            }
-        }
-    }
-    return @inputs;
-}
-
-
 #################################################
 					 ##################################
 					 ##################################

===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/central_db_connection.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/Perl/MOBY/central_db_connection.pm	2003/06/10 17:12:52	1.2
+++ /home/repository/moby/moby-live/Perl/MOBY/central_db_connection.pm	2004/06/15 00:37:55	1.3
@@ -3,7 +3,7 @@
 use Carp;
 use XML::DOM;
 use vars qw($AUTOLOAD @ISA);
-
+use MOBY::Config;
 
 =head1 NAME
 
@@ -116,6 +116,26 @@
     #    $self->host,
     #    $self->port);
 
+
+    my $conf = MOBY::Config->new;
+
+    $username = $conf->{mobycentral}->{username};
+    $password = $conf->{mobycentral}->{password};
+    $port = $conf->{mobycentral}->{port};
+    $dbname = $conf->{mobycentral}->{dbname};
+    $url = $conf->{mobycentral}->{url};
+    
+	#my $url = $ENV{MOBY_CENTRAL_URL}; chomp $url;
+	#my $dbname = $ENV{MOBY_CENTRAL_DBNAME}; chomp $dbname;
+	#my $username = $ENV{MOBY_CENTRAL_DBUSER}; chomp $username;
+	#my $password = $ENV{MOBY_CENTRAL_DBPASS}; chomp $password;
+	#my $port = $ENV{MOBY_CENTRAL_DBPORT}; chomp $port;
+	
+	my ($dsn) = "DBI:mysql:$dbname:$url:$port";
+	my $dbh = DBI->connect($dsn, $username, $password, {RaiseError => 1}) or die "can't connect to database";
+	
+	return ($dbh);
+
 	my $host = $ENV{MOBY_CENTRAL_URL}; chomp $host;
 	my $dbname = $ENV{MOBY_CENTRAL_DBNAME}; chomp $dbname;
 	my $username = $ENV{MOBY_CENTRAL_DBUSER}; chomp $username;




More information about the MOBY-guts mailing list