X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FContainer%2FComponent_i.cxx;h=7e47c0d6195ca761bfd06f6efeef23446bfcc2a5;hb=7cbb0b15185107493896b24ddfc00766433b169d;hp=be654198a8dfd7b4ec9c29e8ade0cab6dbc529c6;hpb=8723fcf67b7efe234c1c63bb7139ee7a247ed421;p=modules%2Fkernel.git diff --git a/src/Container/Component_i.cxx b/src/Container/Component_i.cxx index be654198a..7e47c0d61 100644 --- a/src/Container/Component_i.cxx +++ b/src/Container/Component_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -31,7 +31,12 @@ #include "SALOME_Container_i.hxx" #include "RegistryConnexion.hxx" #include "Basics_Utils.hxx" -#include +#include "OpUtil.hxx" +#include "Utils_SINGLETON.hxx" +#include "SALOME_NamingService.hxx" +#include "Utils_CorbaException.hxx" + +#include #ifndef WIN32 #include #endif @@ -64,7 +69,7 @@ bool Engines_Component_i::_isMultiInstance = false; */ //============================================================================= -Engines_Component_i::Engines_Component_i():_myConnexionToRegistry(0), _notifSupplier(0), _id(0) +Engines_Component_i::Engines_Component_i(): _id(0), _myConnexionToRegistry(0), _notifSupplier(0) { //ASSERT(0); MESSAGE("Default Constructor, not for normal use..."); @@ -93,15 +98,15 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, bool regist ) : _instanceName(instanceName), _interfaceName(interfaceName), + _id(0), + _contId(0), _myConnexionToRegistry(0), _notifSupplier(0), + _graphName("") , + _nodeName(""), _ThreadId(0) , _ThreadCpuUsed(0) , _Executed(false) , - _graphName("") , - _nodeName(""), - _id(0), - _contId(0), _CanceledThread(false) { MESSAGE("Component constructor with instanceName "<< _instanceName); @@ -115,8 +120,8 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, if(regist) { const CORBA::String_var ior = _orb->object_to_string(o); - _myConnexionToRegistry = new RegistryConnexion(0, 0, ior,"theSession", - _instanceName.c_str()); + _myConnexionToRegistry = new RegistryConnexion(ior,"theSession", + _instanceName.c_str(), getNS()); } if(notif) @@ -146,15 +151,15 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, bool regist) : _instanceName(instanceName), _interfaceName(interfaceName), + _id(0), + _contId(0), _myConnexionToRegistry(0), _notifSupplier(0), + _graphName("") , + _nodeName(""), _ThreadId(0) , _ThreadCpuUsed(0) , _Executed(false) , - _graphName("") , - _nodeName(""), - _id(0), - _contId(0), _CanceledThread(false) { MESSAGE("Component constructor with instanceName "<< _instanceName); @@ -165,13 +170,35 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, const CORBA::String_var ior = _orb->object_to_string(_container); if(regist) { - _myConnexionToRegistry = new RegistryConnexion(0, 0, ior,"theSession", _instanceName.c_str()); + _myConnexionToRegistry = new RegistryConnexion(ior,"theSession", _instanceName.c_str(),getNS()); } if(notif) _notifSupplier = new NOTIFICATION_Supplier(instanceName, notif); } +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() +{ + CORBA::ORB_var orb = KERNEL::GetRefToORB(); + + SALOME_NamingService *naming = SINGLETON_::Instance() ; + naming->init_orb( orb ) ; + return naming; +} //============================================================================= /*! @@ -307,7 +334,7 @@ void Engines_Component_i::setProperties(const Engines::FieldsDict& dico) Engines::FieldsDict* Engines_Component_i::getProperties() { Engines::FieldsDict_var copie = new Engines::FieldsDict; - copie->length(_fieldsDict.size()); + copie->length((CORBA::ULong)_fieldsDict.size()); std::map::iterator it; CORBA::ULong i = 0; for (it = _fieldsDict.begin(); it != _fieldsDict.end(); it++, i++) @@ -665,7 +692,7 @@ void Engines_Component_i::endService(const char *serviceName) if ( !_CanceledThread ) _ThreadCpuUsed = CpuUsed_impl() ; - float cpus=_ThreadCpuUsed/1000.; + float cpus=_ThreadCpuUsed/1000.f; std::cerr << "endService for " << serviceName << " Component instance : " << _instanceName ; std::cerr << " Cpu Used: " << cpus << " (s) " << std::endl; MESSAGE("Send EndService notification for " << serviceName @@ -873,16 +900,15 @@ std::string Engines_Component_i::GetDynLibraryName(const char *componentName) */ //============================================================================= -Engines::TMPFile* Engines_Component_i::DumpPython(CORBA::Boolean isPublished, +Engines::TMPFile* Engines_Component_i::DumpPython(CORBA::Boolean /*isPublished*/, CORBA::Boolean isMultiFile, CORBA::Boolean& isValidScript) { const char* aScript = isMultiFile ? "def RebuildData(): pass" : ""; char* aBuffer = new char[strlen(aScript)+1]; strcpy(aBuffer, aScript); - CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer; - int aBufferSize = strlen(aBuffer)+1; - Engines::TMPFile_var aStreamFile = new Engines::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1); + size_t aBufferSize = strlen(aBuffer)+1; + Engines::TMPFile_var aStreamFile = new Engines::TMPFile((CORBA::ULong)aBufferSize, (CORBA::ULong)aBufferSize, (CORBA::Octet*)aBuffer, 1); isValidScript = true; return aStreamFile._retn(); } @@ -1039,9 +1065,9 @@ Engines_Component_i::checkOutputFilesToService(const char* service_name) */ //============================================================================= void -Engines_Component_i::configureSalome_file(std::string service_name, - std::string file_port_name, - Salome_file_i * file) +Engines_Component_i::configureSalome_file(std::string /*service_name*/, + std::string /*file_port_name*/, + Salome_file_i* /*file*/) { // By default this method does nothing } @@ -1077,16 +1103,37 @@ void Engines_Component_i::setContainerName() //============================================================================= /*! - \brief Get version of the component - - This method is supposed to be implemented in all derived classes; default implementation - returns empty string that means that no version information about the component is available. + * \brief Return \c true if component can provide creation information. + */ +//============================================================================= +bool Engines_Component_i::hasObjectInfo() +{ + return false; +} - \note The version of the component is stored to the study, as a part of general persistence - mechanism; once stored, version information in the study cannot be changed. +//============================================================================= +/*! + * \brief Get creation information for object addressed by given entry. + */ +//============================================================================= +char* Engines_Component_i::getObjectInfo(const char* /*entry*/) +{ + return CORBA::string_dup(""); +} - \return string containing component's version, e.g. "1.0" -*/ +//============================================================================= +/*! + * \brief Get version of the component + * + * This method is supposed to be implemented in all derived classes; default implementation + * returns empty string that means that no version information about the component is available. + * + * \note The version of the component is stored to the study, as a part of general persistence + * mechanism; once stored, version information in the study cannot be changed. + * + * \return string containing component's version, e.g. "1.0" + */ +//============================================================================= char* Engines_Component_i::getVersion() { return CORBA::string_dup( "" );