def add_property(obj, ele, prop, fld, ctx):
     if ele.get(fld) is not None:
         Print.debug(' - %s: %s' % (prop, ele.get(fld)))
         obj.save_property('ProcessTypeProperties.%s' % prop, ele.get(fld))
     else:
         Print.debug(' - %s: %s' % (prop, ctx))
         obj.save_property('ProcessTypeProperties.%s' % prop, ctx)
示例#2
0
 def createObj(self,obj,name,parent,fullname,Type):                                  # function to create an object
     obj.set_name(name)
     obj.set_parent(parent)
     obj.set_fullname(fullname)
     obj.set_type(Type)
     obj.save()
     CAST.debug(str(obj.name))      
 def add_jmsproperty(obj, ele, prop, proptext):
     if ele.get(proptext) is not None:
         LOG.debug(' - %s: %s' % (prop, ele.get(proptext)))
         obj.save_property('JmsListenerProperties.%s' % prop,
                           ele.get(proptext))
     else:
         obj.save_property('JmsListenerProperties.%s' % prop, "None")
 def add_propertyfld(obj, ele, prop, fldtext):
     if ele.get(fldtext) is not None:
         Print.debug(' - %s: %s' % (prop, ele.get(fldtext)))
         obj.save_property('ProcessTypeProperties.%s' % prop,
                           ele.get(fldtext))
     else:
         obj.save_property('ProcessTypeProperties.%s' % prop, "None")
示例#5
0
    def start_type(self, type_):
        """
        @type type_: cast.analysers.Type
        """

        # iterate on annotations of the class
        for annotation in type_.get_annotations():

            # annotation is a structure, first element is the 'annotation class'
            annotationType = annotation[0]

            if annotationType.get_fullname(
            ) == 'System.Data.Linq.Mapping.TableAttribute':

                # now we can focus on parameters of the annotation
                parameters = annotation[1]

                if 'Name' in parameters:
                    table_name = parameters['Name']
                else:
                    # default value when no parameter is provided...
                    table_name = type_.get_name()

                log.debug('firing link between ' + str(type_) + ' and ' +
                          table_name)
                link_to_table(type_, table_name)
 def createGenericreportobject(self):
     #ReportModule=CustomObject()
     with open(self.filename, "rb") as binary_file:
         self.file_ref = bytearray(binary_file.read())
         index = self.filename.rfind('\\')
         self.name = self.filename[index + 1:]
         if self.filename.endswith(".csv"):
             with open(self.filename) as csvfile:
                 readCSV = csv.reader(csvfile)
                 for row in readCSV:
                     ReportModule = CustomObject()
                     self.saveObject(ReportModule, row[0] + "." + row[1],
                                     "GenericReport", self.file,
                                     self.filename,
                                     "GenericReport_" + row[0] + row[1])
                     ReportModule.save()
         #self.saveObject(ReportModule,self.name,"GenericReport",self.file,self.filename,"GenericReport_"+self.filename)
         #ReportModule.save()
         else:
             ReportModule = CustomObject()
             #Print.debug("Other than CSV file-----------")
             self.saveObject(ReportModule, self.name, "GenericReport",
                             self.file, self.filename,
                             "GenericReport_" + self.filename)
             ReportModule.save()
         checksum = self.getcrc(self.file_ref)
         Print.debug("checksum == " + str(checksum))
         ReportModule.save_property('checksum.CodeOnlyChecksum', checksum)
         Print.debug("End of Analysis!!!")
示例#7
0
    def start_type(self, type_):
        """
        @type type_: cast.analysers.Type
        """
        
        # iterate on annotations of the class
        for annotation in type_.get_annotations():
            
            
            # annotation is a structure, first element is the 'annotation class'
            annotationType = annotation[0]

            if annotationType.get_fullname() == 'System.Data.Linq.Mapping.TableAttribute':
                
                # now we can focus on parameters of the annotation 
                parameters = annotation[1]

                if 'Name' in parameters:
                    table_name = parameters['Name']
                else:
                    # default value when no parameter is provided...
                    table_name = type_.get_name()
                
                log.debug('firing link between ' + str(type_) + ' and ' + table_name)
                link_to_table(type_, table_name)
    def start_member(self, member):
        for anno in member.get_annotations():
            LOG.debug(str(anno))

            self.findannotation(
                anno, 'Type(org.hibernate.search.annotations.Field)', member,
                'HIBSEARCHFIELD')
            self.findannotation(
                anno, 'Type(org.hibernate.search.annotations.Index)', member,
                'HIBSEARCHINDEXED')
            self.findannotation(
                anno, 'Type(org.hibernate.search.annotations.Analyze)', member,
                'HIBSEARCHFIELD')
            self.findannotation(
                anno, 'Type(org.hibernate.search.annotations.ContainedIn)',
                member, 'HIBSEARCHContainedIn')
            self.findannotation(
                anno, 'Type(org.hibernate.search.annotations.IndexedEmbedded)',
                member, 'HIBSEARCHINDEXEMBEEDED')
            self.findannotation(
                anno, 'Type(org.hibernate.search.annotations.Document)',
                member, 'HIBSEARCHDOCUMENT')
            self.findannotation(
                anno, 'Type(org.hibernate.search.annotations.Boost)', member,
                'HIBSEARCHBOOST')
            self.findannotation(
                anno, 'Type(org.hibernate.search.annotations.Spatial)', member,
                'HIBSEARCHSPATIAL')
            self.findannotation(
                anno, 'Type(org.hibernate.search.annotations.FieldBridge)',
                member, 'HIBSEARCHFieldBridge')
示例#9
0
    def my_callback(self, values, caller, line, column):

        log.debug(
            "Method %s is calling java.sql.Statement.executeQuery at line %s with the following possible values for parameter 1"
            % (str(caller.get_fullname()), str(line)))
        for value in values[1]:
            log.debug("  %s" % str(value))
 def start_xml_file(self, file):
     LOG.debug('Scanning XML  file :')
     setfilter = False
     #filepath = os.path.realpath('XmlFilter.txt')
     #filepath= cwd.replace("8.2", "Extensions\com.castsoftware.labs.jeeXMLDTDinternallogger.1.1.0\XmlFilter.txt")
     filepath = "C:\ProgramData\CAST\CAST\Extensions\com.castsoftware.labs.jeeXMLDTDinternallogger.1.3.0\XmlFilter.txt"
     if (os.path.isfile(filepath)):
         #LOG.info("path--->"+ str(filepath))
         with open(filepath, 'r') as fp:
             filterlist = []
             filterlist = fp.readlines()
         if file.get_name().endswith('.xml'):
             if (os.path.isfile(file.get_path())):
                 tree = ET.parse(file.get_path(),
                                 ET.XMLParser(encoding="UTF-8"))
                 root = tree.getroot()
                 result = os.path.basename(file.get_name())
                 resultclean = ''.join(
                     [i for i in result if not i.isdigit()])
                 resultclean = resultclean.replace('-', '')
                 for x in filterlist:
                     if x.lower().strip() == resultclean.lower().strip():
                         setfilter = True
                         break
                 if setfilter == False:
                     if len(root.attrib) > 0:
                         sumattrvalue = file.get_name() + str(root.attrib)
                         with open(self.temp_file, 'a+') as fd:
                             fd.write(sumattrvalue + '\n')
                             fd.close()
 def start_properties_file(self, file):
     LOG.debug('Successfully Prop file')
     if file.get_name().endswith('.properties'):
         if (os.path.isfile(file.get_path())):
             props = self.loadprop(file)
             LOG.debug(str(props))
             self.Createpropjms(file, props, 'jms.queue.name', 'Java_JMS_QueueCall')
             self.Createpropjms(file, props, 'jms.queue.connection.factory', 'Java_JMS_QueueconnectionFactory')
    def castParserColdFusion(self, file, filename):
        with open(filename) as fp:
            soup = BeautifulSoup(fp, 'html.parser')
            return soup

        try:
            up = soup.find('i').parent
        except AttributeError:
            log.debug("Error !!!")
def parse_querystring(node_qs, obj_report, index, log=None):
    querystring = node_qs.text.replace('<![CDATA[\n','').replace(']]>','').replace('\n',' ')
    querystring = re.sub('[\t ]+',' ', querystring)
    log.debug("querystring="+querystring)
    obj_qs = QueryString("queryString"+str(index), querystring)
    obj_qs.parent = obj_report
    obj_qs.sqlquery = querystring
    obj_qs.position = get_position(node_qs)
    return obj_qs
 def add_property(sqlquery, node, prop, typeAliases):
     if prop in node.attrib:
         if node.attrib[prop] in typeAliases:
             log.debug(' - %s: %s' % (prop, typeAliases[node.attrib[prop]]))
             sqlquery.save_property('iBatisProperties.%s' % prop,
                                    typeAliases[node.attrib[prop]])
         else:
             log.debug(' - %s: %s' % (prop, node.attrib[prop]))
             sqlquery.save_property('iBatisProperties.%s' % prop,
                                    node.attrib[prop])
    def add_sqlnamedquery(sqltable, sql_queries, resultMaps, typeAliases, file,
                          namespace):
        for sqlid, node in sqltable.items():
            log.info('NEW Named Query - %s' % sqlid)

            sqlquery = CustomObject()
            sqlquery.set_name(sqlid)
            sqlquery.set_type('CAST_SQL_NamedQuery')
            sqlquery.set_parent(file)
            sqlquery.save()

            #Get SQL from node
            sql = node.text
            for sub_node in node:
                if 'refid' in sub_node.attrib and sub_node.attrib[
                        'refid'] in sql_queries:
                    sql += sql_queries[sub_node.attrib['refid']].text.strip()
                if sub_node.tail:
                    sql += sub_node.tail

            #log.info('SQL: %s' % sql)
            sqlquery.save_property('CAST_SQL_MetricableQuery.sqlQuery', sql)

            log.info(' - creating links...')
            for embedded in external_link.analyse_embedded(sql):
                for t in embedded.types:
                    #log.info(' - link to : %s' % embedded.callee.get_name())
                    link = create_link(t, sqlquery, embedded.callee)
                    link.mark_as_not_sure()

            #Save all potential properties for later use
            CommonParsing.add_property(sqlquery, node, 'parameterClass',
                                       typeAliases)
            CommonParsing.add_property(sqlquery, node, 'parameterType',
                                       typeAliases)
            CommonParsing.add_property(sqlquery, node, 'resultClass',
                                       typeAliases)
            CommonParsing.add_property(sqlquery, node, 'listClass',
                                       typeAliases)
            CommonParsing.add_property(sqlquery, node, 'resultMap',
                                       typeAliases)
            CommonParsing.add_property(sqlquery, node, 'resultType',
                                       typeAliases)
            CommonParsing.add_property(sqlquery, node, 'parameterMap',
                                       typeAliases)

            if (namespace != ''):
                log.debug('Habemus namespacus!')
                sqlquery.save_property('iBatisProperties.namespace', namespace)

            for mapId, mapClass in resultMaps.items():
                if 'resultMap' in node.attrib and node.attrib[
                        'resultMap'] == mapId:
                    log.debug(' - class: %s' % mapClass)
                    sqlquery.save_property('iBatisProperties.class', mapClass)
 def Createannsearch(self, typ, annoValue, annotext, val):
     annsearch = cast.analysers.CustomObject()
     annsearch.set_name(val)
     annsearch.set_type(val)
     parentFile = typ.get_position().get_file()
     annsearch.set_parent(parentFile)
     annsearch.set_fullname(typ.get_fullname())
     self.fielPath = parentFile.get_fullname()
     self.count = self.count + 1
     annsearch.set_guid(self.fielPath + val + str(self.count))
     annsearch.save()
     annsearch.save_position(typ.get_position())
     cast.analysers.create_link('callLink', annsearch, typ)
     LOG.debug(annotext + '   object is created with name ' + val)
     return self.Createannsearch
    def start_file(self, file):

        Print.info("fsharp : Running extension code start file")

        self.file = file
        if file.get_name().endswith('.fs'):
            #             try:
            #               self.processexternalfshaplint(file)
            #             except:
            #               Print.info ("error executing fsharp lint power shell process")

            Print.debug('Scanning fs  file :' +
                        str(Path(file.get_path()).name))
            if (os.path.isfile(file.get_path())):
                self.parsefsharpnamespace(file.get_path(), file)
                self.parsefsharpmodule(file.get_path(), file)
                self.parsefsharptype(file.get_path(), file)
                self.parsefsharplet(file.get_path(), file)
                self.parsefsharpopen(file.get_path(), file)
    def start_file(self, file):
        if file.get_name().endswith('xml'):
            log.debug('Found xml file: %s' % file.get_path())
            tree = ET.parse(file.get_path(), ET.XMLParser(encoding="utf-8"))
            root = tree.getroot()
            if root.tag == 'sqlMap' or root.tag == '{http://ibatis.apache.org/mapping}sqlMap':
                log.info('Scanning iBatis.NET file: %s' % file.get_name())

                typeAliases = TypeAliases.parse(root)

                resultMaps = ResultMaps.parse(root, typeAliases)

                sql_queries = CommonParsing.get_sql_queries(root)

                statement_queries = CommonParsing.get_statement_queries(root)
                CommonParsing.add_sqlnamedquery(statement_queries, sql_queries,
                                                resultMaps, typeAliases, file,
                                                '')

                procedure_queries = CommonParsing.get_procedure_queries(root)
                CommonParsing.add_sqlnamedquery(procedure_queries, sql_queries,
                                                resultMaps, typeAliases, file,
                                                '')

                select_queries = CommonParsing.get_select_queries(root)
                CommonParsing.add_sqlnamedquery(select_queries, sql_queries,
                                                resultMaps, typeAliases, file,
                                                '')

                insert_queries = CommonParsing.get_insert_queries(root)
                CommonParsing.add_sqlnamedquery(insert_queries, sql_queries,
                                                resultMaps, typeAliases, file,
                                                '')

                update_queries = CommonParsing.get_update_queries(root)
                CommonParsing.add_sqlnamedquery(update_queries, sql_queries,
                                                resultMaps, typeAliases, file,
                                                '')

                delete_queries = CommonParsing.get_delete_queries(root)
                CommonParsing.add_sqlnamedquery(delete_queries, sql_queries,
                                                resultMaps, typeAliases, file,
                                                '')
    def start_file(self, file):
        Print.debug("Inside start_file")

        if file.get_name().endswith('.item'):
            try:
                if (os.path.isfile(file.get_path())):
                    tree = ET.parse(file.get_path(),
                                    ET.XMLParser(encoding="UTF-8"))
                    root = tree.getroot()
                    for a in root.iter():
                        #Print.debug(a.tag)
                        self.findXMLProcess(a, 'context', file)
                        self.findXMLProcesscontext(a, 'contextParameter', file)
                        self.findXMLProcessparameter(a, 'elementParameter',
                                                     file)
                        self.findXMLProcessMetadata(a, 'metadata', file)
                        self.findXMLProcessparameter(a, 'column', file)

            except:
                return
 def CreateaXMLprocesstype(self, file, a, xsdtext):
     try:
         if a.tag == xsdtext:
             processObj = cast.analysers.CustomObject()
             processObj.set_name(a.get(self.processxmltext))
             processObj.set_type(self.processtext)
             processObj.set_parent(file)
             parentFile = file.get_position().get_file()
             self.fielPath = parentFile.get_fullname()
             processObj.set_guid(self.fielPath +
                                 a.get(self.processxmltext) +
                                 str(random.randint(1, 200)) +
                                 str(random.randint(1, 200)))
             processObj.save()
             Print.debug('Creating talend ' + xsdtext + ' object ' +
                         a.get(self.processxmltext))
             xmlParsing.add_propertyfld(processObj, a, 'TypeName', 'field',
                                        self.contextname)
             #processObj.save_position(Bookmark(file,1,1,-1,-1))
     except:
         return
    def start_file(self, file):  # Extension point : each file
        if not self.active:
            return  # no need to do something

        filepath = file.get_path()
        _, ext = os.path.splitext(filepath)

        if not ext in self.extensions:
            return
        log.debug('\t JasperReportAnalysisExtension start_file %s: %s)' %
                  (os.path.basename(filepath), filepath))

        try:
            with open_source_file(filepath) as f:
                self.nb_jrxml_files += 1
                list_reports = parse(f.read(), filepath, log)
                for report in list_reports:
                    report.save(file)
                    self.nb_reports += 1
                    self.nb_sqlqueries += len(report.list_querystrings)

        except:
            log.warning('Issue analyzing file ' + traceback.format_exc())
示例#22
0
    def start_file(self, file):
        Print.info("file start")
        s = self.get_plugin()
        #logging.info(str(s.get_plugin_directory()))
        self.xmlfile = str(s.get_plugin_directory()) + "\\mqsparsedefine.xml"
        Print.info(str(self.xmlfile))
        try:

            if (os.path.isfile(self.xmlfile)):
                tree = ET.parse(self.xmlfile, ET.XMLParser(encoding="UTF-8"))
                root = tree.getroot()

                for group in root.findall('Search'):
                    sbefore = group.find('RegexPatternBefore').text
                    safter = group.find('RegexPatternAfter').text
                    sregex = group.find('RegexPattern').text

                    if sbefore is None:
                        sbefore = ""
                    if safter is None:
                        safter = ""
                    Print.debug(
                        str(sbefore) + "---" + str(sregex) + "---" +
                        str(safter))

                    sextfile = group.find('RefFileExtension').text

                    if file.get_name().endswith(sextfile):
                        Print.info('Scanning mqs  file :' +
                                   str(Path(file.get_path()).name))
                        if (os.path.isfile(file.get_path())):
                            sobjname = group.find('CastCustomObjName').text
                            self.parsemqsuses(file.get_path(), file, sobjname,
                                              sbefore, safter, sregex)

        except Exception as e:
            Print.info(": Error mqs extension  set : %s", str(e))
示例#23
0
    def end_analysis(self):
        X.debug("****************")
        for fromObjs, fromURIs in fromRef.items():
            for toObjs, toURIs in toRef.items():
                if (toURIs[1] == fromURIs[1]):
                    X.debug("&&&&&&&&&")
                    create_link('callLink', fromObjs, toObjs,
                                Bookmark(toObjs.parent, 1, 1, -1, -1))
                    X.debug("__________")

            #X.debug(str(keys))
            #X.debug(str(values[1]))

        pass
示例#24
0
 def start_file(self, file):
     log.debug ('In start_file ... ' + str(file))
     log.info ('In start_file ... ' + str(file))
     self.file_obj = file
     self.file_path = self.file_obj.get_path()
     log.debug("File lists.." + self.file_path)
     
     omnxtObj = CustomObject()
     omnxtObj.set_name("module")
     omnxtObj.set_fullname("C:\\Users\\MKU\\Desktop\\kamal")
     omnxtObj.set_type("OMNEXT_module")
     
     omnxtObj.set_parent(file)
     omnxtObj.set_guid(str(uuid.uuid4())) 
     
     omnxtObj.save()
     
     log.debug ('Object created ... ' + str(omnxtObj))
     log.info ('Object created ... ' + str(omnxtObj))        
示例#25
0
    def start_file(self, file):
        filename = file.get_path()
        #X.debug(filename)

        if filename.endswith('.xml'):
            tree = ET.parse(filename)
            root = tree.getroot()
            count = 0
            for k in list(root.iter()):
                data1 = re.sub('{.*?}', '', str(k.tag))
                if data1 == "from":
                    try:
                        X.debug(k.attrib['uri'])
                        fromObj = CustomObject()
                        self.saveObject(
                            fromObj, data1 + "." + k.attrib['uri'],
                            filename + '.' + data1, "Sender", file,
                            filename + "." + data1 + '.' + str(count))
                        count = count + 1
                        fromObj.save_position(Bookmark(file, 1, 1, -1, -1))
                        fromRef[fromObj] = [fromObj, k.attrib['uri']]
                    except (RuntimeError, TypeError, NameError):
                        pass
                elif data1 == "to":
                    try:
                        X.debug(k.attrib['uri'])
                        toObj = CustomObject()
                        self.saveObject(
                            toObj, data1 + "." + k.attrib['uri'],
                            filename + '.' + data1, "Receiver", file,
                            filename + "." + data1 + '.' + str(count))
                        count = count + 1
                        toObj.save_position(Bookmark(file, 1, 1, -1, -1))
                        toRef[toObj] = [toObj, k.attrib['uri']]
                    except (RuntimeError, TypeError, NameError):
                        pass
        elif filename.endswith('.java'):
            X.debug("")
 def BpelQrImplementation(self, file, bpel_process, bpel_data, file_data):
     if self.QrOnPartnerlinkName(bpel_data['partnerLink']):
         CAST.debug("Violation on Property id 1187062....")
         bpel_process.save_violation("File_Data.patnerlink_name_conflict",
                                     Bookmark(file, 1, 1, -1, -1),
                                     additional_bookmarks=None)
     if self.QrOnPartnerlinkRole(bpel_data['partnerLink']):
         CAST.debug("Violation on Property id 1187071....")
         bpel_process.save_violation("File_Data.patnerlink_role_conflict",
                                     Bookmark(file, 1, 1, -1, -1),
                                     additional_bookmarks=None)
     if self.QrOnVariableName(bpel_data['variable']):
         CAST.debug("Violation on Property id 1187061....")
         bpel_process.save_violation("File_Data.variable_name_conflict",
                                     Bookmark(file, 1, 1, -1, -1),
                                     additional_bookmarks=None)
     if self.QrOnVariableNamingChecker(bpel_data['variable']):
         CAST.debug("Violation on Property id 1187067....")
         bpel_process.save_violation("File_Data.variable_name_constraints",
                                     Bookmark(file, 1, 1, -1, -1),
                                     additional_bookmarks=None)
     if self.QrOnVariableType(bpel_data['variable']):
         CAST.debug("Violation on Property id 1187068....")
         bpel_process.save_violation("File_Data.variable_type_conflict",
                                     Bookmark(file, 1, 1, -1, -1),
                                     additional_bookmarks=None)
     if self.QrOnEventhanlderConflict(file_data):
         CAST.debug("Violation on Property id 1187063 &1187075....")
         bpel_process.save_violation("File_Data.eventhandler_conflict",
                                     Bookmark(file, 1, 1, -1, -1),
                                     additional_bookmarks=None)
         bpel_process.save_violation("File_Data.Eventhandler_constraints",
                                     Bookmark(file, 1, 1, -1, -1),
                                     additional_bookmarks=None)
     if self.QrOnReplyConflict(file_data):
         CAST.debug("Violation on Property id 1187064....")
         bpel_process.save_violation("File_Data.forreply_conflict",
                                     Bookmark(file, 1, 1, -1, -1),
                                     additional_bookmarks=None)
     if self.QrOnCorrelationsetConflict(bpel_data["correlationSet"]):
         CAST.debug("Violation on Property id 1187065....")
         bpel_process.save_violation("File_Data.correlationset_conflict",
                                     Bookmark(file, 1, 1, -1, -1),
                                     additional_bookmarks=None)
     if self.QrOnFromToConflict(bpel_data):
         CAST.debug("Violation on Property id 1187066....")
         bpel_process.save_violation("File_Data.from_to_conflict",
                                     Bookmark(file, 1, 1, -1, -1),
                                     additional_bookmarks=None)
     if self.QrOnFaultHandlerConflict(file_data):
         CAST.debug("Violation on Property id 1187069....")
         bpel_process.save_violation("File_Data.faulthandler_conflict",
                                     Bookmark(file, 1, 1, -1, -1),
                                     additional_bookmarks=None)
     if self.QrOnCompensateConflict(file_data):
         CAST.debug("Violation on Property id 1187070....")
         bpel_process.save_violation("File_Data.compensate_conflict",
                                     Bookmark(file, 1, 1, -1, -1),
                                     additional_bookmarks=None)
     if self.QrOnFlowConflict(bpel_data["link"]):
         CAST.debug("Violation on Property id 1187072....")
         bpel_process.save_violation("File_Data.flow_conflict",
                                     Bookmark(file, 1, 1, -1, -1),
                                     additional_bookmarks=None)
     if self.QrOnFaulthandlerConstrainst(file_data):
         CAST.debug("Violation on Property id 1187073....")
         bpel_process.save_violation("File_Data.faulthandler_constraints",
                                     Bookmark(file, 1, 1, -1, -1),
                                     additional_bookmarks=None)
     if self.QrOnEventConflict(bpel_data["onEvent"]):
         CAST.debug("Violation on Property id 1187074....")
         bpel_process.save_violation("File_Data.onevent_conflict",
                                     Bookmark(file, 1, 1, -1, -1),
                                     additional_bookmarks=None)
     '''
     if self.QrOnEventhanlderConflict(file_data):
         CAST.debug("Violation on Property id 1187075....")
         bpel_process.save_violation("File_Data.Eventhandler_constraints",Bookmark(file,1,1,-1,-1),additional_bookmarks=None)
     '''
     if self.QrOnOperationNameConflict(bpel_data["invoke"]):
         CAST.debug("Violation on Property id 1187076....")
         bpel_process.save_violation("File_Data.operation_name_conflict",
                                     Bookmark(file, 1, 1, -1, -1),
                                     additional_bookmarks=None)
 def add_property(obj,  prop, ele ):
     if ele.get(prop) is not None:
         LOG.debug(' - %s: %s' % (prop, ele.get(prop)))
         obj.save_property('JmsQueueProperties.%s' % prop, ele.get(prop))
     else:
         obj.save_property('JmsQueueProperties.%s' % prop, "None")
示例#28
0
 def start_xml_file(self, file):
     # we get it + all other xml files
     log.debug("We have access to this xml file " + str(file))
 def start_analysis(self, option):
     log.debug("analysis started")
示例#30
0
 def start_file(self, file):
     self.filename = file.get_path()
     CAST.debug(self.filename)
     file_ref = open(self.filename, 'r')
     file_data = []
     for child in file_ref:
         child = child.replace("\n", "")
         file_data.append(child)
     parser = CastOperation()
     if self.filename.endswith(".wsdl"):
         try:
             index = self.filename.rfind('\\')
             self.name = self.filename[index + 1:]
         except:
             index = -1
         wsdl_process = CustomObject()
         self.saveObject(wsdl_process, self.name, self.filename,
                         "WSDL_Process", file,
                         self.filename + "WSDL_Process")
         wsdl_process.save()
         wsdl_process.save_position(Bookmark(file, 1, 1, -1, -1))
         wsdl_file_data[wsdl_process] = parser.castParserWsdl(self.filename)
         #CAST.debug(self.name)
     else:
         self.invokeList = parser.getInvokeJavaCode(self.filename)
         for child in self.invokeList:
             self.intermediate_file.write(str(child) + '\n')
         bpel_data = parser.castParserBpel(file, self.filename)
         #CAST.debug(str(bpel_data["link"]))
         for child in bpel_data:
             #attrib_data = re.sub('(\[)|(\])|(\')','',str(bpel_file_data[child]))
             if "process" in child and not "bookmark" in child:
                 for subchild in bpel_data[child]:
                     if "name" in subchild:
                         self.name = subchild[subchild.find(':') + 1:]
                         break
         bpel_process = CustomObject()
         self.saveObject(bpel_process, self.name, self.filename,
                         "BPEL_Process", file,
                         self.filename + "BPEL_Process")
         bpel_process.save()
         if bpel_data["process.bookmark"]:
             bpel_process.save_position(bpel_data["process.bookmark"][0])
         else:
             bpel_process.save_position(Bookmark(file, 1, 1, -1, -1))
         bpel_process_data[bpel_process] = bpel_data["process"]
         bpel_bookmark_data[
             str(bpel_process) +
             "invoke.bookmark"] = bpel_data["invoke.bookmark"]
         bpel_invoke_data[bpel_process] = bpel_data["invoke"]
         bpel_bookmark_data[
             str(bpel_process) +
             "receive.bookmark"] = bpel_data["receive.bookmark"]
         bpel_receive_data[bpel_process] = bpel_data["receive"]
         bpel_bookmark_data[
             str(bpel_process) +
             "onMessage.bookmark"] = bpel_data["onMessage.bookmark"]
         bpel_onmessage_data[bpel_process] = bpel_data["onMessage"]
         self.file_loc_data = parser.fileLoc(self.filename)
         self.file_checksum_data = parser.fileChecksum(self.filename)
         qr_reference = QualityRule()
         qr_reference.BpelQrImplementation(file, bpel_process, bpel_data,
                                           file_data)
         pass
示例#31
0
    def end_analysis(self):
        for child in bpel_process_data:
            bpel_target_name = ""
            bpel_name = ""
            for ele in bpel_process_data[child]:
                if "targetNamespace:" in ele:
                    bpel_target_name = ele[ele.find(':') + 1:]
                elif "name:" in ele:
                    bpel_name = ele[ele.find(':') + 1:]

            for ele in wsdl_file_data:
                wsdl_target_name = ""
                wsdl_name = ""
                for subele in wsdl_file_data[ele]["definitions"]:
                    if "targetNamespace:" in subele:
                        wsdl_target_name = subele[subele.find(':') + 1:]
                    elif "name:" in subele:
                        wsdl_name = subele[subele.find(':') + 1:]
                #CAST.debug(wsdl_name)
                if wsdl_target_name == bpel_target_name:
                    create_link('callLink', ele, child,
                                Bookmark(child.parent, 1, 1, -1, -1))
                    wsdl_obj_reference[child] = ele
                elif wsdl_name == bpel_name and len(wsdl_name) != 0 and len(
                        bpel_name) != 0:
                    #CAST.debug(bpel_name+wsdl_name)
                    create_link('callLink', ele, child,
                                Bookmark(child.parent, 1, 1, -1, -1))
                    wsdl_obj_reference[child] = ele
        invoke_count = 0
        operation_count = 0
        onmessage_count = 0
        for child in bpel_invoke_data:
            invoke_index = 0
            for ele in bpel_invoke_data[child]:
                port_type = ""
                operation_type = ""
                namespace_port = ""
                invoke_name = "null"
                patnerlink_name = ""
                ele_data = str(ele)
                ele_data = re.sub('(\[)|(\])|(\')|(\s+)', '', ele_data)
                bpel_invoke_list = []
                bpel_invoke_list = ele_data.split(',')
                for subele in bpel_invoke_list:
                    if 'portType:' in subele:
                        port_type = subele[subele.find(':') + 1:]
                    elif 'operation:' in subele:
                        operation_type = subele[subele.find(':') + 1:]
                    elif 'name:' in subele:
                        invoke_name = subele[subele.find(':') + 1:]
                    elif 'partnerLink:' in subele:
                        patnerlink_name = subele[subele.find(':') + 1:]
                filename = child.parent.get_path()
                invoke_fullname = ''
                if invoke_name == "null":
                    invoke_name = patnerlink_name
                    invoke_fullname = filename + '--null'
                else:
                    invoke_fullname = filename + '--' + invoke_name

                bpel_invoke = CustomObject()
                invoke_count = invoke_count + 1
                self.saveObject(bpel_invoke, invoke_name, invoke_fullname,
                                "BPEL_Invoke", child.parent,
                                filename + "BPEL_Invoke" + str(invoke_count))
                bpel_invoke.save()
                try:
                    bpel_invoke.save_position(
                        bpel_bookmark_data[str(child) +
                                           "invoke.bookmark"][invoke_index])
                except:
                    bpel_invoke.save_position(
                        Bookmark(child.parent, 1, 1, -1, -1))
                invoke_index = invoke_index + 1
                create_link('callLink', child, bpel_invoke,
                            Bookmark(child.parent, 1, 1, -1, -1))
                if not ("null" in port_type and "null" in operation_type):
                    if ':' in port_type:
                        namespace_port = port_type[:port_type.find(':') + 1]
                    ele_data = str(bpel_process_data[child])
                    ele_data = re.sub('(\[)|(\])|(\')|(\s+)', '', ele_data)
                    ele_data = ele_data.replace('xmlns:map:', '')
                    #CAST.debug(ele_data)
                    for invoke_data in list(ele_data.split(',')):
                        if namespace_port in invoke_data:
                            namespace_port = invoke_data[invoke_data.
                                                         find(':') + 1:]
                            namespace_port = namespace_port + port_type[
                                port_type.find(':') + 1:]
                            break
                    flag_link = 0
                    '''
                    CAST.debug(ele_data)
                    CAST.debug(operation_type+"--"+namespace_port)
                    CAST.debug('--XD')
                    '''
                    for subele in bpel_receive_data:
                        for bpel_ele in bpel_receive_data[subele]:
                            ele_data = str(bpel_ele)
                            ele_data = re.sub('(\[)|(\])|(\')|(\s+)', '',
                                              ele_data)
                            bpel_receive_list = []
                            bpel_receive_list = ele_data.split(',')
                            receive_port_type = ""
                            receive_operation_type = ""
                            receive_namespace_port = ""
                            for receive_data in bpel_receive_list:
                                if 'portType:' in receive_data:
                                    receive_port_type = receive_data[
                                        receive_data.find(':') + 1:]
                                elif 'operation:' in receive_data:
                                    receive_operation_type = receive_data[
                                        receive_data.find(':') + 1:]
                            if ':' in receive_port_type:
                                receive_namespace_port = receive_port_type[:
                                                                           receive_port_type
                                                                           .
                                                                           find(
                                                                               ':'
                                                                           ) +
                                                                           1]
                            ele_data = str(bpel_process_data[subele])
                            ele_data = re.sub('(\[)|(\])|(\')|(\s+)', '',
                                              ele_data)
                            ele_data = ele_data.replace('xmlns:map:', '')
                            for receive_data in list(ele_data.split(',')):
                                if receive_namespace_port in receive_data:
                                    receive_namespace_port = receive_data[
                                        receive_data.find(':') + 1:]
                                    receive_namespace_port = receive_namespace_port + receive_port_type[
                                        receive_port_type.find(':') + 1:]
                                    break
                            '''
                            for process_data in bpel_process_data[subele].split(','):
                                CAST.debug(str(process_data))
                            '''

                            if namespace_port == receive_namespace_port and operation_type == receive_operation_type:
                                if subele in wsdl_obj_reference:
                                    CAST.debug('Object linking.....')
                                    '''
                                    CAST.debug('XC')
                                    CAST.debug(filename)
                                    CAST.debug(invoke_name)
                                    CAST.debug(receive_namespace_operation+"--"+receive_namespace_port)
                                    '''
                                    file_name = wsdl_obj_reference[
                                        subele].parent.get_path()
                                    wsdl_operation = CustomObject()
                                    operation_count = operation_count + 1
                                    self.saveObject(
                                        wsdl_operation, receive_operation_type,
                                        file_name + receive_operation_type,
                                        "WSDL_Operation",
                                        wsdl_obj_reference[subele].parent,
                                        file_name + "WSDL_Operation" +
                                        str(operation_count))
                                    wsdl_operation.save()
                                    wsdl_operation.save_position(
                                        Bookmark(subele.parent, 1, 1, -1, -1))
                                    create_link(
                                        'callLink', bpel_invoke,
                                        wsdl_operation,
                                        Bookmark(subele.parent, 1, 1, -1, -1))
                                    create_link(
                                        'callLink', wsdl_operation,
                                        wsdl_obj_reference[subele],
                                        Bookmark(subele.parent, 1, 1, -1, -1))
                                    flag_link = 1
                                    break
                                else:
                                    pass
                            else:
                                pass
                        if flag_link == 1:
                            break
                    if flag_link != 1:
                        onmessage_count = self.checkOnmessage(
                            bpel_invoke, operation_type, namespace_port,
                            onmessage_count)
                else:
                    pass
        CAST.debug('End!!')
        '''               
        for child in bpel_file_data:
            for subchild in bpel_file_data[child]:
                CAST.debug(subchild+"->")
                for j in bpel_file_data[child][subchild]:
                    CAST.debug(str(j))           
        #for child in wsdl_file_data:
            #for subchild in wsdl_file_data[child]:
        #    CAST.debug(str(wsdl_file_data[child]))
        '''
        pass
 def start_analysis(self):
     Print.debug("Inside start_analysis")
示例#33
0
 def my_callback(self, values, caller, line, column):
     
     log.debug("Method %s is calling java.sql.Statement.executeQuery at line %s with the following possible values for parameter 1" % (str(caller.get_fullname()), str(line)))
     for value in values[1]:
         log.debug("  %s" % str(value))