summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaspar De Groot2010-01-21 05:02:46 (EST)
committerCaspar De Groot2010-01-21 05:02:46 (EST)
commite86bda6b5c650132daafa37b06ee8a66b4bd6911 (patch)
tree1ca346f4579d516194bbfa13d81b3d6475e68b1c
parentc4d8a68a13422e5aa2471179d42254fbd789df84 (diff)
downloadcdo-e86bda6b5c650132daafa37b06ee8a66b4bd6911.zip
cdo-e86bda6b5c650132daafa37b06ee8a66b4bd6911.tar.gz
cdo-e86bda6b5c650132daafa37b06ee8a66b4bd6911.tar.bz2
[270716] Provide support for branching
https://bugs.eclipse.org/bugs/show_bug.cgi?id=270716
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/AbstractSyncRevisionsRequest.java77
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocol.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockObjectsRequest.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SetPassiveUpdateRequest.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SyncRevisionsRequest.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/AbstractSyncRevisionsIndication.java115
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LockObjectsIndication.java22
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/SyncRevisionsIndication.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionProtocol.java9
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java50
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java15
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java28
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java9
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java3
14 files changed, 234 insertions, 139 deletions
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/AbstractSyncRevisionsRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/AbstractSyncRevisionsRequest.java
index 857a892..0069caa 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/AbstractSyncRevisionsRequest.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/AbstractSyncRevisionsRequest.java
@@ -13,6 +13,7 @@ package org.eclipse.emf.cdo.internal.net4j.protocol;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
@@ -36,6 +37,7 @@ import java.util.Collections;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
+import java.util.Map.Entry;
/**
* @author Simon McDuff
@@ -45,15 +47,15 @@ public abstract class AbstractSyncRevisionsRequest extends CDOClientRequest<Coll
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, AbstractSyncRevisionsRequest.class);
- protected Map<CDOID, CDOIDAndVersionAndBranch> idAndVersionAndBranches;
+ protected Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> refreshables;
protected int referenceChunk;
public AbstractSyncRevisionsRequest(CDOClientProtocol protocol, short signalID,
- Map<CDOID, CDOIDAndVersionAndBranch> idAndVersionAndBranches, int referenceChunk)
+ Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> refreshables, int referenceChunk)
{
super(protocol, signalID);
- this.idAndVersionAndBranches = idAndVersionAndBranches;
+ this.refreshables = refreshables;
this.referenceChunk = referenceChunk;
}
@@ -62,14 +64,25 @@ public abstract class AbstractSyncRevisionsRequest extends CDOClientRequest<Coll
{
if (TRACER.isEnabled())
{
- TRACER.trace("Synchronization " + idAndVersionAndBranches.size() + " objects"); //$NON-NLS-1$ //$NON-NLS-2$
+ TRACER.trace("Synchronization " + refreshables.size() + " objects"); //$NON-NLS-1$ //$NON-NLS-2$
}
out.writeInt(referenceChunk);
- out.writeInt(idAndVersionAndBranches.size());
- for (CDOIDAndVersionAndBranch idAndVersionAndBranch : idAndVersionAndBranches.values())
+ out.writeInt(refreshables.size());
+ for (Entry<CDOIDAndBranch, CDOIDAndVersionAndBranch> refreshable : refreshables.entrySet())
{
- out.writeCDOIDAndVersionAndBranch(idAndVersionAndBranch);
+ CDOIDAndBranch viewedIDandBranch = refreshable.getKey();
+ CDOIDAndVersionAndBranch usedIDandVersionAndBranch = refreshable.getValue();
+
+ // $$$ Remove this assertion
+ if (!viewedIDandBranch.getID().equals(usedIDandVersionAndBranch.getID()))
+ {
+ throw new IllegalStateException("Logic error");
+ }
+ out.writeCDOID(viewedIDandBranch.getID());
+ out.writeInt(viewedIDandBranch.getBranch().getID());
+ out.writeInt(usedIDandVersionAndBranch.getBranchID());
+ out.writeInt(usedIDandVersionAndBranch.getVersion());
}
}
@@ -82,22 +95,31 @@ public abstract class AbstractSyncRevisionsRequest extends CDOClientRequest<Coll
int dirtyCount = in.readInt();
for (int i = 0; i < dirtyCount; i++)
{
+ CDOIDAndBranch idAndBranch = in.readCDOIDAndBranch();
CDORevision revision = in.readCDORevision();
- long oldRevised = in.readLong();
- CDOBranchPoint branchPoint = CDOBranchUtil.createBranchPoint(revision.getBranch(), oldRevised);
+ long revisedTimestamp = in.readLong();
- CDOIDAndVersionAndBranch idAndVersionAndBranch = idAndVersionAndBranches.get(revision.getID());
- if (idAndVersionAndBranch == null)
+ // $$$ Fix
+ if (false)
{
- throw new IllegalStateException(MessageFormat.format(
- Messages.getString("SyncRevisionsRequest.2"), revision.getID())); //$NON-NLS-1$
+ // CDORevision revision = in.readCDORevision();
+ long oldRevised = in.readLong();
+ CDOBranchPoint branchPoint = CDOBranchUtil.createBranchPoint(revision.getBranch(), oldRevised);
+
+ CDOIDAndVersionAndBranch idAndVersionAndBranch = refreshables.get(revision.getID());
+ if (idAndVersionAndBranch == null)
+ {
+ throw new IllegalStateException(MessageFormat.format(
+ Messages.getString("SyncRevisionsRequest.2"), revision.getID())); //$NON-NLS-1$
+ }
+
+ CDORefreshContext refreshContext = getRefreshContext(refreshContexts, branchPoint);
+ Set<CDOIDAndVersion> dirtyObjects = refreshContext.getDirtyObjects();
+ dirtyObjects.add(CDOIDUtil
+ .createIDAndVersion(idAndVersionAndBranch.getID(), idAndVersionAndBranch.getVersion()));
+
+ revisionManager.addRevision(revision);
}
-
- CDORefreshContext refreshContext = getRefreshContext(refreshContexts, branchPoint);
- Set<CDOIDAndVersion> dirtyObjects = refreshContext.getDirtyObjects();
- dirtyObjects.add(CDOIDUtil.createIDAndVersion(idAndVersionAndBranch.getID(), idAndVersionAndBranch.getVersion()));
-
- revisionManager.addRevision(revision);
}
if (TRACER.isEnabled())
@@ -108,12 +130,19 @@ public abstract class AbstractSyncRevisionsRequest extends CDOClientRequest<Coll
int detachedCount = in.readInt();
for (int i = 0; i < detachedCount; i++)
{
- CDOID id = in.readCDOID();
- CDOBranchPoint branchPoint = in.readCDOBranchPoint();
+ CDOIDAndBranch idAndBranch = in.readCDOIDAndBranch();
+ long revisedTimestamp = in.readLong();
+
+ // $$$ Fix
+ if (false)
+ {
+ CDOID id = in.readCDOID();
+ CDOBranchPoint branchPoint = in.readCDOBranchPoint();
- CDORefreshContext refreshContext = getRefreshContext(refreshContexts, branchPoint);
- Collection<CDOID> detachedObjects = refreshContext.getDetachedObjects();
- detachedObjects.add(id);
+ CDORefreshContext refreshContext = getRefreshContext(refreshContexts, branchPoint);
+ Collection<CDOID> detachedObjects = refreshContext.getDetachedObjects();
+ detachedObjects.add(id);
+ }
}
if (TRACER.isEnabled())
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocol.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocol.java
index e07fe99..3e14fc8 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocol.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocol.java
@@ -14,6 +14,7 @@ import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
@@ -83,10 +84,10 @@ public class CDOClientProtocol extends SignalProtocol<CDOSession> implements CDO
return send(new OpenSessionRequest(this, repositoryName, passiveUpdateEnabled));
}
- public void setPassiveUpdate(Map<CDOID, CDOIDAndVersionAndBranch> idAndVersionAndBranches, int initialChunkSize,
+ public void setPassiveUpdate(Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData, int initialChunkSize,
boolean passiveUpdateEnabled)
{
- send(new SetPassiveUpdateRequest(this, idAndVersionAndBranches, initialChunkSize, passiveUpdateEnabled));
+ send(new SetPassiveUpdateRequest(this, revisionData, initialChunkSize, passiveUpdateEnabled));
}
public RepositoryTimeResult getRepositoryTime()
@@ -131,10 +132,10 @@ public class CDOClientProtocol extends SignalProtocol<CDOSession> implements CDO
return send(new LoadRevisionByVersionRequest(this, id, branchVersion, referenceChunk));
}
- public Collection<CDORefreshContext> syncRevisions(Map<CDOID, CDOIDAndVersionAndBranch> idAndVersionAndBranches,
+ public Collection<CDORefreshContext> syncRevisions(Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData,
int initialChunkSize)
{
- return send(new SyncRevisionsRequest(this, idAndVersionAndBranches, initialChunkSize));
+ return send(new SyncRevisionsRequest(this, revisionData, initialChunkSize));
}
public void openView(int viewID, CDOBranchPoint branchPoint, boolean readOnly)
@@ -174,15 +175,15 @@ public class CDOClientProtocol extends SignalProtocol<CDOSession> implements CDO
}
}
- public void lockObjects(CDOView view, Map<CDOID, CDOIDAndVersionAndBranch> objects, long timeout, LockType lockType)
- throws InterruptedException
+ public void lockObjects(CDOView view, Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData, long timeout,
+ LockType lockType) throws InterruptedException
{
InterruptedException interruptedException = null;
RuntimeException runtimeException = null;
try
{
- new LockObjectsRequest(this, view, objects, view.getSession().options().getCollectionLoadingPolicy()
+ new LockObjectsRequest(this, view, revisionData, view.getSession().options().getCollectionLoadingPolicy()
.getInitialChunkSize(), timeout, lockType).send();
}
catch (RemoteException ex)
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockObjectsRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockObjectsRequest.java
index a619ad8..4740e63 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockObjectsRequest.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockObjectsRequest.java
@@ -10,7 +10,7 @@
**************************************************************************/
package org.eclipse.emf.cdo.internal.net4j.protocol;
-import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
@@ -37,9 +37,9 @@ public class LockObjectsRequest extends SyncRevisionsRequest
private long timeout;
public LockObjectsRequest(CDOClientProtocol protocol, CDOView view,
- Map<CDOID, CDOIDAndVersionAndBranch> idAndVersionAndBranches, int referenceChunk, long timeout, LockType lockType)
+ Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData, int referenceChunk, long timeout, LockType lockType)
{
- super(protocol, CDOProtocolConstants.SIGNAL_LOCK_OBJECTS, idAndVersionAndBranches, referenceChunk);
+ super(protocol, CDOProtocolConstants.SIGNAL_LOCK_OBJECTS, revisionData, referenceChunk);
this.view = view;
this.timeout = timeout;
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SetPassiveUpdateRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SetPassiveUpdateRequest.java
index 5e08357..51c37c4 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SetPassiveUpdateRequest.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SetPassiveUpdateRequest.java
@@ -11,7 +11,7 @@
**************************************************************************/
package org.eclipse.emf.cdo.internal.net4j.protocol;
-import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
@@ -33,9 +33,9 @@ public class SetPassiveUpdateRequest extends SyncRevisionsRequest
private boolean passiveUpdateEnabled;
public SetPassiveUpdateRequest(CDOClientProtocol protocol,
- Map<CDOID, CDOIDAndVersionAndBranch> idAndVersionAndBranches, int referenceChunk, boolean passiveUpdateEnabled)
+ Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData, int referenceChunk, boolean passiveUpdateEnabled)
{
- super(protocol, CDOProtocolConstants.SIGNAL_PASSIVE_UPDATE, idAndVersionAndBranches, referenceChunk);
+ super(protocol, CDOProtocolConstants.SIGNAL_PASSIVE_UPDATE, revisionData, referenceChunk);
this.passiveUpdateEnabled = passiveUpdateEnabled;
}
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SyncRevisionsRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SyncRevisionsRequest.java
index 0de7e9c..d51f773 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SyncRevisionsRequest.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SyncRevisionsRequest.java
@@ -11,7 +11,7 @@
**************************************************************************/
package org.eclipse.emf.cdo.internal.net4j.protocol;
-import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
@@ -29,16 +29,16 @@ import java.util.Map;
*/
public class SyncRevisionsRequest extends AbstractSyncRevisionsRequest
{
- public SyncRevisionsRequest(CDOClientProtocol protocol, Map<CDOID, CDOIDAndVersionAndBranch> idAndVersionAndBranches,
+ public SyncRevisionsRequest(CDOClientProtocol protocol, Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> refreshables,
int referenceChunk)
{
- this(protocol, CDOProtocolConstants.SIGNAL_SYNC_REVISIONS, idAndVersionAndBranches, referenceChunk);
+ this(protocol, CDOProtocolConstants.SIGNAL_SYNC_REVISIONS, refreshables, referenceChunk);
}
public SyncRevisionsRequest(CDOClientProtocol protocol, short signalID,
- Map<CDOID, CDOIDAndVersionAndBranch> idAndVersionAndBranches, int referenceChunk)
+ Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> refreshables, int referenceChunk)
{
- super(protocol, signalID, idAndVersionAndBranches, referenceChunk);
+ super(protocol, signalID, refreshables, referenceChunk);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/AbstractSyncRevisionsIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/AbstractSyncRevisionsIndication.java
index 0390497..cc6a2b1 100644
--- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/AbstractSyncRevisionsIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/AbstractSyncRevisionsIndication.java
@@ -15,7 +15,8 @@ import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
+import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
import org.eclipse.emf.cdo.common.revision.CDORevision;
@@ -24,6 +25,7 @@ import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.net4j.util.collection.Pair;
+import org.eclipse.net4j.util.collection.Triplet;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import java.io.IOException;
@@ -37,9 +39,9 @@ public abstract class AbstractSyncRevisionsIndication extends CDOReadIndication
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, SyncRevisionsIndication.class);
- protected List<Pair<InternalCDORevision, Long>> dirtyObjects = new ArrayList<Pair<InternalCDORevision, Long>>();
+ protected List<Triplet<CDOIDAndBranch, InternalCDORevision, Long>> dirtyData = new ArrayList<Triplet<CDOIDAndBranch, InternalCDORevision, Long>>();
- protected List<Pair<CDOID, CDOBranchPoint>> detachedObjects = new ArrayList<Pair<CDOID, CDOBranchPoint>>();
+ protected List<Pair<CDOIDAndBranch, Long>> detachedData = new ArrayList<Pair<CDOIDAndBranch, Long>>();
protected int referenceChunk = CDORevision.UNCHUNKED;
@@ -55,7 +57,11 @@ public abstract class AbstractSyncRevisionsIndication extends CDOReadIndication
int size = in.readInt();
for (int i = 0; i < size; i++)
{
- process(in.readCDOIDAndVersionAndBranch());
+ CDOID id = in.readCDOID();
+ int viewBranchID = in.readInt();
+ int revisionBranchID = in.readInt();
+ int revisionVersion = in.readInt();
+ process(id, viewBranchID, revisionBranchID, revisionVersion);
}
}
@@ -64,63 +70,102 @@ public abstract class AbstractSyncRevisionsIndication extends CDOReadIndication
{
if (TRACER.isEnabled())
{
- TRACER.format("Sync found " + dirtyObjects.size() + " dirty objects"); //$NON-NLS-1$ //$NON-NLS-2$
+ TRACER.format("Sync found " + dirtyData.size() + " dirty objects"); //$NON-NLS-1$ //$NON-NLS-2$
}
- out.writeInt(dirtyObjects.size());
- for (Pair<InternalCDORevision, Long> revisionAndOldRevised : dirtyObjects)
+ out.writeInt(dirtyData.size());
+ for (Triplet<CDOIDAndBranch, InternalCDORevision, Long> triplet : dirtyData)
{
- out.writeCDORevision(revisionAndOldRevised.getElement1(), referenceChunk);
- out.writeLong(revisionAndOldRevised.getElement2());
+ out.writeCDOIDAndBranch(triplet.getElement1());
+ out.writeCDORevision(triplet.getElement2(), referenceChunk);
+ out.writeLong(triplet.getElement3());
}
- out.writeInt(detachedObjects.size());
- for (Pair<CDOID, CDOBranchPoint> idAndRevised : detachedObjects)
+ out.writeInt(detachedData.size());
+ for (Pair<CDOIDAndBranch, Long> pair : detachedData)
{
- out.writeCDOID(idAndRevised.getElement1());
- out.writeCDOBranchPoint(idAndRevised.getElement2());
+ out.writeCDOIDAndBranch(pair.getElement1());
+ out.writeLong(pair.getElement2());
}
}
- protected abstract void process(CDOIDAndVersionAndBranch idAndVersionAndBranch);
-
- protected void updateObjectList(CDOIDAndVersionAndBranch idAndVersionAndBranch)
+ protected abstract void process(CDOID id, int viewBranchID, int revisionBranchID, int revisionVersion);
+
+ /**
+ * @param id
+ * Some object's CDOID
+ * @param viewedBranchID
+ * The ID of the branch that the client is viewing the object in
+ * @param revisionBranchID
+ * The ID of the branch of the revision that the client is using for this object
+ * @param revisionVersion
+ * The version of the revision that the client is using for this object
+ */
+ protected void updateObjectList(CDOID id, int viewedBranchID, int revisionBranchID, int revisionVersion)
{
- CDOID id = idAndVersionAndBranch.getID();
- int version = idAndVersionAndBranch.getVersion();
- int branchID = idAndVersionAndBranch.getBranchID();
- CDOBranch branch = getRepository().getBranchManager().getBranch(branchID);
- CDOBranchPoint branchPoint = CDOBranchUtil.createBranchPoint(branch, CDORevision.UNSPECIFIED_DATE);
+ // Construct the branchPoint that expresses what the client is *viewing*
+ CDOBranch viewedBranch = getRepository().getBranchManager().getBranch(viewedBranchID);
+ CDOBranchPoint branchPoint = CDOBranchUtil.createBranchPoint(viewedBranch, CDORevision.UNSPECIFIED_DATE);
+
+ // Get the branch of the revision that the client is *using* to back the object
+ CDOBranch revisionBranch = getRepository().getBranchManager().getBranch(revisionBranchID);
try
{
- InternalCDORevision revision = (InternalCDORevision)getRepository().getRevisionManager().getRevision(id,
+ // Obtain the latest revision that can back the object that the client is viewing
+ InternalCDORevision latestServerRev = (InternalCDORevision)getRepository().getRevisionManager().getRevision(id,
branchPoint, referenceChunk, CDORevision.DEPTH_NONE, true);
- if (revision == null)
+
+ if (latestServerRev == null)
{
- long revisedTimestamp = getRevisedTimestamp(id, version, branch);
- CDOBranchPoint revisedBranchPoint = CDOBranchUtil.createBranchPoint(branch, revisedTimestamp);
- detachedObjects.add(new Pair<CDOID, CDOBranchPoint>(id, revisedBranchPoint));
+ addDetachedData(id, viewedBranch, revisionBranch, revisionVersion);
}
- else if (revision.getVersion() > version || version == CDORevision.UNSPECIFIED_VERSION)
+ else if (latestServerRev.getBranch().getID() != revisionBranchID
+ || latestServerRev.getVersion() > revisionVersion)
{
- dirtyObjects.add(new Pair<InternalCDORevision, Long>(revision, getRevisedTimestamp(id, version, branch)));
+ addDirtyData(id, viewedBranch, latestServerRev, revisionBranch, revisionVersion);
}
- else if (revision.getVersion() < version)
+ else if (latestServerRev.getBranch().getID() == revisionBranchID
+ && latestServerRev.getVersion() < revisionVersion)
{
- throw new IllegalStateException("The object " + revision.getID() + " has a lower version (" //$NON-NLS-1$ //$NON-NLS-2$
- + revision.getVersion() + ") in the repository than the version (" + version + ") submitted."); //$NON-NLS-1$ //$NON-NLS-2$
+ // Same branch but server's latest version is older than client's version -- impossible!
+ throw new IllegalStateException("The server's revision (" + latestServerRev + ") is on the same branch " //$NON-NLS-1$ //$NON-NLS-2$
+ + "as the client's (" + revisionVersion + "), yet has a smaller version number."); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ else
+ {
+ // $$$ Remove this else branch when all seems well
+ // $$$ It's only an assertion to ensure we cover all cases.
+ boolean _assert = latestServerRev.getBranch().getID() == revisionBranchID
+ && latestServerRev.getVersion() == revisionVersion;
+ if (!_assert)
+ {
+ throw new IllegalStateException("Server logic error");
+ }
}
}
catch (IllegalArgumentException revisionIsNullException)
{
- // $$$ Factor (these 3 lines copied from 102-104)
- long revisedTimestamp = getRevisedTimestamp(id, version, branch);
- CDOBranchPoint revisedBranchPoint = CDOBranchUtil.createBranchPoint(branch, revisedTimestamp);
- detachedObjects.add(new Pair<CDOID, CDOBranchPoint>(id, revisedBranchPoint));
+ addDetachedData(id, viewedBranch, revisionBranch, revisionVersion);
}
}
+ private void addDetachedData(CDOID id, CDOBranch viewedBranch, CDOBranch revisionBranch, int revisionVersion)
+ {
+ CDOIDAndBranch idAndBranch = CDOIDUtil.createIDAndBranch(id, viewedBranch);
+ long revisedTimestamp = getRevisedTimestamp(id, revisionVersion, revisionBranch);
+ detachedData.add(new Pair<CDOIDAndBranch, Long>(idAndBranch, revisedTimestamp));
+ }
+
+ private void addDirtyData(CDOID id, CDOBranch viewedBranch, InternalCDORevision latestServerRev,
+ CDOBranch revisionBranch, int revisionVersion)
+ {
+ CDOIDAndBranch idAndBranch = CDOIDUtil.createIDAndBranch(id, viewedBranch);
+ long revisedTimestamp = getRevisedTimestamp(id, revisionVersion, revisionBranch);
+ dirtyData
+ .add(new Triplet<CDOIDAndBranch, InternalCDORevision, Long>(idAndBranch, latestServerRev, revisedTimestamp));
+ }
+
protected long getRevisedTimestamp(CDOID id, int version, CDOBranch branch)
{
CDOBranchVersion branchVersion = CDOBranchUtil.createBranchVersion(branch, version);
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LockObjectsIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LockObjectsIndication.java
index 611111d..ffa2ad3 100644
--- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LockObjectsIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LockObjectsIndication.java
@@ -11,10 +11,9 @@
*/
package org.eclipse.emf.cdo.server.internal.net4j.protocol;
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
-import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
@@ -70,24 +69,27 @@ public class LockObjectsIndication extends AbstractSyncRevisionsIndication
{
for (CDOIDAndVersionAndBranch idAndVersionAndBranch : idAndVersionAndBranches)
{
- updateObjectList(idAndVersionAndBranch);
+ // $$$ Fix
+ // updateObjectList(idAndVersionAndBranch);
}
- if (!detachedObjects.isEmpty())
+ if (!detachedData.isEmpty())
{
getRepository().getLockManager().unlock(lockType, view, idAndBranches);
- throw new IllegalArgumentException(detachedObjects.size() + " objects are not persistent anymore"); //$NON-NLS-1$
+ throw new IllegalArgumentException(detachedData.size() + " objects are not persistent anymore"); //$NON-NLS-1$
}
super.responding(out);
}
@Override
- protected void process(CDOIDAndVersionAndBranch idAndVersionAndBranch)
+ protected void process(CDOID id, int viewBranchID, int revisionBranchID, int revisionVersion)
{
- CDOBranch branch = getRepository().getBranchManager().getBranch(idAndVersionAndBranch.getBranchID());
- idAndBranches.add(CDOIDUtil.createIDAndBranch(idAndVersionAndBranch.getID(), branch));
-
- idAndVersionAndBranches.add(idAndVersionAndBranch);
+ // $$$ Fix
+ /*
+ * CDOBranch branch = getRepository().getBranchManager().getBranch(idAndVersionAndBranch.getBranchID());
+ * idAndBranches.add(CDOIDUtil.createIDAndBranch(idAndVersionAndBranch.getID(), branch));
+ * idAndVersionAndBranches.add(idAndVersionAndBranch);
+ */
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/SyncRevisionsIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/SyncRevisionsIndication.java
index 4fd8033..59863ab 100644
--- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/SyncRevisionsIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/SyncRevisionsIndication.java
@@ -11,7 +11,7 @@
*/
package org.eclipse.emf.cdo.server.internal.net4j.protocol;
-import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
+import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
import org.eclipse.emf.cdo.server.IStoreAccessor;
@@ -53,11 +53,11 @@ public class SyncRevisionsIndication extends AbstractSyncRevisionsIndication
}
@Override
- protected void process(CDOIDAndVersionAndBranch idAndVersionAndBranch)
+ protected void process(CDOID id, int viewedBranchID, int revisionBranchID, int revisionVersion)
{
- if (idAndVersionAndBranch.getVersion() > 0) // $$$ What's this check for?
+ if (revisionVersion > 0) // $$$ What's this check for?
{
- updateObjectList(idAndVersionAndBranch);
+ updateObjectList(id, viewedBranchID, revisionBranchID, revisionVersion);
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionProtocol.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionProtocol.java
index e8444f8..d274fb6 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionProtocol.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionProtocol.java
@@ -14,6 +14,7 @@ import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDTemp;
import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
@@ -125,7 +126,7 @@ public class EmbeddedClientSessionProtocol extends Lifecycle implements CDOSessi
return result;
}
- public void setPassiveUpdate(Map<CDOID, CDOIDAndVersionAndBranch> idAndVersionAndBranches, int initialChunkSize,
+ public void setPassiveUpdate(Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData, int initialChunkSize,
boolean passiveUpdateEnabled)
{
// serverSessionProtocol.getSession().setPassiveUpdateEnabled(passiveUpdateEnabled);
@@ -180,7 +181,7 @@ public class EmbeddedClientSessionProtocol extends Lifecycle implements CDOSessi
}
}
- public Collection<CDORefreshContext> syncRevisions(Map<CDOID, CDOIDAndVersionAndBranch> allRevisions,
+ public Collection<CDORefreshContext> syncRevisions(Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData,
int initialChunkSize)
{
throw new UnsupportedOperationException();
@@ -272,8 +273,8 @@ public class EmbeddedClientSessionProtocol extends Lifecycle implements CDOSessi
throw new UnsupportedOperationException();
}
- public void lockObjects(CDOView view, Map<CDOID, CDOIDAndVersionAndBranch> objects, long timeout, LockType lockType)
- throws InterruptedException
+ public void lockObjects(CDOView view, Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData, long timeout,
+ LockType lockType) throws InterruptedException
{
throw new UnsupportedOperationException();
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
index e9c37c7..87af174 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
@@ -20,6 +20,7 @@ import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
@@ -479,14 +480,14 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
checkActive();
if (!options().isPassiveUpdateEnabled())
{
- Map<CDOID, CDOIDAndVersionAndBranch> allRevisions = getAllCDOIDAndVersionAndBranch();
+ Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData = getAllRevisionData();
try
{
- if (!allRevisions.isEmpty())
+ if (!revisionData.isEmpty())
{
int initialChunkSize = options().getCollectionLoadingPolicy().getInitialChunkSize();
- return getSessionProtocol().syncRevisions(allRevisions, initialChunkSize);
+ return getSessionProtocol().syncRevisions(revisionData, initialChunkSize);
}
}
catch (Exception ex)
@@ -878,26 +879,31 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
super.doDeactivate();
}
- private Map<CDOID, CDOIDAndVersionAndBranch> getAllCDOIDAndVersionAndBranch()
+ private Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> getAllRevisionData()
{
- Map<CDOID, CDOIDAndVersionAndBranch> uniqueObjects = new HashMap<CDOID, CDOIDAndVersionAndBranch>();
+ Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData = new HashMap<CDOIDAndBranch, CDOIDAndVersionAndBranch>();
+ // Map<CDOID, CDOIDAndVersionAndBranch> uniqueObjects = new HashMap<CDOID, CDOIDAndVersionAndBranch>();
for (InternalCDOView view : getViews())
{
- view.getCDOIDAndVersionAndBranch(uniqueObjects, Arrays.asList(view.getObjectsArray()));
+ view.getCDOIDAndVersionAndBranch(revisionData, Arrays.asList(view.getObjectsArray()));
}
- // Need to add Revision from revisionManager since we do not have all objects in view.
+ // Need to add current revisions from revisionManager that aren't in view
for (CDORevision revision : getRevisionManager().getCache().getCurrentRevisions())
{
- if (!uniqueObjects.containsKey(revision.getID()))
- {
+ CDOID id = revision.getID();
+ int revisionBranchID = revision.getBranch().getID();
+ int revisionVersion = revision.getVersion();
+ CDOIDAndVersionAndBranch ivb = CDOIDUtil.createIDAndVersionAndBranch(id, revisionVersion, revisionBranchID);
- uniqueObjects.put(revision.getID(), CDOIDUtil.createIDAndVersionAndBranch(revision.getID(), revision
- .getVersion(), revision.getBranch().getID()));
+ if (!revisionData.containsValue(ivb))
+ {
+ // $$$ Fix; how do we deal with these "unviewed" current revisions
+ // revisionData.put(???, ivb);
}
}
- return uniqueObjects;
+ return revisionData;
}
public static boolean isInvalidationRunnerActive()
@@ -962,11 +968,11 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
this.passiveUpdateEnabled = passiveUpdateEnabled;
// Need to refresh if we change state
- Map<CDOID, CDOIDAndVersionAndBranch> allRevisions = getAllCDOIDAndVersionAndBranch();
- if (!allRevisions.isEmpty())
+ Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData = getAllRevisionData();
+ if (!revisionData.isEmpty())
{
int initialChunkSize = collectionLoadingPolicy.getInitialChunkSize();
- getSessionProtocol().setPassiveUpdate(allRevisions, initialChunkSize, passiveUpdateEnabled);
+ getSessionProtocol().setPassiveUpdate(revisionData, initialChunkSize, passiveUpdateEnabled);
}
IListener[] listeners = getListeners();
@@ -1459,15 +1465,15 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
}
}
- public void lockObjects(CDOView view, Map<CDOID, CDOIDAndVersionAndBranch> objects, long timeout, LockType lockType)
- throws InterruptedException
+ public void lockObjects(CDOView view, Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData, long timeout,
+ LockType lockType) throws InterruptedException
{
int attempt = 0;
for (;;)
{
try
{
- delegate.lockObjects(view, objects, timeout, lockType);
+ delegate.lockObjects(view, revisionData, timeout, lockType);
return;
}
catch (Exception ex)
@@ -1494,7 +1500,7 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
}
}
- public void setPassiveUpdate(Map<CDOID, CDOIDAndVersionAndBranch> idAndVersionAndBranches, int initialChunkSize,
+ public void setPassiveUpdate(Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData, int initialChunkSize,
boolean passiveUpdateEnabled)
{
int attempt = 0;
@@ -1502,7 +1508,7 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
{
try
{
- delegate.setPassiveUpdate(idAndVersionAndBranches, initialChunkSize, passiveUpdateEnabled);
+ delegate.setPassiveUpdate(revisionData, initialChunkSize, passiveUpdateEnabled);
return;
}
catch (Exception ex)
@@ -1512,7 +1518,7 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
}
}
- public Collection<CDORefreshContext> syncRevisions(Map<CDOID, CDOIDAndVersionAndBranch> allRevisions,
+ public Collection<CDORefreshContext> syncRevisions(Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData,
int initialChunkSize)
{
int attempt = 0;
@@ -1520,7 +1526,7 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
{
try
{
- return delegate.syncRevisions(allRevisions, initialChunkSize);
+ return delegate.syncRevisions(revisionData, initialChunkSize);
}
catch (Exception ex)
{
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 527d18e..e88d26f 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
@@ -20,6 +20,7 @@ import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.common.commit.CDOCommit;
import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDProvider;
@@ -341,7 +342,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
}
@Override
- public void getCDOIDAndVersionAndBranch(Map<CDOID, CDOIDAndVersionAndBranch> uniqueObjects,
+ public void getCDOIDAndVersionAndBranch(Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData,
Collection<? extends CDOObject> cdoObjects)
{
Map<CDOID, CDORevisionDelta> deltaMap = getRevisionDeltas();
@@ -349,20 +350,20 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
{
CDORevision cdoRevision = CDOStateMachine.INSTANCE.readNoLoad((InternalCDOObject)cdoObject);
CDOID cdoId = cdoObject.cdoID();
- if (cdoRevision != null && !cdoId.isTemporary() && !uniqueObjects.containsKey(cdoId))
+ CDOIDAndBranch idAndBranch = CDOIDUtil.createIDAndBranch(cdoId, getBranch());
+ if (cdoRevision != null && !cdoId.isTemporary() && !revisionData.containsKey(idAndBranch))
{
- int version = cdoRevision.getVersion();
+ int revisionVersion = cdoRevision.getVersion();
if (deltaMap != null)
{
CDORevisionDelta delta = deltaMap.get(cdoId);
if (delta != null)
{
- version = delta.getVersion();
+ revisionVersion = delta.getVersion();
}
}
-
- int branchID = cdoRevision.getBranch().getID();
- uniqueObjects.put(cdoId, CDOIDUtil.createIDAndVersionAndBranch(cdoId, version, branchID));
+ int revisionBranchID = cdoRevision.getBranch().getID();
+ revisionData.put(idAndBranch, CDOIDUtil.createIDAndVersionAndBranch(cdoId, revisionVersion, revisionBranchID));
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java
index 7b8f651..7f89417 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java
@@ -18,6 +18,7 @@ import org.eclipse.emf.cdo.CDOState;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDMeta;
@@ -396,21 +397,24 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView
throws InterruptedException
{
checkActive();
- Map<CDOID, CDOIDAndVersionAndBranch> uniqueObjects = new HashMap<CDOID, CDOIDAndVersionAndBranch>();
- getCDOIDAndVersionAndBranch(uniqueObjects, objects);
+ Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData = new HashMap<CDOIDAndBranch, CDOIDAndVersionAndBranch>();
+ getCDOIDAndVersionAndBranch(revisionData, objects);
for (CDOObject object : objects)
{
- CDOIDAndVersionAndBranch idAndVersionAndBranch = uniqueObjects.get(object.cdoID());
+ CDOBranch viewedBranch = getBranch();
+ CDOIDAndBranch idAndBranch = CDOIDUtil.createIDAndBranch(object.cdoID(), viewedBranch);
+
+ CDOIDAndVersionAndBranch idAndVersionAndBranch = revisionData.get(object.cdoID());
if (idAndVersionAndBranch == null)
{
CDOID cdoID = object.cdoID();
int version = CDORevision.UNSPECIFIED_VERSION;
CDOIDAndVersionAndBranch ivb = CDOIDUtil.createIDAndVersionAndBranch(cdoID, version, getBranch().getID());
- uniqueObjects.put(object.cdoID(), ivb);
+ revisionData.put(idAndBranch, ivb);
}
}
- session.getSessionProtocol().lockObjects(this, uniqueObjects, timeout, lockType);
+ session.getSessionProtocol().lockObjects(this, revisionData, timeout, lockType);
}
/**
@@ -1603,18 +1607,22 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView
return getResourceSet();
}
- public void getCDOIDAndVersionAndBranch(Map<CDOID, CDOIDAndVersionAndBranch> uniqueObjects,
+ public void getCDOIDAndVersionAndBranch(Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData,
Collection<? extends CDOObject> cdoObjects)
{
for (CDOObject internalCDOObject : cdoObjects)
{
CDORevision cdoRevision = CDOStateMachine.INSTANCE.readNoLoad((InternalCDOObject)internalCDOObject);
CDOID cdoId = internalCDOObject.cdoID();
- if (cdoRevision != null && !uniqueObjects.containsKey(cdoId))
+
+ CDOBranch viewedBranch = getBranch();
+ CDOIDAndBranch idAndBranch = CDOIDUtil.createIDAndBranch(cdoId, viewedBranch);
+
+ if (cdoRevision != null && !revisionData.containsKey(idAndBranch))
{
- int version = cdoRevision.getVersion();
- int branchID = cdoRevision.getBranch().getID();
- uniqueObjects.put(cdoId, CDOIDUtil.createIDAndVersionAndBranch(cdoId, version, branchID));
+ int revisionVersion = cdoRevision.getVersion();
+ int revisionBranchID = cdoRevision.getBranch().getID();
+ revisionData.put(idAndBranch, CDOIDUtil.createIDAndVersionAndBranch(cdoId, revisionVersion, revisionBranchID));
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java
index 895b7f7..20df844 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java
@@ -13,6 +13,7 @@ package org.eclipse.emf.spi.cdo;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDProvider;
import org.eclipse.emf.cdo.common.id.CDOIDTemp;
@@ -51,7 +52,7 @@ import java.util.Set;
*/
public interface CDOSessionProtocol extends CDOProtocol, PackageLoader, BranchLoader, RevisionLoader
{
- public void setPassiveUpdate(Map<CDOID, CDOIDAndVersionAndBranch> idAndVersionAndBranches, int initialChunkSize,
+ public void setPassiveUpdate(Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData, int initialChunkSize,
boolean passiveUpdateEnabled);
public RepositoryTimeResult getRepositoryTime();
@@ -71,7 +72,7 @@ public interface CDOSessionProtocol extends CDOProtocol, PackageLoader, BranchLo
public Object loadChunk(InternalCDORevision revision, EStructuralFeature feature, int accessIndex, int fetchIndex,
int fromIndex, int toIndex);
- public Collection<CDORefreshContext> syncRevisions(Map<CDOID, CDOIDAndVersionAndBranch> allRevisions,
+ public Collection<CDORefreshContext> syncRevisions(Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData,
int initialChunkSize);
/**
@@ -98,8 +99,8 @@ public interface CDOSessionProtocol extends CDOProtocol, PackageLoader, BranchLo
/**
* @since 3.0
*/
- public void lockObjects(CDOView view, Map<CDOID, CDOIDAndVersionAndBranch> objects, long timeout, LockType lockType)
- throws InterruptedException;
+ public void lockObjects(CDOView view, Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData, long timeout,
+ LockType lockType) throws InterruptedException;
/**
* @since 3.0
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java
index 5def536..4aeca5a 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java
@@ -13,6 +13,7 @@ package org.eclipse.emf.spi.cdo;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.CDOState;
import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDProvider;
@@ -78,7 +79,7 @@ public interface InternalCDOView extends CDOView, CDOIDProvider, ILifecycle
/**
* @since 3.0
*/
- public void getCDOIDAndVersionAndBranch(Map<CDOID, CDOIDAndVersionAndBranch> uniqueObjects,
+ public void getCDOIDAndVersionAndBranch(Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData,
Collection<? extends CDOObject> cdoObjects);
public void handleChangeSubscription(Collection<CDORevisionDelta> deltas, Collection<CDOID> detachedObjects);