com.tibco.bw.maven.plugin.osgi.helpers.VersionParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bw6-maven-plugin Show documentation
Show all versions of bw6-maven-plugin Show documentation
Plugin Code for Apache Maven and TIBCO BusinessWorks™.
This is the Maven Plugin for BW6 and BWCE Build.
package com.tibco.bw.maven.plugin.osgi.helpers;
import java.text.SimpleDateFormat;
import java.util.Date;
public class VersionParser {
protected static SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmm");
public static final String QUALIFIER = "qualifier";
public static Version parseVersion(String version) {
if (version == null) {
return Version.EMPTYVERSION;
}
return new Version(version);
}
public static String getcalculatedOSGiVersion(String versionStr) {
Version version = parseVersion(versionStr);
String calcQualifier = calculateQualifier(version.getQualifier());
String fullVersion = version.getMajor() + "." + version.getMinor() + "." + version.getMicro();
if(!calcQualifier.isEmpty()) {
fullVersion += "." + calcQualifier;
}
return fullVersion;
}
private static String calculateQualifier(String qualifier) {
if( QUALIFIER.equals(qualifier)) {
Date timestamp = new Date();
return format.format(timestamp);
}
return qualifier;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy