2 #include "tao/RTScheduling/RTScheduler_Initializer.h"
3 #include "tao/RTScheduling/Request_Interceptor.h"
5 #include "tao/RTScheduling/RTScheduler.h"
6 #include "tao/RTScheduling/Current.h"
7 #include "tao/RTScheduling/RTScheduler_Manager.h"
9 #include "tao/PI_Server/PI_Server.h"
11 #include "tao/PI/ORBInitInfo.h"
13 #include "tao/Exception.h"
14 #include "tao/ORB_Core.h"
15 #include "tao/debug.h"
16 #include "ace/Service_Repository.h"
17 #include "ace/Svc_Conf.h"
19 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
22 TAO_RTScheduler_ORB_Initializer::pre_init (
23 PortableInterceptor::ORBInitInfo_ptr info
)
26 // Register all of the RT related services.
29 // Create the RT_Current.
31 // Narrow to a TAO_ORBInitInfo object to get access to the
32 // orb_core() TAO extension.
34 if (TAO_debug_level
> 0)
35 TAOLIB_DEBUG ((LM_DEBUG
,
38 TAO_ORBInitInfo_var tao_info
= TAO_ORBInitInfo::_narrow (info
);
40 if (CORBA::is_nil (tao_info
.in ()))
42 if (TAO_debug_level
> 0)
43 TAOLIB_ERROR ((LM_ERROR
,
44 "(%P|%t) Security_ORBInitializer::pre_init:\n"
45 "(%P|%t) Unable to narrow "
46 "\"PortableInterceptor::ORBInitInfo_ptr\" to\n"
47 "(%P|%t) \"TAO_ORBInitInfo *.\"\n"));
49 throw ::CORBA::INTERNAL ();
52 TAO_RTScheduler_Current
*tmp_current
= 0;
53 ACE_NEW_THROW_EX (tmp_current
,
54 TAO_RTScheduler_Current
,
56 CORBA::SystemException::_tao_minor_code (
59 CORBA::COMPLETED_NO
));
60 this->current_
= tmp_current
;
62 this->current_
->init (tao_info
->orb_core ());
64 CORBA::Object_var current_obj
=
65 RTScheduling::Current::_narrow (this->current_
.in ());
67 info
->register_initial_reference ("RTScheduler_Current", current_obj
.in ());
69 Client_Interceptor
*client_interceptor
= 0;
70 ACE_NEW_THROW_EX (client_interceptor
,
73 CORBA::SystemException::_tao_minor_code (
76 CORBA::COMPLETED_NO
));
78 PortableInterceptor::ClientRequestInterceptor_var safe_client
=
81 info
->add_client_request_interceptor (client_interceptor
);
83 Server_Interceptor
*server_interceptor
= 0;
84 ACE_NEW_THROW_EX (server_interceptor
,
85 Server_Interceptor (this->current_
.in ()),
87 CORBA::SystemException::_tao_minor_code (
90 CORBA::COMPLETED_NO
));
92 PortableInterceptor::ServerRequestInterceptor_var safe_server
=
95 info
->add_server_request_interceptor (server_interceptor
);
97 // Set the RTScheduler_Manager
98 TAO_RTScheduler_Manager
*manager
= 0;
100 ACE_NEW_THROW_EX (manager
,
101 TAO_RTScheduler_Manager (tao_info
->orb_core ()),
103 CORBA::SystemException::_tao_minor_code (
106 CORBA::COMPLETED_NO
));
109 TAO_RTScheduler_Manager_var safe_manager
= manager
;
111 info
->register_initial_reference ("RTSchedulerManager", manager
);
115 TAO_RTScheduler_ORB_Initializer::post_init (PortableInterceptor::ORBInitInfo_ptr info
)
117 // @@ This is busted. TAO_ORBInitInfo should do proper reference
119 // Narrow to a TAO_ORBInitInfo object to get access to the
120 // orb_core() TAO extension.
121 //TAO_ORBInitInfo_var tao_info = TAO_ORBInitInfo::_narrow (info);
123 if (TAO_debug_level
> 0)
124 TAOLIB_DEBUG ((LM_DEBUG
,
127 CORBA::Object_var rt_current_obj
=
128 info
->resolve_initial_references (TAO_OBJID_RTCURRENT
);
130 RTCORBA::Current_var rt_current
=
131 RTCORBA::Current::_narrow (rt_current_obj
.in ());
133 if (CORBA::is_nil (rt_current
.in ()))
135 TAOLIB_DEBUG ((LM_DEBUG
,
136 "(%P|%t) ::post_init\n"
137 "(%P|%t) Unable to narrow to RTCORBA::Current\n"));
138 throw ::CORBA::INTERNAL ();
141 this->current_
->rt_current (rt_current
.in ());
144 TAO_END_VERSIONED_NAMESPACE_DECL