package de.swm.nis.logicaldecoding;

import org.springframework.stereotype.Component;

@Component
public class VersionHelper {
	
	public String determineVersion() {
		return "LogicalDeoding v.1.0.1-SNAPSHOT";
	}

}

@@ -28,17 +28,372 @@
 ecoding;
-%0A
+%0D%0A%0D%0Aimport java.io.IOException;%0D%0Aimport java.util.Properties;%0D%0A%0D%0Aimport org.slf4j.Logger;%0D%0Aimport org.slf4j.LoggerFactory;%0D%0Aimport org.springframework.beans.factory.annotation.Autowired;%0D%0Aimport org.springframework.context.ApplicationContext;%0D%0Aimport org.springframework.core.io.Resource;%0D%0Aimport org.springframework.core.io.support.PropertiesLoaderUtils;%0D
 %0Aimport 
@@ -433,17 +433,19 @@
 mponent;
-%0A
+%0D%0A%0D
 %0A@Compon
@@ -447,16 +447,17 @@
 omponent
+%0D
 %0Apublic 
@@ -477,18 +477,153 @@
 Helper %7B
+%0D
 %0A%09
+%0D%0A%09@Autowired%0D%0A%09ApplicationContext ctx;%0D%0A%09%0D%0A%09private static final Logger log = LoggerFactory.getLogger(RefreshCacheService.class);%0D%0A%09%0D
 %0A%09public
@@ -650,16 +650,17 @@
 sion() %7B
+%0D
 %0A%09%09retur
@@ -675,35 +675,945 @@
 alDe
+c
 oding v
-.1.0.1-SNAPSHOT%22;%0A%09%7D%0A
+(%22+ determineMavenVersion() + %22) - git: %22+determineGitVersion();%0D%0A%09%7D%0D%0A%0D%0A%09public String determineGitVersion() %7B%0D%0A%09%09String gitVersion = %22%22;%0D%0A%09%09Resource resource = ctx.getResource(%22classpath:git.properties%22);%0D%0A%09%09try %7B%0D%0A%09%09%09Properties gitProperties = PropertiesLoaderUtils.loadProperties(resource);%0D%0A%09%09%09gitVersion = (String) gitProperties.get(%22git.commit.id.describe%22);%0D%0A%09%09%7D catch (IOException e) %7B%0D%0A%09%09%09log.warn(%22IOException while determining git version%22, e);%0D%0A%09%09%7D%0D%0A%09%09return gitVersion;%0D%0A%09%7D%0D%0A%09%0D%0A%09public String determineMavenVersion() %7B%0D%0A%09%09String mavenVersion = %22%22;%0D%0A%09%09Resource resource = ctx.getResource(%22classpath:META-INF/MANIFEST.MF%22);%0D%0A%09%09try %7B%0D%0A%09%09%09Properties mavenProperties = PropertiesLoaderUtils.loadProperties(resource);%0D%0A%09%09%09mavenVersion = (String) mavenProperties.get(%22Implementation-Version%22);%0D%0A%09%09%7D catch (IOException e) %7B%0D%0A%09%09%09log.warn(%22IOException while determining maven version%22, e);%0D%0A%09%09%7D%0D%0A%09%09return mavenVersion;%0D%0A%09%7D%0D%0A%09%0D
 %0A%7D
+%0D
 %0A

Determine Version and hash of Build on startup