From: prascle Date: Mon, 24 Jan 2005 16:25:49 +0000 (+0000) Subject: PR: add FindContainer method for supervisor (non regression) X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e32f272a58259940b68e9210d8b8c21a86037e86;p=modules%2Fyacs.git PR: add FindContainer method for supervisor (non regression) --- diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx index d846594ab..744229cc7 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx @@ -134,6 +134,36 @@ string SALOME_LifeCycleCORBA::ComputerPath( return CORBA::string_dup( path ) ; } +Engines::Container_ptr SALOME_LifeCycleCORBA::FindContainer(const char *containerName) +{ + ASSERT(_NS != NULL); + string cont ; + if ( strncmp( containerName , "/Containers/" , 12 ) ) { // Compatibility ... + string theComputer ; + string theContainer ; + cont = ContainerName( containerName , &theComputer , &theContainer ) ; + } + else { + cont = containerName ; + } + try { + + SCRUTE( cont ); + + CORBA::Object_var obj = _NS->Resolve( cont.c_str() ); + if( !CORBA::is_nil( obj ) ) { + return Engines::Container::_narrow( obj ) ; + } + } + catch (ServiceUnreachable&) { + INFOS("Caught exception: Naming Service Unreachable"); + } + catch (...) { + INFOS("Caught unknown exception."); + } + return Engines::Container::_nil(); +} + Engines::Component_ptr SALOME_LifeCycleCORBA::FindOrLoad_Component (const char *containerName, const char *componentName) diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx index 249d4c0aa..a7a145c27 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx @@ -44,6 +44,7 @@ class SALOME_LifeCycleCORBA public: SALOME_LifeCycleCORBA(SALOME_NamingService *ns); virtual ~SALOME_LifeCycleCORBA(); + Engines::Container_ptr FindContainer(const char *containerName); // for supervision Engines::Component_ptr FindOrLoad_Component(const Engines::MachineParameters& params, const char *componentName); Engines::Component_ptr FindOrLoad_Component(const char *containerName,