[Bioperl-l] Re: biocorba improvements

Ewan Birney birney@ebi.ac.uk
Thu, 20 Jul 2000 01:34:59 +0100 (BST)


On Wed, 19 Jul 2000, Jason Stajich wrote:

> Brad and I have been discussing how to make BioCorba easier to use.  It
> seems like a lot of things are in common when one goes to build a
> corba object.  What if we moved all the code into a single object
> called Bio::CorbaServer::Server?  Lets look at it from the server
> side first, a similar analogy for Bio::CorbaClient::Client would apply.
> 
> So the following lines (from servers/seqdbsrv.pl) :
> 
> # lets go CORBA-ing
> 
> use CORBA::ORBit idl => [ 'biocorba.idl' ];
> 
> # build the actual orb and get the first POA (Portable Object Adaptor)
> $orb = CORBA::ORB_init("orbit-local-orb");
> $root_poa = $orb->resolve_initial_references("RootPOA");
> 
> # make a Fasta index object
> 
> my $seqdb = Bio::Index::Fasta->new(-filename => $tst_index_file, 
> 				 -write_flag => 0, 
> 				 -verbose => 1);					
> $servant = Bio::CorbaServer::SeqDB->new($root_poa,'test_db', 
> 					$seqdb);
> 
> # this registers this object as a live object with the ORB
> my $id = $root_poa->activate_object ($servant);
> 
> # we need to get the IOR of this object. The way to do this is to
> # to get a client of the object (temp) and then get the IOR of the
> # client
> $temp = $root_poa->id_to_reference ($id);
> my $ior = $orb->object_to_string ($temp);
> 
> # write out the IOR. This is what we give to a different machine
> $ior_file = "seqdbsrv.ior";
> open (OUT, ">$ior_file") || die "Cannot open file for ior: $!";
> print OUT "$ior";
> close OUT;
> 
> # tell everyone we are ready for it
> print STDERR "Activating the ORB. IOR written to $ior_file\n";
> 
> # and off we go. Woo Hoo!
> $root_poa->_get_the_POAManager->activate;
> $orb->run;
> 
> 
>  ---- could be replaced with the following ----
> 
> my $server = Bio::CorbaServer::Server->new(-idl=> 'biocorba.idl',
> 	                                   -ior=> 'seqdbsrv.ior',
> 	                                   -orbname => 'orbit-local-orb' );
> 
> my $seqdb = $server->new_object(-object=> 'Bio::CorbaServer::SeqDB',
>                                 -objectref => $seqdbref,
> 				-args=> [ -dbname => 'dbname-here' ] );
> # if there were other args they could go in here
> $server->start();
> 
> What do you think?  Problems with this?

Sounds *great*. I was thinking about something similar myself.


> 
> -Jason
> 
> Jason Stajich
> jason@chg.mc.duke.edu
> http://galton.mc.duke.edu/~jason/
> (919)684-1806 (office) 
> (919)684-2275 (fax) 
> Center for Human Genetics - Duke University Medical Center
> http://wwwchg.mc.duke.edu/ 
> 
> 

-----------------------------------------------------------------
Ewan Birney. Mobile: +44 (0)7970 151230, Work: +44 1223 494420
<birney@ebi.ac.uk>. 
-----------------------------------------------------------------