From fefae22cce452747e6dca9840ee86f124d07c5ac Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Fri, 11 Jun 2021 08:31:31 +0200 Subject: [PATCH] Implementation of Engines_Component_i::isSSLMode --- idl/SALOME_Component.idl | 1 + src/Container/Component_i.cxx | 15 +++++++++++++++ src/Container/SALOME_Component_i.hxx | 2 ++ src/Container/SALOME_Container_i.hxx | 2 ++ 4 files changed, 20 insertions(+) diff --git a/idl/SALOME_Component.idl b/idl/SALOME_Component.idl index 89b97011b..47d5f7c16 100644 --- a/idl/SALOME_Component.idl +++ b/idl/SALOME_Component.idl @@ -264,6 +264,7 @@ module Engines //! Determines whether the server has already been loaded or not. void ping(); + boolean isSSLMode() raises(SALOME::SALOME_Exception); //! Remove component instance from container /*! Deactivates the %Component. diff --git a/src/Container/Component_i.cxx b/src/Container/Component_i.cxx index 84c125130..892698e55 100644 --- a/src/Container/Component_i.cxx +++ b/src/Container/Component_i.cxx @@ -34,6 +34,7 @@ #include "Utils_SINGLETON.hxx" #include "Utils_ORB_INIT.hxx" #include "SALOME_NamingService.hxx" +#include "Utils_CorbaException.hxx" #include #ifndef WIN32 @@ -176,6 +177,20 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, } +CORBA::Boolean Engines_Component_i::isSSLMode() +{ + PortableServer::ServantBase *serv(_poa->reference_to_servant(_container)); + if(!serv) + THROW_SALOME_CORBA_EXCEPTION("_container and component are not managed by the same POA ! Looks bad !", SALOME::INTERNAL_ERROR); + Abstract_Engines_Container_i *elt=dynamic_cast(serv); + if(!elt) + THROW_SALOME_CORBA_EXCEPTION("_container servant object if not a Abstract_Engines_Container_i ! It smells bad !", SALOME::INTERNAL_ERROR); + SALOME_NamingService_Container_Abstract *ns(elt->getNS()); + if(!ns) + THROW_SALOME_CORBA_EXCEPTION("_container servant object points to a nullptr NS ! It smells bad !", SALOME::INTERNAL_ERROR); + return elt->isSSLMode() && (!dynamic_cast(ns)); +} + SALOME_NamingService_Abstract *Engines_Component_i::getNS() { ORB_INIT &init = *SINGLETON_::Instance() ; diff --git a/src/Container/SALOME_Component_i.hxx b/src/Container/SALOME_Component_i.hxx index beac21100..befe0112d 100644 --- a/src/Container/SALOME_Component_i.hxx +++ b/src/Container/SALOME_Component_i.hxx @@ -71,6 +71,8 @@ public: const char *interfaceName, bool notif = false, bool regist = true); + + CORBA::Boolean isSSLMode() override; virtual ~Engines_Component_i(); diff --git a/src/Container/SALOME_Container_i.hxx b/src/Container/SALOME_Container_i.hxx index 93ea6a675..4dc832eab 100644 --- a/src/Container/SALOME_Container_i.hxx +++ b/src/Container/SALOME_Container_i.hxx @@ -90,6 +90,8 @@ public: Engines::EmbeddedNamingService_ptr get_embedded_NS_if_ssl() override; + SALOME_NamingService_Container_Abstract *getNS() const { return _NS; } + void remove_impl(Engines::EngineComponent_ptr component_i); void finalize_removal(); -- 2.39.2