DEV Module - Core Rules Engine Overview
DEV Module - Core Rules Engine Overview
Module Location: /home/user/openl-tablets/DEV/
Version: 6.0.0-SNAPSHOT
Last Updated: 2025-11-05
Executive Summary
The DEV module is the heart of OpenL Tablets, containing the complete business rules engine that compiles Excel spreadsheets into executable Java bytecode. It consists of 9 submodules organized in a layered architecture:
Foundation (commons) → Core Engine (rules) → Project Management → Integration (spring)
Total Size: ~1,900+ Java files Key Technology: Java 21, ASM (bytecode generation), JavaCC (parser), Apache POI (Excel)
Module Architecture
┌──────────────────────────────────────────────────┐
│ org.openl.spring │
│ (Spring Integration) │
├──────────────────────────────────────────────────┤
│ org.openl.rules.test │
│ (Testing Framework) │
├──────────────────────────────────────────────────┤
│ org.openl.rules.project │
│ (Project Management) │
├──────────────────────────────────────────────────┤
│ org.openl.rules │
│ (CORE ENGINE) │
│ ┌──────────────────────────────────────┐ │
│ │ Parser → Binder → Codegen → VM │ │
│ └──────────────────────────────────────┘ │
├──────────────────────────────────────────────────┤
│ org.openl.rules.annotations │ org.openl.rules.util │
├──────────────────────────────────────────────────┤
│ org.openl.rules.gen │ org.openl.rules.constrainer │
├──────────────────────────────────────────────────┤
│ org.openl.commons │
│ (Foundation) │
└──────────────────────────────────────────────────┘
Submodules Overview
| Module | LOC | Files | Purpose | Dependencies |
|---|---|---|---|---|
org.openl.commons |
3,000+ | 60+ | Foundation utilities, logging | None |
org.openl.rules |
150,000+ | 1,200+ | Core engine, parsing, compilation | commons, annotations, util, POI, ASM |
org.openl.rules.annotations |
200 | 5 | Custom annotations | None |
org.openl.rules.util |
5,000+ | 20+ | Built-in rule functions | annotations |
org.openl.rules.gen |
2,000+ | 30+ | Code generation (build-time) | rules, Velocity |
org.openl.rules.constrainer |
10,000+ | 100+ | Constraint solver | commons |
org.openl.rules.project |
15,000+ | 100+ | Project management | rules, JAXB |
org.openl.spring |
3,000+ | 25+ | Spring integration | commons, Spring |
org.openl.rules.test |
500+ | 5+ | Testing framework | rules.project |
1. org.openl.commons - Foundation
Location: /home/user/openl-tablets/DEV/org.openl.commons/
Purpose: Shared foundation for all OpenL modules
Key Packages
org.openl.domain - Domain Modeling
Purpose: Represents value domains (sets of allowed values) with type information
Core Interfaces:
IDomain<T>- Main domain abstractioninterface IDomain<T> { IType getElementType(); boolean selectObject(T obj); Iterator<T> iterator(); }
Implementations:
IntRangeDomain- Integer ranges (e.g., 1..100)DateRangeDomain- Date rangesEnumDomain- Enumeration domainsIIntDomain- Integer domain specialization
Use Case: Defining valid values for rule parameters (e.g., age must be 18-65)
org.openl.util - Utility Classes (58 classes)
Formatters: /home/user/openl-tablets/DEV/org.openl.commons/src/org/openl/util/
BooleanFormatter- Boolean value formattingDateFormatter- Date/time formattingEnumFormatter- Enum value formattingNumberFormatter- Numeric formatting
Collections:
BiMap- Bidirectional mapCollectionUtils- Collection helpersArrayTool,ArrayUtils- Array operations
File Handling:
FileTool- File operationsFileUtils- File utilitiesZipArchiver,ZipUtils- ZIP compression
Type Utilities:
ClassUtils- Class loading and reflectionJavaGenericsUtils- Java generics handlingJavaKeywordUtils- Java keyword checking
Other:
StringUtils,StringTool- String operationsNumberUtils,MathUtils- Math operationsSqlDBUtils- Database utilitiesJAXBUtils- XML bindingProjectPackager- Project packaging
org.openl.info - Environment Info
Key Classes:
OpenLLogger- Main static logger initializationLogger log = OpenLLogger.getLogger(MyClass.class);OpenLVersion- Version information queriesSysInfo*classes - System introspection (JVM, JDBC, JNDI)
Dependencies
Internal: org.openl.rules.util (since 6.0.0 - circular dependency)
External:
- SLF4J 2.0.17 (logging facade)
- Jakarta XML Bind 4.0.4 (JAXB for Java 11+)
Entry Points
// Logging
Logger log = OpenLLogger.getLogger(MyClass.class);
// Version info
String version = OpenLVersion.getVersion();
// Class loading
Class<?> clazz = ClassUtils.getClass("com.example.MyClass");
2. org.openl.rules - CORE ENGINE ⭐
Location: /home/user/openl-tablets/DEV/org.openl.rules/
Purpose: Complete rules engine - parsing, type system, binding, compilation, execution
Size: ~1,200 Java files, 150,000+ LOC
2.1 Architecture Overview
┌─────────────────────────────────────────────┐
│ EXCEL RULES (Source) │
└─────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ Parser (BExGrammar - JavaCC) │
│ Location: org.openl.rules.lang.xls.Parser │
└─────────────────────────────────────────────┘
↓
ISyntaxNode (Syntax Tree)
↓
┌─────────────────────────────────────────────┐
│ Binder (Type Resolution & Method Binding) │
│ Location: org.openl.binding │
└─────────────────────────────────────────────┘
↓
IBoundNode (Compiled AST)
↓
┌─────────────────────────────────────────────┐
│ Code Generation (ASM Bytecode) │
│ Location: org.openl.rules.runtime │
└─────────────────────────────────────────────┘
↓
Generated Proxy Classes
↓
┌─────────────────────────────────────────────┐
│ Virtual Machine (SimpleRulesVM) │
│ Location: org.openl.vm │
└─────────────────────────────────────────────┘
2.2 Type System
Location: /home/user/openl-tablets/DEV/org.openl.rules/src/org/openl/types/
Core Type Abstractions
IOpenClass - Replaces Java Class
interface IOpenClass {
String getName();
IOpenMethod getMethod(String name, IOpenClass[] params);
IOpenField getField(String name);
IOpenField[] getFields();
IOpenMethod[] getMethods();
Object newInstance(IRuntimeEnv env);
boolean isSimple();
boolean isAbstract();
boolean isArray();
}
Key Implementations:
AOpenClass- Abstract base classADynamicClass- Dynamic type that can add members at runtimeComponentOpenClass- Complex types with nested fieldsStaticOpenClass- Wraps Java classesNullOpenClass- Represents null typeArrayOpenClass- Array types
Why Not Java Classes?
- Allows dynamic types created from Excel tables
- Supports runtime type modification
- Enables cross-module type resolution
- Provides unified interface for Java and OpenL types
IOpenMethod - Method Abstraction
interface IOpenMethod extends IOpenMethodHeader, IMethodCaller {
IOpenClass getType(); // Return type
IMethodSignature getSignature(); // Parameters
Object invoke(Object target, Object[] params, IRuntimeEnv env);
}
IOpenField - Field Abstraction
interface IOpenField {
Object get(Object target, IRuntimeEnv env);
void set(Object target, Object value, IRuntimeEnv env);
IOpenClass getType();
String getName();
}
2.3 Parsing - Excel to Syntax Tree
Parser Location: /home/user/openl-tablets/DEV/org.openl.rules/src/org/openl/rules/lang/xls/Parser.java
Grammar: /home/user/openl-tablets/DEV/org.openl.rules/grammar/bexgrammar.jj (JavaCC)
Parser Methods:
class Parser implements IOpenParser {
XlsModuleSyntaxNode parseAsModule(IOpenSourceCodeModule source);
IdentifierNode[] parseAsParameterDeclaration(String code);
ISyntaxNode parseAsType(String code);
ISyntaxNode parseAsMethodHeader(String code);
}
Process:
- Read Excel using Apache POI
- Identify tables by header patterns (e.g., “Decision Table”, “Data”, “Spreadsheet”)
- Parse expressions in cells using JavaCC grammar
- Build syntax tree (
ISyntaxNodehierarchy) - Attach metadata (table properties, cell locations)
Table Type Detection: /home/user/openl-tablets/DEV/org.openl.rules/src/org/openl/rules/lang/xls/XlsDefinitions.java
2.4 Binding - Type Resolution
Location: /home/user/openl-tablets/DEV/org.openl.rules/src/org/openl/binding/
Core Interface:
interface IBoundNode {
IOpenClass getType(); // Resolved type
Object evaluate(IRuntimeEnv env); // Evaluate at runtime
void assign(IRuntimeEnv env, Object value); // Assignment
IBoundNode[] getChildren();
}
Node Binders (50+ implementations):
BinaryOperatorOrNodeBinder- Binary operations (+, -, *, /, etc.)TypeCastBinder- Type castingForNodeBinder- For loopsMethodNodeBinder- Method callsFieldBoundNode- Field accessLiteralNodeBinder- Literals (strings, numbers)
Binding Context: /home/user/openl-tablets/DEV/org.openl.rules/src/org/openl/binding/IBindingContext.java
- Manages variable scopes
- Resolves method references
- Handles type conversions
- Tracks compilation errors
Main Implementation: RulesModuleBindingContext (848 lines) at /home/user/openl-tablets/DEV/org.openl.rules/src/org/openl/rules/binding/RulesModuleBindingContext.java
2.5 Decision Tables
Location: /home/user/openl-tablets/DEV/org.openl.rules/src/org/openl/rules/dt/
Core Interface:
interface IDecisionTable extends IOpenMethod {
DecisionTableColumnHeaders getColumnHeaders();
IParameterDeclaration[] getDeclarationParameters();
// Execution methods
}
Structure:
Decision Table: Calculate Premium
| Age | Risk | Premium |
|-------|--------|---------|
| 18-25 | High | $500 | <- Rule row
| 26-65 | Low | $200 | <- Rule row
Key Components:
DecisionTableDataType- Represents entire table as a typeDecisionRowField- Single rule rowRuleExecutionObject- Runtime execution objectDecisionTableColumnHeaders- Header metadata
Algorithm Framework: /home/user/openl-tablets/DEV/org.openl.rules/src/org/openl/rules/dt/algorithm/
IMatchAlgorithmCompiler- Compiles matching logicIMatchAlgorithmExecutor- Executes rule matchingWeightAlgorithmCompiler- Weight-based matchingScoreAlgorithmCompiler- Score-based matching
Indexing: /home/user/openl-tablets/DEV/org.openl.rules/src/org/openl/rules/dt/index/
IRuleIndex- Indexes rules for fast lookup- Optimization: Builds search trees for efficient rule matching
Validation: /home/user/openl-tablets/DEV/org.openl.rules/src/org/openl/rules/dt/validator/
DecisionTableValidator- Validates completenessDecisionTableAnalyzer- Detects overlaps and gapsDecisionTableUncovered- Uncovered scenariosDecisionTableOverlapping- Overlapping rules
2.6 Data Tables
Location: /home/user/openl-tablets/DEV/org.openl.rules/src/org/openl/rules/data/
Purpose: Store structured data in Excel tables
Example:
Datatype Rate
| State | Rate |
|-------|-------|
| CA | 0.075 |
| NY | 0.085 |
| TX | 0.060 |
Key Classes:
ITable- Table data interfaceITableModel- Grid-based modelDataOpenField- Field in data tableOpenlBasedDataTableModel- OpenL implementationFieldChain- Navigate complex objects
2.7 Spreadsheet Tables
Location: /home/user/openl-tablets/DEV/org.openl.rules/src/org/openl/rules/calc/
Purpose: Excel-like grid calculations
Key Classes:
Spreadsheet- Main spreadsheet typeSpreadsheetInvoker- Invocation handlerSpreadsheetStructureBuilder- Builds structure from Excel
Features:
- Cell formulas
- Cross-cell references
- Calculated columns
- Aggregate functions
2.8 Datatype Tables
Location: /home/user/openl-tablets/DEV/org.openl.rules/src/org/openl/rules/datatype/
Purpose: Define custom business types in Excel
Example:
Datatype Person
| Field Name | Type |
|------------|--------|
| name | String |
| age | Integer|
| salary | Double |
Code Generation: /home/user/openl-tablets/DEV/org.openl.rules/src/org/openl/rules/datatype/gen/
JavaBeanClassBuilder- Generates Java classes using ASMASMUtils- ASM bytecode utilitiesFieldDescriptionBuilder- Field metadata
Process:
- Parse datatype table
- Build
IOpenClassdynamically - Generate bytecode with getters/setters
- Load into JVM
2.9 Column Match Tables
Location: /home/user/openl-tablets/DEV/org.openl.rules/src/org/openl/rules/cmatch/
Purpose: Specialized matching algorithm for complex scenarios
Key Classes:
ColumnMatch- Main typeColumnMatchBoundNode- Compiled node- Matchers:
EnumMatchMatcher- Enum matchingClassMatchMatcher- Class matchingNumberMatchMatcher- Numeric matching
2.10 Algorithm Tables (TBasic)
Location: /home/user/openl-tablets/DEV/org.openl.rules/src/org/openl/rules/tbasic/
Purpose: Imperative algorithm definitions
Key Classes:
AlgorithmInvoker- Executes algorithmsAlgorithmTableParserManager- Parses algorithm syntax- Compile/Runtime packages: Compilation and execution logic
2.11 Test Methods
Location: /home/user/openl-tablets/DEV/org.openl.rules/src/org/openl/rules/testmethod/
Purpose: Define test cases in Excel
Key Classes:
TestSuiteMethod- Test executionTestUnitsResults- Test resultsRulesResultExport- Export test results
2.12 Compilation & Execution
Compilation Entry Point: /home/user/openl-tablets/DEV/org.openl.rules/src/org/openl/engine/OpenLCompileManager.java
CompiledOpenClass compile(IOpenSourceCodeModule source);
Runtime Entry Point: /home/user/openl-tablets/DEV/org.openl.rules/src/org/openl/rules/runtime/RulesEngineFactory.java
RulesEngineFactory<T> factory =
new RulesEngineFactory<>(sourceFile, interfaceClass);
T instance = factory.newInstance();
Execution Flow:
- Proxy Generation - ASM generates proxy class implementing interface
- Method Interception -
OpenLRulesMethodHandlerintercepts calls - Context Injection -
IRulesRuntimeContextprovides execution context - VM Execution -
SimpleRulesVMexecutes compiled code - Result Return - Result returned to caller
Runtime Context: /home/user/openl-tablets/DEV/org.openl.rules/src/org/openl/rules/context/
IRulesRuntimeContext- Holds execution state (date, region, etc.)DefaultRulesRuntimeContext- Default implementation- Use Case: Rule versioning by context dimensions
2.13 Validation Framework
Location: /home/user/openl-tablets/DEV/org.openl.rules/src/org/openl/validation/
Key Classes:
ValidationManager- Orchestrates validationIOpenLValidator- Validator interface- Property Validation:
/home/user/openl-tablets/DEV/org.openl.rules/src/org/openl/rules/validation/properties/- Dimensional validation
- Constraint checking
- Property consistency
2.14 Error Handling
Location: /home/user/openl-tablets/DEV/org.openl.rules/src/org/openl/exception/
Exception Hierarchy:
OpenLException
├── OpenLCompilationException (compile-time)
├── OpenLRuntimeException (runtime)
└── OpenLUserRuntimeException (user-level runtime)
Message System: /home/user/openl-tablets/DEV/org.openl.rules/src/org/openl/message/
OpenLMessage- Structured message with severityOpenLErrorMessage- Error messagesOpenLWarnMessage- Warning messagesOpenLMessagesUtils- Message utilities
Dependencies
External:
- Apache POI 5.4.1 (Excel parsing) - CRITICAL
- ASM 9.8 (Bytecode generation) - CRITICAL
- Apache Commons Lang3 3.19.0
- Apache Commons Collections4 4.5.0
- Groovy 4.0.28 (expression evaluation)
- Jakarta XML Bind 4.0.4
Internal:
org.openl.commonsorg.openl.rules.annotationsorg.openl.rules.utilorg.openl.rules.constrainer
Entry Points Reference
| Use Case | Entry Point | Location |
|---|---|---|
| Compile single file | RulesEngineFactory<T> |
org.openl.rules.runtime.RulesEngineFactory |
| Parse Excel | Parser.parseAsModule() |
org.openl.rules.lang.xls.Parser |
| Programmatic compilation | OpenLManager.makeMethod() |
org.openl.engine.OpenLManager |
| Execute rules | factory.newInstance() |
(generated proxy) |
3. org.openl.rules.annotations
Location: /home/user/openl-tablets/DEV/org.openl.rules.annotations/
Purpose: Custom annotations for OpenL extensions
Size: 5 annotation classes
Annotations
@Operator - Define Custom Operators
@Operator
public static int add(int a, int b) {
return a + b;
}
Location: org.openl.rules.annotations.Operator
Target: TYPE, METHOD
Retention: RUNTIME
Use: Registers operators in LibrariesRegistry
@ContextProperty - Mark Context Properties
public class Context {
@ContextProperty("region")
private String region;
}
Use: Enables rule versioning by context dimensions
@NonNullLiteral - Disallow Null Values
Use: Literal value validation
@IgnoreNonVarargsMatching / @IgnoreVarargsMatching
Use: Control method matching for varargs methods
Dependencies
None - only standard Java annotations
4. org.openl.rules.util
Location: /home/user/openl-tablets/DEV/org.openl.rules.util/
Purpose: Built-in functions callable from OpenL rules
Utility Classes
Collections:
Arrays- Array operations (filter, map, reduce)Strings- String manipulationsNumbers- Numeric operationsBooleans- Boolean utilitiesDates- Date/time utilities
Aggregations:
Sum,Avg,Product- Statistical functionsStatistics- General statistics
Math:
Round- Rounding operations
Miscellaneous:
Miscs- General utilities
Date Intervals: /home/user/openl-tablets/DEV/org.openl.rules.util/src/org/openl/rules/util/dates/
DateInterval- Date range abstractionDateIntervalImpl- ImplementationCalendarWrapper- Calendar utilities
Usage Example
In Excel rules, these functions are available:
Sum(prices) // Sum array
Avg(ages) // Average
Round(value, 2) // Round to 2 decimals
Strings.join(list, ",") // Join strings
Dependencies
org.openl.rules.annotations(uses@Operator)
5. org.openl.rules.gen - Code Generation
Location: /home/user/openl-tablets/DEV/org.openl.rules.gen/
Type: POM project (not deployed)
Purpose: Generates code at build time
Tools
Main Generators:
GenRulesCode- Generates rule execution codeGenRulesTypes- Generates type definitionsSourceGenerator- Abstract generatorVelocityTool- Template processor
Velocity Templates (12 templates):
ITableProperties-properties.vm- Interface propertiesDefaultTableProperties-properties.vm- Default propertiesDefaultRulesContext-properties.vm- Context propertiesDefaultPropertyDefinitions.vm- DefinitionsTableProperties-properties.vm- Table propertiesMatchingOpenMethodDispatcher.vm- Method dispatchDefaultPropertiesIntersectionFinder.vm- Property intersectionDefaultPropertiesContextMatcher-constraints.vm- Context matchingDefaultTablePropertiesSorter-constraints.vm- SortingRulesCompileContext-validators.vm- Validation coderules-enum.vm- Enum generationIRulesContext-properties.vm- Context interface
Process
- Read table property definitions
- Apply Velocity templates
- Generate Java source files
- Compile into engine
Dependencies
org.openl.rules(engine)- Apache Velocity 2.4.1
Note: Only used during build, not deployed to runtime
6. org.openl.rules.constrainer - Constraint Solver
Location: /home/user/openl-tablets/DEV/org.openl.rules.constrainer/
Purpose: Constraint programming engine for CSP (Constraint Satisfaction Problems)
Core Abstractions
Constrainer - Main solver engine
Constrainer constrainer = new Constrainer();
IntVar x = constrainer.addIntVar(0, 10, "x");
constrainer.addConstraint(x.gt(5));
boolean solved = constrainer.findSolution();
IntVar - Integer variable
- Domain - Value domain
- Operations:
add(),mul(),lt(),gt(), etc.
IntExp - Integer expression
IntBoolExp- Boolean expressionsIntExpConst- Constants
Constraint - Abstract constraint
ConstraintConst- Constant constraints
Goal - Search goal
GoalSetMin,GoalSetMax- Optimization goalsGoalOr- OR goals
Execution Model
- Observer Pattern - Constraint propagation
- Backtracking -
ChoicePointLabel - Undo - Rollback mechanism
Use Case
Rarely used in typical OpenL projects, but available for:
- Resource allocation
- Scheduling problems
- Optimization scenarios
- Complex constraint satisfaction
Dependencies
org.openl.commonsonly
7. org.openl.rules.project - Project Management
Location: /home/user/openl-tablets/DEV/org.openl.rules.project/
Purpose: Manages OpenL projects - loading, configuration, instantiation
Size: ~100 Java files, 15,000+ LOC
7.1 Project Model
Location: /home/user/openl-tablets/DEV/org.openl.rules.project/src/org/openl/rules/project/model/
ProjectDescriptor - Main configuration (848 lines)
@XmlRootElement
class ProjectDescriptor {
String name;
List<Module> modules;
List<PathEntry> classpath;
List<ProjectDependencyDescriptor> dependencies;
OpenAPI openapi;
// Methods
File getProjectFolder();
URL[] getClassPathUrls();
URI getRelativeUri(File file);
}
File: rules.xml (project root)
Example rules.xml:
<project>
<name>Insurance Rules</name>
<modules>
<module>
<name>premium-calc</name>
<rules-root path="rules/premium"/>
</module>
</modules>
<dependencies>
<dependency>
<name>common-rules</name>
</dependency>
</dependencies>
</project>
Module - Single module definition
class Module {
String name;
PathEntry rulesSource;
PathEntry testSource;
}
PathEntry - Classpath entry (URL or file)
ProjectDependencyDescriptor - External project dependency
7.2 Project Serialization
XmlProjectDescriptorSerializer - JAXB-based XML serialization
- Reads/writes
rules.xml - Tag constants:
PROJECT_DESCRIPTOR_TAG,DEPENDENCY_TAG - Custom adapters for whitespace handling
7.3 Project Instantiation (CRITICAL)
Location: /home/user/openl-tablets/DEV/org.openl.rules.project/src/org/openl/rules/project/instantiation/
SimpleProjectEngineFactory<T> - Main factory
Builder Pattern:
SimpleProjectEngineFactory<MyRules> factory =
new SimpleProjectEngineFactoryBuilder<MyRules>()
.setProject("/path/to/project")
.setInterfaceClass(MyRules.class)
.setExecutionMode(true)
.build();
MyRules instance = factory.newInstance();
Configuration Methods:
setProject(String)- Project directorysetWorkspace(String)- Workspace pathsetInterfaceClass(Class<T>)- Service interfacesetClassLoader(ClassLoader)- Custom classloadersetExecutionMode(boolean)- Execution vs compilationsetExternalParameters(Map)- ParameterssetProjectDependencies(String...)- Dependencies
Instantiation Strategies:
RulesInstantiationStrategy- Base interfaceCommonRulesInstantiationStrategy- Common implSimpleMultiModuleInstantiationStrategy- Multi-moduleApiBasedInstantiationStrategy- API-based
Dependency Management:
IDependencyLoader- Loads dependenciesSimpleDependencyLoader- Simple implementationAbstractDependencyManager- Base managerRuntimeContextInstantiationStrategyEnhancer- Context injection
7.4 Project Resolution
ProjectResolver - Finds projects in filesystem
ProjectResourceLoader - Loads project resources
ResolvingStrategy - Resource discovery strategies
SimpleXlsResolvingStrategy- Simple Excel discoveryProjectDescriptorBasedResolvingStrategy- Descriptor-based
7.5 File Name Processing
PropertiesFileNameProcessor - Processes properties files
DefaultPropertiesFileNameProcessor - Default implementation
Purpose: Parse file names with embedded properties
Example: premium-calc%region=US%date=2024.xlsx
Dependencies
org.openl.rules(engine)- Apache Commons Lang3 3.19.0
- JAXB Runtime 4.0.4
Entry Points
Fluent Builder:
new SimpleProjectEngineFactoryBuilder<T>()
.setProject("path")
.build()
Direct:
new SimpleProjectEngineFactory<>(projectPath, interfaceClass)
8. org.openl.spring - Spring Integration
Location: /home/user/openl-tablets/DEV/org.openl.spring/
Purpose: Spring Framework integration for OpenL
Size: ~25 classes, 3,000+ LOC
8.1 Conditional Configuration
@ConditionalOnEnable - Conditional bean registration
@Configuration
@ConditionalOnEnable({"feature.enabled", "module.enabled"})
public class MyConfig {
// Beans only registered if properties are non-false/non-empty
}
Implementation: EnableCondition evaluates properties
8.2 Property Sources Framework
Location: /home/user/openl-tablets/DEV/org.openl.spring/src/org/openl/spring/env/
Base Classes:
DynamicPropertySource- Base for dynamic propertiesPropertySourcesLoader- Loads property sourcesApplicationPropertySource- Application-levelDefaultPropertySource- Default properties
Specialized Sources:
SysPropPropertySource- System propertiesSysEnvRefPropertySource- Environment variablesSysInfoPropertySource- OS/JVM infoServletContextPropertySource- Servlet contextRandomValuePropertySource- Random valuesRefPropertySource- Property references (${})
Features:
- Property References:
${other.property} - Security:
PassCoderfor password encoding - Firewall:
FirewallPropertyResolverfor security - Multi-source: Hierarchical property resolution
Usage Example
@Configuration
public class AppConfig {
@Autowired
private Environment env;
@Bean
public DataSource dataSource() {
String url = env.getProperty("db.url");
// Supports: db.url=${default.db.url}
}
}
Dependencies
- Spring Beans 6.2.11
- Spring Context 6.2.11
- Jakarta Servlet API 6.0.0
org.openl.commons
9. org.openl.rules.test - Testing Framework
Location: /home/user/openl-tablets/DEV/org.openl.rules.test/
Purpose: Testing framework for OpenL rules
Size: ~5 classes, 500+ LOC
Main Component
RulesInFolderTestRunner - Executes tests from folder
Usage:
RulesInFolderTestRunner runner =
new RulesInFolderTestRunner("/path/to/project");
TestResults results = runner.run();
Features:
- Discovers test files automatically
- Executes test methods
- Reports results (pass/fail)
- Integration with project system
Test Resources
Located in /test-resources/:
- Test fixtures
- Multi-module test projects
- Dependency scenarios
- Properties file patterns
Dependencies
org.openl.rules.project(project instantiation)
Module Dependencies Graph
┌─────────────────┐
│ org.openl. │
│ spring │
└────────┬────────┘
│
┌────────▼────────┐
│ org.openl. │
│ rules.test │
└────────┬────────┘
│
┌───────────────────▼────────────────────┐
│ org.openl.rules.project │
└───────────────────┬────────────────────┘
│
┌───────────────────▼────────────────────┐
│ org.openl.rules │
│ (CORE ENGINE) │
└───┬──────┬──────────────┬──────────────┘
│ │ │
┌────────▼──┐ ┌▼──────────┐ ┌▼────────────────┐
│org.openl. │ │org.openl. │ │org.openl.rules. │
│ rules. │ │ rules. │ │ constrainer │
│annotations│ │ util │ └─────────────────┘
└───────────┘ └───────────┘
│ │
└──────┼──────────┐
│ │
┌──────▼──────┐ ┌▼──────────────┐
│org.openl. │ │org.openl.rules│
│ commons │ │ .gen │
└─────────────┘ └───────────────┘
Critical Paths & Entry Points
Compilation Path
Source File
↓
RulesEngineFactory<T>
↓
OpenLCompileManager
↓
Parser.parseAsModule()
↓
Syntax Tree (ISyntaxNode)
↓
Binder.bind()
↓
Bound Tree (IBoundNode)
↓
ASM Bytecode Generation
↓
CompiledOpenClass
Execution Path
factory.newInstance()
↓
ASM Proxy Class
↓
OpenLRulesMethodHandler
↓
Method Lookup
↓
SimpleRulesVM.execute()
↓
IRuntimeEnv
↓
Result
Project Loading Path
SimpleProjectEngineFactory
↓
ProjectDescriptor (rules.xml)
↓
Module Resolution
↓
Dependency Loading
↓
Multi-Module Compilation
↓
Instantiation Strategy
↓
Generated Proxy
Known Issues & Technical Debt
Deprecated Code
OpenL.getInstance()- Marked with TODO: DO NOT USE- Issue: Static singleton anti-pattern
- Status: Needs refactoring
- Operator Methods - 20+ deprecated in
Operatorsclass- Issue: Should use annotation-based registration
- Status: Planned removal
- Source Modules - Several
*SourceCodeModuleclasses deprecated- Issue: Replaced with simpler abstractions
- Status: Scheduled for removal
TODOs & FIXMEs (30+ identified)
Architecture Issues:
- Method calling in constructor -
ComponentOpenClass:52 - Generic type support missing -
CastToWiderType:78 - Array dimension initialization -
NewArrayNodeBinder:45 - Static method access design -
TypeBoundNode:120
Code Quality:
- String interning review -
RuleRowHelper:234 - Cache implementation (memory leak risk) -
JavaOpenClassCache:156 - Public field refactoring -
BinaryNode,UnaryNode - Legacy method search -
MethodSearch:445
Feature Gaps:
- Security blocking for system classes -
TypeResolver:89 - Excel format consideration -
RuleRowHelper:456 - Comma-separated array parsing -
RuleRowHelper:523 - URL space support -
URLSourceCodeModule:67
Excluded Tests
In org.openl.rules.constrainer/pom.xml:
TestExecutionControlTestExecutionControl2TestIntExpElementAt
Status: Excluded from Surefire - likely broken or legacy
Performance Considerations
Compilation Performance
Bottlenecks:
- Excel parsing (Apache POI)
- Type resolution (large type hierarchies)
- Method binding (overload resolution)
- Bytecode generation (ASM)
Optimizations:
- Rule indexing for fast lookup
- Caching of compiled classes
- Lazy loading of modules
Execution Performance
Optimizations:
- Bytecode generation (native JVM performance)
- Method dispatch optimization
- Context caching
- Rule indexing
Profiling: Use org.openl.rules.profiler module
Testing Strategy
Unit Tests
- JUnit 5 framework
- Mockito for mocking
- Test each module independently
Integration Tests
- Located in
/ITEST/ - TestContainers for Docker-based tests
- End-to-end scenarios
Test Coverage
- Core engine: High (>80%)
- Project management: Medium (>60%)
- Utilities: High (>80%)
External Dependencies Summary
Build-Time
- JavaCC - Parser generation
- Maven - Build system
Compile-Time & Runtime
- ASM 9.8 - Bytecode generation (CRITICAL)
- Apache POI 5.4.1 - Excel parsing (CRITICAL)
- Groovy 4.0.28 - Expression evaluation
- Apache Commons - Lang3, Collections4
- SLF4J 2.0.17 - Logging
- Jakarta XML Bind 4.0.4 - JAXB
- Velocity 2.4.1 - Templates (code gen)
- Spring 6.2.11 - Spring integration
Test-Time
- JUnit 5 - Testing
- Mockito - Mocking
- Spring Test - Spring testing
See Also
- Technology Stack - Complete tech stack
- Codebase Tour - Navigate the codebase
- Development Setup - Get started
- Root CLAUDE.md - Coding conventions
- DEV/CLAUDE.md - Core engine conventions
Module Documentation Complete Version: 6.0.0-SNAPSHOT Last Updated: 2025-11-05