コード例 #1
0
ファイル: LoadJavaConnector.py プロジェクト: wlongxiang/noora
    def execute(self, oracleSid, oracleUser, oraclePasswd, oracleScript,
                paramA, paramB, ignoreErrors):
        try:
            startupInfo = self.getStartupInfo()
            projectHelper = self.getProjectHelper()
            handle = open('feedback.log', 'wb')
            credentials = oracleUser + '/' + oraclePasswd + '@' + oracleSid

            statement = 'loadjava -user ' + credentials + ' -resolve -force ' + projectHelper.cleanPath(
                oracleScript)
            p = Popen([statement], stdout=PIPE, shell=True)
            output, error = p.communicate()

            # # templateScript='@'+projectHelper.cleanPath(self.getScriptDir()+os.sep+'template.sql')
            # print executeList
            # result = subprocess.call(executeList, shell=True, stdout=handle, stderr=handle, startupinfo=startupInfo)
            # stream = projectHelper.readFile('feedback.log')

            logger = logging.getLogger('NoOraLogger')
            logger.info(oracleScript)
            if error:
                # stream = StreamHelper.StreamHelper().convert(stream)
                # stream = stream.replace(chr(10),chr(32))
                logger.error(error)
                if ignoreErrors == False:
                    raise NooraException.NooraException(error)
            else:
                logger.info(output)
        except OSError:
            raise NooraException.NooraException(
                "Could not execute loadjava. Is it installed and in your path?"
            )
コード例 #2
0
ファイル: OracleConnector.py プロジェクト: wlongxiang/noora
    def execute(self, oracleSid, oracleUser, oraclePasswd, oracleScript,
                paramA, paramB, ignoreErrors):
        try:
            startupInfo = self.getStartupInfo()
            projectHelper = self.getProjectHelper()
            handle = open('feedback.log', 'wb')
            connectString = oracleUser + '/' + oraclePasswd + '@' + oracleSid
            templateScript = '@' + projectHelper.cleanPath(
                self.getScriptDir() + os.sep + 'template.sql')
            result = subprocess.call([
                'sqlplus', '-l', '-s', connectString, templateScript,
                projectHelper.cleanPath(oracleScript), paramA, paramB
            ],
                                     shell=False,
                                     stdout=handle,
                                     stderr=handle,
                                     startupinfo=startupInfo)
            stream = projectHelper.readFile('feedback.log')

            logger = logging.getLogger('NoOraLogger')
            logger.info(oracleScript)
            if result != 0:
                #stream = StreamHelper.StreamHelper().convert(stream)
                #stream = stream.replace(chr(10),chr(32))
                logger.error(stream)
                if ignoreErrors == False:
                    raise NooraException.NooraException(stream)
            else:
                logger.info(stream)
        except OSError:
            raise NooraException.NooraException(
                "Could not execute sqlplus. Is it installed and in your path?")
コード例 #3
0
ファイル: MysqlCreatePlugin.py プロジェクト: wlongxiang/noora
 def installComponent(self, url, mysqlHost, database, mysqlUser, mysqlPasswd):
   projectHelper=self.getProjectHelper()
   handle=open('feedback.log','wb')
   result=subprocess.call(['python',url+os.sep+'setup.py','-h='+mysqlHost,'-d='+database,'-u='+mysqlUser,'-p='+mysqlPasswd,'-silent'],shell=False,stdout=handle,stderr=handle)
   if result!=0:
     stream=projectHelper.readFile('feedback.log')
     raise NooraException.NooraException(stream)
コード例 #4
0
 def execute(self, oracleSid, oracleUser, oraclePasswd, ctlFile, dataFile, ignoreErrors):
   try:
     startupInfo=self.getStartupInfo()
     projectHelper=self.getProjectHelper()
     handle=open('feedback.log','wb')
     connectString=oracleUser+'/'+oraclePasswd+'@'+oracleSid
     controlString='control='+ctlFile
     dataString='data='+dataFile
     result=subprocess.call(['sqlldr',connectString , controlString, dataString],shell=False,stdout=handle,stderr=handle,startupinfo=startupInfo)
     stream=projectHelper.readFile('feedback.log')
    
     
     logger = logging.getLogger('NoOraLogger')
     logger.info(dataFile)
     if result!=0:  
       #stream = StreamHelper.StreamHelper().convert(stream)
       #stream = stream.replace(chr(10),chr(32))     
       logger.error(stream)
       if ignoreErrors==False:
         raise NooraException.NooraException(stream)
     else:
       logger.info(stream)
   except OSError:
     raise NooraException.NooraException("Could not execute sqlldr. Is it installed and in your path?")
コード例 #5
0
ファイル: ProjectHelper.py プロジェクト: wlongxiang/noora
 def failOnFolderPresent(self, folder, message):
     if self.folderPresent(folder):
         raise NooraException.NooraException(message)
コード例 #6
0
ファイル: ProjectHelper.py プロジェクト: wlongxiang/noora
 def failOnEmpty(self, values, message):
     if len(values) == 0:
         raise NooraException.NooraException(message)
コード例 #7
0
ファイル: ProjectHelper.py プロジェクト: wlongxiang/noora
 def invalidBuildFolder(self, buildFolder):
     if self.folderNotPresent(buildFolder):
         raise NooraException.NooraException('build folder is not present.')
コード例 #8
0
ファイル: ProjectHelper.py プロジェクト: wlongxiang/noora
 def failOnValueNotFound(self, list, value, message):
     if self.hasValue(list, value) == False:
         raise NooraException.NooraException(message)
コード例 #9
0
ファイル: ProjectHelper.py プロジェクト: wlongxiang/noora
 def failOnFileNotPresent(self, url, message):
     if self.fileNotPresent(url):
         raise NooraException.NooraException(message)
コード例 #10
0
ファイル: ProjectHelper.py プロジェクト: wlongxiang/noora
 def failOnNone(self, value, message):
     if value == None:
         raise NooraException.NooraException(message)
コード例 #11
0
 def failOnValueFound(self, keyword, values, message):
     for value in values:
         if self.hasValue(keyword, value) == True:
             raise NooraException.NooraException(message)
コード例 #12
0
 def invalidValue(self, keyword, values):
     for value in values:
         if self.hasValue(keyword, value) == False:
             raise NooraException.NooraException("the given value " + value + " for keyword " + keyword + " is not valid for this project.")
コード例 #13
0
def failOnPluginNotFound(message):
    raise NooraException.NooraException(message)