Skip to content
This repository was archived by the owner on Feb 15, 2024. It is now read-only.

Commit acff271

Browse files
committed
Merge remote-tracking branch 'origin/master'
Merging state from the project-internal repository into the Github one.
2 parents 6fbcb2a + 07bdc14 commit acff271

286 files changed

Lines changed: 28520 additions & 0 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.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.idea/
2+
log/
3+
minimalExample/target/

minimalExample/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/target
2+
*.log

minimalExample/.mvn/extensions.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
2+
<extension>
3+
<groupId>com.github.gzm55.maven</groupId>
4+
<artifactId>project-settings-extension</artifactId>
5+
<version>0.1.1</version>
6+
</extension>
7+
</extensions>

minimalExample/.mvn/settings.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<settings>
2+
<servers>
3+
<server>
4+
<id>FAST-repo</id>
5+
<configuration>
6+
<httpHeaders>
7+
<property>
8+
<name>Deploy-Token</name>
9+
<value>cb4ykE2TaEWP5AGYrCDn</value>
10+
</property>
11+
</httpHeaders>
12+
</configuration>
13+
</server>
14+
</servers>
15+
</settings>

minimalExample/MinimalExample.iml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
4+
<output url="file://$MODULE_DIR$/target/classes" />
5+
<output-test url="file://$MODULE_DIR$/target/test-classes" />
6+
<content url="file://$MODULE_DIR$">
7+
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
8+
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
9+
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
10+
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
11+
<excludeFolder url="file://$MODULE_DIR$/target" />
12+
</content>
13+
<orderEntry type="inheritedJdk" />
14+
<orderEntry type="sourceFolder" forTests="false" />
15+
<orderEntry type="library" scope="TEST" name="Maven: org.apache.commons:commons-lang3:3.10" level="project" />
16+
<orderEntry type="library" scope="TEST" name="Maven: org.slf4j:slf4j-api:1.7.26" level="project" />
17+
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13" level="project" />
18+
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
19+
<orderEntry type="library" name="Maven: de.fraunhofer.iais.eis.infomodel:util:4.0.6-SNAPSHOT" level="project" />
20+
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.11.2" level="project" />
21+
<orderEntry type="library" scope="TEST" name="Maven: de.fraunhofer.iais.eis.ids:infomodel-serializer:4.0.6-SNAPSHOT" level="project" />
22+
<orderEntry type="library" scope="TEST" name="Maven: javax.validation:validation-api:2.0.1.Final" level="project" />
23+
<orderEntry type="library" scope="TEST" name="Maven: commons-codec:commons-codec:1.15" level="project" />
24+
<orderEntry type="library" scope="TEST" name="Maven: org.apache.jena:jena-arq:3.16.0" level="project" />
25+
<orderEntry type="library" scope="TEST" name="Maven: org.apache.jena:jena-core:3.16.0" level="project" />
26+
<orderEntry type="library" scope="TEST" name="Maven: org.apache.jena:jena-base:3.16.0" level="project" />
27+
<orderEntry type="library" scope="TEST" name="Maven: org.apache.commons:commons-csv:1.8" level="project" />
28+
<orderEntry type="library" scope="TEST" name="Maven: org.apache.commons:commons-compress:1.20" level="project" />
29+
<orderEntry type="library" scope="TEST" name="Maven: com.github.andrewoma.dexx:collection:0.7" level="project" />
30+
<orderEntry type="library" scope="TEST" name="Maven: org.apache.jena:jena-iri:3.16.0" level="project" />
31+
<orderEntry type="library" scope="TEST" name="Maven: commons-cli:commons-cli:1.4" level="project" />
32+
<orderEntry type="library" scope="TEST" name="Maven: org.apache.jena:jena-shaded-guava:3.16.0" level="project" />
33+
<orderEntry type="library" scope="TEST" name="Maven: org.apache.httpcomponents:httpclient:4.5.10" level="project" />
34+
<orderEntry type="library" scope="TEST" name="Maven: org.apache.httpcomponents:httpcore:4.4.12" level="project" />
35+
<orderEntry type="library" scope="TEST" name="Maven: com.github.jsonld-java:jsonld-java:0.12.5" level="project" />
36+
<orderEntry type="library" scope="TEST" name="Maven: commons-io:commons-io:2.6" level="project" />
37+
<orderEntry type="library" scope="TEST" name="Maven: org.apache.httpcomponents:httpclient-cache:4.5.10" level="project" />
38+
<orderEntry type="library" scope="TEST" name="Maven: org.apache.thrift:libthrift:0.13.0" level="project" />
39+
<orderEntry type="library" scope="TEST" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
40+
<orderEntry type="library" scope="TEST" name="Maven: org.slf4j:jcl-over-slf4j:1.7.30" level="project" />
41+
<orderEntry type="library" scope="TEST" name="Maven: org.topbraid:shacl:1.3.2" level="project" />
42+
<orderEntry type="library" scope="TEST" name="Maven: org.antlr:antlr4-runtime:4.5.3" level="project" />
43+
<orderEntry type="library" scope="TEST" name="Maven: de.fraunhofer.iosb.ilt.aas.service:serialization-json:0.0.1-SNAPSHOT" level="project" />
44+
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.11.2" level="project" />
45+
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.11.2" level="project" />
46+
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
47+
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.9" level="project" />
48+
<orderEntry type="library" name="Maven: com.networknt:json-schema-validator:1.0.52" level="project" />
49+
<orderEntry type="library" scope="TEST" name="Maven: pl.pragmatists:JUnitParams:1.1.1" level="project" />
50+
</component>
51+
</module>

minimalExample/pom.xml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>de.fraunhofer.iais.eis</groupId>
8+
<artifactId>MinimalExample</artifactId>
9+
<version>0.1-SNAPSHOT</version>
10+
<properties>
11+
<maven.compiler.source>1.8</maven.compiler.source>
12+
<maven.compiler.target>1.8</maven.compiler.target>
13+
</properties>
14+
15+
<dependencies>
16+
<dependency>
17+
<groupId>junit</groupId>
18+
<artifactId>junit</artifactId>
19+
<version>4.13</version>
20+
<scope>test</scope>
21+
</dependency>
22+
<dependency>
23+
<groupId>de.fraunhofer.iais.eis.infomodel</groupId>
24+
<artifactId>util</artifactId>
25+
<version>4.0.6-SNAPSHOT</version>
26+
</dependency>
27+
<dependency>
28+
<groupId>de.fraunhofer.iais.eis.ids</groupId>
29+
<artifactId>infomodel-serializer</artifactId>
30+
<version>4.0.6-SNAPSHOT</version>
31+
<scope>test</scope>
32+
</dependency>
33+
<dependency>
34+
<groupId>de.fraunhofer.iosb.ilt.aas.service</groupId>
35+
<artifactId>serialization-json</artifactId>
36+
<version>0.0.1-SNAPSHOT</version>
37+
<scope>test</scope>
38+
</dependency>
39+
<dependency>
40+
<groupId>com.fasterxml.jackson.core</groupId>
41+
<artifactId>jackson-databind</artifactId>
42+
<version>2.11.2</version>
43+
</dependency>
44+
<dependency>
45+
<groupId>org.slf4j</groupId>
46+
<artifactId>slf4j-api</artifactId>
47+
<version>1.7.30</version>
48+
</dependency>
49+
<dependency>
50+
<groupId>org.apache.commons</groupId>
51+
<artifactId>commons-lang3</artifactId>
52+
<version>3.9</version>
53+
</dependency>
54+
<dependency>
55+
<groupId>com.networknt</groupId>
56+
<artifactId>json-schema-validator</artifactId>
57+
<version>1.0.52</version>
58+
</dependency>
59+
60+
<dependency>
61+
<groupId>pl.pragmatists</groupId>
62+
<artifactId>JUnitParams</artifactId>
63+
<version>1.1.1</version>
64+
<scope>test</scope>
65+
</dependency>
66+
</dependencies>
67+
68+
<repositories>
69+
<repository>
70+
<id>FAST-repo</id>
71+
<url>https://gitlab-ext.iosb.fraunhofer.de/api/v4/projects/1949/packages/maven</url>
72+
</repository>
73+
<repository>
74+
<id>eis-public-repo</id>
75+
<name>maven-public</name>
76+
<url>http://maven.iais.fraunhofer.de/artifactory/eis-ids-public</url>
77+
</repository>
78+
</repositories>
79+
80+
</project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package io.adminshell.aas.v3.dataformat;
2+
3+
4+
5+
6+
import de.fraunhofer.iais.eis.util.*;
7+
import io.adminshell.aas.v3.model.*;
8+
import io.adminshell.aas.v3.model.builder.*;
9+
import io.adminshell.aas.v3.model.impl.*;
10+
11+
public class DeserializationException extends Exception {
12+
13+
public DeserializationException(String msg) {
14+
super(msg);
15+
}
16+
17+
public DeserializationException(String msg, Throwable err) {
18+
super(msg, err);
19+
}
20+
21+
}
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
package io.adminshell.aas.v3.dataformat;
2+
3+
import java.io.BufferedReader;
4+
import java.io.FileInputStream;
5+
import java.io.FileNotFoundException;
6+
import java.io.InputStream;
7+
import java.io.InputStreamReader;
8+
import java.nio.charset.Charset;
9+
import java.nio.charset.StandardCharsets;
10+
import java.util.stream.Collectors;
11+
12+
13+
14+
import de.fraunhofer.iais.eis.util.*;
15+
import io.adminshell.aas.v3.model.*;
16+
import io.adminshell.aas.v3.model.builder.*;
17+
import io.adminshell.aas.v3.model.impl.*;
18+
19+
/**
20+
* * Generic deserializer interface to deserialize a given string, Outputstream or java.io.File into
21+
* an instance of AssetAdministrationShellEnvironment
22+
*/
23+
public interface Deserializer {
24+
25+
/*** Default charset that will be used when no charset is specified */
26+
Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
27+
28+
/***
29+
* Deserializes a given string into an instance of AssetAdministrationShellEnvironment
30+
*
31+
* @param value a string representation of the AssetAdministrationShellEnvironment
32+
* @return an instance of AssetAdministrationShellEnvironment
33+
* @throws DeserializationException if deserialization fails
34+
*/
35+
AssetAdministrationShellEnvironment read(String value) throws DeserializationException;
36+
37+
/***
38+
* Deserializes a given InputStream into an instance of AssetAdministrationShellEnvironment using
39+
* DEFAULT_CHARSET
40+
*
41+
* @param src an InputStream containing the string representation of the
42+
* AssetAdministrationShellEnvironment
43+
* @return an instance of AssetAdministrationShellEnvironment
44+
* @throws DeserializationException if deserialization fails
45+
*/
46+
default AssetAdministrationShellEnvironment read(InputStream src) throws DeserializationException {
47+
return read(src, DEFAULT_CHARSET);
48+
}
49+
50+
/***
51+
* Deserializes a given InputStream into an instance of AssetAdministrationShellEnvironment using a
52+
* given charset
53+
*
54+
* @param src An InputStream containing the string representation of the
55+
* AssetAdministrationShellEnvironment
56+
* @param charset the charset to use for deserialization
57+
* @return an instance of AssetAdministrationShellEnvironment
58+
* @throws DeserializationException if deserialization fails
59+
*/
60+
default AssetAdministrationShellEnvironment read(InputStream src, Charset charset) throws DeserializationException {
61+
return read(new BufferedReader(
62+
new InputStreamReader(src, charset))
63+
.lines()
64+
.collect(Collectors.joining(System.lineSeparator())));
65+
}
66+
67+
// Note that the AAS also defines a file class
68+
69+
/***
70+
* Deserializes a given File into an instance of AssetAdministrationShellEnvironment using
71+
* DEFAULT_CHARSET
72+
*
73+
* @param file A java.io.File containing the string representation of the
74+
* AssetAdministrationShellEnvironment
75+
* @param charset the charset to use for deserialization
76+
* @return an instance of AssetAdministrationShellEnvironment
77+
* @throws FileNotFoundException if file is not present
78+
* @throws DeserializationException if deserialization fails
79+
*/
80+
default AssetAdministrationShellEnvironment read(java.io.File file, Charset charset)
81+
throws FileNotFoundException, DeserializationException {
82+
return read(new FileInputStream(file), charset);
83+
}
84+
85+
/***
86+
* Deserializes a given File into an instance of AssetAdministrationShellEnvironment using a given
87+
* charset
88+
*
89+
* @param file a java.io.File containing the string representation of the
90+
* AssetAdministrationShellEnvironment
91+
* @return an instance of AssetAdministrationShellEnvironment
92+
* @throws FileNotFoundException if the file is not present
93+
* @throws DeserializationException if deserialization fails
94+
*/
95+
default AssetAdministrationShellEnvironment read(java.io.File file) throws FileNotFoundException, DeserializationException {
96+
return read(file, DEFAULT_CHARSET);
97+
}
98+
99+
/***
100+
* Enables usage of custom implementation to be used for deserialization instead of default
101+
* implementation, e.g. defining a custom implementation of the Submodel interface {@code class
102+
* CustomSubmodel implements Submodel {}} and calling
103+
* {@code useImplementation(Submodel.class, CustomSubmodel.class);} will result in all instances of
104+
* Submodel will be deserialized as CustomSubmodel. Subsequent class with the same aasInterface
105+
* parameter will override the effects of all previous calls.
106+
*
107+
* @param <T> the type of the interface to replace
108+
* @param aasInterface the class of the interface to replace
109+
* @param implementation the class implementing the interface that should be used for
110+
* deserialization.
111+
*/
112+
<T> void useImplementation(Class<T> aasInterface, Class<? extends T> implementation);
113+
114+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package io.adminshell.aas.v3.dataformat;
2+
3+
import java.util.Set;
4+
5+
6+
7+
import de.fraunhofer.iais.eis.util.*;
8+
import io.adminshell.aas.v3.model.*;
9+
import io.adminshell.aas.v3.model.builder.*;
10+
import io.adminshell.aas.v3.model.impl.*;
11+
12+
/**
13+
* Validator that can validate a serialized AASEnvironment according to a specific schema.
14+
*/
15+
public interface SchemaValidator {
16+
17+
/**
18+
* Validate a serialized AASEnvironment according to a specific Schema. Does not contain any
19+
* additional validation, but is restricted to schema validation only.
20+
*
21+
* @param serializedAASEnvironment A string-serialized AASEnvironment.
22+
* @return Set of validation errors. If validation succeeds, the Set is empty.
23+
*/
24+
public Set<String> validateSchema(String serializedAASEnvironment);
25+
26+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package io.adminshell.aas.v3.dataformat;
2+
3+
4+
5+
6+
import de.fraunhofer.iais.eis.util.*;
7+
import io.adminshell.aas.v3.model.*;
8+
import io.adminshell.aas.v3.model.builder.*;
9+
import io.adminshell.aas.v3.model.impl.*;
10+
11+
public class SerializationException extends Exception {
12+
13+
public SerializationException(String msg) {
14+
super(msg);
15+
}
16+
17+
public SerializationException(String msg, Throwable err) {
18+
super(msg, err);
19+
}
20+
21+
}

0 commit comments

Comments
 (0)