Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
arnoweiss committed Feb 28, 2023
2 parents a3c41a7 + 3142237 commit bfc93ea
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ root:
`mvn clean package`


or by integrating the respective modules as dependencies from Maven Central Repository, for instance:
or by integrating the respective modules as dependencies from [Maven Central](https://search.maven.org/search?q=aas4j) Repository, for instance:

```
<dependency>
<groupId>org.eclipse.aas4j</groupId>
<groupId>org.eclipse.digitaltwin.aas4j</groupId>
<artifactId>dataformat-json</artifactId>
<version>latest-version</version>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class AASXDeserializer {
private static final String XML_TYPE = "http://www.admin-shell.io/aasx/relationships/aas-spec";
private static final String AASX_ORIGIN = "/aasx/aasx-origin";

private XmlDeserializer deserializer = new XmlDeserializer();
private final XmlDeserializer deserializer;

private Environment environment;
private final OPCPackage aasxRoot;
Expand All @@ -61,6 +61,7 @@ public class AASXDeserializer {
*/
public AASXDeserializer(InputStream inputStream) throws InvalidFormatException, IOException {
aasxRoot = OPCPackage.open(inputStream);
this.deserializer = new XmlDeserializer();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,13 @@ public class AASXSerializer {

private static final String AASSUPPL_RELTYPE = "http://www.admin-shell.io/aasx/relationships/aas-suppl";

private Serializer xmlSerializer = new XmlSerializer();
private final Serializer xmlSerializer;

/**
* Default constructor
*/
public AASXSerializer() {
this.xmlSerializer = new XmlSerializer();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,31 @@
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.module.SimpleAbstractTypeResolver;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.dataformat.xml.XmlFactory;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;

public class XmlDeserializer implements Deserializer {

protected final XmlFactory xmlFactory;
protected XmlMapper mapper;
protected SimpleAbstractTypeResolver typeResolver;
@SuppressWarnings("rawtypes")
protected static Map<Class<?>, JsonDeserializer> customDeserializers = Map.of(
SubmodelElement.class, new SubmodelElementDeserializer());

public XmlDeserializer() {
this(new XmlFactory());
}

public XmlDeserializer(XmlFactory xmlFactory) {
this.xmlFactory = xmlFactory;
initTypeResolver();
buildMapper();
}

protected void buildMapper() {
mapper = XmlMapper.builder().enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
mapper = XmlMapper.builder(xmlFactory)
.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.serializationInclusion(JsonInclude.Include.NON_NULL)
.annotationIntrospector(new XmlDataformatAnnotationIntrospector())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.dataformat.xml.XmlFactory;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator;


public class XmlSerializer implements Serializer {
protected final XmlFactory xmlFactory;
protected XmlMapper mapper;
protected Map<String, String> namespacePrefixes;

Expand All @@ -49,12 +51,17 @@ public XmlSerializer() {
}

public XmlSerializer(Map<String, String> namespacePrefixes) {
this(new XmlFactory(), namespacePrefixes);
}

public XmlSerializer(XmlFactory xmlFactory, Map<String, String> namespacePrefixes) {
this.xmlFactory = xmlFactory;
this.namespacePrefixes = namespacePrefixes;
buildMapper();
}

protected void buildMapper() {
mapper = XmlMapper.builder()
mapper = XmlMapper.builder(xmlFactory)
.enable(SerializationFeature.INDENT_OUTPUT)
.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
.serializationInclusion(JsonInclude.Include.NON_NULL)
Expand Down
Binary file added docs/adr/branching_strategy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions docs/adr/development_process.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Development Process

Reference to [Issue #32](https://github.com/eclipse-digitaltwin/aas4j/issues/32)

## Branch Conventions

Possible branches can be classified between *main* and *support* branching.
The *main* branches are :
- `main` branch: This branch contains the production-ready code that can be released or is released.


The `supporting` branches are:
- `feature` branch: This branch can be used to implement new features for the next releases.
- `release` branch: This branch supports the preparation to new releases and only accepts commits (e.g. minor bug fixes) to stabilize a version of the code ready for release (production ready). Release branches should not be created for every release but only per major version, e.g. `release-v3.x` without any breaking changes. Each release should be created as a tag.
- `bugfixes` branch: This branch captures work to fix an urgent production defect (issues, error, instabilities, vulnerabilities, ...).

## Processes

- Once the `main` branch achieves the development goals, is stable (production-ready) and ready for release.
- `feature` branch *may* branch off from `main` branch but *must* merge back into the `main` branch only.
- `release` branch *may* branch off from `main` branch with the naming convention `release-*`(e.g., `release-v3.x`).
- `bugfix` branch *must* branch off from the `main` and / or `release` branch and *must* merge / cherry pick back into the respective `main` / `release` branch with the naming convention `bugfix-{description}`or `bugfix-issue-nr`(e.g., `bugfix-issue-21`).

> **Housekeeping:** Only permanent branches are main and release-v3.x; other branches such as features or bugfixes are deleted once merged.

## Releases

- `main` branch reflects *major*, *minor*, and *service* releases that *must* have followed the review process defined in the [Eclipse Handbook](https://www.eclipse.org/projects/handbook/#release).
- `release` branch can also reflect a milestone build and release (pre-releases under Eclise Foundation).
- `bugfix` branch can be used to keep dependecies updated and, consequently, only the latest version will be updated.

Resources:
- https://nvie.com/posts/a-successful-git-branching-model/
- https://martinfowler.com/articles/branching-patterns.html
- https://www.gitkraken.com/learn/git/git-flow

0 comments on commit bfc93ea

Please sign in to comment.