summaryrefslogtreecommitdiff
path: root/TAO/tests/POA/On_Demand_Activation/Servant_Activator.cpp
blob: ddecaad41774f8b07351b5395bd2238b568908f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "Servant_Activator.h"
#include "MyFooServant.h"

PortableServer::Servant 
MyFooServantActivator::incarnate (const PortableServer::ObjectId &oid, 
                                  PortableServer::POA_ptr poa,
                                  CORBA::Environment &env)
{
  CORBA::String_var s = PortableServer::ObjectId_to_string (oid);
  if (ACE_OS::strstr (s.in (), "Foo") != 0) 
    {
      return new MyFooServant (poa, 27);
    } 
  else 
    {
      CORBA::Exception *exception = new CORBA::OBJECT_NOT_EXIST (CORBA::COMPLETED_NO);
      env.exception (exception);
      return 0;
    }
}

void 
MyFooServantActivator::etherealize (const PortableServer::ObjectId &oid,
                                    PortableServer::POA_ptr poa,
                                    PortableServer::Servant servant,
                                    CORBA::Boolean cleanup_in_progress, 
                                    CORBA::Boolean remaining_activations,
                                    CORBA::Environment &env)
{
  if (remaining_activations == CORBA::B_FALSE)
    delete servant;
}