diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2011-10-30 22:49:46 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2011-10-30 22:49:46 +0000 |
commit | 801908ae33d63641d9e3648c6fcb01482764b3a8 (patch) | |
tree | 0d5ecea9a6dd8865b1166c04ae883c3d39a42b8f | |
parent | 5aae9832f83c0ae8d5e4f078c06ce4f4af493a62 (diff) | |
download | ATCD-801908ae33d63641d9e3648c6fcb01482764b3a8.tar.gz |
Sun Oct 30 22:39:45 UTC 2011 William R. Otte <wotte@dre.vanderbilt.edu>
* ciao/Deployment/Interceptors/Deployment_Interceptors.h:
* ciao/Deployment/Interceptors/Deployment_Interceptors.cpp:
Moved external reference resolution to the interceptor.
-rw-r--r-- | CIAO/ChangeLog | 7 | ||||
-rw-r--r-- | CIAO/ciao/Deployment/Interceptors/Deployment_Interceptors.cpp | 67 | ||||
-rw-r--r-- | CIAO/ciao/Deployment/Interceptors/Deployment_Interceptors.h | 6 |
3 files changed, 77 insertions, 3 deletions
diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog index 0d7659d1d7d..eee0d6da1dc 100644 --- a/CIAO/ChangeLog +++ b/CIAO/ChangeLog @@ -1,3 +1,10 @@ +Sun Oct 30 22:39:45 UTC 2011 William R. Otte <wotte@dre.vanderbilt.edu> + + * ciao/Deployment/Interceptors/Deployment_Interceptors.h: + * ciao/Deployment/Interceptors/Deployment_Interceptors.cpp: + + Moved external reference resolution to the interceptor. + Fri Oct 21 07:24:24 UTC 2011 Marcel Smit <msmit@remedy.nl> * connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/RG_ResetTopic_Base.idl: diff --git a/CIAO/ciao/Deployment/Interceptors/Deployment_Interceptors.cpp b/CIAO/ciao/Deployment/Interceptors/Deployment_Interceptors.cpp index a548c5fa45a..cbdc952a2ce 100644 --- a/CIAO/ciao/Deployment/Interceptors/Deployment_Interceptors.cpp +++ b/CIAO/ciao/Deployment/Interceptors/Deployment_Interceptors.cpp @@ -124,6 +124,16 @@ namespace CIAO /// Implementation skeleton constructor CIAO_ReferenceLookup_i::CIAO_ReferenceLookup_i (void) { + this->orb_ = DAnCE::PLUGIN_MANAGER::instance ()->get_orb (); + + if (CORBA::is_nil (this->orb_)) + { + CIAO_ERROR (1, (LM_ERROR, CLINFO + "Container_Handler_i::configure -" + "Unable to locate ORB.\n")); + throw ::Deployment::StartError ("CIAO Container Handler", + "Unable to locate ORB"); + } } /// Implementation skeleton destructor @@ -132,10 +142,55 @@ namespace CIAO } void - CIAO_ReferenceLookup_i::pre_connect (::Deployment::DeploymentPlan &, - ::CORBA::ULong, - ::CORBA::Any &) + CIAO_ReferenceLookup_i::pre_connect (::Deployment::DeploymentPlan &plan, + ::CORBA::ULong connectionref, + ::CORBA::Any &ref) { + ::Deployment::PlanConnectionDescription &conn = plan.connection[connectionref]; + + if (conn.externalReference.length () >= 1) + { + try + { + CORBA::Object_ptr + obj = this->orb_->string_to_object(conn.externalReference[0].location.in()); + + if (!CORBA::is_nil (obj)) + { + ref <<= obj; + } + else + { + DANCE_ERROR (DANCE_LOG_WARNING, + (LM_DEBUG, DLINFO + ACE_TEXT("CIAO_ReferenceLookup_i::pre_connect - ") + ACE_TEXT("can't create object for IOR %C\n"), + conn.externalReference[0].location.in())); + throw Deployment::InvalidConnection (conn.name.in (), + ACE_TEXT ("Invalid ExternalReference\n")); + } + } + catch (CORBA::Exception &ex) + { + DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, + (LM_ERROR, DLINFO + ACE_TEXT("CIAO_ReferenceLookup_i::pre_connect - ") + ACE_TEXT("Caught CORBA Exception while resolving endpoint for connection %C: %C\n"), + conn.name.in (), + ex._info ().c_str ())); + throw Deployment::InvalidConnection (conn.name.in (), + ex._info ().c_str ()); + } + catch (...) + { + DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, + (LM_ERROR, DLINFO + ACE_TEXT("CIAO_ReferenceLookup_i::pre_connect - ") + ACE_TEXT("Caught C++ Exception while resolving endpoint for connection\n"))); + throw Deployment::InvalidConnection (conn.name.in (), + ACE_TEXT ("C++ Exception while resolving external reference")); + } + } } void CIAO_ReferenceLookup_i::post_connect (const ::Deployment::DeploymentPlan &, @@ -157,4 +212,10 @@ extern "C" { return new CIAO::CIAO_StoreReferences_i (); } + + ::DAnCE::DeploymentInterceptor_ptr + CIAO_Deployment_Interceptors_Export create_CIAO_ReferenceLookup (void) + { + return new CIAO::CIAO_ReferenceLookup_i (); + } } diff --git a/CIAO/ciao/Deployment/Interceptors/Deployment_Interceptors.h b/CIAO/ciao/Deployment/Interceptors/Deployment_Interceptors.h index 5b792119e19..71d67171ee9 100644 --- a/CIAO/ciao/Deployment/Interceptors/Deployment_Interceptors.h +++ b/CIAO/ciao/Deployment/Interceptors/Deployment_Interceptors.h @@ -68,12 +68,18 @@ namespace CIAO virtual void configure(const Deployment::Properties&); + + private: + CORBA::ORB_var orb_; }; } extern "C" { ::DAnCE::DeploymentInterceptor_ptr + CIAO_Deployment_Interceptors_Export create_CIAO_ReferenceLookup (void); + + ::DAnCE::DeploymentInterceptor_ptr CIAO_Deployment_Interceptors_Export create_CIAO_StoreReferences (void); } |