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 ch...@apache.org on 2015/01/15 16:16:43 UTC
svn commit: r1652131 - in
/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene:
IndexDefinition.java LuceneIndexEditor.java
Author: chetanm
Date: Thu Jan 15 15:16:42 2015
New Revision: 1652131
URL: http://svn.apache.org/r1652131
Log:
OAK-2402 - oak-lucene fails to start in OSGi
- Replaced usage of ImmutableTree with TreeFactory
- Inlined the constant for ':childOrder' as this done for lower level checks on the NodeState and also to add order to index definition node while transforming the previous index config
Modified:
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java
Modified: jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java?rev=1652131&r1=1652130&r2=1652131&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java (original)
+++ jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java Thu Jan 15 15:16:42 2015
@@ -90,9 +90,14 @@ import static org.apache.jackrabbit.oak.
import static org.apache.jackrabbit.oak.plugins.index.lucene.util.ConfigUtil.getOptionalValue;
import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE;
import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.NODE_TYPES_PATH;
-import static org.apache.jackrabbit.oak.plugins.tree.impl.TreeConstants.OAK_CHILD_ORDER;
class IndexDefinition implements Aggregate.AggregateMapper{
+ /**
+ * Name of the internal property that contains the child order defined in
+ * org.apache.jackrabbit.oak.plugins.tree.impl.TreeConstants
+ */
+ private static final String OAK_CHILD_ORDER = ":childOrder";
+
private static final Logger log = LoggerFactory.getLogger(IndexDefinition.class);
/**
Modified: jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java?rev=1652131&r1=1652130&r2=1652131&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java (original)
+++ jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java Thu Jan 15 15:16:42 2015
@@ -43,13 +43,14 @@ import org.apache.jackrabbit.JcrConstant
import org.apache.jackrabbit.oak.api.Blob;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.commons.PathUtils;
import org.apache.jackrabbit.oak.plugins.index.IndexEditor;
import org.apache.jackrabbit.oak.plugins.index.IndexUpdateCallback;
import org.apache.jackrabbit.oak.plugins.index.lucene.Aggregate.Matcher;
import org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState;
-import org.apache.jackrabbit.oak.plugins.tree.impl.ImmutableTree;
+import org.apache.jackrabbit.oak.plugins.tree.TreeFactory;
import org.apache.jackrabbit.oak.spi.commit.Editor;
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
import org.apache.jackrabbit.oak.spi.state.NodeState;
@@ -101,7 +102,9 @@ public class LuceneIndexEditor implement
*/
private final boolean isDeleted;
- private ImmutableTree current;
+ private Tree afterTree;
+
+ private Tree beforeTree;
private IndexDefinition.IndexingRule indexingRule;
@@ -148,14 +151,16 @@ public class LuceneIndexEditor implement
context.enableReindexMode();
}
- //For traversal in deleted sub tree before state has to be used
- NodeState currentState = after.exists() ? after : before;
if (parent == null){
- current = new ImmutableTree(currentState);
+ afterTree = TreeFactory.createReadOnlyTree(after);
+ beforeTree = TreeFactory.createReadOnlyTree(before);
} else {
- current = new ImmutableTree(parent.current, name, currentState);
+ afterTree = parent.afterTree.getChild(name);
+ beforeTree = parent.beforeTree.getChild(name);
}
+ //For traversal in deleted sub tree before state has to be used
+ Tree current = afterTree.exists() ? afterTree : beforeTree;
indexingRule = getDefinition().getApplicableIndexingRule(current);
if (indexingRule != null) {
Re: svn commit: r1652131 - in /jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene:
IndexDefinition.java LuceneIndexEditor.java
Posted by Davide Giannella <da...@apache.org>.
Hello Chetan,
On 15/01/2015 15:16, chetanm@apache.org wrote:
> class IndexDefinition implements Aggregate.AggregateMapper{
> + /**
> + * Name of the internal property that contains the child order defined in
> + * org.apache.jackrabbit.oak.plugins.tree.impl.TreeConstants
> + */
> + private static final String OAK_CHILD_ORDER = ":childOrder";
> +
>
didn't check the code actually using the constants, but wouldn't it be
possible to work directly with the Tree API if you need it to be
ordered? OAK_CHILD_ORDER is an implementation detail and should not be
used outside of core.
We could either change the Tree API by adding an isOrdered() or add a
utility method in the TreeUtil.
As I don't think we'll ever change the property `:childOrder` it's not
really needed but will clean the code.
WDYT?
Cheers
davide