You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Marcel Reutegger <mr...@adobe.com> on 2012/10/29 10:19:19 UTC

RE: svn commit: r1402036 - in /jackrabbit/oak/trunk: oak-core/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/

Hi,

I don't think below will work as expected. The PropertyIndexHook now
simply returns the 'unmodified' after state. Instead it should return
the state (from the builder) after it did the modifications. Basically what
the code did in the previous version.

Regards
 Marcel

> Modified: jackrabbit/oak/trunk/oak-
> core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/Pro
> pertyIndexHook.java
> URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-
> core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/Pro
> pertyIndexHook.java?rev=1402036&r1=1402035&r2=1402036&view=diff
> ==========================================================
> ====================
> --- jackrabbit/oak/trunk/oak-
> core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/Pro
> pertyIndexHook.java (original)
> +++ jackrabbit/oak/trunk/oak-
> core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/Pro
> pertyIndexHook.java Thu Oct 25 09:13:00 2012
> @@ -22,27 +22,31 @@ import java.util.Map;
>  import javax.annotation.Nonnull;
> 
>  import org.apache.jackrabbit.oak.api.CommitFailedException;
> -import org.apache.jackrabbit.oak.spi.commit.CommitHook;
> +import org.apache.jackrabbit.oak.plugins.index.IndexHook;
>  import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
>  import org.apache.jackrabbit.oak.spi.state.NodeState;
> 
>  import com.google.common.collect.Maps;
> 
>  /**
> - * {@link CommitHook} implementation that is responsible for keeping the
> + * {@link IndexHook} implementation that is responsible for keeping the
>   * {@link PropertyIndex} up to date
>   *
>   * @see PropertyIndex
>   * @see PropertyIndexLookup
>   *
>   */
> -public class PropertyIndexHook implements CommitHook {
> +public class PropertyIndexHook implements IndexHook {
> +
> +    private final NodeBuilder builder;
> +
> +    public PropertyIndexHook(NodeBuilder builder) {
> +        this.builder = builder;
> +    }
> 
>      @Override @Nonnull
>      public NodeState processCommit(NodeState before, NodeState after)
>              throws CommitFailedException {
> -        NodeBuilder builder = after.builder();
> -
>          Map<String, List<PropertyIndexUpdate>> indexes =
> Maps.newHashMap();
>          PropertyIndexDiff diff = new PropertyIndexDiff(builder, indexes);
>          after.compareAgainstBaseState(before, diff);
> @@ -53,7 +57,7 @@ public class PropertyIndexHook implement
>              }
>          }
> 
> -        return builder.getNodeState();
> +        return after;
>      }