Skip to content

Commit d84e1fc

Browse files
committed
Improvements from PR review.
1 parent 0475b90 commit d84e1fc

File tree

6 files changed

+95
-80
lines changed

6 files changed

+95
-80
lines changed

documentation/developer-guide/modules/tooling-guide/pages/bamm-cli.adoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,16 @@ The available options and their meaning can also be seen in the help text of the
9494
| _--custom-resolver_ : use an external resolver for the resolution of the model elements |
9595
|===
9696

97+
=== Custom model resolver
98+
99+
To allow the users to provide their own custom implementations of a model resolver, `--custom-resolver` command-line switch can be used.
100+
The value of the switch can be any command which is directly executable by the underlying operating system (such as a batch script on Windows or a shell script on Linux/Unix).
101+
When a model element needs to be resolved, this command is executed with the URN of the element to resolve passed as the last parameter.
102+
The command can provide other parameters as well, the element URN will be added automatically as the last one by bamm-cli.
103+
The resolved model definition is expected to be output to the stdout in Turtle format.
104+
From there, it is read by the bamm-cli and passed on to the internal processing pipeline.
105+
In this way the extension can be flexibly done in any programming language/script language, including complex logic if necessary.
106+
97107
== Using the CLI to create a JSON OpenAPI Specification
98108

99109
Every specification is based on one Aspect, which needs a separately defined server URL where the given aspect will be.

pom.xml

Lines changed: 74 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
<maven-site-plugin-version>3.9.1</maven-site-plugin-version>
119119
<maven-enforcer-plugin-version>3.0.0</maven-enforcer-plugin-version>
120120
<build-helper-maven-plugin-version>3.2.0</build-helper-maven-plugin-version>
121-
<maven-jar-plugin-version>3.2.0</maven-jar-plugin-version>
121+
<maven-jar-plugin-version>3.2.2</maven-jar-plugin-version>
122122
<git-commit-id-plugin-version>4.0.5</git-commit-id-plugin-version>
123123

124124
<!-- General settings -->
@@ -251,122 +251,122 @@
251251

252252
<!-- Third party dependencies -->
253253
<dependency>
254-
<groupId>org.springframework.boot</groupId>
255-
<artifactId>spring-boot-dependencies</artifactId>
256-
<version>${spring-boot-version}</version>
257-
<type>pom</type>
258-
<scope>import</scope>
254+
<groupId>org.springframework.boot</groupId>
255+
<artifactId>spring-boot-dependencies</artifactId>
256+
<version>${spring-boot-version}</version>
257+
<type>pom</type>
258+
<scope>import</scope>
259259
</dependency>
260260
<dependency>
261-
<groupId>com.google.guava</groupId>
262-
<artifactId>guava</artifactId>
263-
<version>${guava-version}</version>
261+
<groupId>com.google.guava</groupId>
262+
<artifactId>guava</artifactId>
263+
<version>${guava-version}</version>
264264
</dependency>
265265
<dependency>
266-
<groupId>net.jqwik</groupId>
267-
<artifactId>jqwik</artifactId>
268-
<version>${jqwik-version}</version>
266+
<groupId>net.jqwik</groupId>
267+
<artifactId>jqwik</artifactId>
268+
<version>${jqwik-version}</version>
269269
</dependency>
270270
<dependency>
271-
<groupId>org.apache.jena</groupId>
272-
<artifactId>jena-core</artifactId>
273-
<version>${jena-version}</version>
271+
<groupId>org.apache.jena</groupId>
272+
<artifactId>jena-core</artifactId>
273+
<version>${jena-version}</version>
274274
</dependency>
275275
<dependency>
276-
<groupId>org.topbraid</groupId>
277-
<artifactId>shacl</artifactId>
278-
<version>${shacl-version}</version>
276+
<groupId>org.topbraid</groupId>
277+
<artifactId>shacl</artifactId>
278+
<version>${shacl-version}</version>
279279
</dependency>
280280
<dependency>
281-
<groupId>io.vavr</groupId>
282-
<artifactId>vavr</artifactId>
283-
<version>${vavr-version}</version>
281+
<groupId>io.vavr</groupId>
282+
<artifactId>vavr</artifactId>
283+
<version>${vavr-version}</version>
284284
</dependency>
285285
<dependency>
286-
<groupId>org.assertj</groupId>
287-
<artifactId>assertj-vavr</artifactId>
288-
<version>${assertj-vavr-version}</version>
286+
<groupId>org.assertj</groupId>
287+
<artifactId>assertj-vavr</artifactId>
288+
<version>${assertj-vavr-version}</version>
289289
</dependency>
290290
<dependency>
291-
<groupId>org.mozilla</groupId>
292-
<artifactId>rhino</artifactId>
293-
<version>${rhino-version}</version>
291+
<groupId>org.mozilla</groupId>
292+
<artifactId>rhino</artifactId>
293+
<version>${rhino-version}</version>
294294
</dependency>
295295
<dependency>
296-
<groupId>org.apache.velocity</groupId>
297-
<artifactId>velocity-engine-core</artifactId>
298-
<version>${velocity-version}</version>
296+
<groupId>org.apache.velocity</groupId>
297+
<artifactId>velocity-engine-core</artifactId>
298+
<version>${velocity-version}</version>
299299
</dependency>
300300
<dependency>
301-
<groupId>org.jboss.forge.roaster</groupId>
302-
<artifactId>roaster-jdt</artifactId>
303-
<version>${roaster-version}</version>
301+
<groupId>org.jboss.forge.roaster</groupId>
302+
<artifactId>roaster-jdt</artifactId>
303+
<version>${roaster-version}</version>
304304
</dependency>
305305
<dependency>
306-
<groupId>org.jboss.forge.roaster</groupId>
307-
<artifactId>roaster-api</artifactId>
308-
<version>${roaster-version}</version>
306+
<groupId>org.jboss.forge.roaster</groupId>
307+
<artifactId>roaster-api</artifactId>
308+
<version>${roaster-version}</version>
309309
</dependency>
310310
<dependency>
311-
<groupId>org.jeasy</groupId>
312-
<artifactId>easy-random-core</artifactId>
313-
<version>${easy-random-version}</version>
311+
<groupId>org.jeasy</groupId>
312+
<artifactId>easy-random-core</artifactId>
313+
<version>${easy-random-version}</version>
314314
</dependency>
315315
<dependency>
316-
<groupId>org.apache.jena</groupId>
317-
<artifactId>jena-arq</artifactId>
318-
<version>${jena-version}</version>
316+
<groupId>org.apache.jena</groupId>
317+
<artifactId>jena-arq</artifactId>
318+
<version>${jena-version}</version>
319319
</dependency>
320320
<dependency>
321-
<groupId>org.apache.commons</groupId>
322-
<artifactId>commons-text</artifactId>
323-
<version>${commons-text-version}</version>
321+
<groupId>org.apache.commons</groupId>
322+
<artifactId>commons-text</artifactId>
323+
<version>${commons-text-version}</version>
324324
</dependency>
325325
<dependency>
326-
<groupId>guru.nidi</groupId>
327-
<artifactId>graphviz-java-all-j2v8</artifactId>
328-
<version>${graphviz-version}</version>
326+
<groupId>guru.nidi</groupId>
327+
<artifactId>graphviz-java-all-j2v8</artifactId>
328+
<version>${graphviz-version}</version>
329329
</dependency>
330330
<dependency>
331-
<groupId>com.github.curious-odd-man</groupId>
332-
<artifactId>rgxgen</artifactId>
333-
<version>${rgxgen-version}</version>
331+
<groupId>com.github.curious-odd-man</groupId>
332+
<artifactId>rgxgen</artifactId>
333+
<version>${rgxgen-version}</version>
334334
</dependency>
335335
<dependency>
336-
<groupId>com.google.inject</groupId>
337-
<artifactId>guice</artifactId>
338-
<version>${guice-version}</version>
336+
<groupId>com.google.inject</groupId>
337+
<artifactId>guice</artifactId>
338+
<version>${guice-version}</version>
339339
</dependency>
340340
<dependency>
341341
<groupId>com.github.javaparser</groupId>
342342
<artifactId>javaparser-symbol-solver-core</artifactId>
343343
<version>${javaparser-version}</version>
344344
</dependency>
345345
<dependency>
346-
<groupId>com.github.stefanbirkner</groupId>
347-
<artifactId>system-lambda</artifactId>
348-
<version>${system-lambda-version}</version>
346+
<groupId>com.github.stefanbirkner</groupId>
347+
<artifactId>system-lambda</artifactId>
348+
<version>${system-lambda-version}</version>
349349
</dependency>
350350
<dependency>
351-
<groupId>io.github.classgraph</groupId>
352-
<artifactId>classgraph</artifactId>
353-
<version>${classgraph-version}</version>
351+
<groupId>io.github.classgraph</groupId>
352+
<artifactId>classgraph</artifactId>
353+
<version>${classgraph-version}</version>
354354
</dependency>
355355
<dependency>
356-
<groupId>io.admin-shell.aas</groupId>
357-
<artifactId>model</artifactId>
358-
<version>${io-admin-shell-aas-model}</version>
356+
<groupId>io.admin-shell.aas</groupId>
357+
<artifactId>model</artifactId>
358+
<version>${io-admin-shell-aas-model}</version>
359359
</dependency>
360360
<dependency>
361-
<groupId>io.admin-shell.aas</groupId>
362-
<artifactId>dataformat-xml</artifactId>
363-
<version>${io-admin-shell-aas-serializer}</version>
364-
<exclusions>
365-
<exclusion>
366-
<groupId>org.slf4j</groupId>
367-
<artifactId>slf4j-simple</artifactId>
368-
</exclusion>
369-
</exclusions>
361+
<groupId>io.admin-shell.aas</groupId>
362+
<artifactId>dataformat-xml</artifactId>
363+
<version>${io-admin-shell-aas-serializer}</version>
364+
<exclusions>
365+
<exclusion>
366+
<groupId>org.slf4j</groupId>
367+
<artifactId>slf4j-simple</artifactId>
368+
</exclusion>
369+
</exclusions>
370370
</dependency>
371371
<dependency>
372372
<groupId>io.admin-shell.aas</groupId>
@@ -399,11 +399,11 @@
399399
<build>
400400
<pluginManagement>
401401
<plugins>
402-
<plugin>
402+
<plugin>
403403
<groupId>org.apache.maven.plugins</groupId>
404404
<artifactId>maven-resources-plugin</artifactId>
405405
<version>${maven-resources-plugin-version}</version>
406-
</plugin>
406+
</plugin>
407407
<plugin>
408408
<groupId>org.apache.maven.plugins</groupId>
409409
<artifactId>maven-clean-plugin</artifactId>

tools/bamm-cli/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@
220220
<plugin>
221221
<groupId>org.apache.maven.plugins</groupId>
222222
<artifactId>maven-jar-plugin</artifactId>
223-
<version>3.2.2</version>
224223
<configuration>
225224
<archive>
226225
<manifest>

tools/bamm-cli/src/main/java/io/openmanufacturing/sds/ExternalResolverMixin.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515

1616
import picocli.CommandLine;
1717

18-
// Configuration of the external command that can be executed to custom resolve a model. The command will be executed
19-
// as given, with the model URN to resolve added as the last parameter automatically by the program logic.
18+
/**
19+
* Configuration of the external command that can be executed to custom resolve a model. The command will be executed
20+
* as given, with the model URN to resolve added as the last parameter automatically by the program logic.
21+
*/
2022
public class ExternalResolverMixin {
2123
@CommandLine.Option( names = { "--custom-resolver" }, description = "External command to execute to produce the custom model resolution." )
2224
protected String commandLine = "";

tools/bamm-cli/src/main/java/io/openmanufacturing/sds/ExternalResolverStrategy.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
import io.openmanufacturing.sds.aspectmodel.urn.AspectModelUrn;
2424
import io.vavr.control.Try;
2525

26-
// Specialized resolution strategy: use external resolver to resolve the URNs passed as argument into models.
26+
/**
27+
* Specialized resolution strategy: use external resolver to resolve the URNs passed as argument into models.
28+
*/
2729
class ExternalResolverStrategy implements ResolutionStrategy {
2830

2931
private final String command;

tools/bamm-cli/src/test/java/io/openmanufacturing/sds/DelegatingCommandResolver.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@
2323
import io.openmanufacturing.sds.aspectmodel.urn.AspectModelUrn;
2424
import io.vavr.control.Try;
2525

26-
// Utility class to help test custom model resolution mechanism. It simply wraps the FileSystemStrategy, delegates the resolution to it,
27-
// and serializes the result to stdout, as expected of the external custom resolver.
26+
/**
27+
* Utility class to help test custom model resolution mechanism. It simply wraps the FileSystemStrategy, delegates the resolution to it,
28+
* and serializes the result to stdout, as expected of the external custom resolver.
29+
*/
2830
public class DelegatingCommandResolver {
2931

3032
public static void main( final String[] args ) throws URISyntaxException {

0 commit comments

Comments
 (0)