Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-07-07 10:19:47 +0000
committerEike Stepper2010-07-07 10:19:47 +0000
commite77d6e617f9cb81e052d7e605d354788bf545155 (patch)
treeb4da46e125d661d2499d8ab9b91a9fce460b701a
parent03ae5c2a69e514023606bb249b8cfec736a3f4d6 (diff)
downloadcdo-e77d6e617f9cb81e052d7e605d354788bf545155.tar.gz
cdo-e77d6e617f9cb81e052d7e605d354788bf545155.tar.xz
cdo-e77d6e617f9cb81e052d7e605d354788bf545155.zip
[319090] Provide a CDOConflictResolver that uses a CDOMerger
https://bugs.eclipse.org/bugs/show_bug.cgi?id=319090
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOSavepoint.java11
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOUserSavepoint.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOXASavepoint.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java44
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSavepoint.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOUserSavepoint.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOXASavepoint.java2
8 files changed, 65 insertions, 4 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOSavepoint.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOSavepoint.java
index 84af04e1de..d62d013278 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOSavepoint.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOSavepoint.java
@@ -11,6 +11,8 @@
package org.eclipse.emf.cdo.transaction;
import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
+import org.eclipse.emf.cdo.common.commit.CDOChangeSetDataProvider;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
@@ -20,8 +22,10 @@ import java.util.concurrent.ConcurrentMap;
/**
* @author Eike Stepper
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
*/
-public interface CDOSavepoint extends CDOUserSavepoint
+public interface CDOSavepoint extends CDOUserSavepoint, CDOChangeSetDataProvider
{
/**
* @since 3.0
@@ -99,4 +103,9 @@ public interface CDOSavepoint extends CDOUserSavepoint
* @since 3.0
*/
public Map<CDOID, CDORevisionDelta> getAllRevisionDeltas();
+
+ /**
+ * @since 3.1
+ */
+ public CDOChangeSetData getAllChangeSetData();
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOUserSavepoint.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOUserSavepoint.java
index 29de4a67c1..2c0b869416 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOUserSavepoint.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOUserSavepoint.java
@@ -19,6 +19,8 @@ package org.eclipse.emf.cdo.transaction;
*
* @author Simon McDuff
* @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
*/
public interface CDOUserSavepoint
{
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOXASavepoint.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOXASavepoint.java
index 48a3f5c00c..fc27d55556 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOXASavepoint.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOXASavepoint.java
@@ -15,6 +15,8 @@ import java.util.List;
/**
* @author Eike Stepper
* @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
*/
public interface CDOXASavepoint extends CDOUserSavepoint
{
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java
index d9b764cd91..276a7f0474 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java
@@ -13,11 +13,17 @@
package org.eclipse.emf.internal.cdo.transaction;
import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDeltaUtil;
+import org.eclipse.emf.cdo.internal.common.commit.CDOChangeSetDataImpl;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionDeltaImpl;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta;
@@ -28,12 +34,14 @@ import org.eclipse.emf.spi.cdo.InternalCDOSavepoint;
import org.eclipse.emf.spi.cdo.InternalCDOTransaction;
import org.eclipse.emf.spi.cdo.InternalCDOUserSavepoint;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.Map.Entry;
+import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -174,6 +182,40 @@ public class CDOSavepointImpl extends CDOUserSavepointImpl implements InternalCD
return revisionDeltas;
}
+ public CDOChangeSetData getChangeSetData()
+ {
+ return createChangeSetData(newObjects, revisionDeltas, detachedObjects);
+ }
+
+ public CDOChangeSetData getAllChangeSetData()
+ {
+ return createChangeSetData(getAllNewObjects(), getAllRevisionDeltas(), getAllDetachedObjects());
+ }
+
+ private CDOChangeSetData createChangeSetData(Map<CDOID, CDOObject> newObjects,
+ Map<CDOID, CDORevisionDelta> revisionDeltas, Map<CDOID, CDOObject> detachedObjects)
+ {
+ List<CDOIDAndVersion> newList = new ArrayList<CDOIDAndVersion>(newObjects.size());
+ for (CDOObject object : newObjects.values())
+ {
+ newList.add(object.cdoRevision());
+ }
+
+ List<CDORevisionKey> changedList = new ArrayList<CDORevisionKey>(revisionDeltas.size());
+ for (CDORevisionDelta delta : revisionDeltas.values())
+ {
+ changedList.add(delta);
+ }
+
+ List<CDOIDAndVersion> detachedList = new ArrayList<CDOIDAndVersion>(detachedObjects.size());
+ for (CDOID id : detachedObjects.keySet())
+ {
+ detachedList.add(CDOIDUtil.createIDAndVersion(id, CDOBranchVersion.UNSPECIFIED_VERSION));
+ }
+
+ return new CDOChangeSetDataImpl(newList, changedList, detachedList);
+ }
+
public Map<CDOID, CDORevision> getBaseNewObjects()
{
return baseNewObjects;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
index ad27cb7b0c..bb3c324491 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
@@ -320,8 +320,8 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
public CDOChangeSetData getChangeSetData()
{
- // TODO: implement CDOTransactionImpl.getChangeSet()
- throw new UnsupportedOperationException();
+ checkActive();
+ return lastSavepoint.getAllChangeSetData();
}
public CDOChangeSetData merge(CDOBranchPoint source, CDOMerger merger)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSavepoint.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSavepoint.java
index 5e6213f7d1..436aead064 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSavepoint.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSavepoint.java
@@ -18,6 +18,8 @@ import java.util.Set;
/**
* @author Eike Stepper
* @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
*/
public interface InternalCDOSavepoint extends CDOSavepoint, InternalCDOUserSavepoint
{
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOUserSavepoint.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOUserSavepoint.java
index d6bd349397..7de422c545 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOUserSavepoint.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOUserSavepoint.java
@@ -15,6 +15,8 @@ import org.eclipse.emf.cdo.transaction.CDOUserSavepoint;
/**
* @author Eike Stepper
* @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
*/
public interface InternalCDOUserSavepoint extends CDOUserSavepoint
{
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOXASavepoint.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOXASavepoint.java
index 3ec5f68611..2943a64ad5 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOXASavepoint.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOXASavepoint.java
@@ -18,6 +18,8 @@ import java.util.List;
/**
* @author Eike Stepper
* @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
*/
public interface InternalCDOXASavepoint extends CDOXASavepoint, InternalCDOUserSavepoint
{

Back to the top