Go to the documentation of this file.00001 #include "tao/IORInterceptor/IORInfo.h"
00002 #include "tao/PortableServer/Root_POA.h"
00003
00004 #include "tao/PolicyC.h"
00005 #include "tao/IOPC.h"
00006 #include "tao/ORB_Constants.h"
00007
00008
00009 ACE_RCSID (IORInterceptor,
00010 IORInfo,
00011 "$Id: IORInfo.cpp 78246 2007-05-02 13:33:04Z johnnyw $")
00012
00013 #if !defined (__ACE_INLINE__)
00014 # include "tao/IORInterceptor/IORInfo.inl"
00015 #endif
00016
00017 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00018
00019 TAO_IORInfo::TAO_IORInfo (TAO_Root_POA *poa)
00020 : poa_ (poa),
00021 components_established_ (false)
00022 {
00023 }
00024
00025 TAO_IORInfo::~TAO_IORInfo (void)
00026 {
00027 }
00028
00029 CORBA::Policy_ptr
00030 TAO_IORInfo::get_effective_policy (CORBA::PolicyType type)
00031 {
00032 this->check_validity ();
00033
00034 CORBA::Policy_var policy =
00035 this->poa_->get_policy (type);
00036
00037 if (!CORBA::is_nil (policy.in ()))
00038 {
00039 return policy._retn ();
00040 }
00041
00042
00043
00044
00045
00046 throw ::CORBA::INV_POLICY (CORBA::OMGVMCID | 3, CORBA::COMPLETED_NO);
00047 }
00048
00049 void
00050 TAO_IORInfo::add_ior_component (const IOP::TaggedComponent &component)
00051 {
00052 this->check_validity ();
00053
00054 if (this->components_established_)
00055 throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, CORBA::COMPLETED_NO);
00056
00057
00058 this->poa_->save_ior_component (component);
00059 }
00060
00061 void
00062 TAO_IORInfo::add_ior_component_to_profile (
00063 const IOP::TaggedComponent &component,
00064 IOP::ProfileId profile_id)
00065 {
00066 this->check_validity ();
00067
00068 if (this->components_established_)
00069 throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, CORBA::COMPLETED_NO);
00070
00071 this->poa_->save_ior_component_and_profile_id (component, profile_id);
00072 }
00073
00074 char *
00075 TAO_IORInfo::manager_id (void)
00076 {
00077 this->check_validity ();
00078
00079 PortableServer::POAManager_var poa_manager = this->poa_->the_POAManager ();
00080 return poa_manager->get_id ();
00081 }
00082
00083 PortableInterceptor::AdapterState
00084 TAO_IORInfo::state (void)
00085 {
00086 this->check_validity ();
00087
00088 return this->poa_->get_adapter_state ();
00089 }
00090
00091 PortableInterceptor::ObjectReferenceTemplate *
00092 TAO_IORInfo::adapter_template (void)
00093 {
00094 this->check_validity ();
00095
00096
00097
00098
00099
00100
00101 PortableInterceptor::ObjectReferenceTemplate *adapter_template =
00102 this->poa_->get_adapter_template ();
00103
00104 if (adapter_template == 0)
00105 {
00106 throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, CORBA::COMPLETED_NO);
00107 }
00108
00109 return adapter_template;
00110 }
00111
00112 PortableInterceptor::ObjectReferenceFactory *
00113 TAO_IORInfo::current_factory (void)
00114 {
00115 this->check_validity ();
00116
00117
00118
00119
00120
00121
00122 PortableInterceptor::ObjectReferenceFactory *adapter_factory =
00123 this->poa_->get_obj_ref_factory ();
00124
00125 if (adapter_factory == 0)
00126 {
00127 throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, CORBA::COMPLETED_NO);
00128 }
00129
00130 return adapter_factory;
00131 }
00132
00133 void
00134 TAO_IORInfo::current_factory (
00135 PortableInterceptor::ObjectReferenceFactory * current_factory)
00136 {
00137 this->check_validity ();
00138
00139 this->poa_->set_obj_ref_factory (current_factory);
00140 }
00141
00142 void
00143 TAO_IORInfo::check_validity (void)
00144 {
00145 if (this->poa_ == 0)
00146 {
00147
00148
00149
00150
00151
00152
00153 throw ::CORBA::OBJECT_NOT_EXIST (TAO::VMCID, CORBA::COMPLETED_NO);
00154 }
00155 }
00156
00157 TAO_END_VERSIONED_NAMESPACE_DECL