jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1372478 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins: type/NodeTypeConstants.java type/TypeValidatorProvider.java value/AnnotatingConflictHandler.java value/ConflictValidator.java
Date Mon, 13 Aug 2012 15:48:25 GMT
Author: angela
Date: Mon Aug 13 15:48:25 2012
New Revision: 1372478

URL: http://svn.apache.org/viewvc?rev=1372478&view=rev
Log:
OAK-240 mix:mergeConflict violates naming convention

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeConstants.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidatorProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/value/AnnotatingConflictHandler.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/value/ConflictValidator.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeConstants.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeConstants.java?rev=1372478&r1=1372477&r2=1372478&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeConstants.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeConstants.java
Mon Aug 13 15:48:25 2012
@@ -17,8 +17,6 @@
 package org.apache.jackrabbit.oak.plugins.type;
 
 import org.apache.jackrabbit.JcrConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * NodeTypeConstants... TODO
@@ -33,4 +31,11 @@ public interface NodeTypeConstants exten
     String JCR_IS_FULLTEXT_SEARCHABLE = "jcr:isFullTextSearchable";
     String JCR_IS_QUERY_ORDERABLE = "jcr:isQueryOrderable";
     String JCR_AVAILABLE_QUERY_OPERATORS = "jcr:availableQueryOperators";
+
+    /**
+     * Name of the mixin type to mark merge conflicts
+     * TODO: review where this constant should be located.
+     */
+    String MIX_REP_MERGE_CONFLICT = "rep:MergeConflict";
+
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidatorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidatorProvider.java?rev=1372478&r1=1372477&r2=1372478&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidatorProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidatorProvider.java
Mon Aug 13 15:48:25 2012
@@ -28,7 +28,7 @@ import org.apache.jackrabbit.oak.spi.sta
 
 @Component
 @Service(ValidatorProvider.class)
-public class TypeValidatorProvider implements ValidatorProvider {
+public class TypeValidatorProvider implements ValidatorProvider, NodeTypeConstants {
 
     @Override
     public Validator getRootValidator(NodeState before, NodeState after) {
@@ -93,12 +93,12 @@ public class TypeValidatorProvider imple
         types.add("rep:RetentionManageable");
 
         // Oak types are always available
-        types.add("mix:mergeConflict");
+        types.add(MIX_REP_MERGE_CONFLICT);
 
         // Find any extra types from /jcr:system/jcr:nodeTypes
-        NodeState system = after.getChildNode("jcr:system");
+        NodeState system = after.getChildNode(JCR_SYSTEM);
         if (system != null) {
-            NodeState registry = system.getChildNode("jcr:nodeTypes");
+            NodeState registry = system.getChildNode(JCR_NODE_TYPES);
             if (registry != null) {
                 for (ChildNodeEntry child : registry.getChildNodeEntries()) {
                     types.add(child.getName());

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/value/AnnotatingConflictHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/value/AnnotatingConflictHandler.java?rev=1372478&r1=1372477&r2=1372478&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/value/AnnotatingConflictHandler.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/value/AnnotatingConflictHandler.java
Mon Aug 13 15:48:25 2012
@@ -29,29 +29,30 @@ import org.apache.jackrabbit.oak.api.Tre
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 
+import static org.apache.jackrabbit.JcrConstants.JCR_MIXINTYPES;
+import static org.apache.jackrabbit.oak.plugins.type.NodeTypeConstants.MIX_REP_MERGE_CONFLICT;
+
 /**
  * This {@link ConflictHandler} implementation resolves conflicts to
  * {@link Resolution#THEIRS} and in addition marks nodes where a conflict
- * occurred with {@code mix:mergeConflict}:
+ * occurred with the mixin {@code rep:MergeConflict}:
  *
  * <pre>
- * [mix:mergeConflict]
+ * [rep:MergeConflict]
  *   mixin
- *   primaryitem jcr:ours
- *   + jcr:ours (nt:unstructured)
+ *   primaryitem rep:ours
+ *   + rep:ours (nt:unstructured)
  * </pre>
  *
- * The {@code jcr:ours} sub node contains our version of the node prior to
+ * The {@code rep:ours} sub node contains our version of the node prior to
  * the conflict.
  *
  * @see ConflictValidator
  */
 public class AnnotatingConflictHandler implements ConflictHandler {
-    private static final String JCR_MIXIN_TYPES = "jcr:mixinTypes";
 
     // TODO: move these constants to some common location for repository internal node types
-    private static final String MIX_MERGE_CONFLICT = "mix:mergeConflict";
-    private static final String JCR_OURS = "jcr:ours";
+    private static final String REP_OURS = "rep:ours";
     private static final String ADD_EXISTING = "addExisting";
     private static final String CHANGE_DELETED = "changeDeleted";
     private static final String CHANGE_CHANGED = "changeChanged";
@@ -128,18 +129,18 @@ public class AnnotatingConflictHandler i
     }
 
     private Tree addConflictMarker(Tree parent) {
-        PropertyState jcrMixin = parent.getProperty(JCR_MIXIN_TYPES);
+        PropertyState jcrMixin = parent.getProperty(JCR_MIXINTYPES);
         List<CoreValue> mixins = new ArrayList<CoreValue>();
         if (jcrMixin != null) {
             assert jcrMixin.isArray();
             mixins.addAll(jcrMixin.getValues());
         }
-        if (!mixins.contains(MIX_MERGE_CONFLICT)) {
-            mixins.add(valueFactory.createValue(MIX_MERGE_CONFLICT, PropertyType.NAME));
-            parent.setProperty(JCR_MIXIN_TYPES, mixins);
+        if (!mixins.contains(MIX_REP_MERGE_CONFLICT)) {
+            mixins.add(valueFactory.createValue(MIX_REP_MERGE_CONFLICT, PropertyType.NAME));
+            parent.setProperty(JCR_MIXINTYPES, mixins);
         }
 
-        return getOrCreateNode(parent, JCR_OURS);
+        return getOrCreateNode(parent, REP_OURS);
     }
 
     private static Tree getOrCreateNode(Tree parent, String name) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/value/ConflictValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/value/ConflictValidator.java?rev=1372478&r1=1372477&r2=1372478&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/value/ConflictValidator.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/value/ConflictValidator.java
Mon Aug 13 15:48:25 2012
@@ -18,9 +18,11 @@ package org.apache.jackrabbit.oak.plugin
 
 import javax.jcr.InvalidItemStateException;
 
+import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.plugins.type.NodeTypeConstants;
 import org.apache.jackrabbit.oak.spi.commit.DefaultValidator;
 import org.apache.jackrabbit.oak.spi.commit.Validator;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
@@ -59,10 +61,10 @@ public class ConflictValidator extends D
     }
 
     private static void failOnMergeConflict(PropertyState property) throws CommitFailedException
{
-        if ("jcr:mixinTypes".equals(property.getName())) {
+        if (JcrConstants.JCR_MIXINTYPES.equals(property.getName())) {
             assert property.isArray();
             for (CoreValue v : property.getValues()) {
-                if ("mix:mergeConflict".equals(v.getString())) {
+                if (NodeTypeConstants.MIX_REP_MERGE_CONFLICT.equals(v.getString())) {
                     throw new CommitFailedException(new InvalidItemStateException("Item has
unresolved conflicts"));
                 }
             }



Mime
View raw message