Cleanup ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE, all platforms support it so far as I can...
[ACE_TAO.git] / TAO / tests / POA / On_Demand_Activation / Servant_Activator.cpp
blobc4123985d72b70af218b6b43014c9ff36682d906
2 //=============================================================================
3 /**
4 * @file Servant_Activator.cpp
6 * Implementation of ServantActivator, which is used by a POA with
7 * a RETAIN policy.
9 * @author Irfan Pyarali
11 //=============================================================================
14 #include "Servant_Activator.h"
15 #include "test_i.h"
16 #include "ace/OS_NS_string.h"
18 ServantActivator::ServantActivator (CORBA::ORB_ptr orb)
19 : orb_ (CORBA::ORB::_duplicate (orb))
23 PortableServer::Servant
24 ServantActivator::incarnate (const PortableServer::ObjectId &oid,
25 PortableServer::POA_ptr poa)
27 // Convert ObjectId to String.
29 CORBA::String_var s = PortableServer::ObjectId_to_string (oid);
31 // If ObjectId string has a test substring, create and return a
32 // test_i.
34 if (ACE_OS::strstr (s.in (), "test") != 0)
35 return new test_i (this->orb_.in (), poa);
36 else
38 throw CORBA::OBJECT_NOT_EXIST ();
43 void
44 ServantActivator::etherealize (const PortableServer::ObjectId &,
45 PortableServer::POA_ptr ,
46 PortableServer::Servant servant,
47 CORBA::Boolean ,
48 CORBA::Boolean remaining_activations)
50 // If there are no remaining activations i.e ObjectIds associated
51 // with test_i delete it.
52 if (!remaining_activations)
53 delete servant;