API Reference

Here are the classes and methods that you can call from your python plugins.

Plugin infrastructure

Plugin API

class cast.Plugin(directory)

CAST Plugin base class

get_name()

Name

register_extension(extension)

Add an implementation for extensions points

get_plugin_directory()

Return the current plugin directory

class cast.Extension
get_plugin()

Access to the plugin of the extension.

Analyzer level

cast.analyzers package, to be used at analysis level only.

Analysis options API

class cast.analysers.ExecutionUnit

A particular object that represents the analysis options.

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]

class cast.analysers.AnalysisUnit

A particular object that represents the analysis options of a single project.

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]

Objects API

Objects produced by the analyzer :

class cast.analysers.Object

An object that can appear in the knowledge base

get_name()

Get the object name

Return type:str

@rtype: str

get_fullname()

Get the object fullname

Return type:str

@rtype: string

get_children()

Get the children

Return type:list of cast.analysers.Object

@rtype: [cast.analysers.Object]

get_position()

Get the position of an object

Return type:cast.analysers.Bookmark

@rtype: cast.analysers.Bookmark

get_positions()

Get the positions of an object

Return type:list of cast.analysers.Bookmark

@rtype: [cast.analysers.Bookmark]

get_annotations()

Returns the annotations associated with the object.

A list of annotations is returned.

Return type:list of tuple (cast.analysers.Type,dict)

An annotation is a tuple (type,parameters) where:

  • type is a Type object
  • parameters is a dictionary with the actual parameters
get_project()

Returns the root project (in the sense of enlighten) of the object.

If the object is shared among several projects, return one.

Return type:cast.analysers.Object
get_typename()

Returns the name of the metamodel type of the object.

Return type:str

New in version 8.1.0.

save_violation(rule, bookmark, additional_bookmarks=None)

Add a violation for the given rule.

rule is the name of a Metamodel property

Parameters:
  • rule (str) – property full name
  • bookmark (cast.analysers.Bookmark) – a bookmark to indicate the position of the violation
  • additional_bookmarks (cast.analysers.Bookmark) – additional bookmarks that help understanding the violation
save_property(property_full_name, value)

Save a property on the object.

Parameters:
  • property_full_name (str) – property full name, i.e. <category name>.<property name>. Example : “identification.name”.
  • or str value (integer) – property value.

Objects gathered from other analysis due to dependency configuration :

class cast.analysers.ExternalObject

The class for all external objects.

External objects are objects coming for a previous server analysis and set as input of the current analysis.

class cast.analysers.Bookmark(file, begin_line, begin_column, end_line, end_column)

The source code position of an object

get_file()

Get the source file of the bookmark.

Return type::cast.analysers.File

@rtype: cast.analysers.File

get_begin_line()

Get begin line number

Return type:int

@rtype: int

get_begin_column()

Get begin column number

Return type:int

@rtype: int

get_end_line()

Get end line number

Return type:int

@rtype: int

get_end_column()

Get end column number

Return type:int

@rtype: int

File

class cast.analysers.File

A particular object that is a source file

get_path()

Get the source file path

Return type:str

@rtype: str

Classes and methods

class cast.analysers.Type

A particular object that is a type in a programming language. It may be a class, an interface, an enum type etc..

get_inherited_types()

Get the list of inherited types

Return type:list of cast.analysers.Type

@rtype: [cast.analysers.Type]

class cast.analysers.Member

A particular object that is a class member or apparented.

get_return_type()

Get the ‘return type’ of the member When a field, it is the member type. When a method the return type. None for constructors.

Return type:cast.analysers.TypeBase

@rtype: cast.analysers.TypeBase

class cast.analysers.Method

A particular Member that is a method or apparented.

get_parameters()

Get the dictionnary of parameter name to parameter type

Return type:map string to cast.analysers.TypeBase

@rtype: {str:cast.analysers.TypeBase}

get_parameter_names()

Get the list of parameter names

Return type:list of str

@rtype: [str]

Programming type representation

class cast.analysers.TypeBase

Base class for all types.

Some types are part of the CAST Knowledge Base like Type. Some are not stored like Pointer or Array to type.

class cast.analysers.GenericType

A particular Type that is a generic type.

get_generic_parameters()

Get the list of generic parameter

Return type:list of cast.analysers.TypeBase

@rtype: [cast.analysers.TypeBase]

class cast.analysers.GenericTypeInstantiation

A particular Type that is an instantiation of a generic type.

get_generic_type()

Get the instantiated generic type.

Return type:list of cast.analysers.TypeBase

@rtype: [cast.analysers.TypeBase]

get_instantiation_parameters()

Get the instantiation parameters.

Return type:list of cast.analysers.TypeBase

@rtype: [cast.analysers.TypeBase]

class cast.analysers.PrimitiveType(name)

A primitive type. int, bool etc...

get_name()
Return type:str

@rtype: str

class cast.analysers.Array(_type)

Array of a TypeBase

get_type()

Type on which we do an array.

Return type:cast.analysers.TypeBase

@rtype: cast.analysers.TypeBase

class cast.analysers.Pointer(_type)

Pointer to a TypeBase

get_type()

Pointed type.

Return type:cast.analysers.TypeBase

@rtype: cast.analysers.TypeBase

class cast.analysers.Reference(_type)

Reference of a TypeBase

get_type()

Referenced type.

Return type:cast.analysers.TypeBase

@rtype: cast.analysers.TypeBase

Log API

Log messages to CAIP analysis log.

All log messages are automatically prefixed by the plugin name.

cast.analysers.log.info(message)

Log an information message

@type message: string

cast.analysers.log.warning(message)

Log a warning message

@type message: string

cast.analysers.log.debug(message)

Log a debug message

@type message: string

Platform utility functions

cast.analysers.get_temporary_directory()

Access to Large Temporary Storage Area folder path.

Return type:str
cast.analysers.get_intermediate_path()

Access to Large Intermediate Storage Area folder

Return type:str
cast.analysers.get_cast_version()

Access to the CAIP version

Return type:distutils.version.StrictVersion

Filtering

Some MetaModel categories that are usefull as a filter.

Use them in :

  • cast.analysers.external_link.find_objects
  • cast.analysers.test.TestAnalysis.get_objects_by_category
cast.analysers.filter.files = 'shell'

File like objects

cast.analysers.filter.classes = 'APM Classes'

Concrete classes

cast.analysers.filter.interfaces = 'APM Interfaces'

Interfaces

cast.analysers.filter.methods = 'APM Methods'

Methods

cast.analysers.filter.fields = 'APM Data Members'

Class members

cast.analysers.filter.tables = 'Database Table'

Database tables

cast.analysers.filter.views = 'Database View'

Database views

cast.analysers.filter.tables_or_views = 'CAST_ANSISQL_TableSource'

Database views and tables

Analysis level tests

This module provide testing help for developping plugins.

Simple usage:

import cast.analysers.test

analysis = cast.analysers.test.DotNetTestAnalysis()

analysis.add_selection(‘path to .csproj’)

analysis.run()

class cast.analysers.test.TestAnalysis(technology)

Base class for all tests analysis.

add_selection(path)

Select some path to analyze. Path relative to python unit test file are accepted.

Parameters:path (str) – selection path to be added.
add_database_table(name, technology)

Register a database table as an dependency.

Parameters:
  • name (str) – table name to be added.
  • technology (str) – technology name of the table. Possible values are : ‘Oracle’, ‘TSQL’.
Return type:

the table object

add_database_view(name, technology)

Register a database view as an dependency.

Parameters:
  • name (str) – view name to be added.
  • technology (str) – technology name of the view. Possible values are : ‘Oracle’, ‘TSQL’.
Return type:

the view object

New in version 8.3.32.

add_database_procedure(name, technology)

Register a database procedure as an dependency.

Parameters:
  • name (str) – procedure name to be added.
  • technology (str) – technology name of the procedure. Possible values are : ‘Oracle’, ‘TSQL’.
Return type:

the procedure object

New in version 8.3.32.

add_database_function(name, technology)

Register a database function as an dependency.

Parameters:
  • name (str) – function name to be added.
  • technology (str) – technology name of the function. Possible values are : ‘Oracle’, ‘TSQL’.
Return type:

the function object

New in version 8.3.32.

set_verbose(all_messages=False)

Will print log to console

Parameters:all_messages (boolean) – if True all messages will be printed, else only messages from current plugin
add_dependency(path)

Add a path to another plugin to also run. Path can be relative to current plugin parent.

run()

Run the analysis with the current plugin registered.

get_objects_by_category(category)

Find all produced objects of a given category Returns a map id -> object

get_objects_by_property(property, value, category)

Find all produced objects by a property value Returns a map id -> object

get_object_by_name(name, category)

Find all produced objects by name

get_objects_by_name(name, category)

Find all produced objects by name Returns a map id -> object

get_object_by_fullname(fullname, category)

Find all produced objects by fullname

Find a produced link by link type, caller, callee

Find a produced link by link type, caller

Find produced links by link type, caller, callee Returns a map id -> object

Find produced links by link type, caller Returns a map id -> object

get_violations(o, property)

Return the violations of an object for a property Return a set of Violation

print_statistics(verbosity=1)

Prints what has been created by tested plugin. number of objects number of links

class cast.analysers.test.DotNetTestAnalysis

Specialised case for dotnet.

Selection can be a csproj or a sln file.

class cast.analysers.test.JEETestAnalysis

Specialised case for JEE.

Simplest way of use is :

analysis = JEETestAnalysis()

analysis.add_selection(‘path to my JEE code’)

analysis.run()

set_java_version(version)

Specify a Java version as a string, eg. ‘1.5’, ‘1.6’

Parameters:version (str) – the version to use

Default version is ‘1.6’

add_classpath(classpath)

Specify an additional classpath

class cast.analysers.test.ABAPTestAnalysis

Specialised case for ABAP.

Simplest way of use is :

analysis = ABAPTestAnalysis()

analysis.add_selection(‘path to my ABAP extracted code’)

analysis.run()

class cast.analysers.test.UATestAnalysis(ua_language)

Specialised case for Universal Analyser.

Simplest way of use is :

analysis = UATestAnalysis(‘PHP’) analysis.add_selection(‘path to my php code’) analysis.run()
When several UA languages should be activated :
analysis = UATestAnalysis([‘PHP’, ‘Shell’])
class cast.analysers.test.MainframeTestAnalysis

Specialised case for Mainframe Analyser.

Simplest way of use is :

analysis = MainframeTestAnalysis()

analysis.add_selection(‘path to my php code’)

analysis.run()

set_cics_extensions(extensions)

Indicate the file extensions for CICS default values is “.csd;.bms”

set_cobol_extensions(extensions)

Indicate the file extensions for COBOL default values is “.cob;.cpy”

set_ims_extensions(extensions)

Indicate the file extensions for IMS default values is “.psb;.dbd”

set_jcl_extensions(extensions)

Indicate the file extensions for JCL default values is “.jcl;.prc”

set_keep_end_of_line()

By default, end of lines are truncated. Call this to keep end of line

set_mainframe_environment()

By default, we are not in mainframe environment (program names truncated to 8 chars) Call this to change to mainframe_environment.

set_cobol_tabulation_length(length)

Default is 4.

set_starting_column(length)

Default is 7.

Application level

cast.applicatin package, to be used at application level only.

Knowledge base API

class cast.application.Application(kb, identifier, name, typ)

A kb object representing an application

sql_tool(query)

Execute a so called SQL Tool.

Parameters:or file query (str) – sql batch

@type query: str or file

Basically it executes a query after having replaced some special variables : §

See documentation of CAST-MS for further detail.

update_cast_knowledge_base(name, query)

Execute a so called Update Cast knowledge base.

Parameters:or file query (str) – sql batch

@type query: str or file

Basically it executes a query after having replaced some special variables : §

to fill in CI_xxx tables and launch the tools that perform the update.

See documentation of CAST-MS for further detail.

get_knowledge_base()

Access to the knowledge base

Return type:cast.application.KnowledgeBase
get_managment_base()

Access to managment base.

Returns:cast.application.managment.ManagmentBase
WARNING :

this version only works for combined install on the same server. Future version of CAIP will leverage this limitation.

Not working on sqlserver

New in version 1.5.4.

get_application_configuration()

Access to managment base application.

Returns:cast.application.managment.Application
WARNING :
this version only works for combined install on the same server. Future version of CAIP will leverage this limitation.

New in version 1.5.4.

get_projects()

The result projects of the application.

Return type:iterable of cast.application.Project
objects()

All internal objects of the application as an iterable.

New in version 1.5.0.

Return type:cast.application.ObjectQuery

All the links of the application as an iterable.

New in version 1.5.0.

Return type:cast.application.LinkQuery
get_objects(internal=True, external=False)

Return a iterable collection of all the objects of the application.

Projects are not considered as part of the of the application as they already are accessible as direct child through get_projects.

Return type:iterable of cast.application.Object
get_objects_by_name(name, internal=True, external=False)

Search objects of a given name

Warning

Use with caution, do not use it with a variable name parameter (unit queries cause performances issues)

Parameters:name (str) – name of the searched object.
Return type:iterable of cast.application.Object
search_objects(name=None, category=None, load_properties=False)

Search objects by name or/and by type

Warning

Deprecated

Deprecated since version 1.5.0: Use cast.application.Object.objects() instead + cast.application.ObjectQuery.load_property()

Parameters:
  • name (str) – the name of the searched object
  • category (str) – the category name of the searched object
  • load_properties (bool) – if True properties of objects will be available. Slower.
Return type:

iterable of cast.application.Object

get_files(languages=[], external=False)

Get all the files of the application.

Parameters:
  • languages – list of str possible categories for the searched files.
  • external – when True takes also files marked as external
Return type:

iterable of cast.application.File

get_databases(is_sorted=None)

Get all the database objects of the application.

Return type:iterable of cast.application.Database
get_analyzer_technologies()

Returns the technologies present in this application.

Return type:multimap language –> projects for each language found

@todo : in case of UA we also need principal projects of ua

language is of type ast.application.internal.metamodel.Category

New in version 1.5.9.

declare_property_ownership(prop, scope)

State that the current plugin handles the production of a property for some types. Also works for links by passing a LinkQuery.

The current plugin will calculate all the values for that property for all the objects of those types. Object of that type that will not receive a value will have no value.

scope is the cleanup scope.

Necessary for saving properties.

Parameters:
  • prop – the property to save. Either a string for the fullname of the property or an integer for the property id.
  • scope – list of strings the names of the types or categories, or a cast.application.LinkQuery

All given types must have the property.

create_job(name, type_id=None)

Create or get an application level plugin job. Mark it as used. See _mark_plugin_jobs_as_unused and _delete_unused_jobs.

Object query API

To write queries on objects.

class cast.application.ObjectQuery(application=None)

A query on objects.

Follow the method chaining pattern.

has_type(_types_or_categories)

Filter and return a query that takes only objects of some certain types or categories

.has_type([‘Java’, ‘C++’]) : all types inheriting from Java or C++

.has_type(‘Java’).has_type(‘Method’) all types inheriting from Java and Method

Parameters:_types_or_categories – category name, id or list of those. If a list is provided, it will act as a logical or.
Return type:cast.application.ObjectQuery
not_has_type(_types_or_categories)

Filter and return a query that takes only objects that do not have certain types or categories

.not_has_type([‘Java’, ‘C++’]) : all types except those inheriting from Java or C++

.not_has_type(‘Java’).not_has_type(‘Method’) all types not inheriting from Java and not inheriting from Method

Parameters:_types_or_categories – category name, id or list of those. If a list is provided, it will act as a logical or.
Return type:cast.application.ObjectQuery

New in version 1.5.9.

load_property(propety_or_properties)

Ask for loading of one or some properties.

Note that loading one or several properties takes longer to perform the query.

Has no effect when query is used as sub query of a LinkQuery.

Parameters:properties – str or int of list of those.
Return type:cast.application.ObjectQuery
load_violations(propety_or_properties)

Ask for loading of one or some violations.

Note that loading one or several violations takes longer to perform the query.

Has no effect when query is used as sub query of a LinkQuery.

Parameters:properties – str or int of list of those.
Return type:cast.application.ObjectQuery

New in version 1.5.7.

load_positions()

Force loading of positions of object.

New in version 1.5.22.

Return type:cast.application.ObjectQuery
is_internal()

Filter internal objects.

New in version 1.5.4.

is_external()

Filter internal objects.

New in version 1.5.4.

is_public()

Filter and return a query that takes only objects that are public.

Works for C++, Java, .Net, ABAP only and will only return object of those types.

Return type:cast.application.ObjectQuery
is_private()

Filter and return a query that takes only objects that are private.

Works for C++, Java, .Net, ABAP only and will only return object of those types.

Return type:cast.application.ObjectQuery
is_protected()

Filter and return a query that takes only objects that are protected.

Works for C++, Java, .Net, ABAP only and will only return object of those types.

Return type:cast.application.ObjectQuery
is_static()

Filter and return a query that takes only objects that are static.

Works for C++, Java, .Net, ABAP only and will only return object of those types.

Return type:cast.application.ObjectQuery
is_virtual()

Filter and return a query that takes only objects that uses late binding. So

  • virtual, virtual by inheritance C+ methods
  • virtual, overrides and interface .Net methods

Works for C++, .Net only and will only return object of those types.

Return type:cast.application.ObjectQuery
is_abstract()

Filter and return a query that takes only objects that are abstract. I.e. with empty implementation and ‘virtual’.

Works for C++, Java, .Net, ABAP only and will only return object of those types.

Return type:cast.application.ObjectQuery
is_caller(link_query)

Objects that are caller of a given link query.

Parameters:linkquerycast.application.LinkQuery
Return type:cast.application.ObjectQuery
is_callee(link_query)

Objects that are callee of a given link query.

Parameters:linkquerycast.application.LinkQuery
Return type:cast.application.ObjectQuery
is_dbms()

Objects that come from a database.

Return type:cast.application.ObjectQuery
is_directory()

Objects that are directories.

Return type:cast.application.ObjectQuery
is_program()

Objects that are programs.

Return type:cast.application.ObjectQuery
is_class()

Objects that are class or interfaces.

Return type:cast.application.ObjectQuery
is_executable()

Objects that are executable : function, method, trigger, ... But not programs.

Return type:cast.application.ObjectQuery
is_package()

Objects that are package, namespace, module, schema, etc...

Return type:cast.application.ObjectQuery
is_variable()

Objects that are variable, field, member variable, something that can receive an assignment.

Return type:cast.application.ObjectQuery
is_table()

Objects that are table or view.

Return type:cast.application.ObjectQuery
is_index()

Objects that are index.

Return type:cast.application.ObjectQuery
is_foreignkey()

Objects that are foreign key.

Return type:cast.application.ObjectQuery
is_web_service_operation()

Objects that are web service handler server side REST (get, post, ...) or SOAP.

Return type:cast.application.ObjectQuery
is_web_service_call()

Objects that are web service call (client side).

Return type:cast.application.ObjectQuery

New in version 1.5.9.

is_nosql_collection()

Objects that are nosql collections (similar to table).

Return type:cast.application.ObjectQuery

New in version 1.6.7.

is_form()

Objects that are forms, controls and events.

Return type:cast.application.ObjectQuery
is_program_call()

Objects that are call to program.

Return type:cast.application.ObjectQuery

New in version 1.6.14.

is_bean()

Objects that are beans.

Return type:cast.application.ObjectQuery

New in version 1.6.14.

is_cloud_function()

Objects that are cloud functions.

Return type:cast.application.ObjectQuery

New in version 1.6.14.

is_cloud_function_call()

Objects that are calls to cloud function.

Return type:cast.application.ObjectQuery

New in version 1.6.14.

is_rpc_receive()

Objects that are receiving of RPC call.

Return type:cast.application.ObjectQuery

New in version 1.6.14.

is_rpc_call()

Objects that are call to RPC.

Return type:cast.application.ObjectQuery

New in version 1.6.14.

is_message_receive()

Objects that are receiving of message.

Return type:cast.application.ObjectQuery

New in version 1.6.14.

is_message_send()

Objects that are send of message.

Return type:cast.application.ObjectQuery

New in version 1.6.14.

in_set(set_name_or_id_or_list)

Filter objects that are part of a given set.

.in_set([‘set1’, ‘set2’]) : all objects in set or set2

.in_set(‘set1’).in_set(‘set2’) all objects in set and set2

Parameters:set_name_or_id_or_list – set name, id or list of those. If a list is provided, it will act as a logical or.
Return type:cast.application.ObjectQuery

New in version 1.5.9.

not_in_set(set_name_or_id_or_list)

Filter objects that are not_part of a given set.

.not_in_set([‘set1’, ‘set2’]) : all objects not in set or set2

.not_in_set(‘set1’).not_in_set(‘set2’) all objects not in set and not set2

Parameters:set_name_or_id_or_list – set name, id or list of those. If a list is provided, it will act as a logical or.
Return type:cast.application.ObjectQuery

New in version 1.5.9.

not_in(object_query)

Filter objects that are not_part of a given query.

Parameters:object_querycast.application.ObjectQuery
Return type:cast.application.ObjectQuery

New in version 1.5.9.

in_projects(projects)

Filter objects that are part of a given set.

.in_projects([p1, p2]) : all objects in p1 or p2

.in_projects([p1]).in_projects([p2]) all objects in p1 and p2

Parameters:projects – list of cast.application.Project.
Return type:cast.application.ObjectQuery

New in version 1.5.9.

in_query(sqlalchemyquery)

Filter objects that are part of a given query.

Parameters:sqlalchemyquery – sqlalchemy.Query a query that selects idkey
Return type:cast.application.ObjectQuery

New in version 1.5.13.

count()

Returns the number of objects in this query.

Execute a count(*) ...

New in version 1.5.9.

Objects API

Objects present in the knowledge base

class cast.application.Object(kb, identifier, name, typ, additional_values=None)

A KB object of any kind

get_name()

Returns object name.

get_fullname()

Returns object fullname.

get_qualified_name()

Give a qualified name usefull for linking.

Try to compensate fullnames differences

@since 1.4.0

get_prefixed_name()

Returns object type.name.

get_type()

Returns object’s type name.

get_metamodel_type()

Returns object metamodel type.

Return type:cast.application.internal.metamodel.Type
get_positions()

Returns object’s code positions.

Return type:cast.application.Bookmark
get_property(prop)

Return an object property.

Parameters:or int prop (str) – the property fullname, or property id to get
get_violations(prop)

Return the violations for an object.

The term violation correspond to the bookmarks of quality rule with bookmarks.

Returns:list of violations, i.e. triplet (property, Bookmark, list of Bookmark)
Parameters:or int prop (str) – the property fullname, or property id corresponding to the violations
save_property(prop, value)

Save a property on current object.

Parameters:
  • prop – the property to save. Either a string for the fullname of the property or an integer for the property id.
  • value – the value to set, either a integer, a string or a list of those integers should be 32 bits integer (i.e. ranging from [ -2^31+1, 2^31-1])

The current plugin must have declared the property has his own. :see cast.application.Application.declare_property_ownership()

Saving several times the same property on the same object will trigger an exception. Both saving a given property on an object and saving a violation for that property will trigger an exception.

save_violation(prop, bookmark, additional_bookmarks=[])

Add a violation for the given rule.

prop is the fullname of a Metamodel property

Parameters:
  • prop (str) – a property full name that count the number of rule violations
  • bookmark (cast.application.Bookmark) – a bookmark to indicate the position of the violation
  • additional_bookmarks (cast.application.Bookmark) – additional bookmarks that help understanding the violation

The property ‘prop’ is automatically valorised with the number of violations for the object.

Warning

The property ‘prop’ is automatically valorised with the number of violations for the object. So do not use save_property for this property as it will trigger and exception.

The current plugin must have declared the prop has his own. :see cast.application.Application.declare_property_ownership()

set_as_external()

Set the object as external to the application (and all its descendants)

get_application()

Returns object’s application

is_dbms()

True when object is an object from a database.

is_directory()

True when object is a directory.

is_file()

True when object is a file.

is_program()

True when object is a program.

is_class()

True when object is class or interface.

is_executable()

True when object is callable and contains executable code.

is_package()

True when object is a package, namespace, module, schema, etc...

is_variable()

True when object is a variable, field, member variable, something that can receive an assignment.

is_table()

True when object is a database table or view.

is_nosql_collection()

True when object is a nosql collection. Similar to a table.

New in version 1.6.7.

is_index()

True when object is a database index.

is_foreignkey()

True when object is a database foreign key.

is_web_service_operation()

True when object is a web service operations (get, post, ...).

is_web_service_call()

True when object is a web service call (client side).

New in version 1.5.13.

is_form()

True for forms, controls and events.

is_default_transaction_entry()

“APM Forms” “APM IFPUG Transaction” “CAST_Web_File”

is_program_call()

True when object is a program call (client side).

New in version 1.6.14.

is_bean()

True when object is a java bean.

New in version 1.6.14.

is_cloud_function()

True when object is a cloud function (AWS Lambda, Azure function, ...).

New in version 1.6.14.

is_cloud_function_call()

True when object is a call to a cloud function.

New in version 1.6.14.

is_rpc_receive()

True when object is a RPC receive.

New in version 1.6.14.

is_rpc_call()

True when object is a call to RPC.

New in version 1.6.14.

is_message_send()

True when object is a send of a message.

New in version 1.6.14.

is_message_receive()

True when object is a receiving of a message.

New in version 1.6.14.

get_projects()

Returns object’s projects

load_objects()

loads the sub objects of an object.

find_most_specific_object(line, column)

Find the most specific sub object containing line, column.

File

class cast.application.File(kb, identifier, name, typ, additional_values=None)

A kb object representing a source file.

get_path()

Get the source file path

Return type:str
load_objects()

Load the objects contained in the file.

Project

Those represent result projects (vcproj, jar, dll, .project, pom.xml, ...).

class cast.application.Project(kb, identifier, name, typ, additional_values=None)

A particular object that is the result of an Analysis Unit

@todo: - get_path on csproj

get_objects(internal=True, external=False)

Return a iterable collection of all the objects of the project

Return type:list of cast.application.Object
objects()

return a query for all the objects of this project. :rtype: cast.application.ObjectQuery

New in version 1.5.9.

Database

Objects representing analysed databases are represented by the following class :

class cast.application.Database(kb, identifier, name, typ, additional_values=None)

A kb object representing a database object.

get_owners(is_sorted=False)

Get all the schemas of the database.

Return type:iterable of cast.application.DatabaseOwner

They be retrieved using :

Application.get_databases(is_sorted=None)

Get all the database objects of the application.

Return type:iterable of cast.application.Database

Schema

class cast.application.DatabaseOwner(kb, identifier, name, typ, additional_values=None)

A kb object representing a database owner/Schema object.

get_tables()

Get the tables of the schema.

Return type:list of cast.application.Object
get_views()

Get the views of the schema.

Return type:list of cast.application.Object
get_procedures()

Get the procedures of the schema.

Return type:list of cast.application.Object
get_functions()

Get the functions of the schema.

Return type:list of cast.application.Object

Bookmark

class cast.application.Bookmark(file, begin_line, begin_column, end_line, end_column)

A bookmark, i.e., a source code area.

contains_position(line, column)

True if bookmark contains a given text location.

contains(position)

True if bookmark contains another bookmark.

get_code()

Returns the code corresponding to the bookmark.

It requires having physical access to the source code.

get_code_line(additional_lines=0)

Returns one total line of code containing the bookmark. Very useful for link’s positions.

Parameters:additional_lines – additional lines (before and after) to be returned.

Example :

for a link to ‘CodeDetail’

>>> pos.get_code_line() 
lstReadyForAdmin.DataValueField = "CodeDetail";
>>> pos.get_code_line(2)
lstReadyForAdmin.DataSource = dataSet.Tables[1];
lstReadyForAdmin.DataTextField = "Description";
lstReadyForAdmin.DataValueField = "CodeDetail";
lstReadyForAdmin.DataBind();
lstReadyForAdmin.Items.Insert(0, new ListItem("*All", string.Empty));        

If the bookmark spans on several lines, this method returns an empty string.

Reference Finder

class cast.application.ReferenceFinder

Search for patterns in a text or file.

add_pattern(name, before, element, after)

Add a search pattern.

Parameters:
  • name (str) – name of the pattern
  • element (str) – a regular expression that is searched
  • before (str) – a regular expression that should match before the searched element, may be empty but cannot be of variable length
  • after (str) – a regular expression that should match after the searched element, may be empty

So we search element preceded by before and followed directly by after.

You may add several patterns. First matching pattern will be recognised, so adding overlapping patterns is not recommended.

find_references_in_file(file)

Find references inside a file.

Parameters:file – either a file path or a File object
Return type:iterable of cast.application.Reference