[MOBY-guts] biomoby commit

José Manuel Rodríguez Carrasco jmrc at dev.open-bio.org
Mon Sep 1 18:53:57 UTC 2008


jmrc
Mon Sep  1 14:53:57 EDT 2008
Update of /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Async
In directory dev.open-bio.org:/tmp/cvs-serv19249

Modified Files:
	Service.pm SimpleServer.pm WSRF.pm 
Log Message:
*	Cosmetic fixes in Service.pm and SimpleServer.pm.
*	Fixed a bug in WSRF.pm related to temporal file location/creation
	introduced by a previous commit.

moby-live/Perl/MOBY-Server/lib/MOBY/Async Service.pm,1.2,1.3 SimpleServer.pm,1.2,1.3 WSRF.pm,1.5,1.6
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/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-Server/lib/MOBY/Async/Service.pm	2008/04/23 13:08:11	1.2
+++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Async/Service.pm	2008/09/01 18:53:57	1.3
@@ -18,8 +18,8 @@
 =head1 DESCRIPTION
 
 It provides a class to invoke asynchronous services. Its use is very similar to
-MOBY::Client::Service, but it also provides additional methods in order to
-have more control over the asynchronous service execution.
+MOBY::Client::Service because it is its super-class. It also provides additional
+methods in order to have more control over the asynchronous service execution.
 
 =head1 METHODS
 
@@ -27,7 +27,7 @@
 
  Name       :    new
  Function   :    create a service connection.
- Usage      :    $Service = MOBY::Client::Service->new(@args)
+ Usage      :    $Service = MOBY::Async::Service->new(@args)
  Args       :    service - string with a WSDL defining an asynchronous
                            MOBY service
  Returns    :    MOBY::Async::Service object, undef if no wsdl.
@@ -135,6 +135,10 @@
 use MOBY::Client::Service;
 use base qw(MOBY::Client::Service);
 
+sub _getPollingTime($$$@);
+sub _getServiceEndpoint($);
+sub _getPseudoRandomPollingTime($$);
+sub _composeResponse(@);
 
 sub new {
 	my ($this, %args) = @_;
@@ -162,7 +166,7 @@
 	my $pollingTime;
 	my ($i, $j) = (0, 1);
 	my @status;
-	while ( $pollingTime = &_getPollingTime($i, $j, $start, @status) ) {
+	while ( $pollingTime = _getPollingTime($i, $j, $start, @status) ) {
 		($i, $j) = ($j, $i+$j);
 		
 		print "(next polling in $pollingTime seconds)\n\n" unless ($self->{silent});
@@ -180,7 +184,7 @@
 	
 	my @responses = $self->result($EPR, @queryIDs);
 	$self->destroy($EPR);
-	my $response = &_composeResponse(@responses);
+	my $response = _composeResponse(@responses);
 	
 	print "Finished.\n\n" unless ($self->{silent});
 	
@@ -239,7 +243,7 @@
 	# Create the resource and submit the batch-call
 	my $func = $self->{serviceName}.'_submit';
 	my $ans = WSRF::Lite
-		-> proxy(&_getServiceEndpoint($self->{service}))
+		-> proxy(_getServiceEndpoint($self->{service}))
 		-> uri($WSRF::Constants::MOBY)
 		-> $func(SOAP::Data->value($data)->type('string'));
 	die "ERROR:  ".$ans->faultstring if ($ans->fault);
@@ -296,7 +300,7 @@
 	my $pollingTime;
 	my ($i, $j) = (0, 1);
 	my @status;
-	while ( $pollingTime = &_getPollingTime($i, $j, $start, @status) ) {
+	while ( $pollingTime = _getPollingTime($i, $j, $start, @status) ) {
 		($i, $j) = ($j, $i+$j);
 		
 		print "(next polling in $pollingTime seconds)\n\n" unless ($self->{silent});
@@ -314,7 +318,7 @@
 	
 	my @responses = $self->result($EPR, @queryIDs);
 	$self->destroy($EPR);
-	my $response = &_composeResponse(@responses);
+	my $response = _composeResponse(@responses);
 	
 	print "Finished.\n\n" unless ($self->{silent});
 	
@@ -372,7 +376,7 @@
 	# Create the resource and submit the batch-call
 	my $func = $self->{serviceName}.'_submit';
 	my $ans = WSRF::Lite
-		-> proxy(&_getServiceEndpoint($self->{service}))
+		-> proxy(_getServiceEndpoint($self->{service}))
 		-> uri($WSRF::Constants::MOBY)
 		-> $func(SOAP::Data->value($data)->type('string'));
 	die "ERROR:  ".$ans->faultstring if ($ans->fault);
@@ -512,7 +516,7 @@
 	die "ERROR:  ".$ans->faultstring if ($ans->fault);
 }
 
-sub _getServiceEndpoint {
+sub _getServiceEndpoint($) {
 	my ($wsdl) = @_;
 	
 	$wsdl =~ /address location\s*=\s*["|'](.+)["|']/;
@@ -521,10 +525,10 @@
 	return $serviceEndpoint;
 }
 
-sub _getPollingTime {
+sub _getPollingTime($$$@) {
 	my ($i, $j, $start, @status) = @_;
 	
-	return &_getPseudoRandomPollingTime($i, $j) unless (scalar(@status));
+	return _getPseudoRandomPollingTime($i, $j) unless (scalar(@status));
 	
 	my $pollingTime = 0;
 	foreach my $status (@status) {
@@ -558,7 +562,7 @@
 			          ($status->new_state eq "running") ||
 			          ($status->new_state eq "RUNNING") ) {
 				
-				$pTime = &_getPseudoRandomPollingTime($i, $j);
+				$pTime = _getPseudoRandomPollingTime($i, $j);
 				
 			} else {
 				die "ERROR:  analysis event block not well formed.\n";
@@ -597,7 +601,7 @@
 	return $pollingTime;
 }
 
-sub _getPseudoRandomPollingTime {
+sub _getPseudoRandomPollingTime($$) {
 	my ($i, $j) = @_;
 	my $c = 15;
 	my $p = 0.1;
@@ -607,7 +611,7 @@
 	return $delay;
 }
 
-sub _composeResponse {
+sub _composeResponse(@) {
 	my (@datas) = @_;
 	
 	my @authorities;

===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Async/SimpleServer.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Async/SimpleServer.pm	2008/04/23 13:08:11	1.2
+++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Async/SimpleServer.pm	2008/09/01 18:53:57	1.3
@@ -178,6 +178,7 @@
 	
 	# Get mobyData and iterate over them in order to run the service for each one
 	my @mobyData = ($moby->getElementsByTagNameNS($WSRF::Constants::MOBY_MESSAGE_NS,'mobyData'));
+
 	foreach my $mobyData (@mobyData) {
 		my $queryID = $mobyData->getAttribute('queryID') || $mobyData->getAttributeNS($WSRF::Constants::MOBY_MESSAGE_NS,'queryID');
 		my $property_pid    = "pid_$queryID";

===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Async/WSRF.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Async/WSRF.pm	2008/08/29 14:16:02	1.5
+++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Async/WSRF.pm	2008/09/01 18:53:57	1.6
@@ -28,6 +28,7 @@
 package MOBY::Async::WSRF;
 use strict;
 use WSRF::Lite 0.8.2.2;
+use File::Path;
 
 use vars qw /$VERSION/;
 $VERSION = sprintf "%d.%02d", q$Revision$ =~ /: (\d+)\.(\d+)/;
@@ -37,7 +38,9 @@
 $WSRF::WSRP::MobyPropertiesPrefixes = ['status', 'result'];
 
 $WSRF::Constants::DataDir  = (exists($ENV{TMPDIR}) && defined($ENV{TMPDIR}) && $ENV{TMPDIR} ne '')?$ENV{TMPDIR}:'/tmp';
+mkpath($WSRF::Constants::DataDir,1,0777);
 $WSRF::Constants::DataPrefix  = 'moby_';
+$WSRF::Constants::Data = $WSRF::Constants::DataDir .'/'. $WSRF::Constants::DataPrefix;
 $WSRF::Constants::MOBY  = 'http://biomoby.org/';
 $WSRF::Constants::MOBY_MESSAGE_NS  = 'http://www.biomoby.org/moby';
 #$WSRF::Constants::WSA   = 'http://www.w3.org/2005/08/addressing';
@@ -324,60 +327,9 @@
 	) ) if (scalar(@notfound));
 	
 	my @resp = $self->SUPER::GetMultipleResourceProperties($envelope);
-	return @resp;   
+	return @resp;
 }
 
-#sub GetMultipleResourcePropertiesRequest {
-#	my $self = shift @_;
-#	my $envelope = pop @_;
-#	my $methodname = (caller(0))[3];
-#	$methodname = substr($methodname,rindex($methodname,':')+1);
-#	eval {
-#		my $parser=XML::LibXML->new();
-#		my $envxml = $parser->parse_string($envelope->raw_xml);
-#		my $context=XML::LibXML::XPathContext->new();
-#		$context->registerNs('s11',$SOAP::Constants::NS_ENV);
-#		$context->registerNs('wsa',$WSRF::Constants::WSA);
-#		my(@actions)=$context->findnodes('/s11:Envelope/s11:Header/wsa:Action[1]',$envxml);
-#		if(scalar(@actions)>0) {
-#			my($action)=$actions[0];
-#			my $acturi = $action->textContent();
-#			my $newacturi= $acturi;
-#			$newacturi =~ s/Request$//;
-#			if( $acturi ne $newacturi) {
-#				foreach my $child ($action->childNodes) {
-#					$action->removeChild($child);
-#				}
-#				$action->appendChild($envxml->createTextNode($newacturi));
-#				
-#				
-#				my(@query)=$context->findnodes("/s11:Envelope/s11:Body/wsa:$methodname".'[1]',$envxml);
-#				if(scalar(@query)>0) {
-#					my($prefix)=$query[0]->prefix();
-#					if(defined($prefix) && $prefix ne '') {
-#						$prefix.=':';
-#					} else {
-#						$prefix='';
-#					}
-#					$methodname =~ s/Request$//;
-#					$query[0]->setNodeName($prefix.$methodname);
-#				}
-#				
-#				# Last, craete new SOM object
-#				my $sparser = WSRF::Deserializer->new();
-#				my($manistring)=$envxml->toString();
-#				$manistring =~ s/[\r\n]+//g;
-#				print STDERR "ENVELOPE ",$manistring,"\n";
-#				$envelope = $sparser->deserialize($manistring);
-#			}
-#		}
-#	};
-#
-#	if($@) {
-#		print STDERR "FALLACANALLA $@\n";
-#	}
-#	return $self->GetMultipleResourceProperties(@_,$envelope);
-#}
 
 #===============================================================================
 # WSRF::FileBasedMobyResourceLifetimes
@@ -414,7 +366,7 @@
 	my $self = shift @_;
 	my $envelope = pop @_;
 	my $lock = WSRF::MobyFile->new($envelope);
-	my $file = $WSRF::Constants::DataDir . '/' . $WSRF::Constants::DataPrefix.$lock->ID();
+	my $file = $WSRF::Constants::Data.$lock->ID();
 	unlink $file or WSRF::BaseFaults::die_with_fault( $envelope, (
 		BaseFault   => "ResourceNotDestroyedFault",
 		Description => "Could not remove WS-Resource file"
@@ -620,7 +572,7 @@
 	$ID_clipped =~ s/-\w*//o;
 	
 	# File containing resource properties
-	my $path = $WSRF::Constants::DataDir . '/' . $WSRF::Constants::DataPrefix.$ID_clipped;
+	my $path = $WSRF::Constants::Data.$ID_clipped;
 	WSRF::BaseFaults::die_with_fault( $envelope, (
 		BaseFault   => "ResourceUnknownFault",
 		Description => "No WS-Resource with Identifer $ID"




More information about the MOBY-guts mailing list