jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1329967 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: core/ kernel/ plugins/name/ query/ query/ast/ query/index/
Date Tue, 24 Apr 2012 19:43:17 GMT
Author: mduerig
Date: Tue Apr 24 19:43:16 2012
New Revision: 1329967

URL: http://svn.apache.org/viewvc?rev=1329967&view=rev
Log:
Minor cleanup:
- make instance fields final when possible
- make methods static when possible 
- add missing @Override
- Fixed Javadoc
- removed redundant public and static modifiers
- Use valueOf instead of "" + int
- Use isEmpty instead of size() == 0

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/BinaryValue.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidator.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/XPathToSQL2Converter.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ComparisonImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/Filter.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/QueryIndexProvider.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/BinaryValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/BinaryValue.java?rev=1329967&r1=1329966&r2=1329967&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/BinaryValue.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/BinaryValue.java
Tue Apr 24 19:43:16 2012
@@ -33,8 +33,8 @@ public class BinaryValue {
      */
     private static final Logger log = LoggerFactory.getLogger(BinaryValue.class);
 
-    private String binaryID;
-    private MicroKernel mk;
+    private final String binaryID;
+    private final MicroKernel mk;
 
     BinaryValue(String binaryID, MicroKernel mk) {
         this.binaryID = binaryID;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java?rev=1329967&r1=1329966&r2=1329967&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
Tue Apr 24 19:43:16 2012
@@ -18,12 +18,12 @@
  */
 package org.apache.jackrabbit.oak.kernel;
 
-import java.util.HashSet;
-import java.util.Set;
-
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.oak.api.CoreValueFactory;
 import org.apache.jackrabbit.oak.api.PropertyState;
+
+import java.util.HashSet;
+import java.util.Set;
 /**
  * {@link MicroKernel}-based {@link NodeStore} implementation.
  */
@@ -112,6 +112,8 @@ public class KernelNodeStore implements 
         }
     }
 
+    //------------------------------------------------------------< internal >---
+
     // TODO clarify write access to store. Expose through interface
     void save(KernelRoot root, NodeState base) {
         if (!(base instanceof KernelNodeState)) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidator.java?rev=1329967&r1=1329966&r2=1329967&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidator.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidator.java
Tue Apr 24 19:43:16 2012
@@ -16,13 +16,13 @@
  */
 package org.apache.jackrabbit.oak.plugins.name;
 
-import java.util.Set;
-
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.commit.Validator;
 import org.apache.jackrabbit.oak.kernel.NodeState;
 
+import java.util.Set;
+
 class NameValidator implements Validator {
 
     private final Set<String> prefixes;
@@ -48,7 +48,7 @@ class NameValidator implements Validator
         }
     }
 
-    private boolean isValidLocalName(String local) {
+    private static boolean isValidLocalName(String local) {
         if (".".equals(local) || "..".equals(local)) {
             return false;
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java?rev=1329967&r1=1329966&r2=1329967&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java
Tue Apr 24 19:43:16 2012
@@ -16,20 +16,19 @@
 */
 package org.apache.jackrabbit.oak.plugins.name;
 
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.jcr.RepositoryException;
-
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.api.Tree;
 
+import javax.jcr.RepositoryException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
 /**
  * Prove of concept implementation for OAK-61.
  *
@@ -110,7 +109,7 @@ public class NamespaceMappings {
      * Returns the namespace URI associated with the given prefix,
      * or {@code null} if such a mapping does not exist.
      *
-     * @param uri namespace URI
+     * @param prefix prefix for which to lookup the namespace URI
      * @return matching namespace prefix, or {@code null}
      */
     public String getURI(String prefix) {
@@ -134,7 +133,7 @@ public class NamespaceMappings {
      * Returns the namespace prefix associated with the given URI,
      * or {@code null} if such a mapping does not exist.
      *
-     * @param prefix namespace prefix
+     * @param uri  uri for which to lookup the prefix
      * @return matching namespace URI, or {@code null}
      */
     public String getPrefix(String uri) throws RepositoryException {
@@ -176,7 +175,7 @@ public class NamespaceMappings {
      * Removes the namespace mapping for the given prefix.
      *
      * @param prefix namespace prefix
-     * @throws CommitFailedException if the unregistration failed
+     * @throws CommitFailedException if the unregistering failed
      */
     public void unregisterNamespace(String prefix)
             throws CommitFailedException {
@@ -186,7 +185,7 @@ public class NamespaceMappings {
         root.commit();
     }
 
-    private Tree getNamespaces(Root root, boolean create) {
+    private static Tree getNamespaces(Root root, boolean create) {
         Tree tree = root.getTree("/");
         Tree system = tree.getChild("jcr:system");
         if (system == null) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java?rev=1329967&r1=1329966&r2=1329967&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java
Tue Apr 24 19:43:16 2012
@@ -16,13 +16,6 @@
  */
 package org.apache.jackrabbit.oak.query;
 
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.index.Indexer;
 import org.apache.jackrabbit.oak.api.CoreValue;
@@ -30,8 +23,16 @@ import org.apache.jackrabbit.oak.api.Cor
 import org.apache.jackrabbit.oak.api.QueryEngine;
 import org.apache.jackrabbit.oak.query.index.Filter;
 import org.apache.jackrabbit.oak.query.index.QueryIndex;
-import org.apache.jackrabbit.oak.query.index.TraversingIndex;
 import org.apache.jackrabbit.oak.query.index.QueryIndexProvider.QueryIndexListener;
+import org.apache.jackrabbit.oak.query.index.TraversingIndex;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
 
 public class QueryEngineImpl implements QueryEngine, QueryIndexListener {
 
@@ -55,6 +56,7 @@ public class QueryEngineImpl implements 
         indexer = new Indexer(mk, INDEX_CONFIG_ROOT);
     }
 
+    @Override
     public void init() {
         // TODO the list of index providers should be configurable as well
         indexer.init();

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/XPathToSQL2Converter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/XPathToSQL2Converter.java?rev=1329967&r1=1329966&r2=1329967&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/XPathToSQL2Converter.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/XPathToSQL2Converter.java
Tue Apr 24 19:43:16 2012
@@ -671,7 +671,7 @@ public class XPathToSQL2Converter {
         }
 
         public static Expression newBoolean(boolean value) {
-            return new Literal("" + value);
+            return new Literal(String.valueOf(value));
         }
 
         static Literal newNumber(String s) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ComparisonImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ComparisonImpl.java?rev=1329967&r1=1329966&r2=1329967&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ComparisonImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ComparisonImpl.java
Tue Apr 24 19:43:16 2012
@@ -231,7 +231,7 @@ public class ComparisonImpl extends Cons
                 buff.append(patternChars[maxMatch++]);
             }
             String lower = buff.toString();
-            if (lower.length() == 0) {
+            if (lower.isEmpty()) {
                 return;
             }
             if (maxMatch == patternLength) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/Filter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/Filter.java?rev=1329967&r1=1329966&r2=1329967&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/Filter.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/Filter.java
Tue Apr 24 19:43:16 2012
@@ -18,13 +18,14 @@
  */
 package org.apache.jackrabbit.oak.query.index;
 
-import java.util.HashMap;
-import java.util.Map.Entry;
 import org.apache.jackrabbit.mk.util.PathUtils;
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.query.ast.Operator;
 import org.apache.jackrabbit.oak.query.ast.SelectorImpl;
 
+import java.util.HashMap;
+import java.util.Map.Entry;
+
 /**
  * A filter or lookup condition.
  */
@@ -48,7 +49,7 @@ public class Filter {
     /**
      * The path restriction type.
      */
-    public static enum PathRestriction {
+    public enum PathRestriction {
 
         /**
          * A parent of this node
@@ -70,7 +71,7 @@ public class Filter {
          */
         ALL_CHILDREN("//*");
 
-        private String name;
+        private final String name;
 
         PathRestriction(String name) {
             this.name = name;
@@ -95,7 +96,8 @@ public class Filter {
      */
     private String valuePrefix;
 
-    private HashMap<String, PropertyRestriction> propertyRestrictions = new HashMap<String,
PropertyRestriction>();
+    private final HashMap<String, PropertyRestriction> propertyRestrictions =
+            new HashMap<String, PropertyRestriction>();
 
     static class PropertyRestriction {
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/QueryIndexProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/QueryIndexProvider.java?rev=1329967&r1=1329966&r2=1329967&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/QueryIndexProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/QueryIndexProvider.java
Tue Apr 24 19:43:16 2012
@@ -57,7 +57,7 @@ public interface QueryIndexProvider {
     /**
      * A query index listener
      */
-    public interface QueryIndexListener {
+    interface QueryIndexListener {
 
         /**
          * The given index was added.



Mime
View raw message