Skip to content

Commit 4fc014d

Browse files
Merge pull request #166 from OP-TED/release/2.0.0-alpha.6
Release/2.0.0 alpha.6
2 parents 2c42661 + 3387fe3 commit 4fc014d

640 files changed

Lines changed: 37038 additions & 4291 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 51 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,65 @@
1-
# EFX Toolkit 2.0.0-alpha.5 Release Notes
1+
# EFX Toolkit 2.0.0-alpha.6 Release Notes
22

33
_The EFX Toolkit for Java developers is a library that enables the transpilation of [EFX](https://docs.ted.europa.eu/eforms/latest/efx) expressions and templates to different target languages. It also includes an implementation of an EFX-to-XPath transpiler._
44

55
---
66

77
## In this release
88

9-
This release fixes an a bug that could result in incorrect context computation for EFX template lines when the same field or node was used as both the parent and child line's context using different predicates. The EFX template translator now correctly calculates the child context, ignoring the predicate of the parent context.
9+
This is a major update that brings the toolkit in line with the complete EFX-2 grammar as released with SDK 2.0.0-alpha.2.
1010

11+
### EFX-2 language support
1112

12-
## EFX-1 Support
13+
- Implemented all new EFX-2 language features introduced in SDK 2.0.0-alpha.2. See the [SDK changelog](https://github.com/OP-TED/eForms-SDK/blob/release/2.0.0-alpha.2/CHANGELOG.md) for the full list.
1314

14-
Although this is a pre-release version of the EFX Toolkit, it provides production-level support for EFX-1 transpilation. EFX-1 is the current version of EFX released with SDK 1.
15+
### EFX Rules translator
1516

16-
NOTE: Transpilation of EFX-1 to XPath and XSL in this version of the EFX Toolkit is **better than** what is provided by **EFX Toolkit 1.3.0**.
17+
- Added a new EFX Rules to Schematron translator, enabling business rules authored in EFX to be transpiled into Schematron validation schemas.
18+
- Rules that apply to all notice subtypes are deduplicated into a shared Schematron pattern.
19+
- New `ValidatorGenerator` interface for Schematron output generation.
20+
21+
### Dependency analysis
22+
23+
- Added dependency extractors for EFX rules, producing dependency graphs that track field, codelist, and variable references.
24+
25+
### Template translator
26+
27+
- Dictionary lookups are now translated using XSL keys for better performance.
28+
- Profiling and timing support for template translation via new `TranslatorOptions` methods.
29+
30+
### EFX autocomplete API
31+
32+
- Added an autocomplete API for code editors, providing completion items for EFX keywords, built-in functions, and field properties.
1733

34+
### New interfaces and classes
1835

19-
## EFX-2 Support
36+
- `ValidatorGenerator`: Interface for generating validation output (Schematron).
37+
- `TranslatorContext`: Interface providing translation context to `MarkupGenerator` methods.
38+
- `TypeChecker`: Interface for SDK-specific type validation.
39+
- `IncludedFileResolver`: Interface for resolving `#include` directives in EFX files.
40+
- New typed exception hierarchy: `EfxCompilationException`, `InvalidArgumentException`, `InvalidIdentifierException`, `InvalidIndentationException`, `InvalidUsageException`, `SdkInconsistencyException`, `SymbolResolutionException`, `TranslatorConfigurationException`, `TypeMismatchException`.
2041

21-
The new version of EFX is still under development and will be released with SDK 2.0.0. For more information of EFX-2 see the release notes of the eForms SDK 2.0.0-alpha.1.
42+
### Bug fixes
43+
44+
- Fixed invalid XPath in typed uniqueness conditions.
45+
- Fixed quote escaping in string literals.
46+
47+
## EFX-1 Support
48+
49+
Although this is a pre-release version of the EFX Toolkit, it provides production-level support for EFX-1 transpilation. EFX-1 is the current version of EFX released with SDK 1.
50+
51+
NOTE: Transpilation of EFX-1 to XPath and XSL in this version of the EFX Toolkit is **better than** what is provided by **EFX Toolkit 1.3.0**.
2252

2353
## Breaking changes
2454

25-
For users of the Toolkit that have implemented custom transpilers, this release contains a few breaking changes from 1.3.0.
26-
More specifically:
55+
For users of the Toolkit that have implemented custom transpilers, this release contains breaking changes from 2.0.0-alpha.5:
2756

28-
- Some additional methods have been added to the SymbolResolver, ScriptGenerator and MarkupGenerator API. As a guide for your implementations please look a the implementations included in the EFX Toolkit for use by the EFX-to-XPath transpilation.
29-
- Some deprecated methods were removed.
30-
- An extensive refactoring in the type management system has rearranged the package structure. As a result some import statements in your code will need to be updated.
57+
- The expression model has been refactored to separate scalar and sequence types. The `path` subpackage has been removed and path expression types have been moved and renamed (e.g. `BooleanPathExpression``BooleanPath` under `scalar`).
58+
- `MarkupGenerator.composeOutputFile` signature changed from 2 parameters to 5 (globals, main section, summary section, navigation section, fragments). The old signature is deprecated with a default implementation.
59+
- Several new methods have been added to the `SymbolResolver`, `ScriptGenerator`, and `MarkupGenerator` interfaces.
60+
- `TranslatorOptions` has three new methods without defaults: `getUserDefinedFunctionNamespace()`, `isProfilerEnabled()`, `getProfilerOutputPath()`.
61+
- New typed exception classes replace previously generic exceptions.
62+
- Axis support and cross-notice references have been removed from the V2 translator.
3163

3264
Users of the Toolkit that only use the included EFX-to-XPath transpiler will not be affected by the above changes.
3365

@@ -37,16 +69,18 @@ Further alpha and beta releases of SDK 2 and EFX Toolkit 2 will be issued. While
3769

3870
---
3971

40-
You can download the latest EFX Toolkit from Maven Central.
72+
You can download the latest EFX Toolkit from Maven Central.
4173
[![Maven Central](https://img.shields.io/maven-central/v/eu.europa.ted.eforms/efx-toolkit-java?label=Download%20&style=flat-square)](https://central.sonatype.com/artifact/eu.europa.ted.eforms/efx-toolkit-java)
4274

4375
Documentation for the EFX Toolkit is available at: <https://docs.ted.europa.eu/eforms/latest/efx-toolkit>
4476

4577
---
4678

47-
This version of the EFX Toolkit has a compile-time dependency on the following versions of eForms SDK versions and uses the EFX grammar that each version provides:
79+
This version of the EFX Toolkit has a compile-time dependency on the following eForms SDK versions and uses the EFX grammar that each version provides:
80+
81+
- eForms SDK 1.x.x (SDK 1.13.0 grammar)
82+
- eForms SDK 2.0.0-alpha.2
4883

49-
- eForms SDK 1.x.x
50-
- eForms SDK 2.0.0-alpha.1
84+
It also depends on the [eForms Core Java library](https://github.com/OP-TED/eforms-core-java) version 1.6.0.
5185

52-
It also depends on the [eForms Core Java library](https://github.com/OP-TED/eforms-core-java) version 1.4.0.
86+
NOTE: The POM currently references SNAPSHOT versions for the SDK 2 and Core dependencies. These will be updated to released versions before publication.

pom.xml

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<groupId>eu.europa.ted.eforms</groupId>
55
<artifactId>efx-toolkit-java</artifactId>
6-
<version>2.0.0-alpha.5</version>
6+
<version>2.0.0-alpha.6</version>
77
<packaging>jar</packaging>
88

99
<name>EFX Toolkit for Java</name>
@@ -46,22 +46,26 @@
4646
<sdk.antlr4.dir>${project.build.directory}/eforms-sdk/antlr4</sdk.antlr4.dir>
4747

4848
<!-- Versions - eForms -->
49-
<version.eforms-core>1.5.0</version.eforms-core>
49+
<version.eforms-sdk-1>1.13.0</version.eforms-sdk-1>
50+
<version.eforms-sdk-2>2.0.0-alpha.2</version.eforms-sdk-2>
51+
<version.eforms-core>1.6.0</version.eforms-core>
5052

5153
<!-- Versions - Third-party libraries -->
5254
<version.antlr4>4.13.1</version.antlr4>
53-
<version.commons-lang3>3.12.0</version.commons-lang3>
54-
<version.logback>1.2.11</version.logback>
55-
<version.jackson>2.13.4</version.jackson>
56-
<version.jackson-databind>2.13.4.2</version.jackson-databind>
55+
<version.commons-lang3>3.18.0</version.commons-lang3>
56+
<version.freemarker>2.3.34</version.freemarker>
57+
<version.logback>1.5.18</version.logback>
58+
<version.jackson>2.18.3</version.jackson>
59+
<version.jackson-databind>2.18.3</version.jackson-databind>
5760
<version.junit-jupiter>5.7.2</version.junit-jupiter>
58-
<version.slf4j>1.7.36</version.slf4j>
61+
<version.saxon-he>11.3</version.saxon-he>
62+
<version.slf4j>2.0.13</version.slf4j>
5963

6064
<!-- Versions - Plugins -->
6165
<version.build-helper.plugin>3.3.0</version.build-helper.plugin>
6266
<version.dependency.plugin>3.3.0</version.dependency.plugin>
6367
<version.install.plugin>2.5.2</version.install.plugin>
64-
<version.jacoco.plugin>0.8.8</version.jacoco.plugin>
68+
<version.jacoco.plugin>0.8.12</version.jacoco.plugin>
6569
<version.jar.plugin>3.2.0</version.jar.plugin>
6670
<version.javadoc.plugin>3.4.0</version.javadoc.plugin>
6771
<version.pgp.plugin>1.5</version.pgp.plugin>
@@ -119,6 +123,16 @@
119123
<artifactId>antlr4-runtime</artifactId>
120124
<version>${version.antlr4}</version>
121125
</dependency>
126+
<dependency>
127+
<groupId>org.freemarker</groupId>
128+
<artifactId>freemarker</artifactId>
129+
<version>${version.freemarker}</version>
130+
</dependency>
131+
<dependency>
132+
<groupId>net.sf.saxon</groupId>
133+
<artifactId>Saxon-HE</artifactId>
134+
<version>${version.saxon-he}</version>
135+
</dependency>
122136
</dependencies>
123137
</dependencyManagement>
124138

@@ -139,11 +153,20 @@
139153
<artifactId>junit-jupiter-params</artifactId>
140154
<scope>test</scope>
141155
</dependency>
156+
<dependency>
157+
<groupId>net.sf.saxon</groupId>
158+
<artifactId>Saxon-HE</artifactId>
159+
<scope>test</scope>
160+
</dependency>
142161
<dependency>
143162
<groupId>org.antlr</groupId>
144163
<artifactId>antlr4-runtime</artifactId>
145164
<scope>compile</scope>
146165
</dependency>
166+
<dependency>
167+
<groupId>org.freemarker</groupId>
168+
<artifactId>freemarker</artifactId>
169+
</dependency>
147170
<dependency>
148171
<groupId>com.fasterxml.jackson.core</groupId>
149172
<artifactId>jackson-core</artifactId>
@@ -219,6 +242,15 @@
219242
<groupId>org.apache.maven.plugins</groupId>
220243
<artifactId>maven-javadoc-plugin</artifactId>
221244
<version>${version.javadoc.plugin}</version>
245+
<configuration>
246+
<doclint>all,-missing</doclint>
247+
<sourceFileExcludes>
248+
<exclude>**/EfxLexer.java</exclude>
249+
<exclude>**/EfxParser.java</exclude>
250+
<exclude>**/EfxListener.java</exclude>
251+
<exclude>**/EfxBaseListener.java</exclude>
252+
</sourceFileExcludes>
253+
</configuration>
222254
</plugin>
223255
<plugin>
224256
<groupId>org.apache.maven.plugins</groupId>
@@ -257,7 +289,7 @@
257289
<artifactItem>
258290
<groupId>eu.europa.ted.eforms</groupId>
259291
<artifactId>eforms-sdk</artifactId>
260-
<version>2.0.0-alpha.1</version>
292+
<version>${version.eforms-sdk-2}</version>
261293
<type>jar</type>
262294
<includes>eforms-sdk/efx-grammar/**/*.g4</includes>
263295
<outputDirectory>${sdk.antlr4.dir}/eu/europa/ted/efx/sdk2</outputDirectory>
@@ -269,7 +301,7 @@
269301
<artifactItem>
270302
<groupId>eu.europa.ted.eforms</groupId>
271303
<artifactId>eforms-sdk</artifactId>
272-
<version>1.6.0</version>
304+
<version>${version.eforms-sdk-1}</version>
273305
<type>jar</type>
274306
<includes>eforms-sdk/efx-grammar/**/*.g4</includes>
275307
<outputDirectory>${sdk.antlr4.dir}/eu/europa/ted/efx/sdk1</outputDirectory>

src/main/java/eu/europa/ted/eforms/sdk/ComponentFactory.java

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package eu.europa.ted.eforms.sdk;
22

33
import java.nio.file.Path;
4-
import java.text.MessageFormat;
54
import java.util.HashMap;
65
import java.util.Map;
76
import java.util.Objects;
@@ -12,6 +11,7 @@
1211
import eu.europa.ted.efx.interfaces.ScriptGenerator;
1312
import eu.europa.ted.efx.interfaces.SymbolResolver;
1413
import eu.europa.ted.efx.interfaces.TranslatorOptions;
14+
import eu.europa.ted.efx.interfaces.ValidatorGenerator;
1515

1616
public class ComponentFactory extends SdkComponentFactory {
1717
public static final ComponentFactory INSTANCE = new ComponentFactory();
@@ -84,20 +84,23 @@ public static SymbolResolver getSymbolResolver(final String sdkVersion, final Pa
8484
* SDK.
8585
* @throws InstantiationException If the SDK version is not supported.
8686
*/
87-
public static SymbolResolver getSymbolResolver(final String sdkVersion, final String qualifier,
87+
public static synchronized SymbolResolver getSymbolResolver(final String sdkVersion, final String qualifier,
8888
final Path sdkRootPath) throws InstantiationException {
8989
VersionQualifier key = ComponentFactory.INSTANCE.new VersionQualifier(sdkVersion, qualifier);
9090

91-
return instances.computeIfAbsent(key, k -> {
92-
try {
93-
return ComponentFactory.INSTANCE.getComponentImpl(sdkVersion,
94-
SdkComponentType.SYMBOL_RESOLVER, qualifier, SymbolResolver.class, sdkVersion,
95-
sdkRootPath);
96-
} catch (InstantiationException e) {
97-
throw new RuntimeException(MessageFormat.format(
98-
"Failed to instantiate SDK Symbol Resolver for SDK version [{0}]", sdkVersion), e);
99-
}
100-
});
91+
// Check if already exists
92+
SymbolResolver existing = instances.get(key);
93+
if (existing != null) {
94+
return existing;
95+
}
96+
97+
// Create new instance (this can throw InstantiationException)
98+
SymbolResolver newInstance = ComponentFactory.INSTANCE.getComponentImpl(sdkVersion,
99+
SdkComponentType.SYMBOL_RESOLVER, qualifier, SymbolResolver.class, sdkVersion, sdkRootPath);
100+
101+
// Store and return
102+
instances.put(key, newInstance);
103+
return newInstance;
101104
}
102105

103106
public static MarkupGenerator getMarkupGenerator(final String sdkVersion, TranslatorOptions options)
@@ -111,6 +114,18 @@ public static MarkupGenerator getMarkupGenerator(final String sdkVersion, final
111114
SdkComponentType.MARKUP_GENERATOR, qualifier, MarkupGenerator.class, options);
112115
}
113116

117+
public static ValidatorGenerator getValidatorGenerator(final String sdkVersion,
118+
TranslatorOptions options) throws InstantiationException {
119+
return getValidatorGenerator(sdkVersion, "", options);
120+
}
121+
122+
public static ValidatorGenerator getValidatorGenerator(final String sdkVersion,
123+
final String qualifier, TranslatorOptions options) throws InstantiationException {
124+
return ComponentFactory.INSTANCE.getComponentImpl(sdkVersion,
125+
SdkComponentType.VALIDATOR_GENERATOR, qualifier, ValidatorGenerator.class,
126+
options);
127+
}
128+
114129
public static ScriptGenerator getScriptGenerator(final String sdkVersion, TranslatorOptions options)
115130
throws InstantiationException {
116131
return getScriptGenerator(sdkVersion, "", options);

0 commit comments

Comments
 (0)