jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r766760 - in /jackrabbit/branches/1.5: ./ jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2s...
Date Mon, 20 Apr 2009 17:20:53 GMT
Author: mduerig
Date: Mon Apr 20 17:20:52 2009
New Revision: 766760

URL: http://svn.apache.org/viewvc?rev=766760&view=rev
Log:
1.5: Merged revision 731941 (JCR-1963)

Modified:
    jackrabbit/branches/1.5/   (props changed)
    jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java
    jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java
    jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java
    jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
    jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java

Propchange: jackrabbit/branches/1.5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Apr 20 17:20:52 2009
@@ -1,2 +1,2 @@
 /jackrabbit/branches/1.3:631261
-/jackrabbit/trunk:703899-704158,704165,704167,704324,704358,704361,704864,704933,704939,705010,705033,705243,705496,705522,705579,705925,705932,705934,705937-705938,705961,706242,706273,706285-706286,706562,706606,706649,706655,706660,706697,706918,707303-707304,707307,707310,707630,708206,708598,708609,708613,708619,708634,708840,708863,708909,708929,708943,709115,709142,709207,709211,710047,711238,711566-711567,711595,711841-711843,712984-712985,713037,713059,713065,713072,713076,713162,713214,713956,713958,713964,713971,713975,714034,718218,718249-718250,718371,718376,718566,718632,718981,719225,719282,719575-719577,719579,719585-719586,719588,719592,720455,720484,720492,720524,720533,720540,720673,720679,720687,720784,720940,720969,721186,721191,721194,721235,721387-721389,721470,721495,722068-722069,722463,722465,722467,722470,722825,723281,723346,723728,723784,724300,724387,725292,727376,727388,727390,727395,727397,727402,727492,727701,728022,731896,731934,731941,73234
 7,732678,732686,732689,732693,732703,732715-732716,732719,732728,732730,732734-732738,732740,732742-732743,732745,732867,732883,733057-733059,733061,733080,734092,734366,734375,734400,734709,735401,736021,736030,736274,736276,736650-736651,736653-736656,736658,736680,737695,738087,738119,738121,738419,738422,738474,738512,739210,739212,739226,740262,740734,740736-740738,740747,740749-740750,741052,741100,741121,741206,741208-741210,741213,741509,741524,741652,741803,742382,742538,743295,743713,743718,743726,743734,743738,744883-744884,744889,744895,744911,744935,744940,744954,744956,745041,745051,745053,745056,745060,745120,745500,745534,745824,745849,746301-746302,746486,746602-746603,746609,746666,746747-746748,747325,747347,747358-747360,747362,747365,747368,747372,747785,748232-748233,748247,748486,749237,749448,749622,749953,749965,750011,750437,752036-752039,752044,752046-752051,752053-752054,752056,752058-752060,752063-752067,752115,752131,752414-752415,752478,752543-
 752545,752809,752840-752841,753225-753228,753232,753244,755582,756378,756403,756405,756409,756442,756444,757698,757775-757776,757854,757856,757862,758263,758265,758349,758354,758629,758632,758634-758636,758639-758642,758646,758649,758653-758654,759880,760386,761690-761691,761715,762671,762675,762700,762702,762731,762737,762755,762780-762781,762789,762793,762797,762802,762804,762808,762813-762814,762817-762818,762821-762823,763146,763160,763188,763205,763215,763242,763244,763248,765328,765337,765532,765551,765554,765556,765585
+/jackrabbit/trunk:703899-704158,704165,704167,704324,704358,704361,704864,704933,704939,705010,705033,705243,705496,705522,705579,705925,705932,705934,705937-705938,705961,706242,706273,706285-706286,706562,706606,706649,706655,706660,706697,706918,707303-707304,707307,707310,707630,708206,708598,708609,708613,708619,708634,708840,708863,708909,708929,708943,709115,709142,709207,709211,710047,711238,711566-711567,711595,711841-711843,712984-712985,713037,713059,713065,713072,713076,713162,713214,713956,713958,713964,713971,713975,714034,718218,718249-718250,718371,718376,718566,718632,718981,719225,719282,719575-719577,719579,719585-719586,719588,719592,720455,720484,720492,720524,720533,720540,720673,720679,720687,720784,720940,720969,721186,721191,721194,721235,721387-721389,721470,721495,722068-722069,722463,722465,722467,722470,722825,723281,723346,723728,723784,724300,724387,725292,727376,727388,727390,727395,727397,727402,727492,727701,728022,731896,731934,731941,73234
 7,732678,732686,732689,732693,732703,732715-732716,732719,732728,732730,732734-732738,732740,732742-732743,732745,732867,732883,733057-733059,733061,733080,734092,734366,734375,734400,734709,735401,736021,736030,736274,736276,736650-736651,736653-736656,736658,736680,737695,738087,738119,738121,738419,738422,738474,738512,739210,739212,739226,740262,740734,740736-740738,740747,740749-740750,741052,741100,741121,741206,741208-741210,741213,741509,741524,741652,741803,742382,742538,743295,743713,743718,743726,743734,743738,744883-744884,744889,744895,744911,744935,744940,744954,744956,745041,745051,745053,745056,745060,745120,745500,745534,745824,745849,746301-746302,746486,746602-746603,746609,746666,746747-746748,747325,747347,747358-747360,747362,747365,747368,747372,747785,747839,748232-748233,748247,748486,749237,749448,749622,749953,749965,750011,750437,752036-752039,752044,752046-752051,752053-752054,752056,752058-752060,752063-752067,752115,752131,752414-752415,752478,
 752543-752545,752809,752840-752841,753225-753228,753232,753244,755582,756378,756403,756405,756409,756442,756444,757698,757775-757776,757854,757856,757862,758263,758265,758349,758354,758629,758632,758634-758636,758639-758642,758646,758649,758653-758654,759880,760386,761690-761691,761715,762671,762675,762700,762702,762731,762737,762755,762780-762781,762789,762793,762797,762802,762804,762808,762813-762814,762817-762818,762821-762823,763146,763160,763188,763205,763215,763242,763244,763248,765328,765337,765532,765551,765554,765556,765585

Modified: jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java?rev=766760&r1=766759&r2=766760&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java
Mon Apr 20 17:20:52 2009
@@ -16,22 +16,8 @@
  */
 package org.apache.jackrabbit.jcr2spi;
 
-import org.apache.commons.collections.map.ReferenceMap;
-import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
-import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyEntry;
-import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
-import org.apache.jackrabbit.jcr2spi.operation.Operation;
-import org.apache.jackrabbit.jcr2spi.operation.Remove;
-import org.apache.jackrabbit.jcr2spi.state.ItemState;
-import org.apache.jackrabbit.jcr2spi.state.ItemStateLifeCycleListener;
-import org.apache.jackrabbit.jcr2spi.state.ItemStateValidator;
-import org.apache.jackrabbit.jcr2spi.state.NodeState;
-import org.apache.jackrabbit.jcr2spi.state.Status;
-import org.apache.jackrabbit.jcr2spi.util.LogUtil;
-import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.spi.Path;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import java.util.Collections;
+import java.util.Map;
 
 import javax.jcr.AccessDeniedException;
 import javax.jcr.InvalidItemStateException;
@@ -48,8 +34,23 @@
 import javax.jcr.lock.LockException;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.version.VersionException;
-import java.util.Collections;
-import java.util.Map;
+
+import org.apache.commons.collections.map.ReferenceMap;
+import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
+import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyEntry;
+import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
+import org.apache.jackrabbit.jcr2spi.operation.Operation;
+import org.apache.jackrabbit.jcr2spi.operation.Remove;
+import org.apache.jackrabbit.jcr2spi.state.ItemState;
+import org.apache.jackrabbit.jcr2spi.state.ItemStateLifeCycleListener;
+import org.apache.jackrabbit.jcr2spi.state.ItemStateValidator;
+import org.apache.jackrabbit.jcr2spi.state.NodeState;
+import org.apache.jackrabbit.jcr2spi.state.Status;
+import org.apache.jackrabbit.jcr2spi.util.LogUtil;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.Path;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * <code>ItemImpl</code>...
@@ -58,7 +59,7 @@
 
     private static Logger log = LoggerFactory.getLogger(ItemImpl.class);
 
-    private ItemState state;
+    private final ItemState state;
 
     /**
      * The session that created this item.
@@ -263,7 +264,7 @@
                 session.getCacheBehaviour() != CacheBehaviour.OBSERVATION) {
                 // merge current transient modifications with latest changes
                 // from the 'server'.
-                // Note, that with Observation-CacheBehaviour no manuel refresh
+                // Note, that with Observation-CacheBehaviour no manual refresh
                 // is required. changes get pushed automatically.
                 state.getHierarchyEntry().invalidate(true);
             }
@@ -276,7 +277,7 @@
             }
 
             /*
-            Reset all transient modifications from this item and its decendants.
+            Reset all transient modifications from this item and its descendants.
             */
             session.getSessionItemStateManager().undo(state);
 

Modified: jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java?rev=766760&r1=766759&r2=766760&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java
Mon Apr 20 17:20:52 2009
@@ -16,20 +16,22 @@
  */
 package org.apache.jackrabbit.jcr2spi.hierarchy;
 
+import java.lang.ref.Reference;
+import java.lang.ref.SoftReference;
+
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.RepositoryException;
+
 import org.apache.jackrabbit.jcr2spi.state.ItemState;
-import org.apache.jackrabbit.jcr2spi.state.Status;
 import org.apache.jackrabbit.jcr2spi.state.ItemStateFactory;
+import org.apache.jackrabbit.jcr2spi.state.Status;
+import org.apache.jackrabbit.jcr2spi.state.ItemState.MergeResult;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.jcr.InvalidItemStateException;
-import javax.jcr.ItemNotFoundException;
-import javax.jcr.RepositoryException;
-import java.lang.ref.SoftReference;
-import java.lang.ref.Reference;
-
 /**
  * <code>HierarchyEntryImpl</code> implements base functionality for child node
  * and property references.
@@ -222,10 +224,10 @@
             // with the passed state.
             int currentStatus = currentState.getStatus();
             boolean keepChanges = Status.isTransient(currentStatus) || Status.isStale(currentStatus);
-            boolean modified = currentState.merge(state, keepChanges);
+            MergeResult mergeResult = currentState.merge(state, keepChanges);
             if (currentStatus == Status.INVALIDATED) {
                 currentState.setStatus(Status.EXISTING);
-            } else if (modified) {
+            } else if (mergeResult.modified()) {
                 currentState.setStatus(Status.MODIFIED);
             } // else: not modified. just leave status as it is.
         }

Modified: jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java?rev=766760&r1=766759&r2=766760&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java
Mon Apr 20 17:20:52 2009
@@ -16,6 +16,14 @@
  */
 package org.apache.jackrabbit.jcr2spi.state;
 
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.RepositoryException;
+
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyEntry;
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.jcr2spi.nodetype.ItemDefinitionProvider;
@@ -26,13 +34,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.jcr.InvalidItemStateException;
-import javax.jcr.ItemNotFoundException;
-import javax.jcr.RepositoryException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-
 /**
  * <code>ItemState</code> represents the state of an <code>Item</code>.
  */
@@ -51,7 +52,7 @@
     /**
      * The hierarchy entry this state belongs to.
      */
-    private HierarchyEntry hierarchyEntry;
+    private final HierarchyEntry hierarchyEntry;
 
     /**
      * Listeners (weak references)
@@ -264,9 +265,9 @@
      *
      * @param another
      * @param keepChanges
-     * @return true if this state has been modified
+     * @return a MergeResult instance which represent the result of the merge operation
      */
-    public abstract boolean merge(ItemState another, boolean keepChanges);
+    public abstract MergeResult merge(ItemState another, boolean keepChanges);
 
     /**
      * Revert all transient modifications made to this ItemState.
@@ -333,4 +334,40 @@
                 throw new InvalidItemStateException(msg);
         }
     }
+
+    // -----------------------------------------------------< MergeResult >---
+
+    /**
+     * A MergeResult represents the result of a {@link ItemState#merge(ItemState, boolean)}
+     * operation.
+     */
+    public interface MergeResult {
+
+        /**
+         * @return  true iff the target state of {@link ItemState#merge(ItemState, boolean)}
+         * was modified.
+         */
+        public boolean modified();
+    }
+
+    /**
+     * A SimpleMergeResult is just a holder for a modification status.
+     * The {@link #modified()} method just returns the modification status passed
+     * to the constructor.
+     */
+    protected class SimpleMergeResult implements MergeResult {
+        private final boolean modified;
+
+        /**
+         * @param modified  modification status
+         */
+        public SimpleMergeResult(boolean modified) {
+            this.modified = modified;
+        }
+
+        public boolean modified() {
+            return modified;
+        }
+    }
+
 }

Modified: jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java?rev=766760&r1=766759&r2=766760&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
Mon Apr 20 17:20:52 2009
@@ -16,6 +16,12 @@
  */
 package org.apache.jackrabbit.jcr2spi.state;
 
+import java.util.Arrays;
+import java.util.List;
+
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.RepositoryException;
+
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry;
 import org.apache.jackrabbit.jcr2spi.nodetype.ItemDefinitionProvider;
@@ -31,11 +37,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.jcr.ItemNotFoundException;
-import javax.jcr.RepositoryException;
-import java.util.Arrays;
-import java.util.List;
-
 /**
  * <code>NodeState</code> represents the state of a <code>Node</code>.
  */
@@ -122,31 +123,30 @@
     /**
      * @see ItemState#merge(ItemState, boolean)
      */
-    public boolean merge(ItemState another, boolean keepChanges) {
-        if (another == null || another == this) {
-            return false;
-        }
-        if (!another.isNode()) {
-            throw new IllegalArgumentException("Attempt to merge node state with property
state.");
-        }
+    public MergeResult merge(ItemState another, boolean keepChanges) {
         boolean modified = false;
-        synchronized (another) {
-            NodeState nState = (NodeState) another;
-
-            if (nState.definition != null && !nState.definition.equals(definition))
{
-                definition = nState.definition;
-                modified = true;
+        if (another != null && another != this) {
+            if (!another.isNode()) {
+                throw new IllegalArgumentException("Attempt to merge node state with property
state.");
             }
+            synchronized (another) {
+                NodeState nState = (NodeState) another;
 
-            // since 'mixinTypeNames' are modified upon save only, no special
-            // merging is required here. just reset the mixinTypeNames.
-            List mixN = Arrays.asList(nState.mixinTypeNames);
-            if (mixN.size() != mixinTypeNames.length || !mixN.containsAll(Arrays.asList(mixinTypeNames)))
{
-                setMixinTypeNames(nState.mixinTypeNames);
-                modified = true;
+                if (nState.definition != null && !nState.definition.equals(definition))
{
+                    definition = nState.definition;
+                    modified = true;
+                }
+
+                // since 'mixinTypeNames' are modified upon save only, no special
+                // merging is required here. just reset the mixinTypeNames.
+                List mixN = Arrays.asList(nState.mixinTypeNames);
+                if (mixN.size() != mixinTypeNames.length || !mixN.containsAll(Arrays.asList(mixinTypeNames)))
{
+                    setMixinTypeNames(nState.mixinTypeNames);
+                    modified = true;
+                }
             }
         }
-        return modified;
+        return new SimpleMergeResult(modified);
     }
 
     /**
@@ -254,7 +254,7 @@
      * TODO: clarify usage
      * In case the status of the given node state is not {@link Status#EXISTING}
      * the transiently added mixin types are taken into account as well.
-     * 
+     *
      * @return
      */
     public synchronized Name[] getAllNodeTypeNames() {

Modified: jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java?rev=766760&r1=766759&r2=766760&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java
Mon Apr 20 17:20:52 2009
@@ -16,6 +16,11 @@
  */
 package org.apache.jackrabbit.jcr2spi.state;
 
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.ValueFormatException;
+import javax.jcr.nodetype.ConstraintViolationException;
+
 import org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry;
 import org.apache.jackrabbit.jcr2spi.nodetype.ItemDefinitionProvider;
 import org.apache.jackrabbit.spi.ItemId;
@@ -26,11 +31,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-import javax.jcr.ValueFormatException;
-import javax.jcr.nodetype.ConstraintViolationException;
-
 /**
  * <code>PropertyState</code> represents the state of a <code>Property</code>.
  */
@@ -130,28 +130,28 @@
      *
      * @see ItemState#merge(ItemState, boolean)
      */
-    public boolean merge(ItemState another, boolean keepChanges) {
-        if (another == null || another == this) {
-            return false;
-        }
-        if (another.isNode()) {
-            throw new IllegalArgumentException("Attempt to merge property state with node
state.");
-        }
-        // calculate if the persistent values of this state differ from the
-        // other state.
-        boolean diff = diff(data, ((PropertyState) another).data);
-        // reset the pInfo to point to the pInfo of another state.
-        this.data = ((PropertyState) another).data;
-        // if transient changes should be preserved OR if there are not
-        // transient changes, simply return diff to indicate if this state
-        // was internally changed.
-        if (keepChanges || transientData == null) {
-            return diff;
-        } else {
-            transientData.discardValues();
-            transientData = null;
-            return true;
+    public MergeResult merge(ItemState another, boolean keepChanges) {
+        boolean modified = false;
+        if (another != null && another != this) {
+            if (another.isNode()) {
+                throw new IllegalArgumentException("Attempt to merge property state with
node state.");
+            }
+            PropertyDiffer result = new PropertyDiffer(data, ((PropertyState) another).data);
+
+            // reset the pInfo to point to the pInfo of another state.
+            this.data = ((PropertyState) another).data;
+            // if transient changes should be preserved OR if there are not
+            // transient changes, simply return diff to indicate if this state
+            // was internally changed.
+            if (keepChanges || transientData == null) {
+                return result;
+            } else {
+                transientData.discardValues();
+                transientData = null;
+                modified = true;
+            }
         }
+        return new SimpleMergeResult(modified);
     }
 
     /**
@@ -340,9 +340,9 @@
      * Inner class storing property values an their type.
      */
     private class PropertyData {
-
         private int type;
         private QValue[] values;
+        private boolean discarded;
 
         private PropertyData(PropertyInfo pInfo) {
             this.type = pInfo.getType();
@@ -365,6 +365,7 @@
         }
 
         private void discardValues() {
+            discarded = true;
             if (values != null) {
                 for (int i = 0; i < values.length; i++) {
                     if (values[i] != null) {
@@ -376,4 +377,27 @@
             }
         }
     }
+
+    /**
+     * Helper class for delayed determination of property differences.
+     */
+    private class PropertyDiffer implements MergeResult {
+        private final PropertyData thisData;
+        private final PropertyData thatData;
+
+        PropertyDiffer(PropertyData thisData, PropertyData thatData) {
+            super();
+            this.thisData = thisData;
+            this.thatData = thatData;
+        }
+
+        public boolean modified() {
+            if (thisData.discarded || thatData.discarded) {
+                log.warn("Property data has been discarded");
+                return true;
+            }
+            return diff(thisData, thatData);
+        }
+    }
+
 }



Mime
View raw message