Go to the documentation of this file.00001
00002
00003
00004
00005 #include "tao/RTScheduling/RTScheduler_Initializer.h"
00006 #include "tao/RTScheduling/Request_Interceptor.h"
00007
00008 ACE_RCSID (TAO, RTScheduler_Initializer, "$Id: RTScheduler_Initializer.cpp 90353 2010-05-31 08:42:46Z vzykov $")
00009
00010 #include "tao/RTScheduling/RTScheduler.h"
00011 #include "tao/RTScheduling/Current.h"
00012 #include "tao/RTScheduling/RTScheduler_Manager.h"
00013
00014 #include "tao/PI_Server/PI_Server.h"
00015
00016 #include "tao/PI/ORBInitInfo.h"
00017
00018 #include "tao/Exception.h"
00019 #include "tao/ORB_Core.h"
00020 #include "tao/debug.h"
00021 #include "ace/Service_Repository.h"
00022 #include "ace/Svc_Conf.h"
00023
00024 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00025
00026 void
00027 TAO_RTScheduler_ORB_Initializer::pre_init (
00028 PortableInterceptor::ORBInitInfo_ptr info)
00029 {
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 if (TAO_debug_level > 0)
00040 ACE_DEBUG ((LM_DEBUG,
00041 "In pre_init\n"));
00042
00043 TAO_ORBInitInfo_var tao_info = TAO_ORBInitInfo::_narrow (info);
00044
00045 if (CORBA::is_nil (tao_info.in ()))
00046 {
00047 if (TAO_debug_level > 0)
00048 ACE_ERROR ((LM_ERROR,
00049 "(%P|%t) Security_ORBInitializer::pre_init:\n"
00050 "(%P|%t) Unable to narrow "
00051 "\"PortableInterceptor::ORBInitInfo_ptr\" to\n"
00052 "(%P|%t) \"TAO_ORBInitInfo *.\"\n"));
00053
00054 throw ::CORBA::INTERNAL ();
00055 }
00056
00057 TAO_RTScheduler_Current *tmp_current = 0;
00058 ACE_NEW_THROW_EX (tmp_current,
00059 TAO_RTScheduler_Current,
00060 CORBA::NO_MEMORY (
00061 CORBA::SystemException::_tao_minor_code (
00062 TAO::VMCID,
00063 ENOMEM),
00064 CORBA::COMPLETED_NO));
00065 this->current_ = tmp_current;
00066
00067 this->current_->init (tao_info->orb_core ());
00068
00069 CORBA::Object_var current_obj =
00070 RTScheduling::Current::_narrow (this->current_.in ());
00071
00072 info->register_initial_reference ("RTScheduler_Current", current_obj.in ());
00073
00074 Client_Interceptor *client_interceptor = 0;
00075 ACE_NEW_THROW_EX (client_interceptor,
00076 Client_Interceptor,
00077 CORBA::NO_MEMORY (
00078 CORBA::SystemException::_tao_minor_code (
00079 TAO::VMCID,
00080 ENOMEM),
00081 CORBA::COMPLETED_NO));
00082
00083 PortableInterceptor::ClientRequestInterceptor_var safe_client =
00084 client_interceptor;
00085
00086 info->add_client_request_interceptor (client_interceptor);
00087
00088 Server_Interceptor *server_interceptor = 0;
00089 ACE_NEW_THROW_EX (server_interceptor,
00090 Server_Interceptor (this->current_.in ()),
00091 CORBA::NO_MEMORY (
00092 CORBA::SystemException::_tao_minor_code (
00093 TAO::VMCID,
00094 ENOMEM),
00095 CORBA::COMPLETED_NO));
00096
00097 PortableInterceptor::ServerRequestInterceptor_var safe_server =
00098 server_interceptor;
00099
00100 info->add_server_request_interceptor (server_interceptor);
00101
00102
00103 TAO_RTScheduler_Manager *manager = 0;
00104
00105 ACE_NEW_THROW_EX (manager,
00106 TAO_RTScheduler_Manager (tao_info->orb_core ()),
00107 CORBA::NO_MEMORY (
00108 CORBA::SystemException::_tao_minor_code (
00109 TAO::VMCID,
00110 ENOMEM),
00111 CORBA::COMPLETED_NO));
00112
00113
00114 TAO_RTScheduler_Manager_var safe_manager = manager;
00115
00116 info->register_initial_reference ("RTSchedulerManager", manager);
00117 }
00118
00119 void
00120 TAO_RTScheduler_ORB_Initializer::post_init (PortableInterceptor::ORBInitInfo_ptr info)
00121 {
00122
00123
00124
00125
00126
00127
00128
00129
00130 if (TAO_debug_level > 0)
00131 ACE_DEBUG ((LM_DEBUG,
00132 "In post_init\n"));
00133
00134 CORBA::Object_var rt_current_obj =
00135 info->resolve_initial_references (TAO_OBJID_RTCURRENT);
00136
00137 RTCORBA::Current_var rt_current =
00138 RTCORBA::Current::_narrow (rt_current_obj.in ());
00139
00140 if (CORBA::is_nil (rt_current.in ()))
00141 {
00142 ACE_DEBUG ((LM_DEBUG,
00143 "(%P|%t) ::post_init\n"
00144 "(%P|%t) Unable to narrow to RTCORBA::Current\n"));
00145 throw ::CORBA::INTERNAL ();
00146 }
00147
00148 this->current_->rt_current (rt_current.in ());
00149 }
00150
00151 TAO_END_VERSIONED_NAMESPACE_DECL