X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=bin%2Forbmodule.py;h=9dfad8a2c025352bfc27f3c26d07ff1a9473a56b;hb=9195c8e92b96a973e05d21904e2841ff14a72f73;hp=627a909871cf824177d886647c4b2763a878e37c;hpb=01dfd25ddd6405ac88e31b49676c09e32924411f;p=modules%2Fkernel.git diff --git a/bin/orbmodule.py b/bin/orbmodule.py index 627a90987..9dfad8a2c 100755 --- a/bin/orbmodule.py +++ b/bin/orbmodule.py @@ -47,7 +47,7 @@ class client: try: self.rootContext = obj._narrow(CosNaming.NamingContext) return - except CORBA.COMM_FAILURE: + except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE): self.rootContext = None print "Lancement du Naming Service", @@ -62,7 +62,7 @@ class client: obj = self.orb.resolve_initial_references("NameService") self.rootContext = obj._narrow(CosNaming.NamingContext) break - except (CORBA.COMM_FAILURE,CORBA.OBJECT_NOT_EXIST): + except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE): self.rootContext = None sys.stdout.write('+') sys.stdout.flush() @@ -77,15 +77,16 @@ class client: def showNScontext(self,context,dec=''): bl,bi=context.list(0) - ok,b=bi.next_one() - while(ok): - for s in b.binding_name : - print "%s%s.%s" %(dec,s.id,s.kind) - if s.kind == "dir": - obj=context.resolve([s]) - scontext = obj._narrow(CosNaming.NamingContext) - self.showNScontext(scontext,dec=dec+' ') + if bi is not None: ok,b=bi.next_one() + while(ok): + for s in b.binding_name : + print "%s%s.%s" %(dec,s.id,s.kind) + if s.kind == "dir": + obj=context.resolve([s]) + scontext = obj._narrow(CosNaming.NamingContext) + self.showNScontext(scontext,dec=dec+' ') + ok,b=bi.next_one() # -------------------------------------------------------------------------- @@ -112,7 +113,7 @@ class client: obj = None except CosNaming.NamingContext.CannotProceed, ex: obj = None - except CORBA.COMM_FAILURE, ex: + except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE): obj = None return obj @@ -140,6 +141,36 @@ class client: if nobj is None: print "%s exists but is not a %s" % (name,typobj) return nobj + def waitNSPID(self, theName, thePID, theTypObj = None): + aCount = 0 + aDelta = 0.5 + anObj = None + print "Searching %s in Naming Service " % theName, + while(1): + try: + aPid, aStatus = os.waitpid(thePID,os.WNOHANG) + except Exception, exc: + raise "Impossible de trouver %s" % theName + aCount += 1 + anObj = self.Resolve(theName) + if anObj: + print " found in %s seconds " % ((aCount-1)*aDelta) + break + else: + sys.stdout.write('+') + sys.stdout.flush() + time.sleep(aDelta) + pass + pass + + if theTypObj is None: + return anObj + + anObject = anObj._narrow(theTypObj) + if anObject is None: + print "%s exists but is not a %s" % (theName,theTypObj) + return anObject + # -------------------------------------------------------------------------- @@ -155,7 +186,7 @@ class client: obj = None except CosNaming.NamingContext.CannotProceed, ex: obj = None - except CORBA.COMM_FAILURE, ex: + except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE): obj = None return obj