Example #1
0
class TRun(threading.Thread):
    def __init__(self, caller):
        threading.Thread.__init__(self)
        self.caller = caller
        self.flag = True

    def run(self):
        try:
            print "Begin to download web template ..."
            self.dl = UrlDownload(self.caller.siteUrl)
            self.dl.execute()
            print "End to download web template"

            if self.caller.isCopyToTomcat:
                print "Begin to copy template to tomcat ..."
                try:
                    clientdir = os.path.join(self.caller.TOMCAT_HOME,
                                             r"webapps\np\clients",
                                             self.caller.instanceName)
                    print "Copy from %s to %s" % (self.dl.resultPath,
                                                  clientdir)
                    if os.path.exists(clientdir):
                        shutil.rmtree(clientdir)

                    shutil.copytree(self.dl.resultPath, clientdir)
                except:
                    print "[ERROR] Copy template to tomcat failed. From %s to %s" % (
                        self.dl.resultPath, clientdir)
                print "End to copy template to tomcat"

            if self.caller.isAddDataSource:
                print "Begin to add datasource ..."
                try:
                    mysqlds.mysql_ds_file = os.path.join(
                        self.caller.JBOSS_HOME,
                        r"server\default\deploy\mysql-ds.xml")
                    mysqlds.add_datasource(self.caller.instanceName,
                                           self.caller.dbHost,
                                           self.caller.dbPort,
                                           self.caller.dbName)
                except:
                    print "[ERROR] Add datasource failed."
                print "End to add datasource"

            print "======================================"
            print "Finish."
            print "======================================"
            wx.CallAfter(self.caller.OnFinish)
        except Exception as e:
            wx.CallAfter(self.caller.handleException, (e, ))
Example #2
0
 def run(self):
     try:
         print "Begin to download web template ..."
         self.dl = UrlDownload(self.caller.siteUrl)
         self.dl.execute()
         print "End to download web template"
         
         if self.caller.isCopyToTomcat:
             print "Begin to copy template to tomcat ..."
             try:
                 clientdir = os.path.join(self.caller.TOMCAT_HOME, r"webapps\np\clients", self.caller.instanceName)
                 print "Copy from %s to %s" % (self.dl.resultPath, clientdir)
                 if os.path.exists(clientdir):
                     shutil.rmtree(clientdir)
                 
                 shutil.copytree(self.dl.resultPath, clientdir)
             except:
                 print "[ERROR] Copy template to tomcat failed. From %s to %s" % (self.dl.resultPath, clientdir)
             print "End to copy template to tomcat"
         
         if self.caller.isAddDataSource:
             print "Begin to add datasource ..."
             try:
                 mysqlds.mysql_ds_file = os.path.join(self.caller.JBOSS_HOME, r"server\default\deploy\mysql-ds.xml")
                 mysqlds.add_datasource(self.caller.instanceName, self.caller.dbHost, self.caller.dbPort, self.caller.dbName)
             except:
                 print "[ERROR] Add datasource failed."
             print "End to add datasource"
         
         print "======================================"
         print "Finish."
         print "======================================"
         wx.CallAfter(self.caller.OnFinish)
     except Exception as e:
         wx.CallAfter(self.caller.handleException, (e,))
Example #3
0
 def run(self):
     dl = UrlDownload(self.frame.siteUrl)
     dl.execute()
Example #4
0
 def run(self):
     dl = UrlDownload(self.frame.siteUrl)
     dl.execute()