]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
*** empty log message ***
authorageay <ageay>
Thu, 20 Jan 2005 07:27:40 +0000 (07:27 +0000)
committerageay <ageay>
Thu, 20 Jan 2005 07:27:40 +0000 (07:27 +0000)
src/LifeCycleCORBA/LifeCycleCORBA.py
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx

index 97e8155aeedfa5c03bb2fd54c8af70279e8e86de..82c3649368b57350d234e7dee3cbe816f6850800 100644 (file)
@@ -157,11 +157,8 @@ class LifeCycleCORBA:
                     machinesOK.append(currentMachine)
                     pass
                 pass
-            print "Finding best ..........",len(machinesOK)
             if len(machinesOK)!=0:
-                print "Finding best .........."
                 bestMachine=self._contManager.FindBest(machinesOK)
-                print "Finding best done .........."
                 componentNameForNS= [CosNaming.NameComponent(bestMachine,"dir"),
                                      CosNaming.NameComponent(containerName,"dir"),
                                      CosNaming.NameComponent(componentName,"object")]
@@ -220,122 +217,3 @@ class LifeCycleCORBA:
                 return ret
             pass
         
-    
-
-##    def FindOrStartContainer(self, theComputer , theContainer ):
-##        MESSAGE( "FindOrStartContainer" + theComputer + theContainer )
-##        aContainer = self.FindContainer( theComputer + "/" + theContainer )
-##        if aContainer is None :
-##            if (theContainer == "FactoryServer") | (theContainer == "FactoryServerPy") :
-##                myMachine=getShortHostName()
-##                if theComputer == myMachine :
-##                    rshstr = ""
-##                else :
-##                    rshstr = "rsh -n " + theComputer + " "
-##                path = self.ComputerPath( theComputer )
-####                if path != "" :
-####                    rshstr = rshstr + path + "/../bin/"
-####                else :
-####                    rshstr = rshstr + os.getenv( "KERNEL_ROOT_DIR" ) + "/bin/"
-##                if theContainer == "FactoryServer" :
-##                    rshstr = rshstr + path + "SALOME_Container "
-##                else :
-##                    rshstr = rshstr + path + "SALOME_ContainerPy.py '"
-##                rshstr = rshstr + theContainer + " -"
-##             omniORBcfg = os.getenv( "OMNIORB_CONFIG" )
-##                file = os.open( omniORBcfg , os.O_RDONLY )
-##                ORBInitRef = os.read(file,132)
-##                if ORBInitRef[len(ORBInitRef)-1] == '\n' :
-##                    ORBInitRef,bsn = ORBInitRef.split('\n')
-##                os.close( file )
-##                rshstr = rshstr + ORBInitRef
-##                if theContainer == "FactoryServerPy" :
-##                    rshstr = rshstr + "'"
-##                rshstr = rshstr + " > /tmp/" + theContainer + "_"
-##                rshstr = rshstr + theComputer
-##                rshstr = rshstr + ".log 2>&1 &"
-##                os.system( rshstr )
-##                MESSAGE( "FindOrStartContainer" + rshstr + " done" )
-##            else :
-##                if theContainer.find('Py') == -1 :
-##                    aContainer = self.FindContainer( theComputer + "/" + "FactoryServer" )
-##                else :
-##                    aContainer = self.FindContainer( theComputer + "/" + "FactoryServerPy" )
-##                aContainer = aContainer.start_impl( theContainer )
-
-##            count = 21
-##            while aContainer is None :
-##                time.sleep(1)
-##                count = count - 1
-##                MESSAGE( str(count) + ". Waiting for " + theComputer + "/" + theContainer )
-##                aContainer = self.FindContainer( theComputer + "/" + theContainer )
-##                if count == 0 :
-##                    return aContainer
-            
-##        return  aContainer       
-##        #os.system("rsh -n dm2s0017 /export/home/KERNEL_ROOT/bin/runSession SALOME_Container -ORBInitRef NameService=corbaname::dm2s0017:1515")
-
-##    #-------------------------------------------------------------------------
-
-##    def FindOrLoadComponent(self, containerName, componentName):
-
-##        theComputer,theContainer = self.ContainerName( containerName )
-##        name = [CosNaming.NameComponent(theComputer,"dir"),
-##                CosNaming.NameComponent(theContainer,"dir"),
-##                CosNaming.NameComponent(componentName,"object")]
-##        try:
-##            obj = self._containerRootContext.resolve(name)
-##        except CosNaming.NamingContext.NotFound, ex:
-##            MESSAGE( "component " + componentName + " not found, trying to load" )
-##            container = self.FindContainer(theComputer + "/" + theContainer)
-##            if container is None:
-##                MESSAGE( "container " + theComputer + "/" + theContainer + " not found in Naming Service, trying to start" )
-##                if (theContainer != "FactoryServer") & (theContainer != "FactoryServerPy") :
-##                    if theContainer.find('Py') == -1 :
-##                        theFactorycontainer = "FactoryServer"
-##                    else :
-##                        theFactorycontainer = "FactoryServerPy"
-##                    Factorycontainer = self.FindContainer(theComputer + "/" + theFactorycontainer)
-##                    if Factorycontainer is None:
-##                        MESSAGE( "container " + theComputer + "/" + theFactorycontainer + " not found in Naming Service, trying to start" )
-##                        Factorycontainer = self.FindOrStartContainer(theComputer,theFactorycontainer)
-##                else:
-##                    Factorycontainer = self.FindOrStartContainer(theComputer,theContainer)
-##                if Factorycontainer != None :
-##                    container = self.FindOrStartContainer(theComputer,theContainer)
-
-##            if container != None:
-##                compoinfo = self._catalog.GetComponent(componentName)
-##                if compoinfo is None:
-##                    MESSAGE( "component " + componentName + " not found in Module Catalog" )
-##                else:
-##                    try:
-##                        machineName = theComputer
-##                        path = compoinfo.GetPathPrefix(machineName) + "/"
-##                    except SALOME_ModuleCatalog.NotFound, ex:
-##                        MESSAGE( "machine " + machineName + " not found in Module Catalog" )
-##                        MESSAGE( "trying localhost" )
-##                        try:
-##                            path = compoinfo.GetPathPrefix("localhost") + "/"
-##                        except SALOME_ModuleCatalog.NotFound, ex:
-##                            path = ""
-##                    implementation = path + "lib" + componentName + "Engine.so"
-##                    MESSAGE( "Trying to load " + implementation )
-##                    try:
-##                        component = container.load_impl(componentName, implementation)
-##                        MESSAGE( "component " + component._get_instanceName() + " launched !" )
-##                        return component
-##                    except:
-##                        MESSAGE( "component " + componentName + " NOT launched !" )
-
-##        else:
-##            try:
-##                component = obj._narrow(Engines.Component)
-##                if component is None:
-##                    MESSAGE( componentName + " is not a component !" )
-##                else:
-##                    MESSAGE( "component " + component._get_instanceName() + " found !" )
-##                return component
-##            except:
-##                MESSAGE( componentName + " failure" )
-##                return None
index f5c43f744be103aa4d2e39e8180b8090a4e19983..cbc8b24ecc687ae74187ec385385498843b8acd1 100644 (file)
@@ -109,15 +109,31 @@ Engines::Component_ptr SALOME_LifeCycleCORBA::FindOrLoad_Component
                                   (const char *containerName,
                                   const char *componentName)
 {
-  cout << "FindOrLoad_Component C++" << endl;
-  Engines::MachineList_var listOfMachine=new Engines::MachineList;
-  listOfMachine->length(1);
-  listOfMachine[0]=CORBA::string_dup(GetHostname().c_str());
-  Engines::Component_ptr ret=FindComponent(containerName,componentName,listOfMachine.in());
-  if(CORBA::is_nil(ret))
-    return LoadComponent(containerName,componentName,listOfMachine);
-  else
-    return ret;
+  char *stContainer=strdup(containerName);
+  string st2Container(stContainer);
+  int rg=st2Container.find("/");
+  if(rg<0) {
+    //containerName doesn't contain "/" => Local container
+    free(stContainer);
+    Engines::MachineList_var listOfMachine=new Engines::MachineList;
+    listOfMachine->length(1);
+    listOfMachine[0]=CORBA::string_dup(GetHostname().c_str());
+    Engines::Component_ptr ret=FindComponent(containerName,componentName,listOfMachine.in());
+    if(CORBA::is_nil(ret))
+      return LoadComponent(containerName,componentName,listOfMachine);
+    else
+      return ret;
+  }
+  else {
+    //containerName contains "/" => Remote container
+    stContainer[rg]='\0';
+    Engines::MachineParameters_var params=new Engines::MachineParameters;
+    params->container_name=CORBA::string_dup(stContainer+rg+1);
+    params->hostname=CORBA::string_dup(stContainer);
+    params->OS=CORBA::string_dup("LINUX");
+    free(stContainer);
+    return FindOrLoad_Component(params,componentName);
+  }
 }
 
 Engines::Component_ptr SALOME_LifeCycleCORBA::FindOrLoad_Component(const Engines::MachineParameters& params,