The AI-Friendly Encyclopaedia

The AI-Friendly Encyclopaedia should be a modern, intelligent knowledge hub that evolves the classic CA Gen Encyclopaedia. It should combines a Knowledge Graph (for structure and relationships) with AI capabilities (semantic search and reasoning) to store and understand all your CA Gen models — including action blocks, views, complex ESCAPE logic, and business rules. Unlike the original tool, it should allow natural language queries, intelligent impact analysis, automated documentation, and smart migration of design objects, while keeping everything transparent and human-controllable.

Why the AI-Friendly Encyclopaedia will be Different from CA Gen

I know many experienced developers were never big fans of CA Gen. The action diagrams felt restrictive, too high-level, and took away the fine-grained control they prefer when writing real code — especially around error handling, performance, and complex logic.

I share some of those concerns. That’s why it’s important to be clear:

The move to an AI-Friendly Encyclopaedia is not “CA Gen 2.0” or another rigid modelling tool.

Instead, it is built as a smart assistant for people who actually work with the system:

  • It makes legacy action blocks (including complex nested ESCAPEs) readable and understandable without forcing you to stay inside the old tool. 
  • You will remain fully in control — you can review, modify, or override anything the AI suggests. 
  • AI will take care of the painful, time-consuming work: impact analysis, tracing dependencies, documentation, and initial transformations. 
  • Developers will focus on what matters most: business logic, architecture, edge cases, and quality.

We are not throwing away control. We are adding intelligence on top of the existing knowledge while keeping the original CA Gen model as a safety net during the transition.

If you were sceptical of CA Gen’s simplified approach, your feedback is especially valuable. This new direction only succeeds if it genuinely helps traditional developers become more effective — not if it repeats the same limitations.

Reviving CA Gen Knowledge: Open Sourcing the Core Meta-Model

Project: CA Gen Meta-Model Simplified & Open

For many years, the most complete technical reference for the CA Gen encyclopedia has been hidden inside odrpta.chm — the Object Repository / Public Interface documentation. This file contains the full meta-meta model: how all objects (Entity Types, Attributes, Relationships, Processes, Action Blocks, etc.) are defined internally.

However, the original documentation is:

  • Extremely low-level and tool-specific
  • Contains a lot of obsolete construction, GUI, and platform details
  • Hard to navigate and not well suited for modern use or AI systems

What I am going to do

I will extract, filter and simplify the most valuable parts of odrpta.chm into clean, readable, and usable knowledge:

  • Focus only on the core concepts that still matter today: Entity Types, Attributes, Relationships, Subject Areas, Functions, Elementary Processes, Action Blocks, Views, etc.
  • Remove noise, obsolete technical details, and internal tool artifacts
  • Transform the very compact Action Block language into clearer, more understandable descriptions while keeping its power
  • Deliver the result in human-friendly Markdown + structured JSON formats

The goal is to create a modern, AI-ready reference of the CA Gen modeling methodology — one that is significantly easier to understand and use than the original 1000+ page help file.

Why this matters

Even today, CA Gen models contain very rich business semantics. One Action Block statement often represents the equivalent of 8–15 lines in Java or C#. This abstraction power is still relevant, but the documentation is locked in an old, complex format.

By cleaning and opening this knowledge, we can:

  • Make CA Gen concepts accessible to new developers and architects
  • Enable AI tools to better understand and work with CA Gen models
  • Preserve and evolve the methodology beyond the original tooling

Open & Extensible Approach

This will not be a static dump.
I plan to publish everything under an open license (most likely CC BY-SA or MIT) on GitHub so that:

  • Anyone can contribute improvements
  • New concepts or modern interpretations can be added
  • Translations and extensions are welcome
  • The knowledge base can evolve with the community

Wabi-Sabi & JGen.eu Philosophy

At JGen.eu, we deeply respect the Wabi-Sabi philosophy — the Japanese aesthetic that finds beauty in imperfection, impermanence, and the honest marks of time and process.

Your legacy CA Gen systems embody a form of modern Wabi-Sabi:
They were built with care in their time, but after decades of use, they now carry visible “cracks”, layers of complexity, patches, and the natural wear of long service. Like an old ceramic vessel, they tell a story of real-world use.

Our role is not to deny this history, but to respectfully transform it. Just as a master ceramic artist can take raw, rough clay — or even fragmented, textured pieces — and guide it toward refined, minimalist forms, we help organizations move from legacy complexity toward elegant simplicity.

This is why you see both styles on our site:

  • The rough, textured, stacked ceramics represent the honest, lived reality of legacy systems — full of character, history, and visible process.
  • The smooth, minimalist white ceramics represent the desired outcome: clarity, balance, precision, and quiet confidence in the AI age.

We don’t reject Wabi-Sabi — we build upon it.
We believe true mastery lies in knowing when to preserve the beauty of imperfection and when to refine it into something timeless and purposeful.

This balance between acceptance of the past and intentional transformation toward the future sits at the heart of everything we do at JGen.eu.

Why Ceramics on a Tech Modernization Website?

These clean, minimalist abstract ceramic forms represent more than just art — they embody our philosophy.

At JGen.eu, we specialize in transforming legacy CA Gen (model-driven) systems into modern, AI-native development environments. Just as these sculptures turn raw, shapeless clay into refined, intentional, and elegant objects, we help organizations reshape complex, aging systems into clean, maintainable, and future-ready solutions.

The minimalist aesthetic you see here is deliberate. It symbolizes the clarity, simplicity, and precision we deliver — moving from legacy complexity to modern elegance.

You won’t find much of the currently trending rough, textured, and fragmented ceramic style on this site. While powerful in its own context, that chaotic and raw aesthetic goes against the core idea we stand for: controlled transformation, order, and refined simplicity.

Well-designed systems, like well-designed objects, should feel balanced, purposeful, and timeless.

Welcome to JGen.eu — where legacy meets modernity.

Should CA Gen meet AI?

JGen focuses on extensions and tools for CA Gen (a legacy model-driven development platform), and now considering integration of AI concepts to be a smart to breathe new life into the concept thru its incubator projects. This should enhance legacy tool integration by leveraging AI models (e.g., large language models or LLMs) for tasks like model analysis, automated documentation, code refactoring suggestions, or even generating modern equivalents from CA Gen action blocks. The “models approach” here aligns well with using AI to process and augment CA Gen’s metamodel data (via JMMI API), turning rigid legacy structures into more dynamic, AI-assisted workflows. Based on industry best practices for AI in legacy modernisation, especially for model-driven tools like CA Gen (which often generates COBOL/Java for mainframes), the emphasis is on evolutionary, low-risk integration. Start small, focus on data extraction, and build prototypes that add value without overhauling everything. AI should help “unlock” legacy assets post-extraction, such as optimising generated code or enabling cloud-native features. It won’t magically provide 1:1 transformations. Human oversight is a key element.

Legacy systems, such as CA Gen, are complex, with dependencies on mainframe products, rigid metamodels, and shrinking expertise pools. AI should excel in targeted areas (e.g., understanding code via knowledge graphs and LLMs), but also needs to prioritize use cases that align with our site’s focus on extensions (e.g., JMMI-based tools, action block reuse, annotations). This aligns with best practices for incremental modernisation.

Some archived projects like Annotating Gen Objects will be reinstated and reused. Perhaps using an LLM to analyse/expand DESC fields and turning them into structured metadata or suggestions.

Action block modernisation is another tempting idea. Extracting logic via JMMI (or some other equivalents), then ask AI to suggest refactors, docs, or translations to modern langs (e.g., Python/Node.js).

Walkency type of tools are dominent as model querying tools, but building a natural language interface to search/explain CA Gen models, reducing manual toolset navigation is probably the best way to go.

AI can help flag outdated patterns in models and prepare for legacy upgrades. It will be prioritizing based on feasibility. We should focus on read-only analysis first to minimize risks when planning predictive maintenance.

Use of existing JMMI-based tools from the jgen.eu to extract sample data from a test CA Gen models will be the basic method of doing things.

This approach should AI efforts could be beneficial and integrated, not bolted-on. Once done, we can move to a proof-of-concept (POC): E.g., a Python script that extracts via JMMI, feeds to an LLM, and outputs enhanced docs.

Answer is it has to be yes. Very few experiments done so far, using Grok as tool, shows a huge potencial that cannot be ignored.

This website is in transition

This website is in transition. Most of the existing contents have been rearranged. You will find a big part of the older staff marked as retired. All references to the retired projects are moved to the Archive pages. Meanwhile, new projects are under development. The main purpose of the existing goal remains the same. Create a model of what you want to have in some sort of universal modeling language, and generate what is needed to run as a real application.

Creating ExtractBooks utility in Swift 4

Introduction

The Booxter for Mac application allows you to collect information about books in your home library.  This post describes the creation of a simple ExtractBooks utility that is extracting some data about books stored in the SQLite database used by the Booxter and loads this data into the MongoDB database. The purpose of this little project is to build expertise in creating a server-side logic using Swift programming language, and this is the first step. It should help later in creating generation templates used by the Data Model Widgets to generate source code in Swift for the different databases like MYSQL, SQLite or PostgreSQL.

Exporting data from Booxter

Booxter helps you track your collections of books, music, movies, and comics on your Mac. You will find more about Booxter here. You can download a trial version and play with it if you like.

Here is a snapshot of how the Booxter main screen looks.

The Booxter creates a library at the location of your choice.

You can use Show Package Contents to explore inner structure of the library.

You will find that data.sql is local SQLite database keeping data about books, music, and videos. You will notice that images subdirectory contains some image files. Those are small snapshots of the book’s covers.

You can open the data.sql file using DB Browser for SQLite or similar product. Here is a list showing the structure of the database used by the application.

We are going to use only a fraction of the data describing books. Here is a sample of the ZBXITEM table keeping most of the details about each book.

Two other tables: ZBXAUTHOR and ZBXIMAGE have additional details we are going to export from the database. The ZBXIMAGE table does not keep images itself, but rather a name of the file stored in the images subdirectory.

It makes sense to mention that path to the data.sql file looks something like:

file:///Users/User/Desktop/BooxterTest.bxbooklib/data.sql

Creating development environment

The first steps will create a development environment for the project. It will allow assembling of all products required to develop and build utility successfully. Installing SQLite and MongoDB is out of the scope of this post.

Step 1. Create a folder for the project

$ mkdir ExtractBooks
$ cd ExtractBooks
$ swift package init --type executable

Step 2. Create package  file inside a new directory

You need to create Package.swift file in the newly created directory.

import PackageDescription

let package = Package(
    name: "ExtractBooks",
    dependencies: [
        .package(url: "https://github.com/IBM-Swift/Swift-Kuery-SQLite.git", from: "1.1.0"),
        .package(url: "https://github.com/OpenKitten/MongoKitten.git", from: "4.0.0")
    ],
    targets: [
         .target(
            name: "ExtractBooks",
            dependencies: ["MongoKitten", "SwiftKuerySQLite"]),
    ]
)

You can notice that our project depends on two other packages: Swift-Kuery-SQLite and MongoKitten. We can create Xcode project now. Rest of the development will be done using Xcode development tool for Mac running macOS.

$ swift package generate-xcodeproj

Structure of the utility

This utility is activated from the command line. It takes some parameters describing the location of the SQLite and MongoDB databases. Here are sample parameters.

-u "file:///Users/User/Desktop/BooxterTest.bxbooklib/data.sql" "mongodb://localhost/library" "books"

Here is the content of the main.swift file’.

//
//  main.swift
//
//  Created by Marek Stankiewicz on 16/06/2018.
//
import Foundation


let mainLogic = MainLogic()
if CommandLine.argc < 1 {
    mainLogic.consoleDialog.printUsage()
} else {
    let returnStatus = mainLogic.startProcessing()
    if returnStatus.rc == 0 {
        mainLogic.consoleDialog.writeMessage(returnStatus.message, to: OutputType.standard)
    } else {
        mainLogic.consoleDialog.writeMessage(returnStatus.message, to: OutputType.error)
    }
    exit(Int32(returnStatus.rc))
}

Here is the MainLogic.swift file with the functionality responsible for processing the input parameters.

//
//  MainLogic.swift
//
//  Created by Marek Stankiewicz on 16/06/2018.
//

import Foundation
import CoreData

enum OptionType: String {
    case upload = "-u"
    case help = "-h"
    case unknown
 
    init(value: String) {
        switch value {
        case "-u": self = .upload
        case "-h": self = .help
        default: self = .unknown
        }
    }
}

enum ProcessResponse  {
    case  successfull
    case  noSQLiteConnect(String)
    case  noMongoDBConnect(String)
    case  problemCreatingMongoDBDoument(String)
    case  problemProcessingMongoDB(String)
    case  problemOpeningImageFile(String)
}

class MainLogic {
    
    let consoleDialog = ConsoleDialog()
    
    func startProcessing() -> (rc: Int, message: String) {
        let arguments = CommandLine.argc
        if arguments < 1 {
            return (rc: ReturnCode.command_line_usage_error.rawValue, message: "No option parameters provided.")
        }

        let option = getOption(CommandLine.arguments[1])
        switch option {
        case .upload:
            let params = unpackCmdParams(array : CommandLine.arguments)
            if params == nil {
                return (rc: ReturnCode.command_line_usage_error.rawValue, message: "Wrong number of parameters for -u function.")
            }
            if !validateURL(url: (params?.sqLite)!) {
                return (rc: ReturnCode.command_line_usage_error.rawValue, message: "URL to SQLite database malformed.")
            }
            if !validateURL(url: (params?.mongodburl)!) {
                 return (rc: ReturnCode.command_line_usage_error.rawValue, message: "URL to MongoDB database malformed.")
            }
            let uploadAction = UploadAction(filename: (params?.sqLite)!)
            let processResponse = uploadAction.upload(fromSQLite: (params?.sqLite)!, toMongoDB: (params?.mongodburl)!, collectionName:  (params?.collectionName)!)
            return createRetrunMessage(processResponse: processResponse)
        case .help:
            consoleDialog.printUsage()
        case .unknown:
            return (rc: ReturnCode.command_line_usage_error.rawValue, message: "Unknown option.")
        }
        consoleDialog.printUsage()
        return (rc: ReturnCode.command_line_usage_error.rawValue, message: "Unknown option.")
    }
    
    func validateURL(url : String) -> Bool {
        let nsurl = NSURL(string: url)
        return nsurl == nil ? false : true
    }
    
    func unpackCmdParams(array : [String]) -> (sqLite : String, mongodburl : String, collectionName : String)? {
        if array.count != 5 {
            return nil
        }
        return (array[2], array[3], array[4])
    }
    
    func getOption(_ option: String) -> OptionType {
        return OptionType(value: option)
    }
    
    func createRetrunMessage(processResponse: ProcessResponse) -> (rc: Int, message: String) {
        switch processResponse {
        case .successfull:
            return (0,"Processing completed successfully")
        default:
            return (1, self.getDescription(processResponse: processResponse))
        }
    }
 
    func getDescription(processResponse: ProcessResponse) -> String {
        switch processResponse {
        case .successfull:
            return "successful"
        case let .noSQLiteConnect(message):
            return  message
        case let .noMongoDBConnect(message):
            return message
        case let .problemOpeningImageFile(message):
            return message
        case let .problemCreatingMongoDBDoument(message):
            return message
        case let .problemProcessingMongoDB(message):
            return message
        }
    }
    
}

The process of extracting from SQLite and loading to the MongoDB is in the UploadAction.swift file.

//
//  UploadAction.swift
//  BooksUpload
//
//  Created by Marek Stankiewicz on 25/06/2018.
//

import Foundation
import SwiftKuery
import SwiftKuerySQLite
import MongoKitten

class ZBXITEM: Table {
    let tableName = "ZBXITEM"
    let zpkitem = Column("Z_PK", Int32.self)
    let zisbn = Column("ZISBN")
    let ztitle = Column("ZTITLE")
    let zlocation = Column("ZLOCATION")
    let zproductdescription = Column("ZPRODUCTDESCRIPTION")
    let zpublisher = Column("ZPUBLISHER")
    let zpages = Column("ZPAGES", Int32.self)
    let zlanguage = Column("ZLANGUAGE")
    let zdatepublished = Column("ZDATEPUBLISHED", Timestamp.self, notNull: false)
}

class ZBXIMAGE: Table {
    let tableName = "ZBXIMAGE"
    let zpkimage = Column("Z_PK")
    let zfilename = Column("ZFILENAME")
}

class ZBXAUTHOR: Table {
    let tableName = "ZBXAUTHOR"
    let zpkauthor = Column("Z_PK", Int32.self)
    let zname = Column("ZNAME")
}

class UploadAction {
    
    var processResponse : ProcessResponse = ProcessResponse.successfull
    var connection : SQLiteConnection
    
    init(filename: String){
        self.processResponse = ProcessResponse.successfull
        self.connection = SQLiteConnection(filename: filename)
    }
    
    func upload(fromSQLite : String, toMongoDB: String, collectionName: String) -> ProcessResponse {
        connection.connect() { error in
            if error == nil {
                let url = URL(string: fromSQLite)
                let imagedir = url?.deletingLastPathComponent().absoluteString
                process(toMongoDB: toMongoDB,collectionName: collectionName, imagedir: imagedir! + "images/")
            }
            else if let error = error {
                processResponse = ProcessResponse.noSQLiteConnect("Error opening database: \(error.description)")
            }
        }
        return processResponse
    }
    
    func extractTimestamp(number: Any) -> String {
        let formatter = DateFormatter()
        formatter.locale = Locale(identifier: "en_US_POSIX")
        formatter.dateFormat = "yyyy-MM-dd'.'HH.mm.ss.00000"
        formatter.timeZone = TimeZone(secondsFromGMT: 0)
        if number is Int32 {
            return formatter.string(from: Date(timeIntervalSince1970: Double(number as! Int32)))
        } else if number is Double {
            return formatter.string(from: Date(timeIntervalSince1970: number as! Double))
        }
        return ""
    }
    
    func process(toMongoDB: String, collectionName: String, imagedir: String) {
        do {
            let library = try MongoKitten.Database(toMongoDB)
            let books = library[collectionName]
            
            let zbxitems = ZBXITEM()
            let query = Select(zbxitems.zpkitem,
                               zbxitems.zisbn,
                               zbxitems.ztitle,
                               zbxitems.zlocation,
                               zbxitems.zproductdescription,
                               zbxitems.zpublisher,
                               zbxitems.zpages,
                               zbxitems.zlanguage,
                               zbxitems.zdatepublished, from: zbxitems)
            connection.execute(query: query) { queryResult in
                if let rows = queryResult.asRows {
                    for row in rows {
                        var book:  Document  = Document()
                        
                        // Primary key
                        let zpkitem = row["Z_PK"].unsafelyUnwrapped as! Int32
                        book.append(zpkitem, forKey: "_id")
   
                        // ISBN Number
                        let zisbn = row["ZISBN"]
                        if zisbn.unsafelyUnwrapped != nil {
                            book.append(zisbn! as! Primitive, forKey: "isbn")
                        }
                        
                        // Title
                        let ztitle = row["ZTITLE"]
                        if ztitle.unsafelyUnwrapped != nil {
                            book.append(ztitle! as! Primitive, forKey: "title")
                        }
                        
                        // Location
                        let zlocation = row["ZLOCATION"]
                        if zlocation.unsafelyUnwrapped != nil {
                          //  book.append(zlocation! as! Primitive, forKey: "location")
                        }
                        
                        // Product Description
                        let zproductdescription = row["ZPRODUCTDESCRIPTION"]
                        if zproductdescription.unsafelyUnwrapped != nil {
                            book.append(zproductdescription! as! Primitive, forKey: "description")
                        }
                        
                        // Publisher
                        let zpublisher = row["ZPUBLISHER"]
                        if zpublisher.unsafelyUnwrapped != nil {
                            book.append(zpublisher! as! Primitive, forKey: "publisher")
                        }
                        
                        // Pages
                        let zpages = row["ZPAGES"]
                        if zpages.unsafelyUnwrapped != nil {
                            book.append(zpages as! Primitive, forKey: "pages")
                        }
                        
                        // Language
                        let zlanguage = row["ZLANGUAGE"]
                        if zlanguage.unsafelyUnwrapped != nil {
                            book.append(zlanguage! as! Primitive, forKey: "language")
                        }
                        
                        // Date Published
                        let zdatepublished = row["ZDATEPUBLISHED"]
                        if zdatepublished.unsafelyUnwrapped != nil {
                            book.append(self.extractTimestamp(number: zdatepublished.unsafelyUnwrapped ?? "unknown"), forKey: "datepublished")
                        }
                        
                        var authors = [String]()
                        
                        let zbxauthor = ZBXAUTHOR()
                        
                        let queryAuthor = Select(zbxauthor.zpkauthor,
                                           zbxauthor.zname, from: zbxauthor).where(zbxauthor.zpkauthor == Parameter())
                        self.connection.execute(query: queryAuthor, parameters: [Int(zpkitem)]) { queryResult in
                        
                            if let rows = queryResult.asRows {
                               
                                for row in rows {
                                    // Author Name
                                    let zname = row["ZNAME"]
                                    if zname.unsafelyUnwrapped != nil {
                                        authors.append(zname as! String)
                                    }
                                }
                            }
                         }
                         book.append(authors, forKey: "authors")
                        
                        let zbximage = ZBXIMAGE()
                        
                        let queryImage = Select(zbximage.zpkimage,
                                                 zbximage.zfilename, from: zbximage).where(zbximage.zpkimage == Parameter())
                        self.connection.execute(query: queryImage, parameters: [Int(zpkitem)]) { queryResult in
                            
                            if let rows = queryResult.asRows {
                                for row in rows {
                                    // Author Name
                                    let zfilename = row["ZFILENAME"]
                                    if zfilename.unsafelyUnwrapped != nil {
                                         let path = imagedir + (zfilename.unsafelyUnwrapped as! String)
                                        
                                        // File Name
                                        let url = URL(string: path)
                                        do {
                                            let file: FileHandle? = try FileHandle(forReadingFrom: url!)
                                            if file != nil {
                                                let data = file?.readDataToEndOfFile()
                                                file?.closeFile()
                                                book.append(Binary(data: data!, withSubtype: Binary.Subtype.generic), forKey: "image")
                                            }
                                        } catch {
                                            self.processResponse = ProcessResponse.problemOpeningImageFile("Problem opening image file: \(String(describing: url))")
                                        }
                                      }
                                }
                            }
                        }
                       
                         do {
                            try books.append(book)
                        } catch {
                            self.processResponse = ProcessResponse.problemCreatingMongoDBDoument("Problem appending a new document for item: \(Int(zpkitem))")
                        }
                    }
                }
            }

        } catch {
            self.processResponse = ProcessResponse.problemProcessingMongoDB("Problem processing MongoDB")
        }
        return
    }
    
}

The entire project is in the GitHub here.

Sample data from the database created using the MongoDB follows:

Summary

This is a just the first example of using Swift. More will follow. Next step will be a server logic written using Kitura framework.

Project: User-Added Function Implemented by Action Block (Part2)

I mentioned about launching a new incubator project. The primary goal was to build a tool helping in the development of so-called user-added functions for the CA Gen. It was couple weeks ago. The first experimental version of the Eclipse project delivering such tool you can find here published on the GitHub for the public viewing. You will be able to download the standalone UAF utility from here. I would like to remain you that all software downloaded from this website is experimental and you should not use it in the production environment until tested adequately.

This post provides a detailed information how to install and use the UAF utility by creating a simple user-added function in the CA Gen Model, later referred to as a function.

Installing software

Step 1. Download and expand zip file

The utility consists of the executable jar file and directory with the number of jar files required to run the UAF utility. Your installation directory will look as follows.

Step 2. Copying CA Gen jar files

The utility is using a number CA Gen jar files which you can find in the CA Gen installation directory. You need to copy them into the subdirectoryuad_lib. They are:

com.ca.gen.jmmi_8.5.0.00333.jar, abrt.jar, csu.jar, odc.jar, vwrt.jar

Above jar files containing JMMI API allowing access a CA Gen model located on the workstation and some runtime classes allowing run mockup software required to do unit-testing of your newly developed functions.

Step 3. Starting utility

You need to run the utility from the command line. Here is how to display help information.

Utility  User-Added Function (UAF), Version 0.5
Usage:  java  -jar uaf.jar  modelpath cagenpath [ -forceall | -testonly  | -sourcesonly]
     where:
        -forceall   force clean up entire generation frastructure
        -testonly   generate test classes only
        -sourcesonly   regenerate implementation classes only

You will learn more about parameters and options later.

Defining user-added function

We are going to use the CA Gen Toolset to develop a library of functions. This is very easy and straightforward process.

Step 1. Create a new CA Gen model

Best practice is to start creating a new dedicated empty model and use it to define all functions in your library. Additionally, you can use such model later to implement some of your functions using some purpose written action blocks created in this model.

Step 2. Set environment for generation

You will notice that your model has one Business System having a name like your model. Select Environment under Construction and select our business system by double-clicking on the name. You will see the following window pane opens allowing set some properties for the selected business system.

The utility can generate only for the Java environment at present. Therefore, be sure that selected operating system is JVM, language is  Java and you set correct name for the package.

Step 3. Create action block

You are defining a function by creating your action block. Not all action block can serve as a template. Qualifying action block should have some attribute views defined in the import section and single attribute in the export section.

We are going to create a rather simple function first whose whole purpose will be to add two numbers and return a sum of them as a result. We expect that our new function will take two parameters of type number and return a single number.

 
Model : TSTUAF1                                       10 Sept. 2017  22:24
Subset: (complete model)                                         
                                                                           
                          BSD Action Block:  FAB01
___________________________________________________________________________

Action Block Description:
#meta {
import eu.jgen.notes.uaf.proc.Function;
@Function (CGName="XFAB01", useselec=false, impl=true)
// Adds two numbers and returns sum of those numbers.
}

 +- FAB01
 |    IMPORTS: 
 |      Work View   imp1 ief_supplied (optional,transient,import only)
 |        count (optional)
 |      Work View   imp2 ief_supplied (mandatory,transient,import only)
 |        count (mandatory)
 |    EXPORTS: 
 |      Work View   exp ief_supplied (transient,export only)
 |        count 
 |    LOCALS: 
 |    ENTITY ACTIONS: 
 |  
 |  USE ab02
 |      WHICH IMPORTS: Work View   imp1 ief_supplied  TO Work View   imp1 ief_supplied 
 |                     Work View   imp2 ief_supplied  TO Work View   imp2 ief_supplied 
 |      WHICH EXPORTS: Work View   exp ief_supplied  FROM Work View   exp ief_supplied 
 +--

The above action block qualifies as a template for the function and we will use it to create such function. Also, please notice that action block has one statement. The statement is USE statement and invokes another action block. This is an unnecessary complication, but it demonstrates that function’s implementation can invoke a number other action blocks if necessary.

 
Model : TSTUAF1                                       10 Sept. 2017  22:28
Subset: (complete model)                                         
                                                                           
                           BSD Action Block:  AB03
___________________________________________________________________________

Action Block Description:

 +- AB03
 |    IMPORTS: 
 |      Work View   imp1 ief_supplied (optional,transient,import only)
 |        count (optional)
 |      Work View   imp2 ief_supplied (mandatory,transient,import only)
 |        count (mandatory)
 |    EXPORTS: 
 |      Work View   exp ief_supplied (transient,export only)
 |        count 
 |    LOCALS: 
 |      Work View   loc ief_supplied 
 |        command 
 |    ENTITY ACTIONS: 
 |  
 |  SET exp ief_supplied count TO imp1 ief_supplied count + imp2 ief_supplied count 
 +--

The statement in the last invoked action block has our implementation logic and simply adds two numbers. On this occasion, we are going to use newly created action block to implement the logic of our function as well. Please notice that only first action block has the annotation.

Step 4. Annotate action block

We are using Java style annotations to mark action block as a template creating function. You find the following annotation added to the description of our action block.

 

The @Funtionannotation allows providing additional information required for creating a function in the CA Gen model. The CGName parameter specifies the generated function internal name. It should be unique among already existing functions including those provided by the CA Gen. The useselecparameter indicates whether the function will take part in a database SELECT statement as selection criteria. The parameterimpl indicates whether the action block should be used as implementation. You may decide to implement function entirely outside of the CA Gen or only partially using also dedicated action blocks.

This step completes a process of defining the function. Rest of processing is generating artifacts using our UAF utility.

Step 5. Running utility

You will need Java 1.8 to run, but you can regenerate project with another version of Java. Version 1.7 should be fine. Utility takes two parameters. The first parameter points to the location of the CA Gen model with templates created in the previous step. The second parameter points to the location of the CA Gen itself. Here is sample output produced when running the utility.

Utility  User-Added Function (UAF), Version 0.5
Starting...
Connected to local model: TSTUAF1
WARNING: All subdirectories were forced to be emptied.
INFO: Adding subdirectory. 
INFO: Adding java functions subdirectory. 
INFO: Adding meta-inf subdirectory. 
INFO: Generation directory used: C:\jgen.notes.models.test\tstuaf1.ief\notes
INFO: Project file with Java nature created. 
INFO: Classpath file with CA Gen libraries created. 
INFO: Found 1 function(s).
INFO: XML file for 1 function(s) created.
INFO: Creating  package sub-directories for functions: C:\jgen.notes.models.test\tstuaf1.ief\notes\src\com\ca\gen\abrt\functions
INFO: Function com.ca.gen.abrt.functions.XFAB01 generated.
INFO: Creating  package sub-directories for functions: C:\jgen.notes.models.test\tstuaf1.ief\notes\src\com\ca\gen\abrt\functions\test
INFO: Function Test Classcom.ca.gen.abrt.functions.XFAB01Tests generated.
WARNING: Test class was regenerated. All previous modifications were lost.
INFO: Implementation action block AB03 generated.
INFO: Implementation action block AB02 generated.
INFO: Implementation action block FAB01 generated.
INFO: MANIFEST.MF file created. 
Processing completed.

Utility produces some messages as progress thru the generation process. The utility does not modify your model and is accessing model in the read-only mode.

Step 5. Reviewing generated artifacts

You will find that your local model directory’s structure has changed and you have a new subdirectory notes and its internal structure is as follows.

The utility creates Eclipse plug-in project structure that you can import into the Eclipse as a new project. The project has Java nature, and all Java artifacts will be compiled as soon import completes.

Step 6. Import project into Eclipse

You need to start Import wizard, select Existing Projects into Workspace and press Next.

You need select root directory and our new project will show up on the list of projects. Select project and press Finish.

 

You will notice that you have a new project in your workspace. The project is instantly built.  You can expand folders to see what has been generated for you.

 

Starting from the top, the folderjava has sources of all action blocks marked by annotation and all other action blocks that may be used by the annotated action block. Next, the foldersrc contains the source of the function and testing harness for the unit testing. On the bottom, you will find XML userfunctions.xmlfile with the definition of the function. The CA Gen Toolset will use this file to create the function inside the CA Gen model.

Testing user-added function

Your functions can be relatively straightforward and tested easily, but in some cases, you will need to ensure a proper test cycle. This includes unit test done in a separation of other software components. The UAF utility can help generating for you some testing classes invoking the function with your choice of input parameters and checking if result matches expected value. The proposed testing framework provides mock-up setting simulating real runtime environment. You do not need to run the web server and deploy test application to the server to conduct such tests.

Here is generated code for our sample function.

/**
* Code generated by UserAddedFunctionProcessor
*/
package com.ca.gen.abrt.functions.test;

import static org.junit.Assert.assertTrue;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;

import com.ca.gen.abrt.functions.XFAB01;
import com.ca.gen.vwrt.types.IntAttr;
import com.google.inject.Guice;
import com.google.inject.Injector;

import eu.jgen.notes.ab.direct.mgr.ActionBlockModule;
import eu.jgen.notes.ab.direct.mgr.DBMSType;
import eu.jgen.notes.ab.direct.mgr.DirectException;
import eu.jgen.notes.ab.direct.mgr.SessionContext;
import eu.jgen.notes.ab.direct.mgr.SessionManager;
import eu.jgen.notes.ab.direct.mgr.TransactionManagerType;

/**
 * @author
 *
 */
public class XFAB01Tests {

	static Injector injector;
	private static SessionManager sessionManager;

	/**
	 * @throws java.lang.Exception
	 */
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		try {
			injector = Guice.createInjector(new ActionBlockModule());
			sessionManager = injector.getInstance(SessionManager.class);
			sessionManager.initialize(TransactionManagerType.None, DBMSType.None).begin();
		} catch (DirectException e) {
			e.printStackTrace();
		}
	}

	/**
	 * @throws java.lang.Exception
	 */
	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	@Test
	public void sampleTest() {
		IntAttr result = IntAttr.getInstance();
		XFAB01.XFAB01(new Object(), new SessionContext(sessionManager.getGlobData()), sessionManager.getGlobData(), 2,
				2, result);
		assertTrue(result.get() == 4);
	}

}

The only change to the generated code was to modify method assertTrue and set values for two input parameters.

The test classes are not always generated. You need to run the utility with the-testonly parameter to have them generated.

Delivering user-added functions

The CA Gen does not know about your new function at this point. You need CA Gen Toolset to find user-added function and create relevant changes in the Gen model. One of the generated artifacts is the XML file.userfunctions.xml You will find file having the same name in one of the directories created after CA Gen was installed. The directory name isC:\ProgramData\CA\Toolset. This file contains some user-added functions provided by the CA Gen. You need to merge those files or, for time being, rename original file and copy in your one generated by our UAF utility. Once you start the CA Gen Toolset our function will be visible and available for use.

You will find more about user-added function here on the CA Gen Documentation website.

Developing application using functions

Here a snapshot of the procedure step developed in the another model that uses the newly developed function.

Model : USEUAF1                                       10 Sept. 2017  23:10
Subset: (complete model)                                         
                                                                           
                          Procedure Step:  USRUAF1
___________________________________________________________________________

Procedure Step Description:

Action Block Description:

 +- USRUAF1
 |    IMPORTS: 
 |      Work View   imp1 ief_supplied (optional,transient,import only)
 |        count (optional)
 |      Work View   imp2 ief_supplied (optional,transient,import only)
 |        count (optional)
 |    EXPORTS: 
 |      Work View   result ief_supplied (transient,export only)
 |        count 
 |      Work View   exp1 ief_supplied (transient,export only)
 |        count 
 |      Work View   exp2 ief_supplied (transient,export only)
 |        count 
 |    LOCALS: 
 |    ENTITY ACTIONS: 
 |  
 +--
 +- EVENT ACTION usruaf1_pb_add_click
 |  SET result ief_supplied count TO fab01(imp1 ief_supplied count, imp2 ief_supplied count) 
 +--

Deploying application

There is no difference to the standard way of building and deploying an application with user-added functions. However, you need to remember to build a jar file with some classes from the model you are using to develop your functions.

You need to make your jar visible to the Build Tool so application consuming your function can successfully compile your application. You jar file needs also to be included in the application ear file by the Assembly process.

You can see the sample application running after deploying to the Weblogic server.

Java Wrapping for CA Gen Encyclopedia API

Historically first officially published CA Gen API was the Encyclopedia and Workstation Application Program Interface (API) software for CA Gen. It supports the Host Encyclopedia and the Client Server Encyclopedia (CSE) for all available API platforms and databases. It also supports local access to workstation models, Host Encyclopedia, and the CSE for all available API platforms and databases.

The Encyclopedia API is a set of C functions, include files, and libraries. You must be familiar with the C programming language and the software development tools for the platform on which you are working in order to use the Encyclopedia API. You must also be familiar with the CA Gen meta-model.

Today we have CA Gen JMMI API written in Java. The JMMI was introduced when CA Technologies announced the CA Gen Studio built on the Eclipse platform. The JMMI is frontend written in Java, but most of their methods are native methods written in C++. The JMMI does not offer access to the models stored in one of the supported encyclopedias (HE and CSE). Therefore, the Encyclopedia API is the only way to access models stored in the HE and CSE.

The JGen Notes Core Java project is offering Java wrapping for the models located on the workstation only (limitations of the CA Gen Free Gen), but those interfaces can be easily extending to the model located in the remote places like Client Server Encyclopedia (CSE) or Host Encylopedia (HE).

You can find sources of the implementation here and here.

 

This website uses cookies. By continuing to use this site, you accept our use of cookies.