Back to index

salome-kernel  6.5.0
Public Member Functions | Public Attributes
salomeConsole.client Class Reference
Inheritance diagram for salomeConsole.client:
Inheritance graph
[legend]
Collaboration diagram for salomeConsole.client:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def initNS
def showNScontext
def showNS
def Resolve
def waitNS
def waitNSPID
def ResolveLogger
def waitLogger

Public Attributes

 rootContext
 orb
 = 100 * 1024 * 1024 Initialise the ORB

Detailed Description

Definition at line 86 of file salomeConsole.py.


Member Function Documentation

def salomeConsole.client.initNS (   self,
  args 
)

Reimplemented from orbmodule.client.

Definition at line 87 of file salomeConsole.py.

00087 
00088    def initNS(self,args):
00089       # Obtain a reference to the root naming context
00090       obj         = self.orb.resolve_initial_references("NameService")
00091       try:
00092           self.rootContext = obj._narrow(CosNaming.NamingContext)
00093           return
00094       except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE):
00095           print "It's not a valid naming service"
00096           self.rootContext = None
00097           raise
00098 
clt=client()
def orbmodule.client.Resolve (   self,
  Path 
) [inherited]

Definition at line 114 of file orbmodule.py.

00114 
00115    def Resolve(self, Path):
00116       resolve_path=string.split(Path,'/')
00117       if resolve_path[0] == '': del resolve_path[0]
00118       dir_path=resolve_path[:-1]
00119       context_name=[]
00120       for e in dir_path:
00121          context_name.append(CosNaming.NameComponent(e,"dir"))
00122       context_name.append(CosNaming.NameComponent(resolve_path[-1],"object"))
00123 
00124       try:
00125           obj = self.rootContext.resolve(context_name)
00126       except CosNaming.NamingContext.NotFound, ex:
00127           obj = None
00128       except CosNaming.NamingContext.InvalidName, ex:
00129           obj = None
00130       except CosNaming.NamingContext.CannotProceed, ex:
00131           obj = None
00132       except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE):
00133           obj = None
00134       return obj

Here is the caller graph for this function:

def orbmodule.client.ResolveLogger (   self,
  name 
) [inherited]

Definition at line 194 of file orbmodule.py.

00194 
00195    def ResolveLogger(self, name):
00196       context_name=[]
00197       context_name.append(CosNaming.NameComponent(name,""))
00198 
00199       try:
00200           obj = self.rootContext.resolve(context_name)
00201       except CosNaming.NamingContext.NotFound, ex:
00202           obj = None
00203       except CosNaming.NamingContext.InvalidName, ex:
00204           obj = None
00205       except CosNaming.NamingContext.CannotProceed, ex:
00206           obj = None
00207       except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE):
00208           obj = None
00209       return obj
   

Here is the caller graph for this function:

def orbmodule.client.showNS (   self) [inherited]
Show the content of SALOME naming service 

Definition at line 108 of file orbmodule.py.

00108 
00109    def showNS(self):
00110       """ Show the content of SALOME naming service """
00111       self.showNScontext(self.rootContext)

Here is the call graph for this function:

def orbmodule.client.showNScontext (   self,
  context,
  dec = '' 
) [inherited]

Definition at line 93 of file orbmodule.py.

00093 
00094    def showNScontext(self,context,dec=''):
00095       bl,bi=context.list(0)
00096       if bi is not None:
00097          ok,b=bi.next_one()
00098          while(ok):
00099             for s in b.binding_name :
00100                print "%s%s.%s" %(dec,s.id,s.kind)
00101                if s.kind == "dir":
00102                   obj=context.resolve([s])
00103                   scontext = obj._narrow(CosNaming.NamingContext)
00104                   self.showNScontext(scontext,dec=dec+'  ')
00105             ok,b=bi.next_one()

Here is the call graph for this function:

Here is the caller graph for this function:

def orbmodule.client.waitLogger (   self,
  name,
  typobj = None,
  maxcount = 40 
) [inherited]

Definition at line 212 of file orbmodule.py.

00212 
00213    def waitLogger(self,name,typobj=None,maxcount=40):
00214       count=0
00215       delta=0.5
00216       print "Searching %s in Naming Service " % name,
00217       while(1):
00218           count += 1
00219           if count > maxcount : raise RuntimeError, "Impossible de trouver %s" % name
00220           obj=self.ResolveLogger(name)
00221           if obj : 
00222               print " found in %s seconds " % ((count-1)*delta)
00223               break
00224           else:
00225               sys.stdout.write('+')
00226               sys.stdout.flush()
00227               time.sleep(delta)
00228  
00229       if typobj is None:return obj
00230 
00231       nobj = obj._narrow(typobj)
00232       if nobj is None:
00233             print "%s exists but is not a %s" % (name,typobj)
00234       return nobj
00235 

Here is the call graph for this function:

def orbmodule.client.waitNS (   self,
  name,
  typobj = None,
  maxcount = 240 
) [inherited]

Definition at line 137 of file orbmodule.py.

00137 
00138    def waitNS(self,name,typobj=None,maxcount=240):
00139       count=0
00140       delta=0.5
00141       print "Searching %s in Naming Service " % name,
00142       while(1):
00143           count += 1
00144           if count > maxcount : raise RuntimeError, "Impossible de trouver %s" % name
00145           obj=self.Resolve(name)
00146           if obj : 
00147               print " found in %s seconds " % ((count-1)*delta)
00148               break
00149           else:
00150               sys.stdout.write('+')
00151               sys.stdout.flush()
00152               time.sleep(delta)
00153  
00154       if typobj is None:return obj
00155 
00156       nobj = obj._narrow(typobj)
00157       if nobj is None:
00158             print "%s exists but is not a %s" % (name,typobj)
00159       return nobj

Here is the call graph for this function:

def orbmodule.client.waitNSPID (   self,
  theName,
  thePID,
  theTypObj = None 
) [inherited]

Definition at line 161 of file orbmodule.py.

00161 
00162     def waitNSPID(self, theName, thePID, theTypObj = None):
00163       aCount = 0
00164       aDelta = 0.5
00165       anObj = None
00166       print "Searching %s in Naming Service " % theName,
00167       while(1):
00168          try:
00169            os.kill(thePID,0)
00170          except:
00171            raise RuntimeError, "Process %d for %s not found" % (thePID,theName)
00172          aCount += 1
00173          anObj = self.Resolve(theName)
00174          if anObj: 
00175             print " found in %s seconds " % ((aCount-1)*aDelta)
00176             break
00177          else:
00178             sys.stdout.write('+')
00179             sys.stdout.flush()
00180             time.sleep(aDelta)
00181             pass
00182          pass
00183       
00184       if theTypObj is None:
00185          return anObj
00186 
00187       anObject = anObj._narrow(theTypObj)
00188       if anObject is None:
00189          print "%s exists but is not a %s" % (theName,theTypObj)
00190       return anObject
00191 

Here is the call graph for this function:


Member Data Documentation

orbmodule.client.orb [inherited]

= 100 * 1024 * 1024 Initialise the ORB

Definition at line 47 of file orbmodule.py.

Reimplemented from orbmodule.client.

Definition at line 91 of file salomeConsole.py.


The documentation for this class was generated from the following file: