Back to index

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

List of all members.

Public Member Functions

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

Public Attributes

 orb
 = 100 * 1024 * 1024 Initialise the ORB
 rootContext

Detailed Description

Client for SALOME

Definition at line 40 of file orbmodule.py.


Constructor & Destructor Documentation

def orbmodule.client.__init__ (   self,
  args = None 
)

Definition at line 43 of file orbmodule.py.

00043 
00044    def __init__(self,args=None):
00045       #set GIOP message size for bug 10560: impossible to get field values in TUI mode
00046       sys.argv.extend(["-ORBgiopMaxMsgSize", "104857600"]) ## = 100 * 1024 * 1024
00047       # Initialise the ORB
00048       self.orb=CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
00049       # Initialise the Naming Service
00050       self.initNS(args or {})


Member Function Documentation

def orbmodule.client.initNS (   self,
  args 
)

Reimplemented in salomeConsole.client.

Definition at line 53 of file orbmodule.py.

00053 
00054    def initNS(self,args):
00055       # Obtain a reference to the root naming context
00056       obj         = self.orb.resolve_initial_references("NameService")
00057       try:
00058           self.rootContext = obj._narrow(CosNaming.NamingContext)
00059           return
00060       except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE):
00061           self.rootContext = None
00062           if verbose(): print "Launch Naming Service++",
00063           
00064       # On lance le Naming Server (doit etre dans le PATH)
00065       test = True
00066       if args['wake_up_session']:
00067          test = False
00068          pass
00069       if test:
00070          NamingServer(args).run()
00071          pass
00072       print "Searching Naming Service ",
00073       ncount=0
00074       delta=0.1
00075       while(ncount < 100):
00076           ncount += 1
00077           try:
00078               obj = self.orb.resolve_initial_references("NameService")
00079               self.rootContext = obj._narrow(CosNaming.NamingContext)
00080               break
00081           except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE):
00082               self.rootContext = None
00083               sys.stdout.write('+')
00084               sys.stdout.flush()
00085               time.sleep(delta)
00086 
00087       if self.rootContext is None:
00088           print "Failed to narrow the root naming context"
00089           sys.exit(1)
00090       print " found in %s seconds " % ((ncount-1)*delta)

def orbmodule.client.Resolve (   self,
  Path 
)

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 
)

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)
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 = '' 
)

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 
)

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 
)

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 
)

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

= 100 * 1024 * 1024 Initialise the ORB

Definition at line 47 of file orbmodule.py.

Reimplemented in salomeConsole.client.

Definition at line 57 of file orbmodule.py.


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