All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.tibco.bw.maven.plugin.osgi.helpers.VersionParser Maven / Gradle / Ivy

Go to download

Plugin Code for Apache Maven and TIBCO BusinessWorks™. This is the Maven Plugin for BW6 and BWCE Build.

There is a newer version: 2.9.9
Show newest version
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