2010-02-08 15:30:06 +02:00
|
|
|
/*
|
2011-12-06 02:42:25 +02:00
|
|
|
* Licensed to ElasticSearch and Shay Banon under one
|
2010-02-08 15:30:06 +02:00
|
|
|
* or more contributor license agreements. See the NOTICE file
|
|
|
|
* distributed with this work for additional information
|
2011-12-06 02:42:25 +02:00
|
|
|
* regarding copyright ownership. ElasticSearch licenses this
|
2010-02-08 15:30:06 +02:00
|
|
|
* 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
|
|
|
|
*
|
|
|
|
* 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;
|
|
|
|
|
2011-10-05 12:42:27 +02:00
|
|
|
import org.elasticsearch.common.Nullable;
|
|
|
|
import org.elasticsearch.common.io.stream.StreamInput;
|
|
|
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
2013-04-29 13:18:51 +02:00
|
|
|
import org.elasticsearch.common.lucene.Lucene;
|
2010-05-06 21:07:24 +03:00
|
|
|
import org.elasticsearch.monitor.jvm.JvmInfo;
|
2010-04-26 11:05:56 +03:00
|
|
|
|
2011-10-05 12:42:27 +02:00
|
|
|
import java.io.IOException;
|
2012-02-01 11:52:57 +02:00
|
|
|
import java.io.Serializable;
|
2010-02-08 15:30:06 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
*/
|
2012-02-01 11:52:57 +02:00
|
|
|
public class Version implements Serializable {
|
2010-02-08 15:30:06 +02:00
|
|
|
|
2011-10-05 12:42:27 +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
|
|
|
|
2011-10-05 12:42:27 +02:00
|
|
|
public static final int V_0_18_0_ID = /*00*/180099;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_18_0 = new Version(V_0_18_0_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2011-10-26 21:04:10 +02:00
|
|
|
public static final int V_0_18_1_ID = /*00*/180199;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_18_1 = new Version(V_0_18_1_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2011-10-27 01:43:08 +02:00
|
|
|
public static final int V_0_18_2_ID = /*00*/180299;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_18_2 = new Version(V_0_18_2_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2011-10-27 20:42:43 +02:00
|
|
|
public static final int V_0_18_3_ID = /*00*/180399;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_18_3 = new Version(V_0_18_3_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2011-11-16 15:23:58 +02:00
|
|
|
public static final int V_0_18_4_ID = /*00*/180499;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_18_4 = new Version(V_0_18_4_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2011-11-16 22:00:13 +02:00
|
|
|
public static final int V_0_18_5_ID = /*00*/180599;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_18_5 = new Version(V_0_18_5_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2011-11-29 13:55:11 +02:00
|
|
|
public static final int V_0_18_6_ID = /*00*/180699;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_18_6 = new Version(V_0_18_6_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2011-12-19 11:43:50 +02:00
|
|
|
public static final int V_0_18_7_ID = /*00*/180799;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_18_7 = new Version(V_0_18_7_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2012-01-10 13:10:53 +02:00
|
|
|
public static final int V_0_18_8_ID = /*00*/180899;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_18_8 = new Version(V_0_18_8_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
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;
|
2013-04-29 13:18:51 +02: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_36);
|
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;
|
2013-04-29 13:18:51 +02: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_36);
|
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;
|
2013-04-29 13:18:51 +02: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_36);
|
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;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_19_0 = new Version(V_0_19_0_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2012-03-02 17:05:41 +02:00
|
|
|
public static final int V_0_19_1_ID = /*00*/190199;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_19_1 = new Version(V_0_19_1_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2012-03-20 14:06:29 +02:00
|
|
|
public static final int V_0_19_2_ID = /*00*/190299;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_19_2 = new Version(V_0_19_2_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2012-04-04 20:53:45 +03:00
|
|
|
public static final int V_0_19_3_ID = /*00*/190399;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_19_3 = new Version(V_0_19_3_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2012-04-30 12:33:24 +03:00
|
|
|
public static final int V_0_19_4_ID = /*00*/190499;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_19_4 = new Version(V_0_19_4_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2012-05-21 22:08:14 +02:00
|
|
|
public static final int V_0_19_5_ID = /*00*/190599;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_19_5 = new Version(V_0_19_5_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2012-06-25 15:37:35 +02:00
|
|
|
public static final int V_0_19_6_ID = /*00*/190699;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_19_6 = new Version(V_0_19_6_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2012-06-25 17:34:31 +02:00
|
|
|
public static final int V_0_19_7_ID = /*00*/190799;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_19_7 = new Version(V_0_19_7_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2012-06-26 19:59:40 +02:00
|
|
|
public static final int V_0_19_8_ID = /*00*/190899;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_19_8 = new Version(V_0_19_8_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2012-07-02 22:10:28 +02:00
|
|
|
public static final int V_0_19_9_ID = /*00*/190999;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_19_9 = new Version(V_0_19_9_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2012-08-23 13:52:57 +02:00
|
|
|
public static final int V_0_19_10_ID = /*00*/191099;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_19_10 = new Version(V_0_19_10_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2012-10-24 01:41:46 +02:00
|
|
|
public static final int V_0_19_11_ID = /*00*/191199;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_19_11 = new Version(V_0_19_11_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2012-10-24 01:41:46 +02:00
|
|
|
public static final int V_0_19_12_ID = /*00*/191299;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_19_12 = new Version(V_0_19_12_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2012-12-04 15:41:38 +01:00
|
|
|
public static final int V_0_19_13_ID = /*00*/191399;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_19_13 = new Version(V_0_19_13_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
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;
|
2013-04-29 13:18:51 +02: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_36);
|
2012-12-07 23:15:44 +01:00
|
|
|
public static final int V_0_20_0_ID = /*00*/200099;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_20_0 = new Version(V_0_20_0_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2012-12-08 01:37:21 +01:00
|
|
|
public static final int V_0_20_1_ID = /*00*/200199;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_20_1 = new Version(V_0_20_1_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2012-12-08 01:37:21 +01:00
|
|
|
public static final int V_0_20_2_ID = /*00*/200299;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_20_2 = new Version(V_0_20_2_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2012-12-27 14:30:40 -08:00
|
|
|
public static final int V_0_20_3_ID = /*00*/200399;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_20_3 = new Version(V_0_20_3_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2013-01-25 22:02:34 +01:00
|
|
|
public static final int V_0_20_4_ID = /*00*/200499;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_20_4 = new Version(V_0_20_4_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2013-01-29 10:14:25 +01:00
|
|
|
public static final int V_0_20_5_ID = /*00*/200599;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_20_5 = new Version(V_0_20_5_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2013-02-14 14:29:30 +01:00
|
|
|
public static final int V_0_20_6_ID = /*00*/200699;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_20_6 = new Version(V_0_20_6_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
2013-03-25 12:33:55 +01:00
|
|
|
public static final int V_0_20_7_ID = /*00*/200799;
|
2013-04-29 13:18:51 +02:00
|
|
|
public static final Version V_0_20_7 = new Version(V_0_20_7_ID, false, org.apache.lucene.util.Version.LUCENE_36);
|
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;
|
2013-04-29 13:18:51 +02: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_41);
|
2013-03-20 19:05:08 +01:00
|
|
|
public static final int V_0_90_0_RC1_ID = /*00*/900051;
|
2013-04-29 13:18:51 +02: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_41);
|
2013-03-20 19:06:30 +01:00
|
|
|
public static final int V_0_90_0_RC2_ID = /*00*/900052;
|
2013-04-29 13:18:51 +02: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_42);
|
2013-04-29 13:41:43 +02:00
|
|
|
public static final int V_0_90_0_ID = /*00*/900099;
|
|
|
|
public static final Version V_0_90_0 = new Version(V_0_90_0_ID, false, org.apache.lucene.util.Version.LUCENE_42);
|
2013-04-29 13:51:09 +02:00
|
|
|
public static final int V_0_90_1_ID = /*00*/900199;
|
2013-04-17 22:12:07 +02:00
|
|
|
public static final Version V_0_90_1 = new Version(V_0_90_1_ID, false, org.apache.lucene.util.Version.LUCENE_43);
|
2013-05-30 14:27:33 +02:00
|
|
|
public static final int V_0_90_2_ID = /*00*/900299;
|
|
|
|
public static final Version V_0_90_2 = new Version(V_0_90_2_ID, false, org.apache.lucene.util.Version.LUCENE_43);
|
2013-06-26 09:02:54 +01:00
|
|
|
public static final int V_0_90_3_ID = /*00*/900399;
|
2013-07-25 18:33:52 +02:00
|
|
|
public static final Version V_0_90_3 = new Version(V_0_90_3_ID, false, org.apache.lucene.util.Version.LUCENE_44);
|
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;
|
2013-07-16 15:41:23 +02:00
|
|
|
public static final Version V_1_0_0_Beta1 = new Version(V_1_0_0_Beta1_ID, true, org.apache.lucene.util.Version.LUCENE_44);
|
2013-04-29 13:51:09 +02:00
|
|
|
|
|
|
|
public static final Version CURRENT = V_1_0_0_Beta1;
|
2013-05-30 14:27:33 +02:00
|
|
|
|
2013-04-30 13:15:29 +02:00
|
|
|
static {
|
2013-05-30 14:27:33 +02:00
|
|
|
assert CURRENT.luceneVersion == Lucene.VERSION : "Version must be upgraded to [" + Lucene.VERSION + "] is still set to [" + CURRENT.luceneVersion + "]";
|
2013-04-30 13:15:29 +02:00
|
|
|
}
|
2011-10-05 12:42:27 +02:00
|
|
|
|
|
|
|
public static Version readVersion(StreamInput in) throws IOException {
|
|
|
|
return fromId(in.readVInt());
|
|
|
|
}
|
|
|
|
|
2011-12-16 18:29:10 +02:00
|
|
|
public static Version fromId(int id) {
|
2011-10-05 12:42:27 +02:00
|
|
|
switch (id) {
|
2013-04-29 13:51:09 +02:00
|
|
|
case V_1_0_0_Beta1_ID:
|
|
|
|
return V_1_0_0_Beta1;
|
|
|
|
|
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
|
|
|
|
2012-09-22 02:35:29 +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
|
|
|
|
2011-10-05 12:42:27 +02:00
|
|
|
default:
|
2013-04-29 13:18:51 +02:00
|
|
|
return new Version(id, null, Lucene.VERSION);
|
2010-02-08 15:30:06 +02:00
|
|
|
}
|
2011-10-05 12:42:27 +02:00
|
|
|
}
|
2010-02-08 15:30:06 +02:00
|
|
|
|
2011-10-05 12:42:27 +02:00
|
|
|
public static void writeVersion(Version version, StreamOutput out) throws IOException {
|
|
|
|
out.writeVInt(version.id);
|
2010-02-08 15:30:06 +02:00
|
|
|
}
|
|
|
|
|
2011-10-05 12:42:27 +02:00
|
|
|
public final int id;
|
|
|
|
public final byte major;
|
|
|
|
public final byte minor;
|
|
|
|
public final byte revision;
|
|
|
|
public final byte build;
|
|
|
|
public final Boolean snapshot;
|
2013-04-29 13:18:51 +02:00
|
|
|
public final org.apache.lucene.util.Version luceneVersion;
|
2011-10-05 12:42:27 +02:00
|
|
|
|
2013-04-29 13:18:51 +02:00
|
|
|
Version(int id, @Nullable Boolean snapshot, org.apache.lucene.util.Version luceneVersion) {
|
2011-10-05 12:42:27 +02:00
|
|
|
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;
|
2013-04-29 13:18:51 +02:00
|
|
|
this.luceneVersion = luceneVersion;
|
2010-02-08 15:30:06 +02:00
|
|
|
}
|
|
|
|
|
2011-10-05 12:42:27 +02:00
|
|
|
public boolean snapshot() {
|
|
|
|
return snapshot != null && snapshot;
|
2010-02-08 15:30:06 +02:00
|
|
|
}
|
|
|
|
|
2011-10-05 12:42:27 +02:00
|
|
|
public boolean after(Version version) {
|
2013-05-31 17:01:21 +02:00
|
|
|
return version.id < id;
|
2010-02-08 15:30:06 +02:00
|
|
|
}
|
|
|
|
|
2011-10-05 12:42:27 +02:00
|
|
|
public boolean onOrAfter(Version version) {
|
2013-05-31 17:01:21 +02:00
|
|
|
return version.id <= id;
|
2011-10-05 12:42:27 +02:00
|
|
|
}
|
|
|
|
|
2012-09-21 23:56:27 +02:00
|
|
|
public boolean before(Version version) {
|
2013-05-31 17:01:21 +02:00
|
|
|
return version.id > id;
|
2012-09-21 23:56:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean onOrBefore(Version version) {
|
2013-05-31 17:01:21 +02:00
|
|
|
return version.id >= id;
|
2012-09-21 23:56:27 +02:00
|
|
|
}
|
|
|
|
|
2011-10-05 12:42:27 +02:00
|
|
|
/**
|
|
|
|
* 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();
|
|
|
|
}
|
2010-04-26 11:05:56 +03:00
|
|
|
|
|
|
|
public static void main(String[] args) {
|
2013-07-24 20:24:23 +02:00
|
|
|
System.out.println("Version: " + Version.CURRENT + ", Build: " + Build.CURRENT.hashShort() + "/" + Build.CURRENT.timestamp() + ", JVM: " + JvmInfo.jvmInfo().version());
|
2011-10-05 12:42:27 +02:00
|
|
|
}
|
|
|
|
|
2011-12-06 02:42:25 +02:00
|
|
|
@Override
|
|
|
|
public String toString() {
|
2011-10-05 12:42:27 +02:00
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
sb.append(number());
|
|
|
|
if (snapshot()) {
|
|
|
|
sb.append("-SNAPSHOT");
|
|
|
|
}
|
|
|
|
return sb.toString();
|
2010-04-26 11:05:56 +03:00
|
|
|
}
|
2012-09-22 02:35:29 +02:00
|
|
|
|
|
|
|
@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;
|
|
|
|
}
|
2010-02-08 15:30:06 +02:00
|
|
|
}
|