[MOBY-guts] biomoby commit

Eddie Kawas kawas at pub.open-bio.org
Wed Mar 22 02:51:30 UTC 2006


kawas
Tue Mar 21 21:51:30 EST 2006
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv4175

Modified Files:
	service_instance.pm 
Log Message:
checking of the lsids that service providers pass in

moby-live/Perl/MOBY service_instance.pm,1.37,1.38
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm	2006/03/22 01:12:02	1.37
+++ /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm	2006/03/22 02:51:30	1.38
@@ -230,7 +230,26 @@
 
 		#create LSID for service and register it in the DB
 		my $_config ||= MOBY::Config->new;
-		unless ($self->lsid){  # if we were not passed an lsid by the service creator, we had better make one now
+		if ($self->lsid){
+			# we were passed in an LSID, so lets construct a correct one and append the revision
+			use LS::ID;
+			my $LSID_Auth = $_config->{mobycentral}->{lsid_authority};
+			my $LSID_NS = $_config->{mobycentral}->{lsid_namespace};
+			$LSID_Auth ||="biomoby.org";
+			$LSID_NS ||="serviceinstance";
+			my $rev = "";
+			my $service_lsid = "urn:lsid:$LSID_Auth:$LSID_NS:"
+			  . $self->authority_uri . ","
+			  . $self->servicename.":";
+			# create a new lsid
+			my $lsid = LS::ID->new($self->lsid);
+			# ensure that the lsid was valid syntacticly
+			return undef unless $lsid;
+			$rev = $lsid->_revision;
+			return undef unless $rev;
+			$self->lsid($service_lsid . $rev);
+		} else {
+			# create an LSID if one wasnt passed in
 			my $LSID_Auth = $_config->{mobycentral}->{lsid_authority};
 			my $LSID_NS = $_config->{mobycentral}->{lsid_namespace};
 			$LSID_Auth ||="biomoby.org";
@@ -238,7 +257,7 @@
 			my $service_lsid = "urn:lsid:$LSID_Auth:$LSID_NS:"
 			  . $self->authority_uri . ","
 			  . $self->servicename.":"."$date";  # LSID with timestamp
-			$self->lsid($service_lsid);
+			$self->lsid($service_lsid);		
 		}
 		my $id = $self->adaptor->insert_service_instance(
 			category         => $self->category,




More information about the MOBY-guts mailing list