1 // This is a simple example, showing how you can load an
2 // ImR Locator and/or Activator as ACE Service Objects
3 // using the ACE Service Configurator framework.
5 #include "service_configS.h"
7 #include "ace/Service_Config.h"
8 #include "ace/streams.h"
9 #include "ace/OS_NS_string.h"
12 using namespace CORBA
;
13 using namespace PortableServer
;
16 : public POA_ServiceConfigurator
18 ACE_Service_Config
& asc_
;
20 SvcConf(ACE_Service_Config
& asc
)
24 virtual CORBA::Long
process_directive(const char* s
)
27 ACE_ASSERT(ACE_OS::strlen(s
) > 0);
28 return asc_
.process_directive(ACE_TEXT_CHAR_TO_TCHAR(s
));
31 virtual void reconfigure()
37 int ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
40 ACE_Service_Config config
;
41 config
.open (argc
, argv
);
43 ORB_var orb
= ORB_init (argc
, argv
);
45 Object_var obj
= orb
->resolve_initial_references("RootPOA");
46 POA_var poa
= POA::_narrow(obj
.in());
47 ACE_ASSERT(! is_nil(poa
.in()));
48 POAManager_var poaman
= poa
->the_POAManager();
52 ObjectId_var id
= poa
->activate_object(&svt
);
53 obj
= poa
->id_to_reference(id
.in());
54 ACE_ASSERT(! is_nil(obj
.in()));
55 String_var ior
= orb
->object_to_string(obj
.in());
60 ofstream
out("combined.ior");
64 ACE_DEBUG((LM_DEBUG
, "Combined service started.\n"));
68 ACE_DEBUG((LM_DEBUG
, "Combined service shutdown.\n"));
72 } catch (const CORBA::Exception
& e
) {
73 e
._tao_print_exception ("Combined Service:");