[MOBY-guts] biomoby commit
Mark Wilkinson
mwilkinson at dev.open-bio.org
Sat Feb 1 18:06:25 UTC 2003
Sat Feb 1 13:06:24 EST 2003
Update of /home/repository/moby/moby-live/Example_Code
In directory dev:/tmp/cvs-serv23493
Modified Files:
mobyadmin.pl
Log Message:
updated Lukas' mobyadmin.pl script so that it talks to teh new API. You can use this script to register, deregister your own services, as well as browse the Central repository.
moby-live/Example_Code mobyadmin.pl,1.4,1.5
===================================================================
RCS file: /home/repository/moby/moby-live/Example_Code/mobyadmin.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- /tmp/T0uuay6T 2003-02-01 13:06:25.050005951 -0500
+++ /tmp/T1vuay6T 2003-02-01 13:06:25.050005951 -0500
@@ -5,36 +5,28 @@
# Comments and improvements welcome.
# Lukas Mueller, TAIR
# July 9, 2002
-
# updated by Mark Wilkinson, Jan 24, 2003.
#
# Usage: mobyadmin.pl
# The rest is menu based.
#
-use SOAP::Lite +autodispatch =>
- proxy => 'http://mobycentral.cbr.nrc.ca/cgi-bin/MOBY-Central.pl',
- on_fault => sub {
- my($soap, $res) = @_;
- die ref $res ? $res->faultstring : $soap->transport->status, "\n";
- };
-
-#use lib "/home/markw/BIO/moby-live/Perl/Central";
-#use MOBY::Central;
+use lib "../Perl/Client";
+use MOBY::Client::Central;
print "Connecting to MOBY Server...\n";
-my $moby = MOBY::Central-> new();
+my $moby = MOBY::Client::Central-> new( ); # use default mobycentral
$REGFILE = "moby_register.dat";
while (main($moby)) { };
-print "Please send comments, bug-reports and swear words to mueller\@acoma.stanford.edu. Thanks & bye!\n";
+print "Please send comments, bug-reports and swear words to mueller\@acoma.stanford.edu or markw\@illuminae.com Thanks & bye!\n";
sub main {
my $moby=shift;
system("clear");
print "\nMOBYadmin Main Menu\n";
- print "Version 0.01\n";
+ print "Version 0.02\n";
print "===================\n";
print "1- List Services, Namespaces, Objects\n";
print "2- Register Service\n";
@@ -62,6 +54,7 @@
print "Service name?"; $serviceName = (<STDIN>); chomp($serviceName);
print "Service type? "; $serviceType = (<STDIN>); chomp($serviceType);
print "AuthURI? "; $authURI = (<STDIN>); chomp($authURI);
+ print "\n\n(currently, this interface does not resolve the relationship between input objects and their relationships. Sorry!)\n";
print "MOBY object types for input (comma separated list)? "; $ins = (<STDIN>); chomp($ins);
@INS=split/\,/, $ins;
print "MOBY object types for output (comma separated list)? "; $outs = (<STDIN>); chomp($outs);
@@ -91,12 +84,25 @@
print "URL: $url\n";
print "Description: $desc\n";
- print "\nIs this information correct? ";
+ print "\nIs this information correct? [y|N] ";
$correct = (<STDIN>);
-
+
+ my %inputs;
+ foreach (@INS){
+ $inputs{$_} = \@NameSpaces;
+ }
+
if ($correct=~/^[Yy]/) {
- $reg = $moby -> registerService($serviceName, $serviceType, $authURI, \@INS, \@OUTS, \@NameSpaces, $url, $desc);
- my ($success, $id, $message) = ($reg->{success}, $reg->{registration_id}, $reg->{error_message});
+ $reg = $moby -> registerService(
+ serviceName => $serviceName,
+ serviceType => $serviceType,
+ authURI => $authURI,
+ input => \%inputs,
+ output => \@OUTS,
+ URL => $url,
+ description => $desc,
+ );
+ my ($success, $id, $message) = ($reg->success, $reg->registration_id, $reg->error_message);
if ($success){
print "Your registration number is: $id\n";
open (F, ">>$REGFILE") || warn "Couldn't open $REGFILE for local recording of this registration $!\n";
@@ -125,8 +131,11 @@
}
}
print "Deregister which ? [choose number from first column] "; $which = (<STDIN>); chomp($which);
- $reg = $moby -> deregisterService ($services{$which});
- my ($success, $id, $message) = ($reg->{success}, $reg->{registration_id}, $reg->{error_message});
+ print "\nselected $which with id $services{$which}\n";
+ $reg = $moby -> deregisterService (
+ serviceID => $services{$which}
+ );
+ my ($success, $id, $message) = ($reg->success, $reg->registration_id, $reg->error_message);
if ($success){
print "Your service has been deregistered!\n";
$REGFILE[$which]=~s/^ACTIVE/INACTIVE/i;
@@ -153,10 +162,17 @@
print "URI to registrar of object? "; $uri = (<STDIN>); chomp($uri);
print "Clobber ? 0=don't, 1=deprecate and re-register, 2=overwrite "; $clobber = (<STDIN>); chomp($clobber);
- print "Register Object? "; $continue = (<STDIN>); chomp($continue);
+ print "Register Object? [y|N] "; $continue = (<STDIN>); chomp($continue);
if ($continue =~ /^[Yy]/) {
- $reg = $moby -> registerObject($term, $desc, $xsd, \@ISA, $clobber);
- my ($success, $id, $message) = ($reg->{success}, $reg->{registration_id}, $reg->{error_message});
+ $reg = $moby -> registerObject(
+ objectType => $term,
+ description => $desc,
+ xsd => $xsd,
+ ISA => \@ISA,
+ authURI => $uri,
+ clobber => $clobber);
+
+ my ($success, $id, $message) = ($reg->success, $reg->registration_id, $reg->error_message);
if ($success){
open (F, ">>$REGFILE") || warn "Couldn't open $REGFILE\n";
@@ -183,10 +199,15 @@
print "Description ? "; $desc = (<STDIN>); chomp($desc);
print "Clobber ? "; $clobber =(<STDIN>); chomp ($clobber);
- print "\nRegister? "; $continue = (<STDIN>); chomp($continue);
+ print "\nRegister? [y|N] "; $continue = (<STDIN>); chomp($continue);
if ($continue =~ /^[Yy]/) {
- $reg = $moby-> registerNamespace($ns, $auth, $desc, $clobber);
- my ($success, $id, $message) = ($reg->{success}, $reg->{registration_id}, $reg->{error_message});
+ $reg = $moby-> registerNamespace(
+ namespaceType => $ns,
+ authURI => $auth,
+ description => $desc,
+ clobber => $clobber
+ );
+ my ($success, $id, $message) = ($reg->success, $reg->registration_id, $reg->error_message);
if ($success){
open (F, ">>$REGFILE") || warn "Couldn't open $REGFILE!\n";
print F "ACTIVE\t$id\t$ns\t$auth\t$desc\t$clobber\n";
@@ -207,22 +228,39 @@
print "Listing MOBY Services, Objects, Namespaces and Providors\n\n";
print "Registered Services:\n\n";
- print $moby -> retrieveServiceNames();
+ my $names = $moby -> retrieveServiceNames();
+ while (my ($authURI, $services) = each %{$names}){
+ print "\n\nAuthority: $authURI\n\t";
+ print join "\n\t", @{$services};
+ }
print "\n\nRegistered Object Names:\n\n";
- print $moby -> retrieveObjectNames();
-
+ my $objects = $moby -> retrieveObjectNames();
+ while (my ($name, $def) = each %{$objects}){
+ print "$name:\t$def\n";
+ }
+
print "\n\nRegistered Namespaces:\n\n";
- print $moby -> retrieveNamespaces();
-
+ my $ns = $moby -> retrieveNamespaces();
+ while (my ($name, $def) = each %{$ns}){
+ print "$name:\t$def\n";
+ }
+
print "\n\nRegistered Objects: \n\n";
- print $moby -> retrieveObject();
-
+ my $obj_defs = $moby -> retrieveObject('all');
+ while (my ($name, $xsd) = each %{$obj_defs}){
+ $xsd =~ s/\n//g;
+ print "$name:\t\t$xsd\n\n";
+ }
+
print "\n\nRegistered Service Types: \n\n";
- print $moby -> retrieveServiceTypes();
+ my $types = $moby -> retrieveServiceTypes();
+ while (my ($type, $def) = each %{$types}){
+ print "$type:\t$def\n";
+ }
- print "\n\nRegistered Providors:\n\n";
- print $moby -> retrieveServiceProviders();
+ print "\n\nRegistered Providers:\n\n";
+ print join "\n", $moby -> retrieveServiceProviders();
print "\n\nPress RETURN to continue. "; my $continue=(<STDIN>);
More information about the MOBY-guts
mailing list