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 th...@apache.org on 2012/07/24 14:10:34 UTC
svn commit: r1364999 - in /jackrabbit/oak/trunk:
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/
oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/
oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/
Author: thomasm
Date: Tue Jul 24 12:10:33 2012
New Revision: 1364999
URL: http://svn.apache.org/viewvc?rev=1364999&view=rev
Log:
OAK-182 Support for "invisible" internal content
Added:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStateUtils.java
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditor.java
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditor.java?rev=1364999&r1=1364998&r2=1364999&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditor.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditor.java Tue Jul 24 12:10:33 2012
@@ -27,6 +27,7 @@ import org.apache.jackrabbit.oak.spi.com
import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
import org.apache.jackrabbit.oak.spi.state.NodeState;
import org.apache.jackrabbit.oak.spi.state.NodeStateDiff;
+import org.apache.jackrabbit.oak.spi.state.NodeStateUtils;
import org.apache.jackrabbit.oak.spi.state.NodeStore;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
@@ -123,6 +124,9 @@ public class LuceneEditor implements Com
@Override
public void childNodeAdded(String name, NodeState after) {
+ if (NodeStateUtils.isHidden(name)) {
+ return;
+ }
if (exception == null) {
try {
addSubtree(path + "/" + name, after);
@@ -135,6 +139,9 @@ public class LuceneEditor implements Com
@Override
public void childNodeChanged(
String name, NodeState before, NodeState after) {
+ if (NodeStateUtils.isHidden(name)) {
+ return;
+ }
if (exception == null) {
try {
LuceneDiff diff = new LuceneDiff(writer, path + "/" + name);
@@ -148,6 +155,9 @@ public class LuceneEditor implements Com
@Override
public void childNodeDeleted(String name, NodeState before) {
+ if (NodeStateUtils.isHidden(name)) {
+ return;
+ }
if (exception == null) {
try {
deleteSubtree(path + "/" + name, before);
Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStateUtils.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStateUtils.java?rev=1364999&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStateUtils.java (added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStateUtils.java Tue Jul 24 12:10:33 2012
@@ -0,0 +1,35 @@
+/*
+ * 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.spi.state;
+
+/**
+ * Utility method for code that deals with node states.
+ */
+public class NodeStateUtils {
+
+ /**
+ * Check whether the node or property with the given name is hidden, that
+ * is, if the node name starts with a ":".
+ *
+ * @param name the node or property name
+ * @return true if the item is hidden
+ */
+ public static boolean isHidden(String name) {
+ return name.startsWith(":");
+ }
+
+}
Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java?rev=1364999&r1=1364998&r2=1364999&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java Tue Jul 24 12:10:33 2012
@@ -33,6 +33,7 @@ import org.apache.jackrabbit.oak.namepat
import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
import org.apache.jackrabbit.oak.spi.state.NodeState;
import org.apache.jackrabbit.oak.spi.state.NodeStateDiff;
+import org.apache.jackrabbit.oak.spi.state.NodeStateUtils;
import com.google.common.base.Function;
import com.google.common.collect.Iterators;
@@ -128,6 +129,9 @@ class ChangeProcessor extends TimerTask
@Override
public void childNodeAdded(String name, NodeState after) {
+ if (NodeStateUtils.isHidden(name)) {
+ return;
+ }
if (!stopped && filterRef.get().includeChildren(jcrPath())) {
Iterator<Event> events = generateNodeEvents(Event.NODE_ADDED, path, name, after);
this.events.add(events);
@@ -139,6 +143,9 @@ class ChangeProcessor extends TimerTask
@Override
public void childNodeDeleted(String name, NodeState before) {
+ if (NodeStateUtils.isHidden(name)) {
+ return;
+ }
if (!stopped && filterRef.get().includeChildren(jcrPath())) {
Iterator<Event> events = generateNodeEvents(Event.NODE_REMOVED, path, name, before);
this.events.add(events);
@@ -147,6 +154,9 @@ class ChangeProcessor extends TimerTask
@Override
public void childNodeChanged(String name, NodeState before, NodeState after) {
+ if (NodeStateUtils.isHidden(name)) {
+ return;
+ }
if (!stopped && filterRef.get().includeChildren(jcrPath())) {
EventGeneratingNodeStateDiff diff = new EventGeneratingNodeStateDiff(
PathUtils.concat(path, name), events, after);