You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by re...@apache.org on 2015/05/21 14:12:13 UTC

svn commit: r1680841 [3/6] - in /jackrabbit/branches/2.0: jackrabbit-api/src/main/java/org/apache/jackrabbit/api/ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/ jac...

Modified: jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/DeclaringTypePredicate.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/DeclaringTypePredicate.java?rev=1680841&r1=1680840&r2=1680841&view=diff
==============================================================================
--- jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/DeclaringTypePredicate.java (original)
+++ jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/DeclaringTypePredicate.java Thu May 21 12:12:11 2015
@@ -1,75 +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.commons.predicate;
-
-import javax.jcr.Item;
-import javax.jcr.Node;
-import javax.jcr.Property;
-import javax.jcr.RepositoryException;
-
-/**
- * Filter that checks the declared type of an item
- *
- */
-public class DeclaringTypePredicate extends DepthPredicate {
-
-    /**
-     * The nodetype to check
-     */
-    protected final String nodeType;
-
-    /**
-     * indicates if only props should be checked
-     */
-    protected final boolean propsOnly;
-
-    /**
-     * Creates a new filter for the given nodetype and flags.
-     * @param nodeType the nodetype name to check
-     * @param propsOnly if <code>true</code> only properties are checked
-     * @param minDepth the minimal depth
-     * @param maxDepth the maximal depth
-     */
-    public DeclaringTypePredicate(String nodeType, boolean propsOnly,
-                                   int minDepth, int maxDepth) {
-        super(minDepth, maxDepth);
-        this.nodeType = nodeType;
-        this.propsOnly = propsOnly;
-    }
-
-    /**
-     * Creates a new filter for the given nodetype and flags
-     * @param nodeType the nodetype name to check
-     * @param propsOnly if <code>true</code> only properties are checked
-     */
-    public DeclaringTypePredicate(String nodeType, boolean propsOnly) {
-        this(nodeType, propsOnly, 0, Integer.MAX_VALUE);
-    }
-
-    /**
-     * Matches if the declaring nodetype of the item is equal to the one
-     * specified in this filter. If the item is a node and <code>propsOnly</code>
-     * flag is <code>true</code> it returns <code>false</code>.
-     * @see org.apache.jackrabbit.commons.predicate.DepthPredicate#matches(javax.jcr.Item)
-     */
-    protected boolean matches(Item item) throws RepositoryException {
-        if (item.isNode()) {
-            return !propsOnly && ((Node) item).getDefinition().getDeclaringNodeType().getName().equals(nodeType);
-        }
-        return ((Property) item).getDefinition().getDeclaringNodeType().getName().equals(nodeType);
-    }
+/*
+ * 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.commons.predicate;
+
+import javax.jcr.Item;
+import javax.jcr.Node;
+import javax.jcr.Property;
+import javax.jcr.RepositoryException;
+
+/**
+ * Filter that checks the declared type of an item
+ *
+ */
+public class DeclaringTypePredicate extends DepthPredicate {
+
+    /**
+     * The nodetype to check
+     */
+    protected final String nodeType;
+
+    /**
+     * indicates if only props should be checked
+     */
+    protected final boolean propsOnly;
+
+    /**
+     * Creates a new filter for the given nodetype and flags.
+     * @param nodeType the nodetype name to check
+     * @param propsOnly if <code>true</code> only properties are checked
+     * @param minDepth the minimal depth
+     * @param maxDepth the maximal depth
+     */
+    public DeclaringTypePredicate(String nodeType, boolean propsOnly,
+                                   int minDepth, int maxDepth) {
+        super(minDepth, maxDepth);
+        this.nodeType = nodeType;
+        this.propsOnly = propsOnly;
+    }
+
+    /**
+     * Creates a new filter for the given nodetype and flags
+     * @param nodeType the nodetype name to check
+     * @param propsOnly if <code>true</code> only properties are checked
+     */
+    public DeclaringTypePredicate(String nodeType, boolean propsOnly) {
+        this(nodeType, propsOnly, 0, Integer.MAX_VALUE);
+    }
+
+    /**
+     * Matches if the declaring nodetype of the item is equal to the one
+     * specified in this filter. If the item is a node and <code>propsOnly</code>
+     * flag is <code>true</code> it returns <code>false</code>.
+     * @see org.apache.jackrabbit.commons.predicate.DepthPredicate#matches(javax.jcr.Item)
+     */
+    protected boolean matches(Item item) throws RepositoryException {
+        if (item.isNode()) {
+            return !propsOnly && ((Node) item).getDefinition().getDeclaringNodeType().getName().equals(nodeType);
+        }
+        return ((Property) item).getDefinition().getDeclaringNodeType().getName().equals(nodeType);
+    }
 }
\ No newline at end of file

Propchange: jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/DeclaringTypePredicate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/DepthPredicate.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/DepthPredicate.java?rev=1680841&r1=1680840&r2=1680841&view=diff
==============================================================================
--- jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/DepthPredicate.java (original)
+++ jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/DepthPredicate.java Thu May 21 12:12:11 2015
@@ -1,77 +1,77 @@
-/*
- * 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.commons.predicate;
-
-import javax.jcr.Item;
-import javax.jcr.RepositoryException;
-
-/**
- * Implements a filter that filters item according to their (passed) depth.
- *
- */
-public class DepthPredicate implements Predicate {
-
-    /**
-     * The minimal depth
-     */
-    protected final int minDepth;
-
-    /**
-     * The maximal depth
-     */
-    protected final int maxDepth;
-
-    /**
-     * Creates a new depth filter for the given depths.
-     * @param minDepth the minimal depth
-     * @param maxDepth the maximal depth
-     */
-    public DepthPredicate(int minDepth, int maxDepth) {
-        this.minDepth = minDepth;
-        this.maxDepth = maxDepth;
-    }
-
-    /**
-     * Matches if the given depth is greater or equal the minimum depth and
-     * less or equal the maximum depth and if the call to {@link #matches(Item)}
-     * returns <code>true</code>.
-     * @see org.apache.commons.collections.Predicate#evaluate(java.lang.Object)
-     */
-    public boolean evaluate(Object item) {
-        if ( item instanceof Item ) {
-            try {
-                final int depth = ((Item)item).getDepth();
-                return depth >= minDepth && depth <= maxDepth && matches((Item)item);
-            } catch (RepositoryException re) {
-                return false;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Returns <code>true</code>. Subclasses can override to implement something
-     * useful that is dependant of the depth.
-     *
-     * @param item the item to match
-     * @return <code>true</code> if the item matches; <code>false</code> otherwise.
-     * @throws RepositoryException if an error occurs.
-     */
-    protected boolean matches(Item item) throws RepositoryException {
-        return true;
-    }
+/*
+ * 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.commons.predicate;
+
+import javax.jcr.Item;
+import javax.jcr.RepositoryException;
+
+/**
+ * Implements a filter that filters item according to their (passed) depth.
+ *
+ */
+public class DepthPredicate implements Predicate {
+
+    /**
+     * The minimal depth
+     */
+    protected final int minDepth;
+
+    /**
+     * The maximal depth
+     */
+    protected final int maxDepth;
+
+    /**
+     * Creates a new depth filter for the given depths.
+     * @param minDepth the minimal depth
+     * @param maxDepth the maximal depth
+     */
+    public DepthPredicate(int minDepth, int maxDepth) {
+        this.minDepth = minDepth;
+        this.maxDepth = maxDepth;
+    }
+
+    /**
+     * Matches if the given depth is greater or equal the minimum depth and
+     * less or equal the maximum depth and if the call to {@link #matches(Item)}
+     * returns <code>true</code>.
+     * @see org.apache.commons.collections.Predicate#evaluate(java.lang.Object)
+     */
+    public boolean evaluate(Object item) {
+        if ( item instanceof Item ) {
+            try {
+                final int depth = ((Item)item).getDepth();
+                return depth >= minDepth && depth <= maxDepth && matches((Item)item);
+            } catch (RepositoryException re) {
+                return false;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Returns <code>true</code>. Subclasses can override to implement something
+     * useful that is dependant of the depth.
+     *
+     * @param item the item to match
+     * @return <code>true</code> if the item matches; <code>false</code> otherwise.
+     * @throws RepositoryException if an error occurs.
+     */
+    protected boolean matches(Item item) throws RepositoryException {
+        return true;
+    }
 }
\ No newline at end of file

Propchange: jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/DepthPredicate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/IsMandatoryPredicate.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/IsMandatoryPredicate.java?rev=1680841&r1=1680840&r2=1680841&view=diff
==============================================================================
--- jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/IsMandatoryPredicate.java (original)
+++ jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/IsMandatoryPredicate.java Thu May 21 12:12:11 2015
@@ -1,54 +1,54 @@
-/*
- * 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.commons.predicate;
-
-import javax.jcr.Item;
-import javax.jcr.Node;
-import javax.jcr.Property;
-import javax.jcr.RepositoryException;
-
-/**
- * <code>IsMandatoryFilter</code>...
- *
- */
-public class IsMandatoryPredicate extends DepthPredicate {
-
-    protected final boolean isMandatory;
-
-    public IsMandatoryPredicate() {
-        this(true);
-    }
-
-    public IsMandatoryPredicate(boolean isMandatory, int minDepth, int maxDepth) {
-        super(minDepth, maxDepth);
-        this.isMandatory = isMandatory;
-    }
-
-    public IsMandatoryPredicate(boolean isMandatory) {
-        this(isMandatory, 0, Integer.MAX_VALUE);
-    }
-
-    /**
-     * @see org.apache.jackrabbit.commons.predicate.DepthPredicate#matches(javax.jcr.Item)
-     */
-    protected boolean matches(Item item) throws RepositoryException {
-        if (item.isNode()) {
-            return ((Node) item).getDefinition().isMandatory() == isMandatory;
-        }
-        return ((Property) item).getDefinition().isMandatory() == isMandatory;
-    }
+/*
+ * 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.commons.predicate;
+
+import javax.jcr.Item;
+import javax.jcr.Node;
+import javax.jcr.Property;
+import javax.jcr.RepositoryException;
+
+/**
+ * <code>IsMandatoryFilter</code>...
+ *
+ */
+public class IsMandatoryPredicate extends DepthPredicate {
+
+    protected final boolean isMandatory;
+
+    public IsMandatoryPredicate() {
+        this(true);
+    }
+
+    public IsMandatoryPredicate(boolean isMandatory, int minDepth, int maxDepth) {
+        super(minDepth, maxDepth);
+        this.isMandatory = isMandatory;
+    }
+
+    public IsMandatoryPredicate(boolean isMandatory) {
+        this(isMandatory, 0, Integer.MAX_VALUE);
+    }
+
+    /**
+     * @see org.apache.jackrabbit.commons.predicate.DepthPredicate#matches(javax.jcr.Item)
+     */
+    protected boolean matches(Item item) throws RepositoryException {
+        if (item.isNode()) {
+            return ((Node) item).getDefinition().isMandatory() == isMandatory;
+        }
+        return ((Property) item).getDefinition().isMandatory() == isMandatory;
+    }
 }
\ No newline at end of file

Propchange: jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/IsMandatoryPredicate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/IsNodePredicate.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/IsNodePredicate.java?rev=1680841&r1=1680840&r2=1680841&view=diff
==============================================================================
--- jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/IsNodePredicate.java (original)
+++ jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/IsNodePredicate.java Thu May 21 12:12:11 2015
@@ -1,72 +1,72 @@
-/*
- * 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.commons.predicate;
-
-import javax.jcr.Item;
-import javax.jcr.RepositoryException;
-
-/**
- * Item filter that checks if an item is a node.
- *
- */
-public class IsNodePredicate extends DepthPredicate {
-
-    /**
-     * Polarity of this filter
-     */
-    protected final boolean isNode;
-
-    /**
-     * Default constructor.
-     */
-    public IsNodePredicate() {
-        this(true);
-    }
-
-    /**
-     * Creates a new node item filter.
-     *
-     * @param polarity the polarity of this filter. if <code>true</code> it matches
-     * nodes, if <code>false</code> it matches properties.
-     * @param minDepth the minimum depth
-     * @param maxDepth the maximum depth
-     *
-     * @see DepthPredicate
-     */
-    public IsNodePredicate(boolean polarity, int minDepth, int maxDepth) {
-        super(minDepth, maxDepth);
-        isNode = polarity;
-    }
-
-    /**
-     * Creates a new node item filter
-     * @param polarity the polarity of this filter. if <code>true</code> it matches
-     * nodes, if <code>false</code> it matches properties.
-     */
-    public IsNodePredicate(boolean polarity) {
-        this(polarity, 0, Integer.MAX_VALUE);
-    }
-
-    /**
-     * Returns <code>true</code> if the item is a node and the polarity is
-     * positive (true).
-     * @see org.apache.jackrabbit.commons.predicate.DepthPredicate#matches(javax.jcr.Item)
-     */
-    protected boolean matches(Item item) throws RepositoryException {
-        return item.isNode() == isNode;
-    }
+/*
+ * 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.commons.predicate;
+
+import javax.jcr.Item;
+import javax.jcr.RepositoryException;
+
+/**
+ * Item filter that checks if an item is a node.
+ *
+ */
+public class IsNodePredicate extends DepthPredicate {
+
+    /**
+     * Polarity of this filter
+     */
+    protected final boolean isNode;
+
+    /**
+     * Default constructor.
+     */
+    public IsNodePredicate() {
+        this(true);
+    }
+
+    /**
+     * Creates a new node item filter.
+     *
+     * @param polarity the polarity of this filter. if <code>true</code> it matches
+     * nodes, if <code>false</code> it matches properties.
+     * @param minDepth the minimum depth
+     * @param maxDepth the maximum depth
+     *
+     * @see DepthPredicate
+     */
+    public IsNodePredicate(boolean polarity, int minDepth, int maxDepth) {
+        super(minDepth, maxDepth);
+        isNode = polarity;
+    }
+
+    /**
+     * Creates a new node item filter
+     * @param polarity the polarity of this filter. if <code>true</code> it matches
+     * nodes, if <code>false</code> it matches properties.
+     */
+    public IsNodePredicate(boolean polarity) {
+        this(polarity, 0, Integer.MAX_VALUE);
+    }
+
+    /**
+     * Returns <code>true</code> if the item is a node and the polarity is
+     * positive (true).
+     * @see org.apache.jackrabbit.commons.predicate.DepthPredicate#matches(javax.jcr.Item)
+     */
+    protected boolean matches(Item item) throws RepositoryException {
+        return item.isNode() == isNode;
+    }
 }
\ No newline at end of file

Propchange: jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/IsNodePredicate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/NamePredicate.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/NamePredicate.java?rev=1680841&r1=1680840&r2=1680841&view=diff
==============================================================================
--- jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/NamePredicate.java (original)
+++ jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/NamePredicate.java Thu May 21 12:12:11 2015
@@ -1,60 +1,60 @@
-/*
- * 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.commons.predicate;
-
-import javax.jcr.Item;
-import javax.jcr.RepositoryException;
-
-/**
- * Filters items according to their names.
- *
- */
-public class NamePredicate extends DepthPredicate {
-
-    /**
-     * The name to filter on
-     */
-    protected final String name;
-
-    /**
-     * Creates a new name filter with the given name and depths
-     * @param name the name to filter on
-     * @param minDepth the minimal depth
-     * @param maxDepth the maximal depth
-     */
-    public NamePredicate(String name, int minDepth, int maxDepth) {
-        super(minDepth, maxDepth);
-        this.name = name;
-    }
-
-    /**
-     * Creates a new name filter with the given name.
-     * @param name the name to filter on
-     */
-    public NamePredicate(String name) {
-        this(name, 0, Integer.MAX_VALUE);
-    }
-
-    /**
-     * Returns <code>true</code> if the name of the given item is equal to
-     * the configured name.
-     * @see org.apache.jackrabbit.commons.predicate.DepthPredicate#matches(javax.jcr.Item)
-     */
-    protected boolean matches(Item item) throws RepositoryException {
-        return item.getName().equals(name);
-    }
+/*
+ * 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.commons.predicate;
+
+import javax.jcr.Item;
+import javax.jcr.RepositoryException;
+
+/**
+ * Filters items according to their names.
+ *
+ */
+public class NamePredicate extends DepthPredicate {
+
+    /**
+     * The name to filter on
+     */
+    protected final String name;
+
+    /**
+     * Creates a new name filter with the given name and depths
+     * @param name the name to filter on
+     * @param minDepth the minimal depth
+     * @param maxDepth the maximal depth
+     */
+    public NamePredicate(String name, int minDepth, int maxDepth) {
+        super(minDepth, maxDepth);
+        this.name = name;
+    }
+
+    /**
+     * Creates a new name filter with the given name.
+     * @param name the name to filter on
+     */
+    public NamePredicate(String name) {
+        this(name, 0, Integer.MAX_VALUE);
+    }
+
+    /**
+     * Returns <code>true</code> if the name of the given item is equal to
+     * the configured name.
+     * @see org.apache.jackrabbit.commons.predicate.DepthPredicate#matches(javax.jcr.Item)
+     */
+    protected boolean matches(Item item) throws RepositoryException {
+        return item.getName().equals(name);
+    }
 }
\ No newline at end of file

Propchange: jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/NamePredicate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/NodeTypePredicate.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/NodeTypePredicate.java?rev=1680841&r1=1680840&r2=1680841&view=diff
==============================================================================
--- jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/NodeTypePredicate.java (original)
+++ jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/NodeTypePredicate.java Thu May 21 12:12:11 2015
@@ -1,84 +1,84 @@
-/*
- * 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.commons.predicate;
-
-import javax.jcr.Item;
-import javax.jcr.Node;
-import javax.jcr.RepositoryException;
-
-/**
- * Filters on the node type of a node.
- *
- */
-public class NodeTypePredicate extends DepthPredicate {
-
-    /**
-     * the nodetype to filter on
-     */
-    protected final String nodeType;
-
-    /**
-     * indicates if supertypes should be respected
-     */
-    protected final boolean respectSupertype;
-
-    /**
-     * Creates a new node type filter.
-     * @param nodeType the node type to filter on
-     * @param respectSupertype indicates if supertype should be respected
-     * @param minDepth the minimal depth
-     * @param maxDepth the maximal depth
-     */
-    public NodeTypePredicate(String nodeType, boolean respectSupertype,
-                              int minDepth, int maxDepth) {
-        super(minDepth, maxDepth);
-        this.nodeType = nodeType;
-        this.respectSupertype = respectSupertype;
-    }
-
-    /**
-     * Creates a new node type filter.
-     * @param nodeType the node type to filter on
-     * @param respectSupertype indicates if supertype should be respected
-     */
-    public NodeTypePredicate(String nodeType, boolean respectSupertype) {
-        this(nodeType, respectSupertype, 0, Integer.MAX_VALUE);
-    }
-
-    /**
-     * Returns <code>true</code> if the item is a node and if the configured
-     * nodetype is equal to the primary type of the node. if supertypes are
-     * respected it also returns <code>true</code> if the items nodetype
-     * extends from the configured node type (Node.isNodeType() check).
-     * @see org.apache.jackrabbit.commons.predicate.DepthPredicate#matches(javax.jcr.Item)
-     */
-    protected boolean matches(Item item) throws RepositoryException {
-        if (item.isNode()) {
-            if (respectSupertype) {
-                try {
-                    return ((Node) item).isNodeType(nodeType);
-                } catch (RepositoryException e) {
-                    // ignore
-                    return false;
-                }
-            }
-            return ((Node) item).getPrimaryNodeType().getName().equals(nodeType);
-        }
-        return false;
-
-    }
+/*
+ * 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.commons.predicate;
+
+import javax.jcr.Item;
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+
+/**
+ * Filters on the node type of a node.
+ *
+ */
+public class NodeTypePredicate extends DepthPredicate {
+
+    /**
+     * the nodetype to filter on
+     */
+    protected final String nodeType;
+
+    /**
+     * indicates if supertypes should be respected
+     */
+    protected final boolean respectSupertype;
+
+    /**
+     * Creates a new node type filter.
+     * @param nodeType the node type to filter on
+     * @param respectSupertype indicates if supertype should be respected
+     * @param minDepth the minimal depth
+     * @param maxDepth the maximal depth
+     */
+    public NodeTypePredicate(String nodeType, boolean respectSupertype,
+                              int minDepth, int maxDepth) {
+        super(minDepth, maxDepth);
+        this.nodeType = nodeType;
+        this.respectSupertype = respectSupertype;
+    }
+
+    /**
+     * Creates a new node type filter.
+     * @param nodeType the node type to filter on
+     * @param respectSupertype indicates if supertype should be respected
+     */
+    public NodeTypePredicate(String nodeType, boolean respectSupertype) {
+        this(nodeType, respectSupertype, 0, Integer.MAX_VALUE);
+    }
+
+    /**
+     * Returns <code>true</code> if the item is a node and if the configured
+     * nodetype is equal to the primary type of the node. if supertypes are
+     * respected it also returns <code>true</code> if the items nodetype
+     * extends from the configured node type (Node.isNodeType() check).
+     * @see org.apache.jackrabbit.commons.predicate.DepthPredicate#matches(javax.jcr.Item)
+     */
+    protected boolean matches(Item item) throws RepositoryException {
+        if (item.isNode()) {
+            if (respectSupertype) {
+                try {
+                    return ((Node) item).isNodeType(nodeType);
+                } catch (RepositoryException e) {
+                    // ignore
+                    return false;
+                }
+            }
+            return ((Node) item).getPrimaryNodeType().getName().equals(nodeType);
+        }
+        return false;
+
+    }
 }
\ No newline at end of file

Propchange: jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/NodeTypePredicate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/NtFilePredicate.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/NtFilePredicate.java?rev=1680841&r1=1680840&r2=1680841&view=diff
==============================================================================
--- jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/NtFilePredicate.java (original)
+++ jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/NtFilePredicate.java Thu May 21 12:12:11 2015
@@ -1,116 +1,116 @@
-/*
- * 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.commons.predicate;
-
-import javax.jcr.Item;
-import javax.jcr.Property;
-import javax.jcr.RepositoryException;
-
-/**
- * The nt file item filter matches all properties that are defined my the
- * nt:file or nt:resource nodetype. the later only, if the respective nodes
- * name is 'jcr:content'.
- *
- * Additionally the properties 'jcr:encoding' can be configured to be excluded.
- *
- */
-public class NtFilePredicate implements Predicate {
-
-    public static final String NT_FILE = "nt:file";
-    public static final String NT_HIERARCHYNODE = "nt:hierarchyNode";
-    public static final String NT_RESOURCE = "nt:resource";
-    public static final String JCR_CONTENT = "jcr:content";
-    public static final String JCR_ENCODING = "jcr:encoding";
-    public static final String JCR_MIMETYPE = "jcr:mimeType";
-    public static final String JCR_PRIMARY_TYPE = "jcr:primaryType";
-
-    /**
-     * indicates if the jcr:encoding property is to be excluded from this filter.
-     */
-    protected final boolean ignoreEncoding;
-
-    /**
-     * indicates if the jcr:mimeType property is to be excluded from this filter.
-     */
-    protected final boolean ignoreMimeType;
-
-    public NtFilePredicate() {
-        this(false, false);
-    }
-
-    public NtFilePredicate(boolean ignoreEncoding, boolean ignoreMimeType) {
-        this.ignoreEncoding = ignoreEncoding;
-        this.ignoreMimeType = ignoreMimeType;
-    }
-
-    /**
-     * Returns the <code>ignore encoding</code> flag.
-     * @return the <code>ignore encoding</code> flag.
-     */
-    public boolean isIgnoreEncoding() {
-        return ignoreEncoding;
-    }
-
-    /**
-     * Returns the <code>ignore mime type</code> flag.
-     * @return the <code>ignore mime type</code> flag.
-     */
-    public boolean isIgnoreMimeType() {
-        return ignoreMimeType;
-    }
-
-    /**
-     * @return <code>true</code> if the item is a nt:file or nt:resource property
-     * @see org.apache.jackrabbit.commons.predicate.Predicate#evaluate(java.lang.Object)
-     */
-    public boolean evaluate(Object item) {
-        if ( item instanceof Item ) {
-            if (!((Item)item).isNode()) {
-                try {
-                    Property prop = (Property) item;
-                    String dnt = prop.getDefinition().getDeclaringNodeType().getName();
-                    // exclude all nt:file props
-                    if (dnt.equals(NT_FILE) || dnt.equals(NT_HIERARCHYNODE)) {
-                        return true;
-                    }
-                    if (ignoreEncoding && prop.getName().equals(JCR_ENCODING)) {
-                        return false;
-                    }
-                    if (ignoreMimeType && prop.getName().equals(JCR_MIMETYPE)) {
-                        return false;
-                    }
-                    // exclude nt:resource props, if parent is 'jcr:content'
-                    if (prop.getParent().getName().equals(JCR_CONTENT)) {
-                        if (dnt.equals(NT_RESOURCE)) {
-                            return true;
-                        }
-                        // exclude primary type if nt:resource
-                        /*
-                        if (prop.getName().equals(JCR_PRIMARY_TYPE)
-                                && prop.getValue().getString().equals(NT_RESOURCE)) {
-                            return true;
-                        }
-                        */
-                    }
-                } catch (RepositoryException re) {
-                    return false;
-                }
-            }
-        }
-        return false;
-    }
+/*
+ * 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.commons.predicate;
+
+import javax.jcr.Item;
+import javax.jcr.Property;
+import javax.jcr.RepositoryException;
+
+/**
+ * The nt file item filter matches all properties that are defined my the
+ * nt:file or nt:resource nodetype. the later only, if the respective nodes
+ * name is 'jcr:content'.
+ *
+ * Additionally the properties 'jcr:encoding' can be configured to be excluded.
+ *
+ */
+public class NtFilePredicate implements Predicate {
+
+    public static final String NT_FILE = "nt:file";
+    public static final String NT_HIERARCHYNODE = "nt:hierarchyNode";
+    public static final String NT_RESOURCE = "nt:resource";
+    public static final String JCR_CONTENT = "jcr:content";
+    public static final String JCR_ENCODING = "jcr:encoding";
+    public static final String JCR_MIMETYPE = "jcr:mimeType";
+    public static final String JCR_PRIMARY_TYPE = "jcr:primaryType";
+
+    /**
+     * indicates if the jcr:encoding property is to be excluded from this filter.
+     */
+    protected final boolean ignoreEncoding;
+
+    /**
+     * indicates if the jcr:mimeType property is to be excluded from this filter.
+     */
+    protected final boolean ignoreMimeType;
+
+    public NtFilePredicate() {
+        this(false, false);
+    }
+
+    public NtFilePredicate(boolean ignoreEncoding, boolean ignoreMimeType) {
+        this.ignoreEncoding = ignoreEncoding;
+        this.ignoreMimeType = ignoreMimeType;
+    }
+
+    /**
+     * Returns the <code>ignore encoding</code> flag.
+     * @return the <code>ignore encoding</code> flag.
+     */
+    public boolean isIgnoreEncoding() {
+        return ignoreEncoding;
+    }
+
+    /**
+     * Returns the <code>ignore mime type</code> flag.
+     * @return the <code>ignore mime type</code> flag.
+     */
+    public boolean isIgnoreMimeType() {
+        return ignoreMimeType;
+    }
+
+    /**
+     * @return <code>true</code> if the item is a nt:file or nt:resource property
+     * @see org.apache.jackrabbit.commons.predicate.Predicate#evaluate(java.lang.Object)
+     */
+    public boolean evaluate(Object item) {
+        if ( item instanceof Item ) {
+            if (!((Item)item).isNode()) {
+                try {
+                    Property prop = (Property) item;
+                    String dnt = prop.getDefinition().getDeclaringNodeType().getName();
+                    // exclude all nt:file props
+                    if (dnt.equals(NT_FILE) || dnt.equals(NT_HIERARCHYNODE)) {
+                        return true;
+                    }
+                    if (ignoreEncoding && prop.getName().equals(JCR_ENCODING)) {
+                        return false;
+                    }
+                    if (ignoreMimeType && prop.getName().equals(JCR_MIMETYPE)) {
+                        return false;
+                    }
+                    // exclude nt:resource props, if parent is 'jcr:content'
+                    if (prop.getParent().getName().equals(JCR_CONTENT)) {
+                        if (dnt.equals(NT_RESOURCE)) {
+                            return true;
+                        }
+                        // exclude primary type if nt:resource
+                        /*
+                        if (prop.getName().equals(JCR_PRIMARY_TYPE)
+                                && prop.getValue().getString().equals(NT_RESOURCE)) {
+                            return true;
+                        }
+                        */
+                    }
+                } catch (RepositoryException re) {
+                    return false;
+                }
+            }
+        }
+        return false;
+    }
 }
\ No newline at end of file

Propchange: jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/NtFilePredicate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/PathPredicate.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/PathPredicate.java?rev=1680841&r1=1680840&r2=1680841&view=diff
==============================================================================
--- jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/PathPredicate.java (original)
+++ jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/PathPredicate.java Thu May 21 12:12:11 2015
@@ -1,77 +1,77 @@
-/*
- * 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.commons.predicate;
-
-import java.util.regex.Pattern;
-
-import javax.jcr.Item;
-import javax.jcr.RepositoryException;
-
-/**
- * The path filter provides hierarchical filtering.
- *
- */
-public class PathPredicate implements Predicate {
-
-    /**
-     * the internal regex pattern
-     */
-    protected final Pattern regex;
-
-    /**
-     * Creates a new default path filter
-     * <xmp>
-     * | Pattern | Matches
-     * | /foo    | exactly "/foo"
-     * | /foo.*  | all paths starting with "foo."
-     * | foo.*   | all files starting with "foo."
-     * | /foo/*  | all direct children of /foo
-     * | /foo/** | all children of /foo
-     * </xmp>
-     * @param pattern the pattern
-     */
-    public PathPredicate(String pattern) {
-        String suffix = "";
-        String prefix = "";
-        if (pattern.endsWith("/**")) {
-            suffix = "/.*";
-            pattern = pattern.substring(0, pattern.length() - 3);
-        } else if (pattern.endsWith("*")) {
-            suffix = "[^/]*$";
-            pattern = pattern.substring(0, pattern.length() - 1);
-        }
-        if (pattern.charAt(0) != '/') {
-            prefix = "^.*/";
-        }
-        pattern = prefix + pattern.replaceAll("\\.", "\\\\.") + suffix;
-        regex = Pattern.compile(pattern);
-    }
-
-    /**
-     * @see org.apache.commons.collections.Predicate#evaluate(java.lang.Object)
-     */
-    public boolean evaluate(Object item) {
-        if ( item instanceof Item ) {
-            try {
-                return regex.matcher(((Item)item).getPath()).matches();
-            } catch (RepositoryException re) {
-                return false;
-            }
-        }
-        return false;
-    }
+/*
+ * 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.commons.predicate;
+
+import java.util.regex.Pattern;
+
+import javax.jcr.Item;
+import javax.jcr.RepositoryException;
+
+/**
+ * The path filter provides hierarchical filtering.
+ *
+ */
+public class PathPredicate implements Predicate {
+
+    /**
+     * the internal regex pattern
+     */
+    protected final Pattern regex;
+
+    /**
+     * Creates a new default path filter
+     * <xmp>
+     * | Pattern | Matches
+     * | /foo    | exactly "/foo"
+     * | /foo.*  | all paths starting with "foo."
+     * | foo.*   | all files starting with "foo."
+     * | /foo/*  | all direct children of /foo
+     * | /foo/** | all children of /foo
+     * </xmp>
+     * @param pattern the pattern
+     */
+    public PathPredicate(String pattern) {
+        String suffix = "";
+        String prefix = "";
+        if (pattern.endsWith("/**")) {
+            suffix = "/.*";
+            pattern = pattern.substring(0, pattern.length() - 3);
+        } else if (pattern.endsWith("*")) {
+            suffix = "[^/]*$";
+            pattern = pattern.substring(0, pattern.length() - 1);
+        }
+        if (pattern.charAt(0) != '/') {
+            prefix = "^.*/";
+        }
+        pattern = prefix + pattern.replaceAll("\\.", "\\\\.") + suffix;
+        regex = Pattern.compile(pattern);
+    }
+
+    /**
+     * @see org.apache.commons.collections.Predicate#evaluate(java.lang.Object)
+     */
+    public boolean evaluate(Object item) {
+        if ( item instanceof Item ) {
+            try {
+                return regex.matcher(((Item)item).getPath()).matches();
+            } catch (RepositoryException re) {
+                return false;
+            }
+        }
+        return false;
+    }
 }
\ No newline at end of file

Propchange: jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/PathPredicate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/Predicate.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/Predicate.java?rev=1680841&r1=1680840&r2=1680841&view=diff
==============================================================================
--- jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/Predicate.java (original)
+++ jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/Predicate.java Thu May 21 12:12:11 2015
@@ -1,42 +1,42 @@
-/*
- * 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.commons.predicate;
-
-/**
- * Interface for object predicates, i.e. functions that evalute a given
- * object to a boolean value.
- */
-public interface Predicate {
-
-    /**
-     * Evaluates the predicate for the given object.
-     *
-     * @param object some object
-     * @return predicate result
-     */
-    boolean evaluate(Object object);
-
-    /**
-     * Constant predicate that returns <code>true</code> for all objects.
-     */
-    static final Predicate TRUE = new Predicate() {
-        public boolean evaluate(Object object) {
-            return true;
-        }
-    };
-
-}
+/*
+ * 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.commons.predicate;
+
+/**
+ * Interface for object predicates, i.e. functions that evalute a given
+ * object to a boolean value.
+ */
+public interface Predicate {
+
+    /**
+     * Evaluates the predicate for the given object.
+     *
+     * @param object some object
+     * @return predicate result
+     */
+    boolean evaluate(Object object);
+
+    /**
+     * Constant predicate that returns <code>true</code> for all objects.
+     */
+    static final Predicate TRUE = new Predicate() {
+        public boolean evaluate(Object object) {
+            return true;
+        }
+    };
+
+}

Propchange: jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/predicate/Predicate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/query/qom/JoinType.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/query/qom/JoinType.java?rev=1680841&r1=1680840&r2=1680841&view=diff
==============================================================================
--- jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/query/qom/JoinType.java (original)
+++ jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/query/qom/JoinType.java Thu May 21 12:12:11 2015
@@ -1,92 +1,92 @@
-/*
- * 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.commons.query.qom;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.query.qom.Join;
-import javax.jcr.query.qom.JoinCondition;
-import javax.jcr.query.qom.QueryObjectModelConstants;
-import javax.jcr.query.qom.QueryObjectModelFactory;
-import javax.jcr.query.qom.Source;
-
-/**
- * Enumeration of the JCR 2.0 join types.
- *
- * @since Apache Jackrabbit 2.0
- */
-public enum JoinType {
-
-    INNER(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER),
-
-    LEFT(QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER),
-
-    RIGHT(QueryObjectModelConstants.JCR_JOIN_TYPE_RIGHT_OUTER);
-
-    /**
-     * JCR name of this join type.
-     */
-    private final String name;
-
-    private JoinType(String name) {
-        this.name = name;
-    }
-
-    /**
-     * Returns the join of the given sources.
-     *
-     * @param factory factory for creating the join
-     * @param left left join source
-     * @param right right join source
-     * @param condition join condition
-     * @return join
-     * @throws RepositoryException if the join can not be created
-     */
-    public Join join(
-            QueryObjectModelFactory factory,
-            Source left, Source right, JoinCondition condition)
-            throws RepositoryException {
-        return factory.join(left, right, name, condition);
-    }
-
-    /**
-     * Returns the JCR 2.0 name of this join type.
-     *
-     * @see QueryObjectModelConstants
-     * @return JCR name of this join type
-     */
-    public String toString() {
-        return name;
-    }
-
-    /**
-     * Returns the join type with the given JCR name.
-     *
-     * @param name JCR name of a join type
-     * @return join type with the given name
-     * @throws RepositoryException if the given name is unknown
-     */
-    public static JoinType getJoinTypeByName(String name)
-            throws RepositoryException {
-        for (JoinType type : JoinType.values()) {
-            if (type.name.equals(name)) {
-                return type;
-            }
-        }
-        throw new RepositoryException("Unknown join type name: " + name);
-    }
-
-}
+/*
+ * 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.commons.query.qom;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.query.qom.Join;
+import javax.jcr.query.qom.JoinCondition;
+import javax.jcr.query.qom.QueryObjectModelConstants;
+import javax.jcr.query.qom.QueryObjectModelFactory;
+import javax.jcr.query.qom.Source;
+
+/**
+ * Enumeration of the JCR 2.0 join types.
+ *
+ * @since Apache Jackrabbit 2.0
+ */
+public enum JoinType {
+
+    INNER(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER),
+
+    LEFT(QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER),
+
+    RIGHT(QueryObjectModelConstants.JCR_JOIN_TYPE_RIGHT_OUTER);
+
+    /**
+     * JCR name of this join type.
+     */
+    private final String name;
+
+    private JoinType(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Returns the join of the given sources.
+     *
+     * @param factory factory for creating the join
+     * @param left left join source
+     * @param right right join source
+     * @param condition join condition
+     * @return join
+     * @throws RepositoryException if the join can not be created
+     */
+    public Join join(
+            QueryObjectModelFactory factory,
+            Source left, Source right, JoinCondition condition)
+            throws RepositoryException {
+        return factory.join(left, right, name, condition);
+    }
+
+    /**
+     * Returns the JCR 2.0 name of this join type.
+     *
+     * @see QueryObjectModelConstants
+     * @return JCR name of this join type
+     */
+    public String toString() {
+        return name;
+    }
+
+    /**
+     * Returns the join type with the given JCR name.
+     *
+     * @param name JCR name of a join type
+     * @return join type with the given name
+     * @throws RepositoryException if the given name is unknown
+     */
+    public static JoinType getJoinTypeByName(String name)
+            throws RepositoryException {
+        for (JoinType type : JoinType.values()) {
+            if (type.name.equals(name)) {
+                return type;
+            }
+        }
+        throw new RepositoryException("Unknown join type name: " + name);
+    }
+
+}

Propchange: jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/query/qom/JoinType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/query/qom/Operator.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/query/qom/Operator.java?rev=1680841&r1=1680840&r2=1680841&view=diff
==============================================================================
--- jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/query/qom/Operator.java (original)
+++ jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/query/qom/Operator.java Thu May 21 12:12:11 2015
@@ -1,161 +1,161 @@
-/*
- * 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.commons.query.qom;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.query.qom.Comparison;
-import javax.jcr.query.qom.DynamicOperand;
-import javax.jcr.query.qom.QueryObjectModelConstants;
-import javax.jcr.query.qom.QueryObjectModelFactory;
-import javax.jcr.query.qom.StaticOperand;
-
-/**
- * Enumeration of the JCR 2.0 query operators.
- *
- * @since Apache Jackrabbit 2.0
- */
-public enum Operator {
-
-    EQ(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, "="),
-
-    NE(QueryObjectModelConstants.JCR_OPERATOR_NOT_EQUAL_TO, "!=", "<>"),
-
-    GT(QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN, ">"),
-
-    GE(QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO, ">="),
-
-    LT(QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN, "<"),
-
-    LE(QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN_OR_EQUAL_TO, "<="),
-
-    LIKE(QueryObjectModelConstants.JCR_OPERATOR_LIKE, null, "like");
-
-    /**
-     * JCR name of this operator.
-     */
-    private final String name;
-
-    /**
-     * This operator in XPath syntax.
-     */
-    private final String xpath;
-
-    /**
-     * This operator in SQL syntax.
-     */
-    private final String sql;
-
-    private Operator(String name, String op) {
-        this(name, op, op);
-    }
-
-    private Operator(String name, String xpath, String sql) {
-        this.name = name;
-        this.xpath = xpath;
-        this.sql = sql;
-    }
-
-    /**
-     * Returns a comparison between the given operands using this operator.
-     *
-     * @param factory factory for creating the comparison
-     * @param left operand on the left hand side
-     * @param right operand on the right hand side
-     * @return comparison
-     * @throws RepositoryException if the comparison can not be created
-     */
-    public Comparison comparison(
-            QueryObjectModelFactory factory,
-            DynamicOperand left, StaticOperand right)
-            throws RepositoryException {
-        return factory.comparison(left, name, right);
-    }
-
-    /**
-     * Formats an XPath constraint with this operator and the given operands.
-     * The operands are simply used as-is, without any quoting or escaping.
-     *
-     * @param a first operand
-     * @param b second operand
-     * @return XPath constraint, <code>a op b</code> or
-     *         <code>jcr:like(a, b)</code> for {@link #LIKE}
-     */
-    public String formatXpath(String a, String b) {
-        if (this == LIKE) {
-            return "jcr:like(" + a + ", " + b + ")";
-        } else {
-            return a + " " + xpath + " " + b;
-        }
-    }
-
-    /**
-     * Formats an SQL constraint with this operator and the given operands.
-     * The operands are simply used as-is, without any quoting or escaping.
-     *
-     * @param a first operand
-     * @param b second operand
-     * @return SQL constraint, <code>a op b</code>
-     */
-    public String formatSql(String a, String b) {
-        return a + " " + sql + " " + b;
-    }
-
-    /**
-     * Returns the JCR 2.0 name of this query operator.
-     *
-     * @see QueryObjectModelConstants
-     * @return JCR name of this operator
-     */
-    public String toString() {
-        return name;
-    }
-
-    /**
-     * Returns an array of the names of all the JCR 2.0 query operators.
-     *
-     * @return names of all query operators
-     */
-    public static String[] getAllQueryOperators() {
-        return new String[] {
-                EQ.toString(),
-                NE.toString(),
-                GT.toString(),
-                GE.toString(),
-                LT.toString(),
-                LE.toString(),
-                LIKE.toString()
-        };
-    }
-
-    /**
-     * Returns the operator with the given JCR name.
-     *
-     * @param name JCR name of an operator
-     * @return operator with the given name
-     * @throws RepositoryException if the given name is unknown
-     */
-    public static Operator getOperatorByName(String name)
-            throws RepositoryException {
-        for (Operator operator : Operator.values()) {
-            if (operator.name.equals(name)) {
-                return operator;
-            }
-        }
-        throw new RepositoryException("Unknown operator name: " + name);
-    }
-
-}
+/*
+ * 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.commons.query.qom;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.query.qom.Comparison;
+import javax.jcr.query.qom.DynamicOperand;
+import javax.jcr.query.qom.QueryObjectModelConstants;
+import javax.jcr.query.qom.QueryObjectModelFactory;
+import javax.jcr.query.qom.StaticOperand;
+
+/**
+ * Enumeration of the JCR 2.0 query operators.
+ *
+ * @since Apache Jackrabbit 2.0
+ */
+public enum Operator {
+
+    EQ(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, "="),
+
+    NE(QueryObjectModelConstants.JCR_OPERATOR_NOT_EQUAL_TO, "!=", "<>"),
+
+    GT(QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN, ">"),
+
+    GE(QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO, ">="),
+
+    LT(QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN, "<"),
+
+    LE(QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN_OR_EQUAL_TO, "<="),
+
+    LIKE(QueryObjectModelConstants.JCR_OPERATOR_LIKE, null, "like");
+
+    /**
+     * JCR name of this operator.
+     */
+    private final String name;
+
+    /**
+     * This operator in XPath syntax.
+     */
+    private final String xpath;
+
+    /**
+     * This operator in SQL syntax.
+     */
+    private final String sql;
+
+    private Operator(String name, String op) {
+        this(name, op, op);
+    }
+
+    private Operator(String name, String xpath, String sql) {
+        this.name = name;
+        this.xpath = xpath;
+        this.sql = sql;
+    }
+
+    /**
+     * Returns a comparison between the given operands using this operator.
+     *
+     * @param factory factory for creating the comparison
+     * @param left operand on the left hand side
+     * @param right operand on the right hand side
+     * @return comparison
+     * @throws RepositoryException if the comparison can not be created
+     */
+    public Comparison comparison(
+            QueryObjectModelFactory factory,
+            DynamicOperand left, StaticOperand right)
+            throws RepositoryException {
+        return factory.comparison(left, name, right);
+    }
+
+    /**
+     * Formats an XPath constraint with this operator and the given operands.
+     * The operands are simply used as-is, without any quoting or escaping.
+     *
+     * @param a first operand
+     * @param b second operand
+     * @return XPath constraint, <code>a op b</code> or
+     *         <code>jcr:like(a, b)</code> for {@link #LIKE}
+     */
+    public String formatXpath(String a, String b) {
+        if (this == LIKE) {
+            return "jcr:like(" + a + ", " + b + ")";
+        } else {
+            return a + " " + xpath + " " + b;
+        }
+    }
+
+    /**
+     * Formats an SQL constraint with this operator and the given operands.
+     * The operands are simply used as-is, without any quoting or escaping.
+     *
+     * @param a first operand
+     * @param b second operand
+     * @return SQL constraint, <code>a op b</code>
+     */
+    public String formatSql(String a, String b) {
+        return a + " " + sql + " " + b;
+    }
+
+    /**
+     * Returns the JCR 2.0 name of this query operator.
+     *
+     * @see QueryObjectModelConstants
+     * @return JCR name of this operator
+     */
+    public String toString() {
+        return name;
+    }
+
+    /**
+     * Returns an array of the names of all the JCR 2.0 query operators.
+     *
+     * @return names of all query operators
+     */
+    public static String[] getAllQueryOperators() {
+        return new String[] {
+                EQ.toString(),
+                NE.toString(),
+                GT.toString(),
+                GE.toString(),
+                LT.toString(),
+                LE.toString(),
+                LIKE.toString()
+        };
+    }
+
+    /**
+     * Returns the operator with the given JCR name.
+     *
+     * @param name JCR name of an operator
+     * @return operator with the given name
+     * @throws RepositoryException if the given name is unknown
+     */
+    public static Operator getOperatorByName(String name)
+            throws RepositoryException {
+        for (Operator operator : Operator.values()) {
+            if (operator.name.equals(name)) {
+                return operator;
+            }
+        }
+        throw new RepositoryException("Unknown operator name: " + name);
+    }
+
+}

Propchange: jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/query/qom/Operator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/SingletonRepositoryFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/SingletonRepositoryFactory.java?rev=1680841&r1=1680840&r2=1680841&view=diff
==============================================================================
--- jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/SingletonRepositoryFactory.java (original)
+++ jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/SingletonRepositoryFactory.java Thu May 21 12:12:11 2015
@@ -1,49 +1,49 @@
-/*
- * 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.commons.repository;
-
-import javax.jcr.Repository;
-
-/**
- * Repository factory that always returns the same configured repository.
- */
-public class SingletonRepositoryFactory implements RepositoryFactory {
-
-    /**
-     * Singleton repository instance.
-     */
-    private final Repository repository;
-
-    /**
-     * Creates a repository factory that always returns the given repository.
-     *
-     * @param repository singleton repository instance.
-     */
-    public SingletonRepositoryFactory(Repository repository) {
-        this.repository = repository;
-    }
-
-    /**
-     * Returns the configured repository instance.
-     *
-     * @return singleton repository instance
-     */
-    public Repository getRepository() {
-        return repository;
-    }
-
-}
+/*
+ * 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.commons.repository;
+
+import javax.jcr.Repository;
+
+/**
+ * Repository factory that always returns the same configured repository.
+ */
+public class SingletonRepositoryFactory implements RepositoryFactory {
+
+    /**
+     * Singleton repository instance.
+     */
+    private final Repository repository;
+
+    /**
+     * Creates a repository factory that always returns the given repository.
+     *
+     * @param repository singleton repository instance.
+     */
+    public SingletonRepositoryFactory(Repository repository) {
+        this.repository = repository;
+    }
+
+    /**
+     * Returns the configured repository instance.
+     *
+     * @return singleton repository instance
+     */
+    public Repository getRepository() {
+        return repository;
+    }
+
+}

Propchange: jackrabbit/branches/2.0/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/SingletonRepositoryFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native