[MOBY-guts] biomoby commit
Eddie Kawas
kawas at pub.open-bio.org
Fri Jul 8 18:57:00 UTC 2005
kawas
Fri Jul 8 14:57:00 EDT 2005
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv24723
Modified Files:
Central.pm
Log Message:
Implemented the check for valid secondary input types.
moby-live/Perl/MOBY Central.pm,1.156,1.157
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -r1.156 -r1.157
--- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2005/07/06 15:32:52 1.156
+++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2005/07/08 18:57:00 1.157
@@ -185,6 +185,7 @@
+
=head1 METHODS
@@ -1409,33 +1410,40 @@
);
}
- use MOBY::Client::Central;
- my $services = MOBY::Client::Central::_parseServices( '', '', $si );
- my $service_instance = shift @{$services};
- # my $storage = new RDF::Core::Storage::Memory;
- # my $model = new RDF::Core::Model( Storage => $storage );
- # my $RDF_MODEL = MOBY::RDF::ServiceInstanceRDF->new(
- #model => $model,
- #service_instance => $service_instance );
- # my $RDF_XML = $RDF_MODEL->serialize;
- my $LSID = $service_instance->LSID;
+ use MOBY::Client::Central;
+ my $services = MOBY::Client::Central::_parseServices( '', '', $si );
+ my $service_instance = shift @{$services};
+
+ # my $storage = new RDF::Core::Storage::Memory;
+ # my $model = new RDF::Core::Model( Storage => $storage );
+ # my $RDF_MODEL = MOBY::RDF::ServiceInstanceRDF->new(
+ #model => $model,
+ #service_instance => $service_instance );
+ # my $RDF_XML = $RDF_MODEL->serialize;
+ my $LSID = $service_instance->LSID;
+
# my $RDF = _getServiceInstanceRDF($LSID);
-my $RDF="<RDF/>";
- unless ($RDF){return &_success("Registration successful but LSID resolution error",$SVC->service_instance_id,"" )}
- unless ($RDF =~ /RDF/){
- return &_success("Registration successful but LSID resolution error $RDF",$SVC->service_instance_id,"")
+ my $RDF = "<RDF/>";
+ unless ($RDF) {
+ return &_success( "Registration successful but LSID resolution error",
+ $SVC->service_instance_id, "" );
+ }
+ unless ( $RDF =~ /RDF/ ) {
+ return &_success(
+ "Registration successful but LSID resolution error $RDF",
+ $SVC->service_instance_id, "" );
}
- return &_success( "Registration successful",
- $SVC->service_instance_id, $RDF );
+ return &_success( "Registration successful", $SVC->service_instance_id,
+ $RDF );
}
-
sub _getServiceInstanceRDF {
- my ($self, $LSID) = @_;
+ my ( $self, $LSID ) = @_;
my $lsid = LS::ID->new($LSID);
my $RDF_XML = "";
my $lsid_error = "";
- my $lsid_good = 1;
+ my $lsid_good = 1;
+
#use LS::ID;
#use LS::Authority::WSDL::Constants;
#use LS::Client::BasicResolver;
@@ -1451,13 +1459,14 @@
$authority->clean_cache();
my $resource = $authority->getResource($lsid);
- unless ($resource) {
- $lsid_error .= $authority->error_string. " " ;
- return $lsid_error
+ unless ($resource) {
+ $lsid_error .= $authority->error_string . " ";
+ return $lsid_error;
}
-
+
my $response = $resource->get_metadata;
unless ( ref($response) =~ /LS::Service::Response/ ) {
+
#TODO raise an error
$lsid_error .= "Metadata response didn't come back";
return $lsid_error;
@@ -1471,7 +1480,7 @@
}
while (<$rsp>) {
$RDF_XML .= $_;
- }
+ }
return $RDF_XML
}
@@ -1614,6 +1623,19 @@
( $_->nodeType == TEXT_NODE ) && ( $datatype .= $_->nodeValue );
}
}
+
+ #ensure that thet type is correct (Integer | String | Float | DateTime)
+ $datatype =~ s/\s//g;
+ my $secondaries = $CONFIG->{valid_secondary_datatypes};
+ my $valid;
+ map { $valid = 1 if $datatype eq $_ } @{$secondaries};
+ unless ($valid) {
+ $SVC->DELETE_THYSELF;
+ return ( -1,
+"Registration failed. $datatype must be one of type Integer, String, DateTime, or Float."
+ );
+ }
+
my $defs = $parameter->getElementsByTagName('default');
if ( $defs->get_node(1) ) {
foreach ( $defs->get_node(1)->childNodes )
@@ -2998,20 +3020,26 @@
=cut
sub DUMP_MySQL {
- my ( $pkg ) = @_;
- my $config = MOBY::Config->new();
- my @dbsections = ('mobycentral', 'mobyobject', 'mobyservice', 'mobynamespace', 'mobyrelationship');
+ my ($pkg) = @_;
+ my $config = MOBY::Config->new();
+ my @dbsections = (
+ 'mobycentral', 'mobyobject',
+ 'mobyservice', 'mobynamespace',
+ 'mobyrelationship'
+ );
my @response;
- foreach my $dbsection (@dbsections) {
- my $dbname = ${${$config}{$dbsection}}{'dbname'};
- my $username = ${${$config}{$dbsection}}{'username'};
- my $password = ${${$config}{$dbsection}}{'password'};
- my $host = ${${$config}{$dbsection}}{'url'};
- my $port = ${${$config}{$dbsection}}{'port'};
- open( IN, "mysqldump -h $host -P $port -u $username --password=$password $dbname|" )
- || die "can't open $dbname for dumping";
+ foreach my $dbsection (@dbsections) {
+ my $dbname = ${ ${$config}{$dbsection} }{'dbname'};
+ my $username = ${ ${$config}{$dbsection} }{'username'};
+ my $password = ${ ${$config}{$dbsection} }{'password'};
+ my $host = ${ ${$config}{$dbsection} }{'url'};
+ my $port = ${ ${$config}{$dbsection} }{'port'};
+ open( IN,
+"mysqldump -h $host -P $port -u $username --password=$password $dbname|"
+ )
+ || die "can't open $dbname for dumping";
my @dbdump;
- while ( <IN> ) {
+ while (<IN>) {
push @dbdump, $_;
}
my $dbdump = ( join "", @dbdump );
@@ -3067,6 +3095,7 @@
+
=head1 Internal Object Methods
More information about the MOBY-guts
mailing list