[MOBY-guts] biomoby commit
Mark Wilkinson
mwilkinson at pub.open-bio.org
Mon Jun 23 17:49:36 UTC 2003
mwilkinson
Mon Jun 23 13:49:35 EDT 2003
Update of /home/repository/moby/moby-live/Perl/MOBY/Client
In directory pub.open-bio.org:/tmp/cvs-serv4593/MOBY/Client
Modified Files:
Central.html Central.pm
Log Message:
tightened up Client::Central code to ensure that message structure is correct and allow flexibility in the parameters that you send in (not all are required anymore). error checking is more stringent, and the method returns a pair of objects rather than an unpredictable ServiceInstance or Registration object.
moby-live/Perl/MOBY/Client Central.html,1.6,1.7 Central.pm,1.36,1.37
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html 2003/06/19 00:47:35 1.6
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html 2003/06/23 17:49:35 1.7
@@ -263,9 +263,10 @@
<h2><a name="findservice">findService</a></h2>
<pre>
Title : findService
- Usage : $ServiceInstances = $MOBY->findService(%args)
- Function : deregister a registered MOBY Service
- Returns : arrayref of MOBY::Client::ServiceInstance objects
+ Usage : ($ServiceInstances, $RegObject) = $MOBY->findService(%args)
+ Function : Find services that match certain search criterion
+ Returns : ON SUCCESS: arrayref of MOBY::Client::ServiceInstance objects, and undef
+ ON FAILURE: undef, and a MOBY::Registration object indicating the reason for failure
Args :
Registry => which registry do you want to search (optional)
serviceName => $serviceName, (optional)
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2003/06/19 00:47:35 1.36
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2003/06/23 17:49:35 1.37
@@ -704,9 +704,10 @@
=head2 findService
Title : findService
- Usage : $ServiceInstances = $MOBY->findService(%args)
- Function : deregister a registered MOBY Service
- Returns : arrayref of MOBY::Client::ServiceInstance objects
+ Usage : ($ServiceInstances, $RegObject) = $MOBY->findService(%args)
+ Function : Find services that match certain search criterion
+ Returns : ON SUCCESS: arrayref of MOBY::Client::ServiceInstance objects, and undef
+ ON FAILURE: undef, and a MOBY::Registration object indicating the reason for failure
Args :
Registry => which registry do you want to search (optional)
serviceName => $serviceName, (optional)
@@ -749,27 +750,33 @@
my $exObj = $a{'expandObjects'}; $exObj ||=0;
my $exServ = $a{'expandServices'}; $exServ ||= 0;
my $kw = $a{'keywords'}; $kw ||=[];
- ref($kw) =~ /array/i || return $self->errorRegXML("invalid structure of keywords. Expected arrayref");
+ ref($kw) =~ /array/i || return (undef, $self->errorRegXML("invalid structure of keywords. Expected arrayref"));
my @kw = @{$kw};
- my $message = "<findService>
- <authoritative>$authoritative</authoritative>
- <Category>$category</Category>
- <serviceType>$serviceType</serviceType>
- <serviceName>$servicename</serviceName>
- <authURI>$authURI</authURI>;
- <expandObjects>$exObj</expandObjects>
- <expandServices>$exServ</expandServices>
- <keywords>\n";
- foreach (@kw){
- $message .="<keyword>$kw</keyword>\n";
- }
- $message .="</keywords>\n";
-
- unless (ref($a{input}) =~ /array/i){return $self->errorRegXML("invalid structure of input objects, expected arrayref for input")}
- unless (ref($a{output}) =~ /array/i){return $self->errorRegXML("invalid structure of output objects, expected arrayref for output")}
+ my $message = "<findService>\n";
- my %funkyhash = ( Input => $a{input}, Output => $a{output});
+ defined($authoritative) && ($message .="<authoritative>$authoritative</authoritative>\n");
+ $category && ($message .="<Category>$category</Category>\n");
+ $serviceType && ($message .="<serviceType>$serviceType</serviceType>\n");
+ $servicename && ($message .="<serviceName>$servicename</serviceName>\n");
+ $authURI && ($message .="<authURI>$authURI</authURI>\n");
+ #defined($exObj) && ($message .="<expandObjects>$exObj</expandObjects> \n");
+ #defined($exServ) && ($message .="<expandServices>$exServ</expandServices>\n");
+ if (scalar(@kw)){
+ $message .=" <keywords>\n";
+ foreach (@kw){
+ $message .="<keyword>$kw</keyword>\n";
+ }
+ $message .="</keywords>\n";
+ }
+ #$a{input} = [[]] unless (defined $a{input});
+ #$a{output} = [[]] unless (defined $a{output});
+ if (defined $a{input} && !(ref($a{input}) =~ /array/i)){return (undef, $self->errorRegXML("invalid structure of input objects, expected arrayref for input"))}
+ if (defined $a{output} && !(ref($a{output}) =~ /array/i)){return (undef, $self->errorRegXML("invalid structure of output objects, expected arrayref for output"))}
+ my %funkyhash;
+
+ $funkyhash{Input} = $a{input} if (defined $a{input}) ;
+ $funkyhash{Output} = $a{output} if (defined $a{output}) ;
#input =>[
# [objType1 => [ns1, ns2...]], # Simple
# [[objType2 => [ns3, ns4...]]], # collection of one object type
@@ -781,7 +788,7 @@
my @PARAM = @{$param};
$message .= "<${inout_lc}Objects><${inout}>\n";
foreach my $param(@PARAM){
- unless (ref($param) =~ /array/i){return $self->errorRegXML("invalid structure of $inout objects, expected arrayref of class and \@namespaces")}
+ unless (ref($param) =~ /array/i){return (undef, $self->errorRegXML("invalid structure of $inout objects, expected arrayref of class and \@namespaces"))}
my ($class, $namespaces) = @{$param};
my @objectdefs;
if ((ref $class) =~ /array/i){ # collection
@@ -795,7 +802,7 @@
$message .="<Simple>\n";
my ($type, $Namespaces) = @{$objectdef};
$message .="<objectType>$type</objectType>\n";
- unless (ref($Namespaces) =~ /array/i){return $self->errorRegXML("invalid structure of $inout namespaces for object $type; expected arrayref")}
+ if (defined($Namespaces) && !(ref($Namespaces) =~ /array/i)){return (undef, $self->errorRegXML("invalid structure of $inout namespaces for object $type; expected arrayref"))}
foreach my $ns(@{$Namespaces}){
$message .="<Namespace>$ns</Namespace>\n";
}
@@ -813,7 +820,7 @@
# my $return = $self->SOAP_connection($reg)->call('retrieveServiceTypes' => (@_))->paramsall;
my $return = $self->SOAP_connection($reg)->call('findService' => ($message))->paramsall;
- return ($self->_parseServices($reg, $return));
+ return ($self->_parseServices($reg, $return), undef);
}
@@ -1366,7 +1373,7 @@
my ($self, $message) = @_;
my $reg = MOBY::Client::Registration->new(
success => 0,
- error_message => $message,
+ message => $message,
registration_id => -1,);
return $reg;
}
More information about the MOBY-guts
mailing list