Page tree
Skip to end of metadata
Go to start of metadata
Purpose

This is an alternate Reference Finder for use when the original Reference Finder on Dependencies is not working. It is not faster than the original Reference Finder, so it should be used only when the original Reference Finder does not give the expected results. It is based on a Python script (sos_reference_finder.py) and a SQL script (sos_reference_finder.sql). The Python script parses the source files and fills-in a temporary table (SUP_TMP_REF_FINDER), Then the SQL script must be used as a KB Update Tool in order to create the links. There is also a batch file (sos_reference_finder.bat) that allows to call the Python script from Cast-MS.

It can be added to Cast-MS as a set of two Tools After Analysis : one External Program (sos_reference_finder.bat), and one KB Update Tool (containing sos_reference_finder.sql

Applicable in CAST Version
Release
Yes/No
8.3.x(tick)
8.2.x(tick)
8.1.x(tick)
8.0.x(tick)
7.3.x(tick)
Applicable RDBMS
RDBMS
Yes/No
Oracle Server(tick)
Microsoft SQL Server(tick)
CSS2(tick)
Details

Prerequisites

 Follow the below prerequisites before running the tool:

CAST-AIP

sos_reference_finder must be installed on the same machine as  CAST-AIP.

sos_reference_finder.py is a Python script, so you need to launch it with Python 3.4 embedded in Cast AIP.

Objects in KB

The application must have been analyzed first, so that KB is populated with objects

Configuration

The Python script must be configured in the configuration section (see below). The options are the same as in the original Reference Finder.

Configuration Section - sos_reference_finder.py
###########################################################################################
#                                                                                         #
#                                CONFIGURATION SECTION                                    #
#                                                                                         #
###########################################################################################

#####################################################################
#                         TECHNOLOGIES                              #
#                                                                   #
# The possible choices depend on the contents of your metamodel.    #      
# For source technology, make your choice among the results of the  #
# following query :                                                 #
#                                                                   #
#    select idcat, catnam from cat                                  #
#    where catnam like '%Artifacts';                                #
#                                                                   #
#####################################################################

SOURCE_TECHNOLOGY = 'APM SQL Artifacts'     # mandatory unique

TARGET_TECHNOLOGY = 'PLSQL'                 # mandatory unique
      

#################
#     MATCH     #
#################

REGEX = r'\$\(\"#[a-zA-Z0-9]+\"\)\.attr\(\"[a-zA-Z0-9]+\",\"([a-zA-Z0-9\.]+)\"\)'                      # mandatory unique

IGNORECASE = True

REPLACE = r'\1/'

MATCH = 'Name'                                # 'Name', 'FullName' or 'Path'

MATCH_MODE = 'Whole'                          # 'Whole', 'Sub' or 'Over'

#############################################
#               SOURCE SET                  #
#                                           #
# The file extensions specified here must   #
# be part of the selected SOURCE_TECHNOLOGY #
# else the tool will not work               #
#                                           #
# In case of doubt, just leave it empty     #
#############################################

SOURCE_FILE_REGEX = ['PB[\w\.]+\.SRC]                           # case insensitive

#############################################
#                TARGET SET                 #
#                                           #
# The types specified here must be part of  #
# the selected TARGET_TECHNOLOGY else the   #
# tool will not work                        #
#                                           #
# In case of doubt, just leave it empty     #
#############################################

TARGET_TYPES = ["Oracle view", "Oracle table", "Oracle procedure", "Oracle function"]

###############
#    LINK     #
###############

LINK_TYPE = 'useLink'                      # mandatory unique

 

The batch file must be configured with 3 variables : the location of the python executable, and two mandatory arguments for the python script : host and kb

sos_reference_finder.bat
rem To be set
set HOST=localhost
set KBNAME=salim_823_local
set "PYTHON=C:\Flat Service Packs\8.2.6\ThirdParty\Python34\python.exe"

Launch Sos Reference Finder

The Python script can also be launched in command-line if no automation is needed (or for testing purpose)

Usage

sos_reference_finder.py is a Python script, so you need to launch it with Pyhon 3.4 embedded in Cast AIP.

Mandatory arguments :

  • host : the hostname of the CSS server where the knowledge base is installed
  • kb: the name of the knowlegde base
  • log : dependency injector log file (not the analysis log)

Optional arguments :

  • port : the port of the CSS server where the management base is installed (default : 2280)
  • user : the user name used to connect to the CSS server (default : operator)
  • password : the password used to connect to the CSS server (default : CastAIP)
  • verbose : more details are given in the log file and on the standard output (default : False)
  • encoding : the encoding used in the files to parse (default: utf-8)

Open a CMD window, and navigate to the folder where you installed classpath_checker. Type the following command-line :

Command-line
<INSTALL_FOLDER>\ThirdParty\Python34\python.exe sos_reference_finder.py -host <CSS SERVER> -kb <KNOWLEDGE_BASE> -log <SOS_REFERENCE_FINDER_LOG>

Command-line output

sos_reference_finder first builds the source file set and the target objects set based on the configuration:

Build source file set and target set
C:\temp\Tools\sos_reference_finder>"C:\Flat Service Packs\8.2.7\ThirdParty\Python34\python.exe" sos_reference_finder.py -host localhost -kb app_local -log C:\temp\11050\TKB.log
 
Computing source set...
Building source set query
Done !
Found 18087 source objects
Done
Computing target set...
Building target set query
Done !
Found 35379 target objects
Done
Found 890 files to parse

 

Then it pre-pocesses and parses the source files, and adds links to a table called SUP_TMP_REF_FINDER

File Parsing
Preprocessing file P:\Deploy\APP\DB\PB.XXX.YYY_0001.src...
Parsing preprocessed file P:\Deploy\APP\DB\PB.XXX.YYY_0001.src...
No source object found for reference to CREATE
Bingo !
Adding link from [37072,GET_PACKAGE_VERSION] to TARGET : [id_obj = 20940], [obj_name=GET_VERSION], [obj_full_name=APP.XXX.YYYY.GET_VERSION], [obj_path=P:\Deploy\APP\DB\PB.XXX.ZZZ_VERSION.src]
Notes/comments

Tickets #11050

The tool is available here :

svn://gargantua/SUPPORT/trunk/Tools/PYTHON/sos_reference_finder

Related Pages

 

 

 

 

  • No labels