[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Thu May 13 17:56:33 UTC 2004


mwilkinson
Thu May 13 13:56:33 EDT 2004
Update of /home/repository/moby/moby-live/Perl/MOBY/Client
In directory pub.open-bio.org:/tmp/cvs-serv32254

Modified Files:
	OntologyServer.pm 
Added Files:
	OntologyServer.html 
Log Message:
changes to Ontology Server to allow for proxies.  More changes coming.

moby-live/Perl/MOBY/Client OntologyServer.html,NONE,1.1 OntologyServer.pm,1.3,1.4
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/OntologyServer.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- /home/repository/moby/moby-live/Perl/MOBY/Client/OntologyServer.pm	2003/07/10 20:43:09	1.3
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/OntologyServer.pm	2004/05/13 17:56:33	1.4
@@ -41,7 +41,8 @@
 
 =head1 AUTHORS
 
-Mark Wilkinson (markw at illuminae.com)
+Mark Wilkinson (markw at illuminae.com)
+Nina Opushneva (opushneva at yahoo.ca)
 
 BioMOBY Project:  http://www.biomoby.org
 
@@ -57,7 +58,8 @@
  Usage     :	my $OS = MOBY::OntologyServer->new(%args)
  Function  :	
  Returns   :	MOBY::OntologyServer object
- Args      :    host =>  URL to ontolgy_server script
+ Args      :    host =>  URL to ontolgy_server script (default http://mobycentral.cbr.nrc.ca/cgi-bin/OntologyServer.cgi)
+                proxy => URL to an HTTP proxy server if necessarray (optional)
 
 =cut
 
@@ -80,6 +82,8 @@
     my %_attr_data = #     				DEFAULT    	ACCESSIBILITY
                   (
                     host    =>      ["http://mobycentral.cbr.nrc.ca/cgi-bin/OntologyServer.cgi",         'read/write'],
+					proxy	=>		[undef, 				'read/write'],
+					
                     );
 
    #_____________________________________________________________
@@ -121,6 +125,8 @@
     else {
 		$self->{$attrname} = $self->_default_for($attrname) }
     }
+    
+
     return undef unless $self->host;
     return $self;
 }
@@ -135,7 +141,7 @@
     
     my $term = $args{'term'};    
     $term =~ s/^moby://;   # if the term is namespaced, then remove that
-    my $ua = LWP::UserAgent->new;
+    my $ua = $self->getUserAgent;
     my $req = HTTP::Request->new(POST => $self->host);
     $req->content("objectExists=$term");
     my $res = $ua->request($req);
@@ -157,7 +163,7 @@
     
     my $term = $args{'term'};    
     $term =~ s/^moby://;   # if the term is namespaced, then remove that
-    my $ua = LWP::UserAgent->new;
+    my $ua = $self->getUserAgent;
     my $req = HTTP::Request->new(POST => $self->host);
     $req->content("serviceExists=$term");
     my $res = $ua->request($req);
@@ -178,7 +184,7 @@
     
     my $term = $args{'term'};    
     $term =~ s/^moby://;   # if the term is namespaced, then remove that
-    my $ua = LWP::UserAgent->new;
+    my $ua = $self->getUserAgent;
     my $req = HTTP::Request->new(POST => $self->host);
     $req->content("namespaceExists=$term");
     my $res = $ua->request($req);
@@ -199,7 +205,7 @@
     
     my $term = $args{'term'};
     $term =~ s/^moby://;   # if the term is namespaced, then remove that
-    my $ua = LWP::UserAgent->new;
+    my $ua = $self->getUserAgent;
     my $req = HTTP::Request->new(POST => $self->host);
     $req->content("relationshipExists=$term");
     my $res = $ua->request($req);
@@ -210,6 +216,17 @@
     }
 }
 
+sub getUserAgent{
+	my ($self, @args) = @_;
+  my $ua = LWP::UserAgent->new;
+    my $proxy = $ENV{PROXY} if $ENV{PROXY}; # first check the environment
+	$proxy = $self->proxy if $self->proxy;  # but if the object was initialized with a proxy argument then use that instead
+    if($proxy){
+       $ua->proxy('http', $proxy);
+    }
+  return $ua;
+}
+
 sub DESTROY {}
 
 sub AUTOLOAD {




More information about the MOBY-guts mailing list