Types of Refactoring

Refactoring Toolkit supports three primary categories of refactoring:

  • Model-Based Refactoring
  • File-Based Refactoring
  • Global Refactoring

Model-Based Refactoring

This approach processes artifacts at the model level. Refactoring Toolkit reads the outputs generated during the Transform action, converting them into Java beans via the Eclipse Modeling Framework (EMF), which adheres to predefined metamodels.
The schema below illustrates the process of refactoring based on model.
 

Model-Based Refactoring.png


Inputs for Model-Based Refactoring:

For Legacy Programs (e.g., COBOL, PL/I, RPG, ...):

  • DS Files: Contain legacy structure definitions (Data Simplifier).
  • STM Files: Represent legacy control flows (State Machine).

For Legacy Job Control Language (JCL) Scripts:

  • .bsModel Files: Compliant with the bsModel.ecore metamodel.

For Legacy Control Language (CL) Scripts:

  • .clModel Files: Compliant with the clModel.ecore metamodel.


Workflow:

  1. Load input files into memory as models.
  2. Apply refactorings to the models.
  3. Generate modified output files.

File-Based Refactoring

This approach works directly on textual artifacts, such as SQL or JSON files, generated during the Transform action.
The schema below illustrates the process of refactoring based on files.
 

File-Based Refactoring.png


Inputs for File-Based Refactoring:

  • SQL: Scripts for database operations.
  • JSON: Configuration or data exchange files.
  • Other text-based formats.

Workflow:

  1. Read the textual content of the input files and expose them as Java beans for refactoring.
  2. Apply the required refactorings.
  3. Generate modified output files.

Global Refactorings

Global refactoring is the final step in the refactoring process. It is a single-pass operation designed to process results from previous refactorings or to make a global action on the output project. All files from the Transform action are used as inputs, whether they were refactored or not. The schema below illustrates the process of global refactorings.
 

Global Refactorings.png


Inputs for Global Refactorings:

  • Inputs for Model-Based Refactoring
  • Inputs for File-Based Refactoring

Workflow:

  1. Read the input files and convert them into Java beans for refactoring.
  2. Apply the necessary refactorings.
  3. Generate refactored output files.