#
import sys,os,time
import string
+from nameserver import *
from omniORB import CORBA
# Import the stubs for the Naming service
import CosNaming
from runNS import *
-# -----------------------------------------------------------------------------
-
-class Server:
- XTERM="/usr/bin/X11/xterm -iconic -e "
- CMD=""
-
- def run(self):
- commande=self.XTERM+self.CMD
- print commande
- if sys.platform != "win32":
- ier=os.system(commande)
- if ier:
- print "Commande failed"
-
-# -----------------------------------------------------------------------------
-
-class NamingServer(Server):
- XTERM=""
- USER=os.getenv('USER')
- if USER is None:
- USER='anonymous'
- #os.system("mkdir -m 777 -p /tmp/logs")
- #LOGDIR="/tmp/logs/" + USER
- #os.system("mkdir -m 777 -p " + LOGDIR)
- #CMD="runNS.sh > " + LOGDIR + "/salomeNS.log 2>&1"
- startOmni()
-
-
# -----------------------------------------------------------------------------
class client:
- def __init__(self):
+ def __init__(self,args):
#set GIOP message size for bug 10560: impossible to get field values in TUI mode
sys.argv.extend(["-ORBgiopMaxMsgSize", "104857600"]) ## = 100 * 1024 * 1024
# Initialise the ORB
self.orb=CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
# Initialise the Naming Service
- self.initNS()
+ self.initNS(args)
# --------------------------------------------------------------------------
- def initNS(self):
+ def initNS(self,args):
# Obtain a reference to the root naming context
obj = self.orb.resolve_initial_references("NameService")
try:
print "Lancement du Naming Service",
# On lance le Naming Server (doit etre dans le PATH)
- NamingServer().run()
+ NamingServer(args).run()
print "Searching Naming Service ",
ncount=0
delta=0.1
if sys.platform == "win32":
#import win32pm
#command = ['omniNames -start ' , aPort , ' -logdir ' , '\"' + upath + '\"']
- os.system("start omniNames -start " + aPort + " -logdir " + "\"" + upath + "\"" )
+ #os.system("start omniNames -start " + aPort + " -logdir " + "\"" + upath + "\"" )
+ command = "start omniNames -start " + aPort + " -logdir " + "\"" + upath + "\""
#print command
- #pid = win32pm.spawnpid( string.join(command, " ") )
- #process_id[pid]=command
+ pid = win32pm.spawnpid( string.join(command, " "), -nc )
+ process_id[pid]=command
else:
os.system("omniNames -start " + aPort + " -logdir " + upath + " &")
import sys, os, string, glob, time, pickle
import orbmodule
import setenv
-
-process_id = {}
+from server import *
+#process_id = {} move to server.py
# -----------------------------------------------------------------------------
# Definition des classes d'objets pour le lancement des Server CORBA
#
-class Server:
- """Generic class for CORBA server launch"""
-
- def initArgs(self):
- self.PID=None
- self.CMD=[]
- self.ARGS=[]
- if self.args['xterm']:
- self.ARGS=['xterm', '-iconic', '-sb', '-sl', '500', '-hold']
-
- def __init__(self,args):
- self.args=args
- self.initArgs()
-
-
- def run(self):
- global process_id
- myargs=self.ARGS
- if self.args['xterm']:
- # (Debian) send LD_LIBRARY_PATH to children shells (xterm)
- env_ld_library_path=['env', 'LD_LIBRARY_PATH='
- + os.getenv("LD_LIBRARY_PATH")]
- myargs = myargs +['-T']+self.CMD[:1]+['-e'] + env_ld_library_path
- command = myargs + self.CMD
- print "SERVER::command = ", command
- if sys.platform == "win32":
- import win32pm
- pid = win32pm.spawnpid( string.join(command, " "),'-nc' )
- else:
- pid = os.spawnvp(os.P_NOWAIT, command[0], command)
- process_id[pid]=self.CMD
- self.PID = pid
-
-
class InterpServer(Server):
def __init__(self,args):
self.args=args
# Initialisation ORB et Naming Service
#
- clt=orbmodule.client()
+ clt=orbmodule.client(args)
# (non obligatoire) Lancement Logger Server
# et attente de sa disponibilite dans le naming service