Analysers specific events¶
Each analyser level extension has it’s own events set and order.
For example, JEE and DotNet will broadcast event for classes but Universal Anbalyser is so abstract and agnostic that it cannot.
Here are the specific callbacks with their relative order for each different analyser extension.
ABAP Analyser specificities¶
ABAP Extension¶
- class cast.analysers.abap.Extension¶
Extension points for SAP analyzer.
- start_analysis(options)¶
Called at the beginning of analysis
Parameters: options (cast.analysers.ExecutionUnit) – analysis options @type options: cast.analysers.ExecutionUnit
- start_program(file)¶
Called at the beginning of the analysis of a program
Parameters: file (cast.analysers.File) – the program @type file: cast.analysers.File
- end_program(file)¶
Called at the end of the analysis of a program
Parameters: file (cast.analysers.File) – the program @type file: cast.analysers.File
- start_include(file)¶
Called at the beginning of the analysis of an include
Parameters: file (cast.analysers.File) – the include @type file: cast.analysers.File
- end_include(file)¶
Called at the end of the analysis of an include
Parameters: file (cast.analysers.File) – the include @type file: cast.analysers.File
- start_modulepool(file)¶
Called at the beginning of the analysis of a module pool
Parameters: file (cast.analysers.File) – the module pool @type file: cast.analysers.File
- end_modulepool(file)¶
Called at the end of the analysis of a module pool
Parameters: file (cast.analysers.File) – the module pool @type file: cast.analysers.File
- start_functionpool(_object)¶
Called at the beginning of the analysis of a function pool
Parameters: file (cast.analysers.Object) – the function pool @type _object: cast.analysers.Object
- end_functionpool(_object)¶
Called at the end of the analysis of a function pool
Parameters: file (cast.analysers.Object) – the function pool @type _object: cast.analysers.Object
- start_typepool(file)¶
Called at the beginning of the analysis of a type pool
Parameters: file (cast.analysers.File) – the type pool @type file: cast.analysers.File
- end_typepool(file)¶
Called at the end of the analysis of a type pool
Parameters: file (cast.analysers.File) – the type pool @type file: cast.analysers.File
- start_userexit(file)¶
Called at the beginning of the analysis of a user exit
Parameters: file (cast.analysers.File) – the user exit @type file: cast.analysers.File
- end_userexit(file)¶
Called at the end of the analysis of a user exit
Parameters: file (cast.analysers.File) – the user exit @type file: cast.analysers.File
- start_flowlogic(file)¶
Called at the beginning of the analysis of a flow logic
Parameters: file (cast.analysers.File) – the flow logic @type file: cast.analysers.File
- end_flowlogic(file)¶
Called at the end of the analysis of a flow logic
Parameters: file (cast.analysers.File) – the flow logic @type file: cast.analysers.File
- start_classpool(_object)¶
Called at the beginning of the analysis of a class pool
Parameters: _object (cast.analysers.Object) – the class pool @type _object: cast.analysers.Object
- end_classpool(_object)¶
Called at the end of the analysis of a class pool
Parameters: _object (cast.analysers.Object) – the class pool @type _object: cast.analysers.Object
- start_interfacepool(_object)¶
Called at the beginning of the analysis of a interface pool
Parameters: _object (cast.analysers.Object) – the interface pool @type _object: cast.analysers.Object
- end_interfacepool(_object)¶
Called at the end of the analysis of a interface pool
Parameters: _object (cast.analysers.Object) – the interface pool @type _object: cast.analysers.Object
- start_badi(_object)¶
Called at the beginning of the analysis of a badi
Parameters: _object (cast.analysers.Object) – the badi @type _object: cast.analysers.Object
- end_badi(_object)¶
Called at the end of the analysis of a badi
Parameters: _object (cast.analysers.Object) – the badi @type _object: cast.analysers.Object
- start_bapi_file(file)¶
Called at the beginning of the analysis of a bapi file
Parameters: file (cast.analysers.File) – the bapi file @type file: cast.analysers.File
- end_bapi_file(file)¶
Called at the end of the analysis of a bapi file
Parameters: file (cast.analysers.File) – the bapi file @type file: cast.analysers.File
- start_transaction_file(file)¶
Called at the beginning of the analysis of a transaction file
Parameters: file (cast.analysers.File) – the transaction file @type file: cast.analysers.File
- end_transaction_file(file)¶
Called at the end of the analysis of a transaction file
Parameters: file (cast.analysers.File) – the transaction file @type file: cast.analysers.File
- start_transaction(o)¶
Called at the beginning of the analysis of a transaction
Parameters: transaction (cast.analysers.Object) – the transaction @type transaction: cast.analysers.Object
- start_webdynpro_file(file)¶
Called at the beginning of the analysis of a webdynpro file
Parameters: file (cast.analysers.File) – the webdynpro file @type file: cast.analysers.File
- end_webdynpro_file(file)¶
Called at the end of the analysis of a webdynpro file
Parameters: file (cast.analysers.File) – the webdynpro file @type file: cast.analysers.File
- start_webdynpro_method(member)¶
Called at the beginning of the analysis of a webdynpro method
Parameters: member (cast.analysers.Member) – the webdynpro method @type member: cast.analysers.Member
- end_webdynpro_method(member)¶
Called at the end of the analysis of a webdynpro method
Parameters: member (cast.analysers.Member) – the webdynpro method @type member: cast.analysers.Member
- start_programs_description_file(file)¶
Called at the beginning of the analysis of a programs description file
Parameters: file (cast.analysers.File) – the programs description file @type file: cast.analysers.File
- end_programs_description_file(file)¶
Called at the end of the analysis of a programs description file
Parameters: file (cast.analysers.File) – the programs description file @type file: cast.analysers.File
- start_package(o)¶
Called at the beginning of a package entering
Parameters: file (cast.analysers.Object) – the package @type file: cast.analysers.Object
- create_package(o)¶
Called at a package creation
Parameters: file (cast.analysers.Object) – the package @type file: cast.analysers.Object
- start_form(form)¶
Called at the beginning of the analysis of a form
Parameters: form (cast.analysers.Member) – the form @type form: cast.analysers.Member
- end_form(form)¶
Called at the end of the analysis of a form
Parameters: form (cast.analysers.Member) – the form @type form: cast.analysers.Member
- start_function(_function)¶
Called at the beginning of the analysis of a function
Parameters: _function (cast.analysers.Member) – the function @type form: cast.analysers.Member
- end_function(_function)¶
Called at the end of the analysis of a function
Parameters: _function (cast.analysers.Member) – the function @type _function: cast.analysers.Member
- start_module(module)¶
Called at the beginning of the analysis of a module
Parameters: module (cast.analysers.Member) – the module @type module: cast.analysers.Member
- end_module(module)¶
Called at the end of the analysis of a module
Parameters: module (cast.analysers.Member) – the module @type module: cast.analysers.Member
- start_event_block(block)¶
Called at the beginning of the analysis of a block
Parameters: block (cast.analysers.Member) – the event block @type block: cast.analysers.Member
- end_event_block(block)¶
Called at the end of the analysis of a event block
Parameters: block (cast.analysers.Member) – the block @type block: cast.analysers.Member
- start_type(_type)¶
Called at the beginning of the analysis of a class/interface
Parameters: _type (cast.analysers.Type) – the class @type _type: cast.analysers.Type
- end_type(_type)¶
Called at the end of the analysis of a class/interface
Parameters: _type (cast.analysers.Type) – the class @type _type: cast.analysers.Type
- start_class_definition(_type)¶
Called at the beginning of the analysis of a class definition
Parameters: _type (cast.analysers.Type) – the class @type _type: cast.analysers.Type
- end_class_definition(_type)¶
Called at the end of the analysis of a class definition
Parameters: _type (cast.analysers.Type) – the class @type _type: cast.analysers.Type
- start_member(member)¶
Called at the beginning of the analysis of a class member
Parameters: member (cast.analysers.Member) – the class member @type member: cast.analysers.Member
- end_member(member)¶
Called at the end of the analysis of a class member
Parameters: member (cast.analysers.Member) – the class member @type member: cast.analysers.Member
- start_database_procedure(member)¶
Called at the beginning of the analysis of a database procedure method
Parameters: member (cast.analysers.Member) – the class procedure method @type member: cast.analysers.Member
- start_database_function(member)¶
Called at the beginning of the analysis of a database function method
Parameters: member (cast.analysers.Member) – the class function method @type member: cast.analysers.Member
- start_method_definition(member)¶
Called at the beginning of the analysis of a class method definition
Parameters: member (cast.analysers.Member) – the class method definition @type member: cast.analysers.Member
- start_constructor_definition(member)¶
Called at the beginning of the analysis of a class constructor definition
Parameters: member (cast.analysers.Member) – the class constructor definition @type member: cast.analysers.Member
- start_sap_unresolved_folder(o)¶
Called at the creation of the sap unresolved folder
Parameters: o (cast.analysers.Object) – the sap unresolved folder @type o: cast.analysers.Object
- start_abap_unresolved_folder(o)¶
Called at the creation of the abap unresolved folder
Parameters: o (cast.analysers.Object) – the abap unresolved folder @type o: cast.analysers.Object
- start_file_level_code(o)¶
Called at the beginning of the file level code
Parameters: o (cast.analysers.Object) – the file level code @type o: cast.analysers.Object
- end_file_level_code(o)¶
Called at the end of the file level code
Parameters: o (cast.analysers.Object) – the file level code @type o: cast.analysers.Object
- start_sap_views_file(file)¶
Called at the beginning of the analysis of a sap views file
Parameters: file (cast.analysers.File) – the sap views file @type file: cast.analysers.File
- start_sap_cds_views_file(file)¶
Called at the beginning of the analysis of a sap cds views file
Parameters: file (cast.analysers.File) – the sap cds views file @type file: cast.analysers.File
- end_sap_views_file(file)¶
Called at the end of the analysis of a sap views file
Parameters: file (cast.analysers.File) – the sap views file @type file: cast.analysers.File
- end_sap_cds_views_file(file)¶
Called at the end of the analysis of a sap cds views file
Parameters: file (cast.analysers.File) – the sap cds views file @type file: cast.analysers.File
- start_sap_tables_file(file)¶
Called at the beginning of the analysis of a sap tables file
Parameters: file (cast.analysers.File) – the sap tables file @type file: cast.analysers.File
- end_sap_tables_file(file)¶
Called at the end of the analysis of a sap tables file
Parameters: file (cast.analysers.File) – the sap tables file @type file: cast.analysers.File
- start_sap_view(o)¶
Called at the creation of the sap view
Parameters: o (cast.analysers.Object) – the sap view @type o: cast.analysers.Object
- start_sap_cds_view(o)¶
Called at the creation of the sap cds view
Parameters: o (cast.analysers.Object) – the sap cds view @type o: cast.analysers.Object
- start_sap_table(o)¶
Called at the creation of the sap table
Parameters: o (cast.analysers.Object) – the sap table @type o: cast.analysers.Object
- start_sap_unresolved_table(o)¶
Called at the creation of the sap unresolved table
Parameters: o (cast.analysers.Object) – the sap unresolved table @type o: cast.analysers.Object
- complete_table_or_view(o)¶
Called at the completion of the sap table
Parameters: o (cast.analysers.Object) – the sap table @type o: cast.analysers.Object
- end_light_parsing()¶
Called at the completion of the light parsing
- end_full_parsing()¶
Called at the completion of the full parsing
- end_bapis_analysis()¶
Called at the completion of the bapi analysis
- end_sap_tables_analysis()¶
Called at the completion of the sap tables analysis
- end_webdynpros_analysis()¶
Called at the completion of the web dynpros analysis
- start_abap_project(o)¶
Called at the creation of the abap project
Parameters: o (cast.analysers.Object) – the abap project @type o: cast.analysers.Object
- start_sap_project(o)¶
Called at the creation of the sap project
Parameters: o (cast.analysers.Object) – the sap project @type o: cast.analysers.Object
- start_sap_tables_analysis()¶
Called at the beginning of sap tables analysis
- end_transactions_analysis()¶
Called at the end of sap transactions analysis
JEE Analyser specificities¶
JEE Extension¶
- class cast.analysers.jee.Extension¶
Extension points for JEE analyzer.
- start_analysis(options)¶
Called at the beginning of analysis
Parameters: options (cast.analysers.JEEExecutionUnit) – analysis option @type options: cast.analysers.JEEExecutionUnit
- start_web_xml(file)¶
Called at the beginning of the analysis of the web.xml file
Parameters: file (cast.analysers.File) – web.xml file @type file: cast.analysers.File
- end_web_xml(file)¶
Called at the end of the analysis of the web.xml file
Parameters: file (cast.analysers.File) – web.xml file @type file: cast.analysers.File
- start_properties_files(project)¶
Called before the analysis of properties file of a project.
Parameters: project (cast.analysers.Object) – visited project @type project: cast.analysers.Object
New in version 8.1.0.
- start_properties_file(file)¶
Called at the beginning of the analysis of a specific properties file.
Parameters: file (cast.analysers.File) – visited properties file @type file: cast.analysers.File
New in version 8.1.0.
- end_properties_file(file)¶
Called at the end of the analysis of a specific properties file.
Parameters: file (cast.analysers.File) – visited properties file @type file: cast.analysers.File
New in version 8.1.0.
- end_properties_files(project)¶
Called after the analysis of properties file of a project.
Parameters: project (cast.analysers.Object) – visited project @type project: cast.analysers.Object
New in version 8.1.0.
- start_types()¶
Begin visit of classes, intefaces, etc..
- start_type(_type)¶
Called on each class, interface, etc...
Parameters: _type (cast.analysers.Type) – visited class @type _type: cast.analysers.Type
- start_member(member)¶
Called on each class member field, method etc...
Parameters: member (cast.analysers.Member) – visited member @type member: cast.analysers.Member
- end_member(member)¶
Called on each class member field, method etc...
Parameters: member (cast.analysers.Member) – visited member @type member: cast.analysers.Member
- end_type(_type)¶
Called on each class, interface, etc...
Parameters: _type (cast.analysers.Type) – visited class @type _type: cast.analysers.Type
- end_types()¶
End visit of classes, intefaces, etc..
- start_xml_files()¶
Called at the beginning of the xml files analysis.
- start_xml_file(file)¶
Called at the beginning of the analysis of a specific xml file.
Parameters: file (cast.analysers.File) – visited xml file @type file: cast.analysers.File
- end_xml_file(file)¶
Called at the end of the analysis of a specific xml file.
Parameters: file (cast.analysers.File) – visited xml file @type file: cast.analysers.File
- end_xml_files()¶
Called at the end of the xml files analysis.
- start_web_files()¶
Called at the beginning of the web files analysis.
- start_web_file(file)¶
Called at the beginning of the analysis of a specific Web file.
Parameters: file (cast.analysers.File) – visited web file @type file: cast.analysers.File
- end_web_file(file)¶
Called at the end of the analysis of a specific Web file.
Parameters: file (cast.analysers.File) – visited web file @type file: cast.analysers.File
- end_web_files()¶
Called at the end of the web files analysis.
- end_analysis()¶
Called at the end of analysis
Events order¶
On a classical JEE analysis job, the event from cast.analysers.jee.Extension will be triggered in the following order
start_analysis(project)
start_web_xml(web_xml_file)
end_web_xml(web_xml_file)
start_types()
start_type(t1)
start_member(t1_m1)
end_member(t1_m1)
...
start_member(t1_mn)
end_member(t1_mn)
end_type(t1)
...
start_type(tx)
end_type(tx)
end_types()
start_xml_files()
start_xml_file(xml_file1)
end_xml_file(xml_file1)
...
end_xml_files()
start_web_files()
start_web_file(web_file1)
end_web_file(web_file1)
...
end_web_files()
end_analysis()
Manipulating options¶
During cast.analysers.jee.Extension.start_analysis(), one may register handling of xml files.
If an xml file is not handled at all, this file will not appear in analysis service and will not be accessible for analysis.
There are several ways to register xml file :
- through file name pattern : cast.analysers.JEEExecutionUnit.handle_xml_with_filename()
- through xpath pattern : cast.analysers.JEEExecutionUnit.handle_xml_with_xpath(), if an xml file contains a given xpath query
- class cast.analysers.JEEExecutionUnit¶
A particular object that represents the JEE analysis options. All the method below are meant to be called during start_analysis. Calling them at another moment will not work.
- handle_xml_with_filename(pattern)¶
XML file names that follow the given pattern will be created and received through start_xml_file. Remove the necessity to add create and select an environment profile.
Parameters: pattern (str) – a file pattern
- handle_xml_with_xpath(xpath)¶
XML file that contains the given xpath will be created and received through start_xml_file. Remove the necessity to add create and select an environment profile.
Parameters: xpath (str) – a xpath query For a file:
<struts> ... </struts>
use:
options.handle_xml_with_xpath('/struts')
For a file:
<ui:UiBinder> ... </ui:UiBinder>
use:
# this skips xml namespace options.handle_xml_with_xpath("/*[local-name()='UiBinder']")
- handle_xml_with_dtd(dtd)¶
XML file that reference the given dtd will be created and received through start_xml_file. Remove the necessity to add create and select an environment profile.
- handle_xml_with_xsd(xsd)¶
XML file that reference the given XSD or namespace will be created and received through start_xml_file. Remove the necessity to add create and select an environment profile.
- add_classpath(path)¶
Add a classpath to Java analyzer.
This path must be relative to the plugin. It can be either a jar file or a folder of jars.
Parameters: path (str) – a relative path
- add_no_link_parameterization(signature)¶
Method calls with given signature will not create dynamic links.
Parameters: signature (str) – method signature for which no link should be created. All parameters will be parametrized.
Sample:
def start_analysis(self, options): options.add_no_link_parameterization('java.lang.Error.Error(java.lang.String)')
- add_parameterization(signature, parameters, callback)¶
Method calls with given signature will trigger callback with the actual parameter dynamic values.
Parameters: - signature (str) – method signature for which calls are parameterized.
- of int parameters (list) – a list of integer indicating parameter number to be parameterized. Each parameter must be of type java.lang.String.
- callback (function) – a callable object to be called back.
signature is the CAST signature exactly as it can be found in enlighten. It should not contain any space.
callback must be a callable with 4 arguments. It will be called with a dictionnary parameter_number -> list parameter’s possible values the object that perform the method call the line of the call the column of the call
Sample:
def start_analysis(self, options): # all calls to root.A.g(java.lang.String) will trigger # self.my_callback options.add_parameterization('root.A.g(java.lang.String)', [1], self.my_callback) def my_callback(self, values, caller, line, column): # values is of the form {1:[..., ..., ...]} # caller is the object calling the method # line, column is the position of the call cast.analysers.log.info(str(values))
- add_external_javascript_file_path(pattern)¶
All javascript files whose file path match pattern will be considered as external.
Parameters: pattern (str) – file pattern
- add_external_javascript_file_content(file_content)¶
All javascript files that contains file_content pattern will be considered as external.
Parameters: file_content (str) – content to be grepped
DotNet Analyser specificities¶
DotNet Extension¶
- class cast.analysers.dotnet.Extension¶
Extension points for DotNet analyzer.
- start_analysis(options)¶
Called at the beginning of analysis.
Parameters: options (cast.analysers.dotnet.DotNetExecutionUnit) – analysisoptions
- start_project(project)¶
Called at the beginning of analysis of a project.
Parameters: project (cast.analysers.AnalysisUnit) – analysisoptions New in version 7.3.6.
- introducing_file(file)¶
Begin visit of a source file.
Parameters: file (cast.analysers.File) – the file @type file: cast.analysers.File
- start_types()¶
Begin visit of classes, intefaces, etc..
- start_type(_type)¶
Begin visit of a class, interface, etc...
Parameters: _type (cast.analysers.Type) – the class @type _type: cast.analysers.Type
- start_member(member)¶
Begin visit of a class’s member : field, method, etc...
Parameters: member (cast.analysers.Member) – the member @type member: cast.analysers.Member
- end_member(member)¶
End visit of a class’s member : field, method, etc...
Parameters: member (cast.analysers.Member) – the member @type member: cast.analysers.Member
- end_type(_type)¶
End visit of a class, interface, etc...
Parameters: _type (cast.analysers.Type) – the class @type _type: cast.analysers.Type
- end_types()¶
End visit of classes, intefaces, etc..
- start_files()¶
Begin visit of source files.
- start_file(file)¶
Begin visit of a source file.
Parameters: file (cast.analysers.File) – the file @type file: cast.analysers.File
- end_file(file)¶
End visit of a source file.
Parameters: file (cast.analysers.File) – the file @type file: cast.analysers.File
- end_files()¶
End visit of source files.
- end_project()¶
Called at the end of analysis of a project.
- end_analysis()¶
Called at the end of analysis
- class cast.analysers.dotnet.DotNetExecutionUnit(projects, files)¶
Specialised class for dotnet execution unit.
- get_source_projects()¶
For analysis that rely on projects, returns the list of project pathes.
A source project can be a vcproj, a vsproj, an eclipse project, a maven project etc...
Return type: list of str @rtype: [str]
- get_source_files()¶
Returns the selection of analysed source file pathes.
Return type: list of str @rtype: [str]
Events order¶
Note
The order is different from CAIP 7.3.3
The events are sent in the following order:
start_analysis(execution_unit)
start_project(dotnet_project1)
introducing_file(file1)
...
introducing_file(filen)
start_types()
start_type(type1)
start_member(member)
end_member(member)
...
end_type(type1)
...
end_types()
start_file(file1)
end_file(file1)
...
end_project()
start_project(dotnet_project2)
...
end_project()
end_analysis()
The order is different from 7.3.3.
cast.analysers.dotnet.Extension.start_project() gives the current project options.
Partial classes¶
Partial classes are merged when visiting the type and it’s members.
Universal Analyser specificities¶
Universal Analyser Extension¶
- class cast.analysers.ua.Extension¶
Extension points for Universal Analyzer.
- start_analysis()¶
Called at the beginning of analysis
- start_file(file)¶
Begin visit of a source file.
Parameters: file (cast.analysers.File) – the file @type file: cast.analysers.File
- start_object(object)¶
Begin visit of an object created by language pattern.
Parameters: object (cast.analysers.Object) – the object @type object: cast.analysers.Object
New in version 7.3.6.
- end_object(object)¶
End visit of an object created by language pattern.
Parameters: object (cast.analysers.Object) – the object @type object: cast.analysers.Object
New in version 7.3.6.
- end_file(file)¶
End visit of a source file.
Parameters: file (cast.analysers.File) – the file @type file: cast.analysers.File
- end_analysis()¶
Called at the end of analysis
Events order¶
The events are sent in the following order:
start_analysis()
start_file(file1)
start_object(object1)
start_object(object2)
end_object(object2)
end_object(object1)
...
end_file(file1)
start_file(file2)
end_file(file2)
...
end_analysis()
See cast.analysers.ua.Extension.
Events cast.analysers.jee.Extension.start_object(), cast.analysers.jee.Extension.end_object() correspond to objects created by pattern inside language pattern file.