[MOBY-guts] biomoby commit

Enrique de Andres Saiz deandres at dev.open-bio.org
Tue Mar 13 15:50:58 UTC 2007


deandres
Tue Mar 13 11:50:58 EDT 2007
Update of /home/repository/moby/moby-live/Perl/MOBY/Async
In directory dev.open-bio.org:/tmp/cvs-serv7113

Modified Files:
	Service.pm SimpleServer.pm 
Log Message:
Replaced calls to the deprecated getInputs and getInputID functions
moby-live/Perl/MOBY/Async Service.pm,1.2,1.3 SimpleServer.pm,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Async/Service.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/Perl/MOBY/Async/Service.pm	2007/02/08 14:19:37	1.2
+++ /home/repository/moby/moby-live/Perl/MOBY/Async/Service.pm	2007/03/13 15:50:58	1.3
@@ -445,9 +445,9 @@
 		}
 		
 		# Get queries
-		my @query = getInputs($data);
-		foreach my $query (@query) {
-			push(@queries, $query->toString());
+		my @mobyData = ($moby->getElementsByTagName('mobyData'), $moby->getElementsByTagName('moby:mobyData'));
+		foreach my $mobyData (@mobyData) {
+			push(@queries, $mobyData->toString());
 		}
 	}
 	

===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Async/SimpleServer.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Perl/MOBY/Async/SimpleServer.pm	2006/12/04 08:27:52	1.1
+++ /home/repository/moby/moby-live/Perl/MOBY/Async/SimpleServer.pm	2007/03/13 15:50:58	1.2
@@ -92,28 +92,6 @@
 @ISA = qw(WSRF::FileBasedMobyResourceLifetimes);
 
 #===============================================================================
-# authority
-# 
-# This variable is a subroutine which gets the authority of a MOBY message
-# and returns it.
-#
-my $authority = sub {
-	my ($data) = @_;
-	
-	# Get moby document
-	my $parser = XML::LibXML->new();
-	my $doc = $parser->parse_string($data);
-	my $moby = $doc->getDocumentElement();
-	
-	# Get authority
-	my @mobyContents = ($moby->getChildrenByTagName('mobyContent'), $moby->getChildrenByTagName('moby:mobyContent'));
-	my $mobyContent = shift(@mobyContents);
-	my $authority = $mobyContent->getAttribute('authority') || $mobyContent->getAttribute('moby:authority');
-	
-	return $authority;
-};
-
-#===============================================================================
 # async_create
 #
 # This variable is a subroutine which creates a WS-Resource and returns
@@ -153,19 +131,25 @@
 	
 	# Get input queryIDs and store them
 	my $lock = WSRF::MobyFile->new($envelope);
-	my @queries = getInputs($data);
-	my @queryIDs;
-	foreach my $query (@queries) {
-		my $queryID = getInputID($query);
-		push(@queryIDs, $queryID);
-	}
+	my $inputs = serviceInputParser($data);
+	my @queryIDs = keys %$inputs;
 	$WSRF::WSRP::Private{queryIDs} = \@queryIDs;
 	$lock->toFile();
 	
-	# Iterate in order to run the service for each mobyData
-	my $auth = $authority->($data);
-	foreach my $query (@queries) {
-		my $queryID         = getInputID($query);
+	# Get moby document
+	my $parser = XML::LibXML->new();
+	my $doc = $parser->parse_string($data);
+	my $moby = $doc->getDocumentElement();
+	
+	# Get authority
+	my @mobyContents = ($moby->getChildrenByTagName('mobyContent'), $moby->getChildrenByTagName('moby:mobyContent'));
+	my $mobyContent = shift(@mobyContents);
+	my $auth = $mobyContent->getAttribute('authority') || $mobyContent->getAttribute('moby:authority');
+	
+	# Get mobyData and iterate over them in order to run the service for each one
+	my @mobyData = ($moby->getElementsByTagName('mobyData'), $moby->getElementsByTagName('moby:mobyData'));
+	foreach my $mobyData (@mobyData) {
+		my $queryID = $mobyData->getAttribute('queryID') || $mobyData->getAttribute('moby:queryID');
 		my $property_pid    = "pid_$queryID";
 		my $property_input  = "input_$queryID";
 		my $property_status = "status_$queryID";
@@ -179,7 +163,7 @@
 			
 			# Input
 			my $parser = XML::LibXML->new();
-			my $doc = $parser->parse_string(responseHeader($auth).$query->toString.responseFooter());
+			my $doc = $parser->parse_string(responseHeader($auth).$mobyData->toString().responseFooter());
 			my $input = $doc->getDocumentElement->toString;
 			
 			# Fork
@@ -335,8 +319,7 @@
 	# Compose response using the status properties
 	my $lock = WSRF::MobyFile->new($envelope);
 	my $ans = '';
-	foreach my $query (@queries) {
-		my $queryID = getInputID($query);
+	foreach my $queryID (@queryIDs) {
 		my $property_status = "status_$queryID";
 		$ans .= "<".$WSRF::WSRP::PropertyNamespaceMap->{$property_status}{prefix}.":$property_status";
 		my $ns = defined($WSRF::WSRP::PropertyNamespaceMap->{$property_status}{namespace}) ?
@@ -377,13 +360,12 @@
 		my $exception = '';
 		my $response = '';
 		
-		my @queries = getInputs($data);
-		foreach my $query (@queries) {
-			my $queryID = getInputID($query);
+		my $inputs = serviceInputParser($data);
+		foreach my $queryID (keys %$inputs) {
 			
 			$exception .= "<mobyException refQueryID=\'$queryID\' severity=\'error\'>";
 			$exception .= "<exceptionCode>701</exceptionCode>";
-			$exception .= "<exceptionMessage>Timeout exceeded. Try to invoke the service asynch-ronously.</exceptionMessage>";
+			$exception .= "<exceptionMessage>Timeout exceeded. Try to invoke the service asynchronously.</exceptionMessage>";
 			$exception .= "</mobyException>";
 			
 			$response .= simpleResponse('', '', $queryID);
@@ -412,9 +394,8 @@
 	my $exception = '';
 	my $response = '';
 	
-	my @queries = getInputs($data);
-	foreach my $query (@queries) {
-		my $queryID = getInputID($query);
+	my $inputs = serviceInputParser($data);
+	foreach my $queryID (keys %$inputs) {
 		
 		$exception .= "<mobyException refQueryID=\'$queryID\' severity=\'error\'>";
 		$exception .= "<exceptionCode>701</exceptionCode>";




More information about the MOBY-guts mailing list