# 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::Supervisor_types; use Copex::Supervisor_skel; # IDL:Copex/Supervisor:1.0 package Copex::Supervisor_impl; use COPE::CORBA::Servant @Copex::Supervisor_impl::ISA=qw(CORBA::BOA::_Servant); sub _skelname($) { 'Copex::Supervisor_skel' } sub new { my($class,@args) = @_; my $self = {}; bless $self, $class; $CORBA::BOA::_The_Boa->activate_object($self); return $self; } # IDL:Copex/Supervisor/get_temp:1.0 sub get_temp ($) { my($self) = @_; # Temp objects are deactivated when the caller exits, but they # remain in existence until the reference in the temp_objects # array is removed. Attempting to return references to incactive # objects would throw CORBA::MARSHAL. my $temp; my $i = 0; while ($i < @Copex::Temp_impl::temp_objects) { $temp = $Copex::Temp_impl::temp_objects[$i]; if ($temp->_ior) { $i++; # Active oject, continue; } else { splice @Copex::Temp_impl::temp_objects, $i, 1; } } return \@Copex::Temp_impl::temp_objects; } # IDL:Copex/Supervisor/get_persistent:1.0 sub get_persistent ($) { my($self) = @_; # This is necessary to make the Temp objects vanish on disconnect. # It sets the BOA to register new objects in private maps # so they will be cleaned up when the client disconnects. # Doing this here sets the server state just before the client # creates the temporary objects that need it. # This is cheating, but otherwise the Temp and OnDemand objects # can not be used in the same server, if the client is to run more # than once. $CORBA::BOA::_The_Boa->cleanupObjectOnExit(1); return \@Copex::Persistent_impl::persist; } # IDL:Copex/Supervisor/get_one:1.0 sub get_one ($) { my($self) = @_; # This is necessary to stop the OnDemand objects vanishing on disconnect. # It sets the BOA to register new objects in the permanent object map. # This is the normal state, but was overriden in get_temp() above. # Restoring it here allows the client to be run several times # with the same server process. $CORBA::BOA::_The_Boa->cleanupObjectOnExit(0); # throw together object refs for all the oids in our database my @iors = map { $CORBA::BOA::_The_Boa->create_reference_with_id( $_, Copex::OneServant_impl->_interface); } keys %Copex::OneServant_impl::ones; return \@iors; } # IDL:Copex/Supervisor/new_one:1.0 sub new_one ($$) { my($self,$id) = @_; return Copex::OneServant_impl->new($id); } # IDL:Copex/Supervisor/get_loaded:1.0 sub get_loaded ($) { my($self) = @_; return \@Copex::OnDemand_impl::loaded; } # IDL:Copex/Supervisor/get_unloaded:1.0 sub get_unloaded ($) { my($self) = @_; # For the objects that aren't loaded yet, create IORs my @iors = map { $CORBA::BOA::_The_Boa->create_reference_with_id( $_, Copex::OnDemand_impl->_interface); } @Copex::OnDemand_impl::unloaded; return \@iors; } 1;