Class MavenArtifactRevisionResolver
- java.lang.Object
-
- io.axoniq.dataprotection.serialization.MavenArtifactRevisionResolver
-
- All Implemented Interfaces:
RevisionResolver
public class MavenArtifactRevisionResolver extends Object implements RevisionResolver
RevisionResolver that uses Maven meta data to retrieve the application version. This application version is used as event revision. By default, Maven stores the meta-data in a file called 'pom.properties' in the JAR files under 'META-INF/maven/<groupId>/<artifactId>/'.- Since:
- 2.1
- Author:
- Allard Buijze
-
-
Constructor Summary
Constructors Constructor Description MavenArtifactRevisionResolver(String groupId, String artifactId)Initialize the RevisionResolver to look for the version in the Meta Data of the artifact with givengroupIdandartifactId.MavenArtifactRevisionResolver(String groupId, String artifactId, ClassLoader classLoader)Initialize the RevisionResolver to look for the version in the Meta Data of the artifact with givengroupIdandartifactId.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringrevisionOf(Class<?> payloadType)Returns the revision for the givenpayloadType.
-
-
-
Constructor Detail
-
MavenArtifactRevisionResolver
public MavenArtifactRevisionResolver(String groupId, String artifactId) throws IOException
Initialize the RevisionResolver to look for the version in the Meta Data of the artifact with givengroupIdandartifactId. The class loader that loaded the MavenArtifactRevisionResolver class is used to load the artifact configuration.- Parameters:
groupId- The groupId as defined in the pom.xml file of the moduleartifactId- The artifactId as defined in the pom.xml file of the module- Throws:
IOException- When an exception occurs reading from the maven configuration file
-
MavenArtifactRevisionResolver
public MavenArtifactRevisionResolver(String groupId, String artifactId, ClassLoader classLoader) throws IOException
Initialize the RevisionResolver to look for the version in the Meta Data of the artifact with givengroupIdandartifactId.- Parameters:
groupId- The groupId as defined in the pom.xml file of the moduleartifactId- The artifactId as defined in the pom.xml file of the moduleclassLoader- The class loader to load the artifact configuration with- Throws:
IOException- When an exception occurs reading from the maven configuration file
-
-
Method Detail
-
revisionOf
public String revisionOf(Class<?> payloadType)
Description copied from interface:RevisionResolverReturns the revision for the givenpayloadType. The revision is used by upcasters to decide whether they need to process a certain serialized event. Generally, the revision needs to be modified each time the structure of an event has been changed in an incompatible manner.- Specified by:
revisionOfin interfaceRevisionResolver- Parameters:
payloadType- The type for which to return the revision- Returns:
- the revision for the given
payloadType
-
-