You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by to...@apache.org on 2018/10/03 13:39:27 UTC
svn commit: r1842720 - in
/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene:
IndexFormatVersion.java LuceneIndexDefinition.java
Author: tommaso
Date: Wed Oct 3 13:39:26 2018
New Revision: 1842720
URL: http://svn.apache.org/viewvc?rev=1842720&view=rev
Log:
OAK-7803 - bring IFV back to oak-lucene for BC
Added:
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexFormatVersion.java
Modified:
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexDefinition.java
Added: jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexFormatVersion.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexFormatVersion.java?rev=1842720&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexFormatVersion.java (added)
+++ jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexFormatVersion.java Wed Oct 3 13:39:26 2018
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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
+ *
+ * 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.apache.jackrabbit.oak.plugins.index.lucene;
+
+/**
+ * The version of an index (property "compatVersion").
+ *
+ * The default is version 2. Version 1 is supported for backward compatibility.
+ */
+public enum IndexFormatVersion {
+ /**
+ * Index confirming to Oak version upto 1.0.8
+ */
+ V1(1),
+ /**
+ * Index confirming to Oak version upto 1.0.9
+ */
+ V2(2);
+
+ private final int version;
+
+ IndexFormatVersion(int version) {
+ this.version = version;
+ }
+
+ /**
+ * Returns <code>true</code> if this version is at least as high as the
+ * given <code>version</code>.
+ *
+ * @param version the other version to compare.
+ * @return <code>true</code> if this version is at least as high as the
+ * provided; <code>false</code> otherwise.
+ */
+ public boolean isAtLeast(IndexFormatVersion version) {
+ return this.version >= version.getVersion();
+ }
+
+ public int getVersion() {
+ return version;
+ }
+
+ public static IndexFormatVersion getVersion(int version) {
+ switch(version){
+ case 1 : return V1;
+ case 2 : return V2;
+ default : throw new IllegalArgumentException("Unknown version : " + version);
+ }
+ }
+
+ public static IndexFormatVersion getDefault(){
+ return V2;
+ }
+
+ public static IndexFormatVersion max(IndexFormatVersion o1, IndexFormatVersion o2){
+ return o1.version > o2.version ? o1 : o2;
+ }
+
+}
Modified: jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexDefinition.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexDefinition.java?rev=1842720&r1=1842719&r2=1842720&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexDefinition.java (original)
+++ jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexDefinition.java Wed Oct 3 13:39:26 2018
@@ -52,7 +52,7 @@ import static org.apache.jackrabbit.oak.
import static org.apache.jackrabbit.oak.plugins.index.search.util.ConfigUtil.getOptionalValue;
public class LuceneIndexDefinition extends IndexDefinition {
- private static final Logger log = LoggerFactory.getLogger(IndexDefinition.class);
+ private static final Logger log = LoggerFactory.getLogger(LuceneIndexDefinition.class);
private final boolean saveDirListing;