class AE: #(Thread): #xmlFileName = workspaceXmlPath + os.sep + 'Scenario_XML_2012-291T17.49.09.xml' #packageName = 'Scenario_medium_2012' xmlFileName = workspaceXmlPath + os.sep + 'Scenario_XML_2012-291T17.48.51.xml' packageName = 'Scenario_large_2012' generatedXmlFileName = 'unspecified' timeScale = 1.0e15 # Options for what to run # sysMlToAeXml = True # xmlToJava = True # compileAndLoad = True # execute = True # simulate = True # animate = True options = { 'sysMlToAeXml': True, 'xmlToJava': True, 'writeJavaFiles': True, 'compile': True, 'load': True, 'execute': True, 'simulate': True, 'animate': True } # options = { 'sysMlToAeXml':False, 'xmlToJava':False, 'writeJavaFiles':False, # 'compile':False, 'load':True, 'execute':True, 'simulate':True, # 'animate':True } # other members translator = None translatorTester = None mainEvent = None simulator = None magicDrawExecutor = None system = None # the selected SysML system/component to be processed def __init__(self, system): #, anim):#, sim): ''' Constructor ''' self.system = system def runSysMlToAeXml(self): import ExportForAnalysisEngine_v2 reload(ExportForAnalysisEngine_v2) ExportForAnalysisEngine_v2.run(self.system) self.generatedXmlFileName = ExportForAnalysisEngine_v2.generatedXmlFileName def simulate(self): if self.simulator != None: self.simulator.simulate(self.timeScale) def run(self): print "AE run() start" testJava() print "AE run() start2" gl.log("running AE.py with options: " + str(self.options)) if self.options['sysMlToAeXml']: gl.log("translating sysML to XML") self.runSysMlToAeXml() gl.log("translated sysML to " + self.generatedXmlFileName) print "AE about to build tester" if self.options['xmlToJava']: self.xmlFileName = self.generatedXmlFileName gl.log("translating " + str(self.xmlFileName) + " to Java in package " + str(self.packageName)) self.translatorTester = TestEventXmlToJava(self.xmlFileName, self.packageName, self.options['xmlToJava']) print "AE built tester" #self.translatorTester = TestEventXmlToJava( self.xmlFileName, self.packageName ) if self.options['writeJavaFiles']: gl.log("writing Java") self.translatorTester.writeFiles() self.translator = self.translatorTester.translator if self.options['compile']: if self.translator == None: print >> sys.stderr, "Trying to compile, but there's no translator to provide it!" else: gl.log("compiling Java") os.chdir(projectPath) self.translator.compile(projectPath) if self.options['load']: if self.translator == None: print >> sys.stderr, "Trying to load Java, but there's no translator to provide it!" else: gl.log("loading Java") os.chdir(projectPath) self.translator.load(projectPath) if self.options['execute']: if self.translator == None: print >> sys.stderr, "Trying to execute event, but there's no translator to provide it!" else: gl.log("executing Java") self.mainEvent = self.translator.generateExecution() if self.options['simulate']: if self.mainEvent == None: print >> sys.stderr, "Trying to simulate with no event to simulate!" else: gl.log("simulating") self.simulator = self.mainEvent.createEventSimulation() if self.simulator == None: #gl.log("") print >> sys.stderr, "Trying to simulate with no simulator!" else: if self.options['animate']: gl.log("and animating") import MagicDrawExecutor reload(MagicDrawExecutor) from MagicDrawExecutor import MagicDrawExecutor self.magicDrawExecutor = MagicDrawExecutor() self.simulator.add(self.magicDrawExecutor) t = Thread(target=self.simulate, args=None) t.start() print "PYTHONPATH = " + str(os.getenv("PYTHONPATH")) print "AE run() finished!"
class AE:#(Thread): #xmlFileName = workspaceXmlPath + os.sep + 'Scenario_XML_2012-291T17.49.09.xml' #packageName = 'Scenario_medium_2012' xmlFileName = workspaceXmlPath + os.sep + 'Scenario_XML_2012-291T17.48.51.xml' packageName = 'Scenario_large_2012' generatedXmlFileName = 'unspecified' timeScale = 1.0e15 # Options for what to run # sysMlToAeXml = True # xmlToJava = True # compileAndLoad = True # execute = True # simulate = True # animate = True options = { 'sysMlToAeXml':True, 'xmlToJava':True, 'writeJavaFiles':True, 'compile':True, 'load':True, 'execute':True, 'simulate':True, 'animate':True } # options = { 'sysMlToAeXml':False, 'xmlToJava':False, 'writeJavaFiles':False, # 'compile':False, 'load':True, 'execute':True, 'simulate':True, # 'animate':True } # other members translator = None translatorTester = None mainEvent = None simulator = None magicDrawExecutor = None system = None # the selected SysML system/component to be processed def __init__(self, system):#, anim):#, sim): ''' Constructor ''' self.system = system def runSysMlToAeXml(self): import ExportForAnalysisEngine_v2 reload(ExportForAnalysisEngine_v2) ExportForAnalysisEngine_v2.run(self.system) self.generatedXmlFileName = ExportForAnalysisEngine_v2.generatedXmlFileName def simulate( self ): if self.simulator != None: self.simulator.simulate( self.timeScale ) def run(self): print "AE run() start" testJava() print "AE run() start2" gl.log( "running AE.py with options: " + str(self.options) ) if self.options['sysMlToAeXml']: gl.log("translating sysML to XML") self.runSysMlToAeXml() gl.log("translated sysML to " + self.generatedXmlFileName) print "AE about to build tester" if self.options['xmlToJava']: self.xmlFileName = self.generatedXmlFileName gl.log("translating " + str(self.xmlFileName) + " to Java in package " + str(self.packageName) ) self.translatorTester = TestEventXmlToJava( self.xmlFileName, self.packageName, self.options['xmlToJava'] ) print "AE built tester" #self.translatorTester = TestEventXmlToJava( self.xmlFileName, self.packageName ) if self.options['writeJavaFiles']: gl.log("writing Java") self.translatorTester.writeFiles() self.translator = self.translatorTester.translator if self.options['compile']: if self.translator == None: print >>sys.stderr, "Trying to compile, but there's no translator to provide it!" else: gl.log("compiling Java") os.chdir(projectPath) self.translator.compile( projectPath ) if self.options['load']: if self.translator == None: print >>sys.stderr, "Trying to load Java, but there's no translator to provide it!" else: gl.log("loading Java") os.chdir(projectPath) self.translator.load( projectPath ) if self.options['execute']: if self.translator == None: print >>sys.stderr, "Trying to execute event, but there's no translator to provide it!" else: gl.log("executing Java") self.mainEvent = self.translator.generateExecution() if self.options['simulate']: if self.mainEvent == None: print >>sys.stderr, "Trying to simulate with no event to simulate!" else: gl.log("simulating") self.simulator = self.mainEvent.createEventSimulation() if self.simulator == None: #gl.log("") print >>sys.stderr, "Trying to simulate with no simulator!" else: if self.options['animate']: gl.log("and animating") import MagicDrawExecutor reload(MagicDrawExecutor) from MagicDrawExecutor import MagicDrawExecutor self.magicDrawExecutor = MagicDrawExecutor() self.simulator.add( self.magicDrawExecutor ) t = Thread(target=self.simulate, args=None) t.start() print "PYTHONPATH = " + str(os.getenv("PYTHONPATH")) print "AE run() finished!"
def run(self): print "AE run() start" testJava() print "AE run() start2" gl.log("running AE.py with options: " + str(self.options)) if self.options['sysMlToAeXml']: gl.log("translating sysML to XML") self.runSysMlToAeXml() gl.log("translated sysML to " + self.generatedXmlFileName) print "AE about to build tester" if self.options['xmlToJava']: self.xmlFileName = self.generatedXmlFileName gl.log("translating " + str(self.xmlFileName) + " to Java in package " + str(self.packageName)) self.translatorTester = TestEventXmlToJava(self.xmlFileName, self.packageName, self.options['xmlToJava']) print "AE built tester" #self.translatorTester = TestEventXmlToJava( self.xmlFileName, self.packageName ) if self.options['writeJavaFiles']: gl.log("writing Java") self.translatorTester.writeFiles() self.translator = self.translatorTester.translator if self.options['compile']: if self.translator == None: print >> sys.stderr, "Trying to compile, but there's no translator to provide it!" else: gl.log("compiling Java") os.chdir(projectPath) self.translator.compile(projectPath) if self.options['load']: if self.translator == None: print >> sys.stderr, "Trying to load Java, but there's no translator to provide it!" else: gl.log("loading Java") os.chdir(projectPath) self.translator.load(projectPath) if self.options['execute']: if self.translator == None: print >> sys.stderr, "Trying to execute event, but there's no translator to provide it!" else: gl.log("executing Java") self.mainEvent = self.translator.generateExecution() if self.options['simulate']: if self.mainEvent == None: print >> sys.stderr, "Trying to simulate with no event to simulate!" else: gl.log("simulating") self.simulator = self.mainEvent.createEventSimulation() if self.simulator == None: #gl.log("") print >> sys.stderr, "Trying to simulate with no simulator!" else: if self.options['animate']: gl.log("and animating") import MagicDrawExecutor reload(MagicDrawExecutor) from MagicDrawExecutor import MagicDrawExecutor self.magicDrawExecutor = MagicDrawExecutor() self.simulator.add(self.magicDrawExecutor) t = Thread(target=self.simulate, args=None) t.start() print "PYTHONPATH = " + str(os.getenv("PYTHONPATH")) print "AE run() finished!"
def run(self): print "AE run() start" testJava() print "AE run() start2" gl.log( "running AE.py with options: " + str(self.options) ) if self.options['sysMlToAeXml']: gl.log("translating sysML to XML") self.runSysMlToAeXml() gl.log("translated sysML to " + self.generatedXmlFileName) print "AE about to build tester" if self.options['xmlToJava']: self.xmlFileName = self.generatedXmlFileName gl.log("translating " + str(self.xmlFileName) + " to Java in package " + str(self.packageName) ) self.translatorTester = TestEventXmlToJava( self.xmlFileName, self.packageName, self.options['xmlToJava'] ) print "AE built tester" #self.translatorTester = TestEventXmlToJava( self.xmlFileName, self.packageName ) if self.options['writeJavaFiles']: gl.log("writing Java") self.translatorTester.writeFiles() self.translator = self.translatorTester.translator if self.options['compile']: if self.translator == None: print >>sys.stderr, "Trying to compile, but there's no translator to provide it!" else: gl.log("compiling Java") os.chdir(projectPath) self.translator.compile( projectPath ) if self.options['load']: if self.translator == None: print >>sys.stderr, "Trying to load Java, but there's no translator to provide it!" else: gl.log("loading Java") os.chdir(projectPath) self.translator.load( projectPath ) if self.options['execute']: if self.translator == None: print >>sys.stderr, "Trying to execute event, but there's no translator to provide it!" else: gl.log("executing Java") self.mainEvent = self.translator.generateExecution() if self.options['simulate']: if self.mainEvent == None: print >>sys.stderr, "Trying to simulate with no event to simulate!" else: gl.log("simulating") self.simulator = self.mainEvent.createEventSimulation() if self.simulator == None: #gl.log("") print >>sys.stderr, "Trying to simulate with no simulator!" else: if self.options['animate']: gl.log("and animating") import MagicDrawExecutor reload(MagicDrawExecutor) from MagicDrawExecutor import MagicDrawExecutor self.magicDrawExecutor = MagicDrawExecutor() self.simulator.add( self.magicDrawExecutor ) t = Thread(target=self.simulate, args=None) t.start() print "PYTHONPATH = " + str(os.getenv("PYTHONPATH")) print "AE run() finished!"