1 #include "Logging_Service_i.h"
4 Logger_Server::Logger_Server ()
5 :service_name_ (ACE_TEXT("LoggingService"))
11 Logger_Server::parse_args ()
13 ACE_Get_Opt
get_opts (argc_
, argv_
, ACE_TEXT("dn:"));
16 while ((c
= get_opts ()) != -1)
19 case 'd': // debug flag.
22 case 'n': // Set factory name to cmnd line arg
23 service_name_
= get_opts
.opt_arg ();
27 ACE_ERROR_RETURN ((LM_ERROR
,
36 // Indicates successful parsing of command line.
41 Logger_Server::init (int argc
,
47 // Call the init of <TAO_ORB_Manager> to initialize the ORB and
48 // create a child POA under the root POA.
49 if (this->orb_manager_
.init_child_poa (argc
,
52 ACE_ERROR_RETURN ((LM_ERROR
,
58 this->orb_manager_
.activate_poa_manager ();
60 // Parse the command line arguments.
61 if (this->parse_args () != 0)
62 ACE_ERROR_RETURN ((LM_ERROR
,
67 // Activate the logger_factory.
68 CORBA::String_var str
=
69 this->orb_manager_
.activate_under_child_poa ("logger_factory",
70 &this->factory_impl_
);
71 if (TAO_debug_level
> 0)
76 // Initialize the naming service
77 int ret
= this->init_naming_service ();
79 ACE_ERROR_RETURN ((LM_ERROR
,
81 "init_naming_service"),
88 // Initialisation of Naming Service and register IDL_Logger Context
89 // and logger_factory object.
92 Logger_Server::init_naming_service ()
94 // Get pointers to the ORB and child POA
95 CORBA::ORB_var orb
= this->orb_manager_
.orb ();
97 // Initialize the naming service
98 if (this->my_name_server_
.init (orb
.in ()) == -1)
101 // Create an instance of the Logger_Factory
102 Logger_Factory_var factory
= this->factory_impl_
._this ();
104 //Register the logger_factory
105 CosNaming::Name
factory_name (1);
106 factory_name
.length (1);
107 factory_name
[0].id
= CORBA::string_dup ("Logger_Factory");
108 this->my_name_server_
->bind (factory_name
,
115 Logger_Server::run ()
117 int ret
= this->orb_manager_
.run ();
119 ACE_ERROR_RETURN ((LM_ERROR
,
120 "Logger_Server::run"),
125 Logger_Server::~Logger_Server ()