579 lines
27 KiB
Java
Raw Normal View History

2010-02-08 15:30:06 +02:00
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
2010-02-08 15:30:06 +02:00
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch;
import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.AbstractModule;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.monitor.jvm.JvmInfo;
import java.io.IOException;
import java.io.Serializable;
2010-02-08 15:30:06 +02:00
/**
*/
2013-07-29 01:55:41 +02:00
@SuppressWarnings("deprecation")
public class Version implements Serializable {
2010-02-08 15:30:06 +02:00
// The logic for ID is: XXYYZZAA, where XX is major version, YY is minor version, ZZ is revision, and AA is Beta/RC indicator
// AA values below 50 are beta builds, and below 99 are RC builds, with 99 indicating a release
// the (internal) format of the id is there so we can easily do after/before checks on the id
2010-02-08 15:30:06 +02:00
public static final int V_0_18_0_ID = /*00*/180099;
2014-06-26 08:18:59 -04:00
public static final Version V_0_18_0 = new Version(V_0_18_0_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2011-10-26 21:04:10 +02:00
public static final int V_0_18_1_ID = /*00*/180199;
2014-06-26 08:18:59 -04:00
public static final Version V_0_18_1 = new Version(V_0_18_1_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2011-10-27 01:43:08 +02:00
public static final int V_0_18_2_ID = /*00*/180299;
2014-06-26 08:18:59 -04:00
public static final Version V_0_18_2 = new Version(V_0_18_2_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2011-10-27 20:42:43 +02:00
public static final int V_0_18_3_ID = /*00*/180399;
2014-06-26 08:18:59 -04:00
public static final Version V_0_18_3 = new Version(V_0_18_3_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2011-11-16 15:23:58 +02:00
public static final int V_0_18_4_ID = /*00*/180499;
2014-06-26 08:18:59 -04:00
public static final Version V_0_18_4 = new Version(V_0_18_4_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2011-11-16 22:00:13 +02:00
public static final int V_0_18_5_ID = /*00*/180599;
2014-06-26 08:18:59 -04:00
public static final Version V_0_18_5 = new Version(V_0_18_5_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2011-11-29 13:55:11 +02:00
public static final int V_0_18_6_ID = /*00*/180699;
2014-06-26 08:18:59 -04:00
public static final Version V_0_18_6 = new Version(V_0_18_6_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2011-12-19 11:43:50 +02:00
public static final int V_0_18_7_ID = /*00*/180799;
2014-06-26 08:18:59 -04:00
public static final Version V_0_18_7 = new Version(V_0_18_7_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2012-01-10 13:10:53 +02:00
public static final int V_0_18_8_ID = /*00*/180899;
2014-06-26 08:18:59 -04:00
public static final Version V_0_18_8 = new Version(V_0_18_8_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2010-02-08 15:30:06 +02:00
2012-02-07 15:17:09 +02:00
public static final int V_0_19_0_RC1_ID = /*00*/190051;
2014-06-26 08:18:59 -04:00
public static final Version V_0_19_0_RC1 = new Version(V_0_19_0_RC1_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2011-10-26 21:04:10 +02:00
2012-02-07 15:17:09 +02:00
public static final int V_0_19_0_RC2_ID = /*00*/190052;
2014-06-26 08:18:59 -04:00
public static final Version V_0_19_0_RC2 = new Version(V_0_19_0_RC2_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2012-02-07 15:17:09 +02:00
2012-02-09 00:37:12 +02:00
public static final int V_0_19_0_RC3_ID = /*00*/190053;
2014-06-26 08:18:59 -04:00
public static final Version V_0_19_0_RC3 = new Version(V_0_19_0_RC3_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2012-02-09 00:37:12 +02:00
2012-03-02 11:17:55 +02:00
public static final int V_0_19_0_ID = /*00*/190099;
2014-06-26 08:18:59 -04:00
public static final Version V_0_19_0 = new Version(V_0_19_0_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2012-03-02 17:05:41 +02:00
public static final int V_0_19_1_ID = /*00*/190199;
2014-06-26 08:18:59 -04:00
public static final Version V_0_19_1 = new Version(V_0_19_1_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2012-03-20 14:06:29 +02:00
public static final int V_0_19_2_ID = /*00*/190299;
2014-06-26 08:18:59 -04:00
public static final Version V_0_19_2 = new Version(V_0_19_2_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2012-04-04 20:53:45 +03:00
public static final int V_0_19_3_ID = /*00*/190399;
2014-06-26 08:18:59 -04:00
public static final Version V_0_19_3 = new Version(V_0_19_3_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2012-04-30 12:33:24 +03:00
public static final int V_0_19_4_ID = /*00*/190499;
2014-06-26 08:18:59 -04:00
public static final Version V_0_19_4 = new Version(V_0_19_4_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2012-05-21 22:08:14 +02:00
public static final int V_0_19_5_ID = /*00*/190599;
2014-06-26 08:18:59 -04:00
public static final Version V_0_19_5 = new Version(V_0_19_5_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2012-06-25 15:37:35 +02:00
public static final int V_0_19_6_ID = /*00*/190699;
2014-06-26 08:18:59 -04:00
public static final Version V_0_19_6 = new Version(V_0_19_6_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2012-06-25 17:34:31 +02:00
public static final int V_0_19_7_ID = /*00*/190799;
2014-06-26 08:18:59 -04:00
public static final Version V_0_19_7 = new Version(V_0_19_7_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2012-06-26 19:59:40 +02:00
public static final int V_0_19_8_ID = /*00*/190899;
2014-06-26 08:18:59 -04:00
public static final Version V_0_19_8 = new Version(V_0_19_8_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2012-07-02 22:10:28 +02:00
public static final int V_0_19_9_ID = /*00*/190999;
2014-06-26 08:18:59 -04:00
public static final Version V_0_19_9 = new Version(V_0_19_9_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2012-08-23 13:52:57 +02:00
public static final int V_0_19_10_ID = /*00*/191099;
2014-06-26 08:18:59 -04:00
public static final Version V_0_19_10 = new Version(V_0_19_10_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2012-10-24 01:41:46 +02:00
public static final int V_0_19_11_ID = /*00*/191199;
2014-06-26 08:18:59 -04:00
public static final Version V_0_19_11 = new Version(V_0_19_11_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2012-10-24 01:41:46 +02:00
public static final int V_0_19_12_ID = /*00*/191299;
2014-06-26 08:18:59 -04:00
public static final Version V_0_19_12 = new Version(V_0_19_12_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2012-12-04 15:41:38 +01:00
public static final int V_0_19_13_ID = /*00*/191399;
2014-06-26 08:18:59 -04:00
public static final Version V_0_19_13 = new Version(V_0_19_13_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2012-03-02 17:05:41 +02:00
2012-10-22 01:48:09 +02:00
public static final int V_0_20_0_RC1_ID = /*00*/200051;
2014-06-26 08:18:59 -04:00
public static final Version V_0_20_0_RC1 = new Version(V_0_20_0_RC1_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2012-12-07 23:15:44 +01:00
public static final int V_0_20_0_ID = /*00*/200099;
2014-06-26 08:18:59 -04:00
public static final Version V_0_20_0 = new Version(V_0_20_0_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2012-12-08 01:37:21 +01:00
public static final int V_0_20_1_ID = /*00*/200199;
2014-06-26 08:18:59 -04:00
public static final Version V_0_20_1 = new Version(V_0_20_1_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2012-12-08 01:37:21 +01:00
public static final int V_0_20_2_ID = /*00*/200299;
2014-06-26 08:18:59 -04:00
public static final Version V_0_20_2 = new Version(V_0_20_2_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2012-12-27 14:30:40 -08:00
public static final int V_0_20_3_ID = /*00*/200399;
2014-06-26 08:18:59 -04:00
public static final Version V_0_20_3 = new Version(V_0_20_3_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2013-01-25 22:02:34 +01:00
public static final int V_0_20_4_ID = /*00*/200499;
2014-06-26 08:18:59 -04:00
public static final Version V_0_20_4 = new Version(V_0_20_4_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2013-01-29 10:14:25 +01:00
public static final int V_0_20_5_ID = /*00*/200599;
2014-06-26 08:18:59 -04:00
public static final Version V_0_20_5 = new Version(V_0_20_5_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2013-02-14 14:29:30 +01:00
public static final int V_0_20_6_ID = /*00*/200699;
2014-06-26 08:18:59 -04:00
public static final Version V_0_20_6 = new Version(V_0_20_6_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2013-03-25 12:33:55 +01:00
public static final int V_0_20_7_ID = /*00*/200799;
2014-06-26 08:18:59 -04:00
public static final Version V_0_20_7 = new Version(V_0_20_7_ID, false, org.apache.lucene.util.Version.LUCENE_3_6);
2012-03-02 11:23:24 +02:00
2013-02-26 10:32:50 +01:00
public static final int V_0_90_0_Beta1_ID = /*00*/900001;
2014-06-26 08:18:59 -04:00
public static final Version V_0_90_0_Beta1 = new Version(V_0_90_0_Beta1_ID, false, org.apache.lucene.util.Version.LUCENE_4_1);
2013-03-20 19:05:08 +01:00
public static final int V_0_90_0_RC1_ID = /*00*/900051;
2014-06-26 08:18:59 -04:00
public static final Version V_0_90_0_RC1 = new Version(V_0_90_0_RC1_ID, false, org.apache.lucene.util.Version.LUCENE_4_1);
2013-03-20 19:06:30 +01:00
public static final int V_0_90_0_RC2_ID = /*00*/900052;
2014-06-26 08:18:59 -04:00
public static final Version V_0_90_0_RC2 = new Version(V_0_90_0_RC2_ID, false, org.apache.lucene.util.Version.LUCENE_4_2);
2013-04-29 13:41:43 +02:00
public static final int V_0_90_0_ID = /*00*/900099;
2014-06-26 08:18:59 -04:00
public static final Version V_0_90_0 = new Version(V_0_90_0_ID, false, org.apache.lucene.util.Version.LUCENE_4_2);
2013-04-29 13:51:09 +02:00
public static final int V_0_90_1_ID = /*00*/900199;
2014-06-26 08:18:59 -04:00
public static final Version V_0_90_1 = new Version(V_0_90_1_ID, false, org.apache.lucene.util.Version.LUCENE_4_3);
2013-05-30 14:27:33 +02:00
public static final int V_0_90_2_ID = /*00*/900299;
2014-06-26 08:18:59 -04:00
public static final Version V_0_90_2 = new Version(V_0_90_2_ID, false, org.apache.lucene.util.Version.LUCENE_4_3);
2013-06-26 09:02:54 +01:00
public static final int V_0_90_3_ID = /*00*/900399;
2014-06-26 08:18:59 -04:00
public static final Version V_0_90_3 = new Version(V_0_90_3_ID, false, org.apache.lucene.util.Version.LUCENE_4_4);
2013-08-06 15:28:02 +02:00
public static final int V_0_90_4_ID = /*00*/900499;
2014-06-26 08:18:59 -04:00
public static final Version V_0_90_4 = new Version(V_0_90_4_ID, false, org.apache.lucene.util.Version.LUCENE_4_4);
2013-09-16 16:20:33 +02:00
public static final int V_0_90_5_ID = /*00*/900599;
2014-06-26 08:18:59 -04:00
public static final Version V_0_90_5 = new Version(V_0_90_5_ID, false, org.apache.lucene.util.Version.LUCENE_4_4);
2013-09-17 15:04:33 +02:00
public static final int V_0_90_6_ID = /*00*/900699;
2014-06-26 08:18:59 -04:00
public static final Version V_0_90_6 = new Version(V_0_90_6_ID, false, org.apache.lucene.util.Version.LUCENE_4_5);
public static final int V_0_90_7_ID = /*00*/900799;
2014-06-26 08:18:59 -04:00
public static final Version V_0_90_7 = new Version(V_0_90_7_ID, false, org.apache.lucene.util.Version.LUCENE_4_5);
2013-12-18 17:30:28 +01:00
public static final int V_0_90_8_ID = /*00*/900899;
2014-06-26 08:18:59 -04:00
public static final Version V_0_90_8 = new Version(V_0_90_8_ID, false, org.apache.lucene.util.Version.LUCENE_4_6);
2013-12-23 11:49:28 +01:00
public static final int V_0_90_9_ID = /*00*/900999;
2014-06-26 08:18:59 -04:00
public static final Version V_0_90_9 = new Version(V_0_90_9_ID, false, org.apache.lucene.util.Version.LUCENE_4_6);
2014-01-10 11:39:13 +01:00
public static final int V_0_90_10_ID = /*00*/901099;
2014-06-26 08:18:59 -04:00
public static final Version V_0_90_10 = new Version(V_0_90_10_ID, false, org.apache.lucene.util.Version.LUCENE_4_6);
2014-02-03 16:26:44 +01:00
public static final int V_0_90_11_ID = /*00*/901199;
2014-06-26 08:18:59 -04:00
public static final Version V_0_90_11 = new Version(V_0_90_11_ID, false, org.apache.lucene.util.Version.LUCENE_4_6);
public static final int V_0_90_12_ID = /*00*/901299;
2014-06-26 08:18:59 -04:00
public static final Version V_0_90_12 = new Version(V_0_90_12_ID, false, org.apache.lucene.util.Version.LUCENE_4_6);
2014-03-20 18:37:10 +01:00
public static final int V_0_90_13_ID = /*00*/901399;
2014-06-26 08:18:59 -04:00
public static final Version V_0_90_13 = new Version(V_0_90_13_ID, false, org.apache.lucene.util.Version.LUCENE_4_6);
2014-03-25 17:42:41 +01:00
public static final int V_0_90_14_ID = /*00*/901499;
2014-06-26 08:18:59 -04:00
public static final Version V_0_90_14 = new Version(V_0_90_14_ID, false, org.apache.lucene.util.Version.LUCENE_4_6);
2013-03-20 19:06:30 +01:00
2013-04-29 13:51:09 +02:00
public static final int V_1_0_0_Beta1_ID = /*00*/1000001;
2014-06-26 08:18:59 -04:00
public static final Version V_1_0_0_Beta1 = new Version(V_1_0_0_Beta1_ID, false, org.apache.lucene.util.Version.LUCENE_4_5);
2013-11-06 16:19:50 +01:00
public static final int V_1_0_0_Beta2_ID = /*00*/1000002;
2014-06-26 08:18:59 -04:00
public static final Version V_1_0_0_Beta2 = new Version(V_1_0_0_Beta2_ID, false, org.apache.lucene.util.Version.LUCENE_4_6);
2013-12-02 17:10:07 +01:00
public static final int V_1_0_0_RC1_ID = /*00*/1000051;
2014-06-26 08:18:59 -04:00
public static final Version V_1_0_0_RC1 = new Version(V_1_0_0_RC1_ID, false, org.apache.lucene.util.Version.LUCENE_4_6);
2014-01-22 11:15:24 +01:00
public static final int V_1_0_0_RC2_ID = /*00*/1000052;
2014-06-26 08:18:59 -04:00
public static final Version V_1_0_0_RC2 = new Version(V_1_0_0_RC2_ID, false, org.apache.lucene.util.Version.LUCENE_4_6);
2014-01-15 18:21:49 +01:00
public static final int V_1_0_0_ID = /*00*/1000099;
2014-06-26 08:18:59 -04:00
public static final Version V_1_0_0 = new Version(V_1_0_0_ID, false, org.apache.lucene.util.Version.LUCENE_4_6);
2014-03-20 18:37:10 +01:00
public static final int V_1_0_1_ID = /*00*/1000199;
2014-06-26 08:18:59 -04:00
public static final Version V_1_0_1 = new Version(V_1_0_1_ID, false, org.apache.lucene.util.Version.LUCENE_4_6);
2014-03-20 18:37:10 +01:00
public static final int V_1_0_2_ID = /*00*/1000299;
2014-06-26 08:18:59 -04:00
public static final Version V_1_0_2 = new Version(V_1_0_2_ID, false, org.apache.lucene.util.Version.LUCENE_4_6);
2014-03-25 17:42:41 +01:00
public static final int V_1_0_3_ID = /*00*/1000399;
2014-06-26 08:18:59 -04:00
public static final Version V_1_0_3 = new Version(V_1_0_3_ID, false, org.apache.lucene.util.Version.LUCENE_4_6);
public static final int V_1_0_4_ID = /*00*/1000499;
2014-06-26 08:18:59 -04:00
public static final Version V_1_0_4 = new Version(V_1_0_3_ID, false, org.apache.lucene.util.Version.LUCENE_4_6);
public static final int V_1_1_0_ID = /*00*/1010099;
2014-06-26 08:18:59 -04:00
public static final Version V_1_1_0 = new Version(V_1_1_0_ID, false, org.apache.lucene.util.Version.LUCENE_4_7);
2014-03-25 17:42:41 +01:00
public static final int V_1_1_1_ID = /*00*/1010199;
2014-06-26 08:18:59 -04:00
public static final Version V_1_1_1 = new Version(V_1_1_1_ID, false, org.apache.lucene.util.Version.LUCENE_4_7);
public static final int V_1_1_2_ID = /*00*/1010299;
2014-06-26 08:18:59 -04:00
public static final Version V_1_1_2 = new Version(V_1_1_2_ID, false, org.apache.lucene.util.Version.LUCENE_4_7);
2014-03-20 18:37:10 +01:00
public static final int V_1_2_0_ID = /*00*/1020099;
2014-06-26 08:18:59 -04:00
public static final Version V_1_2_0 = new Version(V_1_2_0_ID, false, org.apache.lucene.util.Version.LUCENE_4_8);
2014-06-03 17:25:44 +02:00
public static final int V_1_2_1_ID = /*00*/1020199;
2014-06-26 08:18:59 -04:00
public static final Version V_1_2_1 = new Version(V_1_2_1_ID, false, org.apache.lucene.util.Version.LUCENE_4_8);
public static final int V_1_2_2_ID = /*00*/1020299;
2014-06-26 08:18:59 -04:00
public static final Version V_1_2_2 = new Version(V_1_2_2_ID, false, org.apache.lucene.util.Version.LUCENE_4_8);
2014-07-09 15:02:06 +02:00
public static final int V_1_2_3_ID = /*00*/1020399;
public static final Version V_1_2_3 = new Version(V_1_2_3_ID, false, org.apache.lucene.util.Version.LUCENE_4_8);
public static final int V_1_2_4_ID = /*00*/1020499;
public static final Version V_1_2_4 = new Version(V_1_2_4_ID, false, org.apache.lucene.util.Version.LUCENE_4_8);
public static final int V_1_2_5_ID = /*00*/1020599;
public static final Version V_1_2_5 = new Version(V_1_2_5_ID, false, org.apache.lucene.util.Version.LUCENE_4_8);
2014-05-19 20:53:39 +02:00
public static final int V_1_3_0_ID = /*00*/1030099;
2014-06-26 08:18:59 -04:00
public static final Version V_1_3_0 = new Version(V_1_3_0_ID, false, org.apache.lucene.util.Version.LUCENE_4_9);
public static final int V_1_3_1_ID = /*00*/1030199;
public static final Version V_1_3_1 = new Version(V_1_3_1_ID, false, org.apache.lucene.util.Version.LUCENE_4_9);
2014-07-28 17:22:18 +02:00
public static final int V_1_3_2_ID = /*00*/1030299;
public static final Version V_1_3_2 = new Version(V_1_3_2_ID, false, org.apache.lucene.util.Version.LUCENE_4_9);
public static final int V_1_3_3_ID = /*00*/1030399;
public static final Version V_1_3_3 = new Version(V_1_3_3_ID, false, org.apache.lucene.util.Version.LUCENE_4_9);
public static final int V_1_3_4_ID = /*00*/1030499;
public static final Version V_1_3_4 = new Version(V_1_3_4_ID, false, org.apache.lucene.util.Version.LUCENE_4_9);
public static final int V_1_3_5_ID = /*00*/1030599;
public static final Version V_1_3_5 = new Version(V_1_3_5_ID, false, org.apache.lucene.util.Version.LUCENE_4_9);
public static final int V_1_3_6_ID = /*00*/1030699;
public static final Version V_1_3_6 = new Version(V_1_3_6_ID, false, org.apache.lucene.util.Version.LUCENE_4_9);
public static final int V_1_4_0_Beta1_ID = /*00*/1040001;
2014-09-28 13:42:12 -04:00
public static final Version V_1_4_0_Beta1 = new Version(V_1_4_0_Beta1_ID, false, org.apache.lucene.util.Version.LUCENE_4_10_1);
2014-07-15 15:39:14 +02:00
public static final int V_1_4_0_ID = /*00*/1040099;
2014-10-29 11:21:51 -04:00
public static final Version V_1_4_0 = new Version(V_1_4_0_ID, false, org.apache.lucene.util.Version.LUCENE_4_10_2);
public static final int V_1_4_1_ID = /*00*/1040199;
public static final Version V_1_4_1 = new Version(V_1_4_1_ID, false, org.apache.lucene.util.Version.LUCENE_4_10_2);
2014-09-11 22:38:03 +02:00
public static final int V_1_5_0_ID = /*00*/1050099;
2014-10-29 11:21:51 -04:00
public static final Version V_1_5_0 = new Version(V_1_5_0_ID, false, org.apache.lucene.util.Version.LUCENE_4_10_2);
2014-01-21 17:07:39 +01:00
public static final int V_2_0_0_ID = /*00*/2000099;
2014-10-29 11:21:51 -04:00
public static final Version V_2_0_0 = new Version(V_2_0_0_ID, true, org.apache.lucene.util.Version.LUCENE_4_10_2);
2013-04-29 13:51:09 +02:00
2014-01-21 17:07:39 +01:00
public static final Version CURRENT = V_2_0_0;
2013-05-30 14:27:33 +02:00
static {
assert CURRENT.luceneVersion.equals(Lucene.VERSION) : "Version must be upgraded to [" + Lucene.VERSION + "] is still set to [" + CURRENT.luceneVersion + "]";
}
public static Version readVersion(StreamInput in) throws IOException {
return fromId(in.readVInt());
}
public static Version fromId(int id) {
switch (id) {
2014-01-21 17:07:39 +01:00
case V_2_0_0_ID:
return V_2_0_0;
2014-09-11 22:38:03 +02:00
case V_1_5_0_ID:
return V_1_5_0;
case V_1_4_1_ID:
return V_1_4_1;
2014-07-15 15:39:14 +02:00
case V_1_4_0_ID:
return V_1_4_0;
case V_1_4_0_Beta1_ID:
return V_1_4_0_Beta1;
case V_1_3_6_ID:
return V_1_3_6;
case V_1_3_5_ID:
return V_1_3_5;
case V_1_3_4_ID:
return V_1_3_4;
case V_1_3_3_ID:
return V_1_3_3;
2014-07-28 17:22:18 +02:00
case V_1_3_2_ID:
return V_1_3_2;
case V_1_3_1_ID:
return V_1_3_1;
2014-05-19 20:53:39 +02:00
case V_1_3_0_ID:
return V_1_3_0;
case V_1_2_5_ID:
return V_1_2_5;
case V_1_2_4_ID:
return V_1_2_4;
2014-07-09 15:02:06 +02:00
case V_1_2_3_ID:
return V_1_2_3;
case V_1_2_2_ID:
return V_1_2_2;
2014-06-03 17:25:44 +02:00
case V_1_2_1_ID:
return V_1_2_1;
2014-03-20 18:37:10 +01:00
case V_1_2_0_ID:
return V_1_2_0;
case V_1_1_2_ID:
return V_1_1_2;
2014-03-25 17:42:41 +01:00
case V_1_1_1_ID:
return V_1_1_1;
case V_1_1_0_ID:
return V_1_1_0;
case V_1_0_4_ID:
return V_1_0_4;
2014-03-25 17:42:41 +01:00
case V_1_0_3_ID:
return V_1_0_3;
2014-03-20 18:37:10 +01:00
case V_1_0_2_ID:
return V_1_0_2;
case V_1_0_1_ID:
return V_1_0_1;
2014-01-15 18:21:49 +01:00
case V_1_0_0_ID:
return V_1_0_0;
2014-01-22 11:15:24 +01:00
case V_1_0_0_RC2_ID:
return V_1_0_0_RC2;
2013-12-02 17:10:07 +01:00
case V_1_0_0_RC1_ID:
return V_1_0_0_RC1;
2013-11-06 16:19:50 +01:00
case V_1_0_0_Beta2_ID:
return V_1_0_0_Beta2;
2013-04-29 13:51:09 +02:00
case V_1_0_0_Beta1_ID:
return V_1_0_0_Beta1;
2014-03-25 17:42:41 +01:00
case V_0_90_14_ID:
return V_0_90_14;
2014-03-20 18:37:10 +01:00
case V_0_90_13_ID:
return V_0_90_13;
case V_0_90_12_ID:
return V_0_90_12;
2014-02-03 16:26:44 +01:00
case V_0_90_11_ID:
return V_0_90_11;
2014-01-10 11:39:13 +01:00
case V_0_90_10_ID:
return V_0_90_10;
2013-12-23 11:49:28 +01:00
case V_0_90_9_ID:
return V_0_90_9;
2013-12-18 17:30:28 +01:00
case V_0_90_8_ID:
return V_0_90_8;
case V_0_90_7_ID:
return V_0_90_7;
2013-09-17 15:04:33 +02:00
case V_0_90_6_ID:
return V_0_90_6;
2013-09-16 16:20:33 +02:00
case V_0_90_5_ID:
return V_0_90_5;
2013-08-06 15:28:02 +02:00
case V_0_90_4_ID:
return V_0_90_4;
2013-06-26 09:02:54 +01:00
case V_0_90_3_ID:
return V_0_90_3;
2013-05-30 14:27:33 +02:00
case V_0_90_2_ID:
return V_0_90_2;
2013-04-29 13:51:09 +02:00
case V_0_90_1_ID:
return V_0_90_1;
2013-04-29 13:41:43 +02:00
case V_0_90_0_ID:
return V_0_90_0;
2013-03-20 19:06:30 +01:00
case V_0_90_0_RC2_ID:
return V_0_90_0_RC2;
2013-03-20 19:05:08 +01:00
case V_0_90_0_RC1_ID:
return V_0_90_0_RC1;
2013-02-26 10:32:50 +01:00
case V_0_90_0_Beta1_ID:
return V_0_90_0_Beta1;
2012-10-22 01:51:20 +02:00
2013-03-25 12:33:55 +01:00
case V_0_20_7_ID:
return V_0_20_7;
2013-02-14 14:29:30 +01:00
case V_0_20_6_ID:
return V_0_20_6;
2013-01-29 10:14:25 +01:00
case V_0_20_5_ID:
return V_0_20_5;
2013-01-25 22:02:34 +01:00
case V_0_20_4_ID:
return V_0_20_4;
2012-12-27 14:30:40 -08:00
case V_0_20_3_ID:
return V_0_20_3;
2012-12-08 01:37:21 +01:00
case V_0_20_2_ID:
return V_0_20_2;
case V_0_20_1_ID:
return V_0_20_1;
2012-12-07 23:15:44 +01:00
case V_0_20_0_ID:
return V_0_20_0;
2012-10-22 01:48:09 +02:00
case V_0_20_0_RC1_ID:
return V_0_20_0_RC1;
2011-12-19 11:43:50 +02:00
2012-02-07 15:17:09 +02:00
case V_0_19_0_RC1_ID:
return V_0_19_0_RC1;
case V_0_19_0_RC2_ID:
return V_0_19_0_RC2;
2012-02-09 00:37:12 +02:00
case V_0_19_0_RC3_ID:
return V_0_19_0_RC3;
2012-03-02 11:17:55 +02:00
case V_0_19_0_ID:
return V_0_19_0;
2012-03-02 17:05:41 +02:00
case V_0_19_1_ID:
return V_0_19_1;
2012-03-20 14:06:29 +02:00
case V_0_19_2_ID:
return V_0_19_2;
2012-04-04 20:53:45 +03:00
case V_0_19_3_ID:
return V_0_19_3;
2012-04-30 12:33:24 +03:00
case V_0_19_4_ID:
return V_0_19_4;
2012-05-21 22:08:14 +02:00
case V_0_19_5_ID:
return V_0_19_5;
2012-06-25 15:37:35 +02:00
case V_0_19_6_ID:
return V_0_19_6;
2012-06-25 17:34:31 +02:00
case V_0_19_7_ID:
return V_0_19_7;
2012-06-26 19:59:40 +02:00
case V_0_19_8_ID:
return V_0_19_8;
2012-07-02 22:10:28 +02:00
case V_0_19_9_ID:
return V_0_19_9;
2012-08-23 13:52:57 +02:00
case V_0_19_10_ID:
return V_0_19_10;
2012-10-24 01:41:46 +02:00
case V_0_19_11_ID:
return V_0_19_11;
case V_0_19_12_ID:
return V_0_19_12;
2012-12-04 15:41:38 +01:00
case V_0_19_13_ID:
return V_0_19_13;
2012-03-02 11:23:24 +02:00
case V_0_18_0_ID:
return V_0_18_0;
case V_0_18_1_ID:
return V_0_18_1;
case V_0_18_2_ID:
return V_0_18_2;
case V_0_18_3_ID:
return V_0_18_3;
case V_0_18_4_ID:
return V_0_18_4;
case V_0_18_5_ID:
return V_0_18_5;
case V_0_18_6_ID:
return V_0_18_6;
case V_0_18_7_ID:
return V_0_18_7;
case V_0_18_8_ID:
return V_0_18_8;
2012-03-02 11:23:24 +02:00
default:
return new Version(id, null, Lucene.VERSION);
2010-02-08 15:30:06 +02:00
}
}
2010-02-08 15:30:06 +02:00
/**
* Return the {@link Version} of Elasticsearch that has been used to create an index given its settings.
* @throws ElasticsearchIllegalStateException if the given index settings doesn't contain a value for the key {@value IndexMetaData#SETTING_VERSION_CREATED}
*/
public static Version indexCreated(Settings indexSettings) {
final Version indexVersion = indexSettings.getAsVersion(IndexMetaData.SETTING_VERSION_CREATED, null);
if (indexVersion == null) {
throw new ElasticsearchIllegalStateException("[" + IndexMetaData.SETTING_VERSION_CREATED + "] is not present in the index settings for index with uuid: [" + indexSettings.get(IndexMetaData.SETTING_UUID) + "]");
}
return indexVersion;
}
public static void writeVersion(Version version, StreamOutput out) throws IOException {
out.writeVInt(version.id);
2010-02-08 15:30:06 +02:00
}
/**
* Returns the smallest version between the 2.
*/
public static Version smallest(Version version1, Version version2) {
return version1.id < version2.id ? version1 : version2;
}
/**
* Returns the version given its string representation, current version if the argument is null or empty
*/
public static Version fromString(String version) {
if (!Strings.hasLength(version)) {
return Version.CURRENT;
}
String[] parts = version.split("\\.");
if (parts.length < 3 || parts.length > 4) {
throw new IllegalArgumentException("the version needs to contain major, minor and revision, and optionally the build");
}
try {
//we reverse the version id calculation based on some assumption as we can't reliably reverse the modulo
int major = Integer.parseInt(parts[0]) * 1000000;
int minor = Integer.parseInt(parts[1]) * 10000;
int revision = Integer.parseInt(parts[2]) * 100;
int build = 99;
if (parts.length == 4) {
String buildStr = parts[3];
if (buildStr.startsWith("Beta")) {
build = Integer.parseInt(buildStr.substring(4));
}
if (buildStr.startsWith("RC")) {
build = Integer.parseInt(buildStr.substring(2)) + 50;
}
}
return fromId(major + minor + revision + build);
} catch(NumberFormatException e) {
throw new IllegalArgumentException("unable to parse version " + version, e);
}
}
public final int id;
public final byte major;
public final byte minor;
public final byte revision;
public final byte build;
public final Boolean snapshot;
public final org.apache.lucene.util.Version luceneVersion;
Version(int id, @Nullable Boolean snapshot, org.apache.lucene.util.Version luceneVersion) {
this.id = id;
this.major = (byte) ((id / 1000000) % 100);
this.minor = (byte) ((id / 10000) % 100);
this.revision = (byte) ((id / 100) % 100);
this.build = (byte) (id % 100);
this.snapshot = snapshot;
this.luceneVersion = luceneVersion;
2010-02-08 15:30:06 +02:00
}
public boolean snapshot() {
return snapshot != null && snapshot;
2010-02-08 15:30:06 +02:00
}
public boolean after(Version version) {
return version.id < id;
2010-02-08 15:30:06 +02:00
}
public boolean onOrAfter(Version version) {
return version.id <= id;
}
public boolean before(Version version) {
return version.id > id;
}
public boolean onOrBefore(Version version) {
return version.id >= id;
}
/**
* Returns the minimum compatible version based on the current
* version. Ie a node needs to have at least the return version in order
* to communicate with a node running the current version. The returned version
* is in most of the cases the smallest major version release unless the current version
* is a beta or RC release then the version itself is returned.
*/
public Version minimumCompatibilityVersion() {
return Version.smallest(this, fromId(major * 1000000 + 99));
}
/**
* Just the version number (without -SNAPSHOT if snapshot).
*/
public String number() {
StringBuilder sb = new StringBuilder();
sb.append(major).append('.').append(minor).append('.').append(revision);
if (build < 50) {
sb.append(".Beta").append(build);
} else if (build < 99) {
sb.append(".RC").append(build - 50);
2010-02-08 15:30:06 +02:00
}
return sb.toString();
}
public static void main(String[] args) {
System.out.println("Version: " + Version.CURRENT + ", Build: " + Build.CURRENT.hashShort() + "/" + Build.CURRENT.timestamp() + ", JVM: " + JvmInfo.jvmInfo().version());
}
2011-12-06 02:42:25 +02:00
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(number());
if (snapshot()) {
sb.append("-SNAPSHOT");
}
return sb.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Version version = (Version) o;
if (id != version.id) {
return false;
}
return true;
}
@Override
public int hashCode() {
return id;
}
public static class Module extends AbstractModule {
private final Version version;
public Module(Version version) {
this.version = version;
}
@Override
protected void configure() {
bind(Version.class).toInstance(version);
}
}
2010-02-08 15:30:06 +02:00
}