Search in sources :

Example 16 with ProductVersion

use of org.talend.utils.ProductVersion in project tdq-studio-se by Talend.

the class WorkspaceVersionHelper method getVesion.

/**
 * DOC bZhou Comment method "getVesion".
 *
 * @param versionFile
 * @return
 */
public static ProductVersion getVesion(IPath versionPath) {
    File versionFile = versionPath == null ? null : versionPath.toFile();
    ProductVersion pVersion = null;
    try {
        if (versionFile != null && versionFile.exists()) {
            FileInputStream inStream = new FileInputStream(versionFile);
            Properties pros = new Properties();
            pros.load(inStream);
            String version = pros.getProperty(VERSION);
            if (version != null && !"".equals(version)) {
                // $NON-NLS-1$
                pVersion = ProductVersion.fromString(version);
            }
            inStream.close();
        } else {
            pVersion = new ProductVersion(0, 0, 0);
        }
    } catch (Exception e) {
        log.error(e, e);
    }
    return pVersion;
}
Also used : ProductVersion(org.talend.utils.ProductVersion) Properties(java.util.Properties) File(java.io.File) IFile(org.eclipse.core.resources.IFile) FileInputStream(java.io.FileInputStream) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException)

Aggregations

ProductVersion (org.talend.utils.ProductVersion)16 BasicEList (org.eclipse.emf.common.util.BasicEList)9 Test (org.junit.Test)9 TdExpression (org.talend.cwm.relational.TdExpression)9 IndicatorDefinition (org.talend.dataquality.indicators.definition.IndicatorDefinition)9 UDIndicatorDefinition (org.talend.dataquality.indicators.definition.userdefine.UDIndicatorDefinition)9 ArrayList (java.util.ArrayList)3 FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2 Properties (java.util.Properties)2 IMigrationTask (org.talend.dataprofiler.migration.IMigrationTask)2 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 MalformedURLException (java.net.MalformedURLException)1 SQLException (java.sql.SQLException)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 IFile (org.eclipse.core.resources.IFile)1 IPath (org.eclipse.core.runtime.IPath)1