Skip to content

Commit 192116d

Browse files
committed
Merge branch 'main' into 2.10.x
2 parents c32aceb + 99e587c commit 192116d

File tree

78 files changed

+1157
-558
lines changed

Some content is hidden

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

78 files changed

+1157
-558
lines changed

.github/workflows/release-workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ jobs:
471471
# Milestone release: Maven deploy to Github
472472
- name: Publish to Github
473473
if: contains( github.event.inputs.release_version, '-M' )
474-
run: mvn -s ./settings.xml -B clean -pl '!esmf-sdk-test-report,!documentation,!tools/samm-cli' deploy -DskipTests -Pmilestone-build,sign
474+
run: mvn -s ./settings.xml -B clean -pl '!documentation,!tools/samm-cli' deploy -DskipTests -Pmilestone-build,sign
475475
env:
476476
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
477477
PGP_KEY_PASSWORD: ${{ secrets.PGP_KEY_PASSWORD }}

CONVENTIONS.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,8 @@ if (someOptional != null && someOptional.isPresent()) ...
5555
* You should be using Objects.requireNonNull() for those sort of checks (or Guava's Preconditions if you're having more types of assertions than non-null and aim for a maximum of consistency).
5656

5757
### Lombok
58-
We use Lombok in the ESMF SDK. Project Lombok is a Java library that automatically plugs into your
59-
editor and build tools. It removes the burden to write getter or equals methods, adds fully featured
60-
builders to a class with one annotation, automates logging variables, and much more. Consider using
61-
its features if you are in the need to do something like that.
58+
Lombok was used in the past, but is not used anymore in the ESMF SDK. Instead of the `@Value` or
59+
`@Data` annotations, consider using Java records.
6260

6361
## Documentation
6462

core/esmf-aspect-meta-model-interface/pom.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@
4848
<groupId>jakarta.xml.bind</groupId>
4949
<artifactId>jakarta.xml.bind-api</artifactId>
5050
</dependency>
51-
<dependency>
52-
<groupId>org.projectlombok</groupId>
53-
<artifactId>lombok</artifactId>
54-
</dependency>
5551

5652
<dependency>
5753
<groupId>org.junit.jupiter</groupId>

core/esmf-aspect-meta-model-interface/src/main/java/org/eclipse/esmf/metamodel/vocabulary/RdfNamespace.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ static Map<String, String> createPrefixMap( final KnownVersion metaModelVersion
5656
result.put( samm.getShortForm(), samm.getNamespace() );
5757
final SAMMC sammc = new SAMMC( metaModelVersion );
5858
result.put( sammc.getShortForm(), sammc.getNamespace() );
59-
result.put( "samm-e", new SAMME( metaModelVersion, samm ).getNamespace() );
59+
final SAMME samme = new SAMME( metaModelVersion, samm );
60+
result.put( samme.getShortForm(), samme.getNamespace() );
6061
final UNIT unit = new UNIT( metaModelVersion, samm );
6162
result.put( unit.getShortForm(), unit.getNamespace() );
6263
result.put( "rdf", RDF.getURI() );

core/esmf-aspect-meta-model-interface/src/main/java/org/eclipse/esmf/metamodel/vocabulary/SammNs.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
package org.eclipse.esmf.metamodel.vocabulary;
1515

16+
import java.util.stream.Stream;
17+
1618
import org.eclipse.esmf.samm.KnownVersion;
1719

1820
/**
@@ -23,4 +25,13 @@ public class SammNs {
2325
public static final SAMMC SAMMC = new SAMMC( KnownVersion.getLatest() );
2426
public static final SAMME SAMME = new SAMME( KnownVersion.getLatest(), SAMM );
2527
public static final UNIT UNIT = new UNIT( KnownVersion.getLatest(), SAMM );
28+
29+
/**
30+
* All SAMM-specific metamodel RDF namespaces
31+
*
32+
* @return the namespaces
33+
*/
34+
public static Stream<RdfNamespace> sammNamespaces() {
35+
return Stream.of( SAMM, SAMMC, SAMME, UNIT );
36+
}
2637
}

core/esmf-aspect-meta-model-java/pom.xml

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
<name>ESMF Aspect Meta Model Java</name>
2929
<packaging>jar</packaging>
3030

31+
<properties>
32+
<!-- Necessary so that properties-maven-plugin writes it into app.properties -->
33+
<project-version>${project.version}</project-version>
34+
</properties>
35+
3136
<dependencies>
3237
<dependency>
3338
<groupId>org.eclipse.esmf</groupId>
@@ -79,12 +84,30 @@
7984

8085
<build>
8186
<plugins>
87+
<plugin>
88+
<groupId>org.codehaus.mojo</groupId>
89+
<artifactId>properties-maven-plugin</artifactId>
90+
<executions>
91+
<execution>
92+
<phase>initialize</phase>
93+
<goals>
94+
<goal>write-project-properties</goal>
95+
</goals>
96+
<configuration>
97+
<outputFile>
98+
${project.build.outputDirectory}/app.properties
99+
</outputFile>
100+
</configuration>
101+
</execution>
102+
</executions>
103+
</plugin>
104+
82105
<plugin>
83106
<groupId>org.codehaus.mojo</groupId>
84107
<artifactId>build-helper-maven-plugin</artifactId>
85108
<executions>
86109
<execution>
87-
<id>add-shared-test-source</id>
110+
<id>add-shared-test-sources</id>
88111
<phase>initialize</phase>
89112
<goals>
90113
<goal>add-test-source</goal>
@@ -96,7 +119,7 @@
96119
</configuration>
97120
</execution>
98121
<execution>
99-
<id>add-source</id>
122+
<id>add-generated-sources</id>
100123
<phase>initialize</phase>
101124
<goals>
102125
<goal>add-source</goal>
@@ -108,7 +131,7 @@
108131
</configuration>
109132
</execution>
110133
<execution>
111-
<id>add-src-buildtime-source</id>
134+
<id>add-buildtime-sources</id>
112135
<phase>initialize</phase>
113136
<goals>
114137
<goal>add-source</goal>
@@ -141,28 +164,6 @@
141164
</executions>
142165
</plugin>
143166

144-
<!-- Disable surefire report plugin. The report is created in the esmf-sdk-test-report module -->
145-
<plugin>
146-
<groupId>org.apache.maven.plugins</groupId>
147-
<artifactId>maven-surefire-report-plugin</artifactId>
148-
<version>${maven-surefire-report-plugin-version}</version>
149-
<configuration>
150-
<skipFailsafeReport>true</skipFailsafeReport>
151-
<skipSurefireReport>true</skipSurefireReport>
152-
</configuration>
153-
</plugin>
154-
155-
<!-- Disable maven site plugin. It is not required since the report is created in the
156-
esmf-sdk-test-report module -->
157-
<plugin>
158-
<groupId>org.apache.maven.plugins</groupId>
159-
<artifactId>maven-site-plugin</artifactId>
160-
<version>${maven-site-plugin-version}</version>
161-
<configuration>
162-
<skip>true</skip>
163-
</configuration>
164-
</plugin>
165-
166167
<plugin>
167168
<groupId>org.apache.maven.plugins</groupId>
168169
<artifactId>maven-clean-plugin</artifactId>
@@ -180,11 +181,6 @@
180181
<artifactId>maven-compiler-plugin</artifactId>
181182
<configuration>
182183
<annotationProcessorPaths>
183-
<path>
184-
<groupId>org.projectlombok</groupId>
185-
<artifactId>lombok</artifactId>
186-
<version>${lombok-version}</version>
187-
</path>
188184
<path>
189185
<groupId>io.soabase.record-builder</groupId>
190186
<artifactId>record-builder-processor</artifactId>

core/esmf-aspect-meta-model-java/src-buildtime/main/java/org/eclipse/esmf/buildtime/GenerateBuildtimeCode.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ public static void main( final String[] args ) {
3131

3232
Stream.of(
3333
new GenerateUnits( srcBuildtimePath, srcGenPath ),
34-
new GenerateQuantityKinds( srcBuildtimePath, srcGenPath )
34+
new GenerateQuantityKinds( srcBuildtimePath, srcGenPath ),
35+
new GenerateVersionInfo( srcBuildtimePath, srcGenPath )
3536
).forEach( BuildtimeCodeGenerator::writeGeneratedFile );
3637
}
3738
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright (c) 2025 Robert Bosch Manufacturing Solutions GmbH
3+
*
4+
* See the AUTHORS file(s) distributed with this work for additional
5+
* information regarding authorship.
6+
*
7+
* This Source Code Form is subject to the terms of the Mozilla Public
8+
* License, v. 2.0. If a copy of the MPL was not distributed with this
9+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
10+
*
11+
* SPDX-License-Identifier: MPL-2.0
12+
*/
13+
14+
package org.eclipse.esmf.buildtime;
15+
16+
import java.io.InputStream;
17+
import java.nio.file.Path;
18+
import java.util.Properties;
19+
20+
/**
21+
* Generates the static version info class
22+
*/
23+
public class GenerateVersionInfo extends BuildtimeCodeGenerator {
24+
private final Properties properties;
25+
26+
protected GenerateVersionInfo( final Path srcBuildTimePath, final Path srcGenPath ) {
27+
super( srcBuildTimePath, srcGenPath, "VersionInfo", "org.eclipse.esmf.aspectmodel" );
28+
29+
try ( final InputStream stream = GenerateVersionInfo.class.getClassLoader().getResourceAsStream( "app.properties" ) ) {
30+
if ( stream == null ) {
31+
throw new RuntimeException();
32+
}
33+
properties = new Properties();
34+
properties.load( stream );
35+
} catch ( final Exception exception ) {
36+
throw new RuntimeException( "Could not load app.properties" );
37+
}
38+
}
39+
40+
@Override
41+
protected String interpolateVariable( final String variableName ) {
42+
return switch ( variableName ) {
43+
case "esmfSdkVersion" -> properties.getProperty( "project-version" );
44+
case "aspectMetaModelVersion" -> properties.getProperty( "aspect-meta-model-version" );
45+
case "generator" -> getClass().getCanonicalName();
46+
default -> throw new RuntimeException( "Unexpected variable in template: " + variableName );
47+
};
48+
}
49+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright (c) 2025 Robert Bosch Manufacturing Solutions GmbH
3+
*
4+
* See the AUTHORS file(s) distributed with this work for additional
5+
* information regarding authorship.
6+
*
7+
* This Source Code Form is subject to the terms of the Mozilla Public
8+
* License, v. 2.0. If a copy of the MPL was not distributed with this
9+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
10+
*
11+
* SPDX-License-Identifier: MPL-2.0
12+
*/
13+
14+
package org.eclipse.esmf.buildtime.template;
15+
16+
import javax.annotation.processing.Generated;
17+
18+
@Generated( "${generator}" )
19+
public class VersionInfo {
20+
public static final String ESMF_SDK_VERSION = "${esmfSdkVersion}";
21+
public static final String ASPECT_META_MODEL_VERSION = "${aspectMetaModelVersion}";
22+
}

core/esmf-aspect-meta-model-java/src/main/java/org/eclipse/esmf/aspectmodel/RdfUtil.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.stream.Stream;
2424

2525
import org.eclipse.esmf.aspectmodel.resolver.services.TurtleLoader;
26+
import org.eclipse.esmf.aspectmodel.serializer.AspectSerializer;
2627
import org.eclipse.esmf.aspectmodel.urn.AspectModelUrn;
2728
import org.eclipse.esmf.aspectmodel.urn.ElementType;
2829
import org.eclipse.esmf.metamodel.vocabulary.SammNs;
@@ -39,6 +40,9 @@
3940
import org.apache.jena.rdf.model.ResIterator;
4041
import org.apache.jena.rdf.model.Resource;
4142
import org.apache.jena.rdf.model.Statement;
43+
import org.apache.jena.riot.RDFFormat;
44+
import org.apache.jena.riot.RDFLanguages;
45+
import org.apache.jena.riot.RDFWriter;
4246
import org.apache.jena.vocabulary.RDF;
4347
import org.apache.jena.vocabulary.XSD;
4448

@@ -147,6 +151,17 @@ public static Model createModel( final String ttlRepresentation ) {
147151
return TurtleLoader.loadTurtle( ttlRepresentation ).get();
148152
}
149153

154+
/**
155+
* Turn a an RDF model to its String representation. Note that this method should only be used where {@link AspectSerializer} can
156+
* not be used since it does not honor Aspect Model formatting rules.
157+
*
158+
* @param model the input model
159+
* @return the rendered model
160+
*/
161+
public static String modelToString( final Model model ) {
162+
return RDFWriter.create().format( RDFFormat.TURTLE ).lang( RDFLanguages.TURTLE ).source( model ).asString();
163+
}
164+
150165
/**
151166
* Returns the List of named resources that transitively point to a given node. Transtively here means that the given node
152167
* is reachable from the named resource via any number of anonymous nodes inbetween.

0 commit comments

Comments
 (0)