001/*-------------------------------------------------------------------------+
002|                                                                          |
003| Copyright 2005-2011 the ConQAT Project                                   |
004|                                                                          |
005| Licensed under the Apache License, Version 2.0 (the "License");          |
006| you may not use this file except in compliance with the License.         |
007| You may obtain a copy of the License at                                  |
008|                                                                          |
009|    http://www.apache.org/licenses/LICENSE-2.0                            |
010|                                                                          |
011| Unless required by applicable law or agreed to in writing, software      |
012| distributed under the License is distributed on an "AS IS" BASIS,        |
013| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
014| See the License for the specific language governing permissions and      |
015| limitations under the License.                                           |
016+-------------------------------------------------------------------------*/
017package org.conqat.engine.service.shared.client;
018
019/**
020 * The version of the service API as used by the service clients. In case of
021 * compatible extensions to the API, we increase {@link #CURRENT_VERSION}, thus
022 * old clients can still talk to this server. For breaking changes we set both
023 * {@link #CURRENT_VERSION} and {@link #MIN_SUPPORTED_VERSION} to the value of (
024 * {@link #CURRENT_VERSION} + 1).
025 * 
026 * @deprecated Use @PublicApi to version new api endpoints, which uses a
027 *             versioning scheme that matches the Teamscale version.
028 */
029public enum EServiceApiVersion {
030
031        /** The first version */
032        VERSION_1(1),
033
034        /** The second version (Teamscale 3.0) */
035        VERSION_2(2),
036
037        /** Third version (Teamscale 3.2) */
038        VERSION_3(3),
039
040        /** Fourth version (Teamscale 3.8) */
041        VERSION_4(4),
042
043        /** Fifth version (Teamscale 3.9) */
044        VERSION_5(5),
045
046        /** Sixth version (Teamscale 4.1) */
047        VERSION_6(6),
048
049        /**
050         * Seventh version (Teamscale 4.7) introducing blacklist types (toleration and
051         * false positive)
052         */
053        VERSION_7(7),
054
055        /**
056         * Version 8 (Teamscale 5.5)
057         */
058        VERSION_8(8),
059
060        /**
061         * Version 9 (Teamscale 5.7) introduction of api/version-info to supersede
062         * service api version.
063         */
064        VERSION_9(9);
065
066        // when adding values here, make sure updating the IDE clients, e.g.
067        // com.teamscale.ide.commons.client.services.TeamscaleConnectorUtils
068
069        /** The current version of the service API. */
070        public static final EServiceApiVersion CURRENT_VERSION = values()[values().length - 1];
071
072        /**
073         * The minimum version of service clients that are still supported by this
074         * server.
075         */
076        public static final EServiceApiVersion MIN_SUPPORTED_VERSION = VERSION_6;
077
078        /**
079         * The version number. This can be used by service clients for version
080         * compatibility checking.
081         */
082        private final int versionNumber;
083
084        /** Constructor */
085        EServiceApiVersion(int versionNumber) {
086                this.versionNumber = versionNumber;
087        }
088
089        /** Returns number. */
090        public int getVersionNumber() {
091                return versionNumber;
092        }
093
094}