orb=CORBA.ORB_init([''])
import KernelModuleCatalog
import SALOME_ModuleCatalog
- modulcat = KernelModuleCatalog.myModuleCatalog()
+ from salome_kernel import list_of_catalogs_regarding_environement
+ modulcat = KernelModuleCatalog.myModuleCatalog( list_of_catalogs_regarding_environement() )
# activate poaManager to accept co-localized CORBA calls.
poa = orb.resolve_initial_references("RootPOA")
poaManager = poa._get_the_POAManager()
dsm = None
modulcat = None
+def list_of_catalogs_regarding_environement():
+ """
+ Method to detect XML module catalogs regarding environement variables
+ """
+ import os
+ KEY_IN_ENV_VAR = "_ROOT_DIR"
+ modules_env_var = [elt for elt in os.environ.keys() if elt[-len(KEY_IN_ENV_VAR):]==KEY_IN_ENV_VAR]
+ list_catalogs = []
+ for module_env_var in modules_env_var:
+ module_upper_case = module_env_var[:-len(KEY_IN_ENV_VAR)]
+ file_candidate = os.path.join(os.environ[module_env_var],"share","salome","resources",module_upper_case.lower(),"{}Catalog.xml".format(module_upper_case))
+ if os.path.isfile(file_candidate):
+ list_catalogs.append(file_candidate)
+ pass
+ return list_catalogs
+
def salome_kernel_init():
global orb, lcc, naming_service, cm, esm, dsm, modulcat
#include "SALOME_ModuleCatalog_impl.hxx"
#include "SALOME_KernelServices.hxx"
-std::string GetModuleCatalogInstance()
+std::string GetModuleCatalogInstance(const std::string& listOfCatalogsGrouped)
{
- SALOME_ModuleCatalog::ModuleCatalog_var study = KERNEL::getModuleComponentServantSA();
+ SALOME_ModuleCatalog::ModuleCatalog_var study = KERNEL::getModuleComponentServantSA(listOfCatalogsGrouped.c_str());
CORBA::ORB_ptr orb = KERNEL::getORB();
CORBA::String_var ior = orb->object_to_string(study);
return std::string(ior.in());
#include <string>
-std::string GetModuleCatalogInstance();
+std::string GetModuleCatalogInstance(const std::string& listOfCatalogsGrouped);
%inline
{
- std::string GetModuleCatalogInstance();
+ std::string GetModuleCatalogInstance(const std::string& listOfCatalogsGrouped);
}
%pythoncode %{
-def myModuleCatalog():
+def myModuleCatalog(listOfCatalogs):
import SALOMEDS
import CORBA
orb=CORBA.ORB_init([''])
- return orb.string_to_object(GetModuleCatalogInstance())
+ param = "::".join(["\"{}\"".format(elt) for elt in listOfCatalogs])
+ return orb.string_to_object(GetModuleCatalogInstance(param))
%}
static const char* SEPARATOR = "::";
static const char* OLD_SEPARATOR = ":";
-SALOME_ModuleCatalog::ModuleCatalog_ptr KERNEL::getModuleComponentServantSA()
+SALOME_ModuleCatalog::ModuleCatalog_ptr KERNEL::getModuleComponentServantSA(const char *listOfCatalogs)
{
static SALOME_ModuleCatalog::ModuleCatalog_var moduleCata;
if(CORBA::is_nil(moduleCata))
{
CORBA::ORB_ptr orb = KERNEL::getORB();
- char *argv[3] = {"SALOME_ModuleCatalog_Server",nullptr};
- SALOME_ModuleCatalogImpl *servant = new SALOME_ModuleCatalogImpl(1,argv,orb);
+ constexpr int NB_OF_ELT_IN_CMD = 3;
+ char *argv[NB_OF_ELT_IN_CMD] = {"SALOME_ModuleCatalog_Server","-common",nullptr};
+ if(listOfCatalogs)
+ argv[2] = const_cast<char*>(listOfCatalogs);
+ SALOME_ModuleCatalogImpl *servant = new SALOME_ModuleCatalogImpl(NB_OF_ELT_IN_CMD,argv,orb);
moduleCata = servant->_this();
}
return SALOME_ModuleCatalog::ModuleCatalog::_duplicate(moduleCata);
namespace KERNEL
{
- MODULECATALOG_EXPORT SALOME_ModuleCatalog::ModuleCatalog_ptr getModuleComponentServantSA();
+ MODULECATALOG_EXPORT SALOME_ModuleCatalog::ModuleCatalog_ptr getModuleComponentServantSA(const char *listOfCatalogs = nullptr);
}
class MODULECATALOG_EXPORT SALOME_ModuleCatalogImpl: public POA_SALOME_ModuleCatalog::ModuleCatalog