[MOBY-guts] biomoby commit

Eddie Kawas kawas at dev.open-bio.org
Tue Jul 24 22:25:40 UTC 2007


kawas
Tue Jul 24 18:25:40 EDT 2007
Update of /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache
In directory dev.open-bio.org:/tmp/cvs-serv20380/Java/src/Perl/MOSES/MOBY/Cache

Modified Files:
	Central.pm 
Log Message:
more error checking added
moby-live/Java/src/Perl/MOSES/MOBY/Cache Central.pm,1.3,1.4
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm	2007/07/24 17:29:38	1.3
+++ /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm	2007/07/24 22:25:40	1.4
@@ -312,8 +312,7 @@
 	my $xml   =
 			  $soap->retrieveObjectNames( )->result;
     # create cache dirs as needed
-    $self->create_cache_dirs;
-    
+    $self->create_cache_dirs;    
     my $file = File::Spec->catfile ($self->cachedir,
 				    $self->_clean ($self->_endpoint),
 				    DATATYPES_CACHE,
@@ -322,7 +321,9 @@
 	or $self->throw ("Can't open file '$file' for writing: $!");
     print FILE $xml;
     close FILE;
- 
+    
+    $LOG->debug("Saving the '". LIST_FILE . "' file.");
+    
     # 2-> foreach datatype store 'retrieveObjectDefinition'
     my $parser       = XML::LibXML->new();
     my $doc          = $parser->parse_string($xml);
@@ -335,6 +336,7 @@
            <objectType>$name</objectType>
 </retrieveObjectDefinition>
 END
+		$LOG->debug("Processing the datatype, '$name'.");
 		$xml   =
 			  $soap->retrieveObjectDefinition ( SOAP::Data->type('string' => "$input") )->result;
 		$file = File::Spec->catfile ($self->cachedir,
@@ -377,9 +379,16 @@
 				    DATATYPES_CACHE))) {
 		$self->throw("Datatype cache doesn't exist, so I can't update it. Please create a datatype cache first!");
 	}
-   
+   if (!(-e File::Spec->catfile (
+   					$self->cachedir,
+				    $self->_clean ($self->_endpoint),
+				    DATATYPES_CACHE,
+				    LIST_FILE))) {
+		$self->throw("Datatypes LIST_FILE doesn't exist, so I can't update the cache. Please create a datatype cache first!");
+	}
     # steps:
     # read in the LIST file and extract lsids for all datatypes
+    $LOG->debug("Reading the cached '" . LIST_FILE ."'.");
     my $file = File::Spec->catfile ($self->cachedir,
 				    $self->_clean ($self->_endpoint),
 				    DATATYPES_CACHE,
@@ -392,6 +401,7 @@
     	my $lsid = $nodes->get_node($_ )->getAttribute('lsid');
     	$old_datatypes{$name} = $lsid;
     }
+    $LOG->debug("Retrieving an up to date '". LIST_FILE ."'.");
     # get the new LIST file and extract lsids for all datatypes
     my $soap = 
     	SOAP::Lite->uri($self->_namespace)
@@ -416,6 +426,7 @@
     foreach my $dt (keys %new_datatypes) {
     	next unless !$old_datatypes{$dt} or $old_datatypes{$dt} ne $new_datatypes{$dt}; 
    		push @changed_datatypes, $dt;
+   		$LOG->debug("The datatype, '$dt', seems to have been modified.");
     }
     
     # if their where changes, save new LIST file over the old one and get changes
@@ -438,6 +449,8 @@
            <objectType>$name</objectType>
 </retrieveObjectDefinition>
 END
+
+			$LOG->debug("Updating the datatype, '$name'.");
 			$xml   =
 				  $soap->retrieveObjectDefinition ( SOAP::Data->type('string' => "$input") )->result;
 			$file = File::Spec->catfile ($self->cachedir,
@@ -550,6 +563,14 @@
 				    SERVICES_CACHE))) {
 		$self->throw("Services cache doesn't exist, so I can't update it. Please create a services cache first!");
 	}
+	
+	if (!(-e File::Spec->catfile (
+   					$self->cachedir,
+				    $self->_clean ($self->_endpoint),
+				    SERVICES_CACHE,
+				    LIST_FILE))) {
+		$self->throw("Services LIST_FILE doesn't exist, so I can't update the cache. Please create a services cache first!");
+	}
    
     # steps:
     # read in the LIST file and extract lsids for all datatypes
@@ -1210,6 +1231,7 @@
         	$dir = File::Spec->catdir($dir, $part);
         	next if -d $dir or -e $dir;
         	mkdir( $dir ) || $self->throw("Error creating caching directory '".$dir."':\n$!");
+        	$LOG->debug("creating the directory, '$dir'.");
     	}
     }
 }




More information about the MOBY-guts mailing list