Configure the source code viewer

Introduction

It is possible to view object source code direct in CAST Imaging. Source code is available by right clicking objects in the Investigation view (available after a double clicking an item at Level 5) and selecting Show source code. Below is an explanation of how to configure the source code viewer.

Click to expand

Step 1 - Identify instance names

First identify the instance names for the PostgreSQL hosts from which the Application data has been exported:

  • Locate the Application ZIPs generated during the export process and unzip them
  • Open each .csv file named xxx_is_app.csv with a text editor (where xxx is the Application name)
  • Find the instance name on the line starting with InstanceName - in the example below the instance is an IP address 192.168.200.104:
property,label,value
InstanceName,Instance Name,192.168.200.104
SchemaName,Schema Name,v8315_local
Extension,com.castsoftware.JEE-MavenHttp,2.0.6
  • Make a note of all the instance names that you want to configure for source code viewing and match these to the PostgreSQL instances.

Step 2 - Edit the configuration

All deployments - edit the application.properties file

Locate and edit the following file:

Traditional Windows installer: %APPDATA%\CAST\ImagingSystem\sourcecode\application.properties
 
Docker Installer (located in the unzipped extension folder):
server\sourcecode\application.properties or sourcecode\application.properties

Now locate the following lines in the application.properties file and ensure they match the PostgreSQL instances that host the Applications you have generated and imported. The application.propertiesfile will be predefined with two “dummy” PostgreSQL instances as shown below, these can be removed:

datasource.url=jdbc:postgresql://127.0.0.1:2284/postgres,jdbc:postgresql://127.0.0.1:2284/postgres
datasource.username=operator,operator
datasource.password=CastAIP,CastAIP
datasource.alias=localhost,local

Where:

datasource.urlThis is the JDBC url for the PostgreSQL instance where the application source code is stored. The syntax is as follows: jdbc:postgresql://<host or IP address>:<port>/postgres. Multiple instances should be separated by a comma.
datasource.usernameFor the vast majority of PostgreSQL instances, this will be operator. Multiple usernames should be separated by a comma.
datasource.passwordFor the vast majority of PostgreSQL instances, this will be CastAIP.  Multiple password should be separated by a comma.
datasource.aliasThis entry is used to identify the host name - you can use any name, however CAST suggests using the host name or IP address as entered in datasource.url entry. Separate with a comma for multiples instances.

Save the file and ensure that you restart the CAST Imaging System - sourcecode service Windows service or the sourcecode Docker container in order for the new configuration to be taken into account.

Examples

Single PostgreSQL instance

Single PostgreSQL instance called my_postgresql with default username and password:

datasource.url=jdbc:postgresql://my_postgresql:2282/postgres
datasource.username=operator
datasource.password=CastAIP
datasource.alias=my_postgresql
Multiple PostgreSQL instances

In this example we have one instance called my_postgresql1 and another called my_postgresql2 both with default username and password. Ensure that the hosts are added in the same order on each line

datasource.url=jdbc:postgresql://my_postgresql1:2282/postgres,jdbc:postgresql://my_postgresql2:2282/postgres
datasource.username=operator,operator
datasource.password=CastAIP,CASTAIP
datasource.alias=my_postgresql1,my_postgresql2

Docker deployments only - option to use run commands

Run the following command (adapt to your own environment):

imaging --updatesourcecodeconfig datasource.url=jdbc:postgresql://my_host:my_port/postgres datasource.username=operator datasource.password=CastAIP datasource.alias=my_host

Or if you need to define multiple PostgreSQL instances, run the following command (adapt to your own environment). The example below shows two PostgreSQL instances, but more than two can be added if required:

imaging --updatesourcecodeconfig datasource.url=jdbc:postgresql://my_host:my_port/postgres,jdbc:postgresql://my_host2:my_port/postgres datasource.username=operator,operator datasource.password=CastAIP,CastAIP datasource.alias=my_host,my_host2

If your PostgreSQL instances are hosted on another host machine (i.e. not hosted on the same host machine as Docker) then you will also need to run the following additional command to ensure that CAST Imaging is aware of the external host via its IP address:

imaging --addextrahost my_host=192.168.0.4

Or for multiple hosts:

imaging --addextrahost my_host=192.168.0.4 my_host2=192.168.0.5

Why can’t I see source code for some items?

Some objects/nodes in CAST Imaging do not contain any source code and a message is displayed to explain this.:

This can occur for a variety of reasons, for example:

  • Nodes in levels 1 - 5 do not have associated source code since these nodes are “groups” of nodes/objects:

  • At object level, when the object is not a specific object but rather an object grouping. In this situation, the grouped items must be expanded in order to see the constituent objects and their source code:

Click to enlarge

 

  • When the object is an “Unknown Program” - this is seen with Mainframe applications when the analyzer creates has a placeholder for programs found that are not present in the delivered source code.