using namespace std;
-const char *SALOME_ContainerManager::_ContainerManagerNameInNS="ContainerManager";
+const char *SALOME_ContainerManager::_ContainerManagerNameInNS="/ContainerManager";
SALOME_ContainerManager::SALOME_ContainerManager(CORBA::ORB_ptr orb)
{
vector<string> vec=_NS->list_directory_recurs();
for(vector<string>::iterator iter=vec.begin();iter!=vec.end();iter++)
{
+ SCRUTE((*iter));
CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
Engines::Container_var cont=Engines::Container::_narrow(obj);
if(!CORBA::is_nil(cont))
if ( count != 10 )
MESSAGE( count << ". Waiting for FactoryServer on " << theMachine);
string containerNameInNS=BuildContainerNameInNS(containerName,theMachine.c_str());
+ SCRUTE(containerNameInNS);
CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str());
ret=Engines::Container::_narrow(obj);
}
Engines::Container_ptr SALOME_ContainerManager::FindContainer(const char *containerName,const char *theMachine)
{
string containerNameInNS(BuildContainerNameInNS(containerName,theMachine));
+ SCRUTE(containerNameInNS);
CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str());
if( !CORBA::is_nil(obj) )
return Engines::Container::_narrow(obj);
_NS = ns;
//add try catch
CORBA::Object_var obj=_NS->Resolve(SALOME_ContainerManager::_ContainerManagerNameInNS);
+ ASSERT( !CORBA::is_nil(obj));
_ContManager=Engines::ContainerManager::_narrow(obj);
}
return theComputerContainer ;
}
+bool SALOME_LifeCycleCORBA::isKnownComponentClass(const char *componentName)
+{
+
+ try
+ {
+ CORBA::Object_var obj = _NS->Resolve("/Kernel/ModulCatalog");
+ SALOME_ModuleCatalog::ModuleCatalog_var Catalog =
+ SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj) ;
+ SALOME_ModuleCatalog::Acomponent_ptr compoInfo =
+ Catalog->GetComponent(componentName);
+ if (CORBA::is_nil (compoInfo))
+ {
+ INFOS("Catalog Error : Component not found in the catalog");
+ return false;
+ }
+ else return true;
+ }
+ catch (ServiceUnreachable&)
+ {
+ INFOS("Caught exception: Naming Service Unreachable");
+ }
+ catch (...)
+ {
+ INFOS("Caught unknown exception.");
+ }
+ return false;
+}
+
string SALOME_LifeCycleCORBA::ComputerPath(
const char * theComputer ) {
CORBA::String_var path;
(const char *containerName,
const char *componentName)
{
+ if (! isKnownComponentClass(componentName)) return Engines::Component::_nil();
char *stContainer=strdup(containerName);
string st2Container(stContainer);
int rg=st2Container.find("/");
Engines::Component_ptr SALOME_LifeCycleCORBA::FindOrLoad_Component(const Engines::MachineParameters& params,
const char *componentName)
{
+ if (! isKnownComponentClass(componentName)) return Engines::Component::_nil();
Engines::MachineList_var listOfMachine=_ContManager->GetFittingResources(params,componentName);
Engines::Component_ptr ret=FindComponent(params.container_name,componentName,listOfMachine);
if(CORBA::is_nil(ret))
const char *componentName,
const Engines::MachineList& listOfMachines)
{
+ if (! isKnownComponentClass(componentName)) return Engines::Component::_nil();
if(containerName[0]!='\0')
{
Engines::MachineList_var machinesOK=new Engines::MachineList;
const char *componentName);
Engines::Component_ptr FindOrLoad_Component(const char *containerName,
const char *componentName);
+ bool isKnownComponentClass(const char *componentName);
protected:
//! Establish if a component called "componentName" in a container called "containerName" exists among the list of resources
//! in "listOfMachines". This method uses Naming Service to find the component.