# Automatically generated sample implementation code # PLEASE EDIT PLEASE EDIT PLEASE EDIT. # Generated on Fri Aug 14 11:02:41 1998 with the following command: # /usr/home/irving/bin/idl2perl -o . --impl copex.idl use Copex::OneServant_types; use Copex::OneServant_skel; # IDL:Copex/OneServant:1.0 package Copex::OneServant_impl; use COPE::CORBA::Servant @Copex::OneServant_impl::ISA=qw(CORBA::BOA::_Servant); sub _skelname($) { 'Copex::OneServant_skel' } use COPE::CORBA::Exception; use Experimental::Exception; use vars '%ones'; sub new { my($class, $oid) = @_; # Rather than creating a new object, just create a # CORBA object reference (IOR) my $ior = $CORBA::BOA::_The_Boa->create_reference_with_id($oid, $class->_interface); # Put the object data in our "database" # Note that we don't save the IOR; we can recreate it any time from # the oid $ones{$oid} = 1; # and return the object reference return $ior; } # IDL:Copex/OneServant/GetId:1.0 sub GetId ($) { my($self) = @_; # Extract the object ID from the call my $oid = $CORBA::BOA::_The_Boa->servant_to_id($self); # If this was a real application, we could use $oid to look up # the object info in our database # Another client might have deleted the object from the database... if (!exists($ones{$oid})) { throw new CORBA::OBJECT_NOT_EXIST minor => 0, completed=> Corba::CompletionStatus::COMPLETED_NO; } return $oid; } # Initialize the OneServant module: # Create the "default" servant object and register it with the BOA # to handle all calls for objects of this class # We don't use Copex::OneServant_impl->new() here because the new() method # doesn't actually create a Perl object. sub init() { my $default = bless {}, 'Copex::OneServant_impl'; $CORBA::BOA::_The_Boa->activate_object($default); $CORBA::BOA::_The_Boa->set_servant($default->_interface, $default); } 1;