@@ -0,0 +1,2601 @@
+/**%0A * Copyright (C) 2015 The Gravitee team (http://gravitee.io)%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *         http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage io.gravitee.common.util;%0A%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.util.Properties;%0A%0A/**%0A * Represents the version information.%0A *%0A * @author David BRASSELY (brasseld at gmail.com)%0A * @author GraviteeSource Team%0A */%0Apublic final class Version %7B%0A%0A    /**%0A     * Represents the build id, which is a string like %22b13%22.%0A     */%0A    public final String BUILD_ID;%0A%0A    /**%0A     * Represents the complete build number%0A     */%0A    public final String BUILD_NUMBER;%0A%0A    /**%0A     * Represents the major version, such as %222.0%22.%0A     */%0A    public final String MAJOR_VERSION;%0A%0A    /**%0A     * Represents the latest Revision number.%0A     */%0A    public final String REVISION;%0A%0A    /**%0A     * The Runtime Version.%0A     */%0A    public static final Version RUNTIME_VERSION = Version.create(Version.class.getResourceAsStream(%22/version.properties%22));%0A%0A    private Version(String buildId, String buildVersion, String majorVersion, String revision) %7B%0A        this.BUILD_ID = fixNull(buildId);%0A        this.BUILD_NUMBER = fixNull(buildVersion);%0A        this.MAJOR_VERSION = fixNull(majorVersion);%0A        this.REVISION = fixNull(revision);%0A    %7D%0A%0A    public static Version create(InputStream is) %7B%0A        Properties props = new Properties();%0A        try %7B%0A            props.load(is);%0A        %7D catch (IOException e) %7B%0A            // ignore even if the property was not found. we'll treat everything as unknown%0A        %7D catch (Exception e) %7B%0A            //ignore even if property not found%0A        %7D%0A%0A        return new Version(%0A                props.getProperty(%22build-id%22),%0A                props.getProperty(%22build-version%22),%0A                props.getProperty(%22major-version%22),%0A                props.getProperty(%22revision%22));%0A    %7D%0A%0A    private String fixNull(String v) %7B%0A        if(v==null) return %22unknown%22;%0A        return v;%0A    %7D%0A%0A    public String toString() %7B%0A        return MAJOR_VERSION + %22 (build: %22 + BUILD_ID + %22) revision#%22 + REVISION;%0A    %7D%0A%7D

Add version class used to read data from a properties file available from classloader