[Bioperl-l] biocorba improvements

Jason Stajich jason@chg.mc.duke.edu
Wed, 19 Jul 2000 18:00:55 -0400 (EDT)

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', 

# 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!

 ---- 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

What do you think?  Problems with this?


Jason Stajich
(919)684-1806 (office) 
(919)684-2275 (fax) 
Center for Human Genetics - Duke University Medical Center