summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-09-06 05:42:41 (EDT)
committerEike Stepper2007-09-06 05:42:41 (EDT)
commit6c9713c15f90684532a3dbabdc1165d611c14d8b (patch)
treeaed715cba7cdc02b98cc5f2e071967c115341c2c
parent333b4294eeed80807f54aa885f3821d8226466bb (diff)
downloadcdo-6c9713c15f90684532a3dbabdc1165d611c14d8b.zip
cdo-6c9713c15f90684532a3dbabdc1165d611c14d8b.tar.gz
cdo-6c9713c15f90684532a3dbabdc1165d611c14d8b.tar.bz2
[202063] Loading CDORevision chunks instead of CDOID chunks
https://bugs.eclipse.org/bugs/show_bug.cgi?id=202063
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java36
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java32
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadRevisionByTimeIndication.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadRevisionByVersionIndication.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadRevisionIndication.java58
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InvalidationTest.java13
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TDD.java4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java24
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java60
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java14
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionByTimeRequest.java17
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionByVersionRequest.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionRequest.java73
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ProxyResolverURIResourceMap.java2
14 files changed, 258 insertions, 99 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java
index 9d8beb1..a26811a 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java
@@ -10,6 +10,7 @@
**************************************************************************/
package org.eclipse.emf.cdo.internal.server;
+import org.eclipse.emf.cdo.internal.protocol.model.CDOClassRefImpl;
import org.eclipse.emf.cdo.internal.protocol.model.resource.CDOPathFeatureImpl;
import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionResolverImpl;
@@ -22,6 +23,8 @@ import org.eclipse.emf.cdo.server.IStoreWriter;
import org.eclipse.net4j.util.transaction.ITransaction;
import org.eclipse.net4j.util.transaction.ITransactionalOperation;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
/**
@@ -100,9 +103,39 @@ public class RevisionManager extends CDORevisionResolverImpl implements IRevisio
return revision;
}
+ @Override
+ protected List<CDORevisionImpl> loadRevisions(Collection<CDOID> ids, int referenceChunk)
+ {
+ IStoreReader storeReader = StoreUtil.getReader();
+ List<CDORevisionImpl> revisions = new ArrayList<CDORevisionImpl>();
+ for (CDOID id : ids)
+ {
+ CDORevisionImpl revision = (CDORevisionImpl)storeReader.readRevision(id, referenceChunk);
+ registerObjectType(revision);
+ }
+
+ return revisions;
+ }
+
+ @Override
+ protected List<CDORevisionImpl> loadRevisionsByTime(Collection<CDOID> ids, int referenceChunk, long timeStamp)
+ {
+ IStoreReader storeReader = StoreUtil.getReader();
+ List<CDORevisionImpl> revisions = new ArrayList<CDORevisionImpl>();
+ for (CDOID id : ids)
+ {
+ CDORevisionImpl revision = (CDORevisionImpl)storeReader.readRevisionByTime(id, referenceChunk, timeStamp);
+ registerObjectType(revision);
+ }
+
+ return revisions;
+ }
+
private void registerObjectType(CDORevisionImpl revision)
{
- repository.getTypeManager().registerObjectType(revision.getID(), revision.getCDOClass().createClassRef());
+ CDOID id = revision.getID();
+ CDOClassRefImpl type = revision.getCDOClass().createClassRef();
+ repository.getTypeManager().registerObjectType(id, type);
}
/**
@@ -137,4 +170,5 @@ public class RevisionManager extends CDORevisionResolverImpl implements IRevisio
{
}
}
+
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
index 572a8cc..c7b19df 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
@@ -11,6 +11,8 @@
package org.eclipse.emf.cdo.internal.server;
import org.eclipse.emf.cdo.internal.protocol.CDOIDImpl;
+import org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl;
+import org.eclipse.emf.cdo.internal.protocol.model.CDOFeatureImpl;
import org.eclipse.emf.cdo.internal.protocol.revision.CDOIDProvider;
import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
import org.eclipse.emf.cdo.internal.server.bundle.OM;
@@ -31,6 +33,7 @@ import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.lifecycle.ILifecycle;
import java.text.MessageFormat;
+import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
@@ -180,6 +183,35 @@ public class Session extends Container<IView> implements ISession, CDOIDProvider
return CDOIDImpl.create(id.getValue(), type);
}
+ /**
+ * TODO I can't see how recursion is controlled/limited
+ */
+ public void collectContainedRevisions(CDORevisionImpl revision, int referenceChunk,
+ Collection<CDORevisionImpl> containedRevisions)
+ {
+ RevisionManager revisionManager = getSessionManager().getRepository().getRevisionManager();
+ CDOClassImpl cdoClass = revision.getCDOClass();
+ CDOFeatureImpl[] features = cdoClass.getAllFeatures();
+ for (int i = 0; i < features.length; i++)
+ {
+ CDOFeatureImpl feature = features[i];
+ if (feature.isReference() && !feature.isMany() && feature.isContainment())
+ {
+ Object value = revision.getValue(feature);
+ if (value instanceof CDOID)
+ {
+ CDOID id = (CDOID)value;
+ if (!id.isNull())
+ {
+ CDORevisionImpl containedRevision = revisionManager.getRevision(id, referenceChunk);
+ containedRevisions.add(containedRevision);
+ collectContainedRevisions(containedRevision, referenceChunk, containedRevisions);
+ }
+ }
+ }
+ }
+ }
+
@Override
public String toString()
{
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadRevisionByTimeIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadRevisionByTimeIndication.java
index 89a9393..69b021f 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadRevisionByTimeIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadRevisionByTimeIndication.java
@@ -12,6 +12,7 @@ package org.eclipse.emf.cdo.internal.server.protocol;
import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
import org.eclipse.emf.cdo.internal.server.bundle.OM;
+import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.protocol.CDOProtocolConstants;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
@@ -43,15 +44,12 @@ public class LoadRevisionByTimeIndication extends LoadRevisionIndication
{
super.indicating(in);
timeStamp = in.readLong();
- if (PROTOCOL.isEnabled())
- {
- PROTOCOL.format("Read timeStamp: {0}", timeStamp);
- }
+ if (PROTOCOL.isEnabled()) PROTOCOL.format("Read timeStamp: {0}", timeStamp);
}
@Override
- protected CDORevisionImpl getRevision()
+ protected CDORevisionImpl getRevision(CDOID cdoID)
{
- return getRevisionManager().getRevisionByTime(id, referenceChunk, timeStamp);
+ return getRevisionManager().getRevisionByTime(cdoID, referenceChunk, timeStamp);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadRevisionByVersionIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadRevisionByVersionIndication.java
index d55aabd..e1ae9f8 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadRevisionByVersionIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadRevisionByVersionIndication.java
@@ -12,6 +12,7 @@ package org.eclipse.emf.cdo.internal.server.protocol;
import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
import org.eclipse.emf.cdo.internal.server.bundle.OM;
+import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.protocol.CDOProtocolConstants;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
@@ -44,14 +45,11 @@ public class LoadRevisionByVersionIndication extends LoadRevisionIndication
{
super.indicating(in);
version = in.readInt();
- if (PROTOCOL.isEnabled())
- {
- PROTOCOL.format("Read version: {0}", version);
- }
+ if (PROTOCOL.isEnabled()) PROTOCOL.format("Read version: {0}", version);
}
@Override
- protected CDORevisionImpl getRevision()
+ protected CDORevisionImpl getRevision(CDOID id)
{
return getRevisionManager().getRevisionByVersion(id, referenceChunk, version);
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadRevisionIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadRevisionIndication.java
index 3a9de59..1a4c5ef 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadRevisionIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadRevisionIndication.java
@@ -12,16 +12,18 @@ package org.eclipse.emf.cdo.internal.server.protocol;
import org.eclipse.emf.cdo.internal.protocol.CDOIDImpl;
import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
+import org.eclipse.emf.cdo.internal.server.Session;
import org.eclipse.emf.cdo.internal.server.bundle.OM;
import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.protocol.revision.CDORevision;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
/**
* @author Eike Stepper
@@ -30,7 +32,7 @@ public class LoadRevisionIndication extends CDOReadIndication
{
private static final ContextTracer PROTOCOL = new ContextTracer(OM.DEBUG_PROTOCOL, LoadRevisionIndication.class);
- protected CDOID id;
+ protected CDOID[] ids;
protected int referenceChunk;
@@ -47,40 +49,44 @@ public class LoadRevisionIndication extends CDOReadIndication
@Override
protected void indicating(ExtendedDataInputStream in) throws IOException
{
- id = CDOIDImpl.read(in);
- if (id.isTemporary())
- {
- id = CDOIDImpl.create(-id.getValue());
- if (PROTOCOL.isEnabled())
- {
- PROTOCOL.format("Read ID: {0}", id);
- }
+ referenceChunk = in.readInt();
+ if (PROTOCOL.isEnabled()) PROTOCOL.format("Read referenceChunk: {0}", referenceChunk);
- referenceChunk = in.readInt();
- if (PROTOCOL.isEnabled())
- {
- PROTOCOL.format("Read referenceChunk: {0}", referenceChunk);
- }
- }
- else
- {
- if (PROTOCOL.isEnabled())
- {
- PROTOCOL.format("Read ID: {0}", id);
- }
+ int size = in.readInt();
+ if (PROTOCOL.isEnabled()) PROTOCOL.format("Reading {0} IDs", size);
- referenceChunk = CDORevision.UNCHUNKED;
+ ids = new CDOID[size];
+ for (int i = 0; i < size; i++)
+ {
+ CDOID id = CDOIDImpl.read(in);
+ if (PROTOCOL.isEnabled()) PROTOCOL.format("Read ID: {0}", id);
+ ids[i] = id;
}
}
@Override
protected void responding(ExtendedDataOutputStream out) throws IOException
{
- CDORevisionImpl revision = getRevision();
- revision.write(out, getSession(), referenceChunk);
+ Session session = getSession();
+ List<CDORevisionImpl> containedRevisions = new ArrayList<CDORevisionImpl>(0);
+
+ if (PROTOCOL.isEnabled()) PROTOCOL.format("Writing {0} revisions", ids.length);
+ for (CDOID id : ids)
+ {
+ CDORevisionImpl revision = getRevision(id);
+ revision.write(out, session, referenceChunk);
+ session.collectContainedRevisions(revision, referenceChunk, containedRevisions);
+ }
+
+ out.writeInt(containedRevisions.size());
+ if (PROTOCOL.isEnabled()) PROTOCOL.format("Writing {0} additional revisions", containedRevisions.size());
+ for (CDORevisionImpl revision : containedRevisions)
+ {
+ revision.write(out, session, referenceChunk);
+ }
}
- protected CDORevisionImpl getRevision()
+ protected CDORevisionImpl getRevision(CDOID id)
{
return getRevisionManager().getRevision(id, referenceChunk);
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InvalidationTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InvalidationTest.java
index 6ed534e..31fca39 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InvalidationTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InvalidationTest.java
@@ -61,7 +61,7 @@ public class InvalidationTest extends AbstractCDOTest
category1A.getCategories().add(category2A);
category2A.getCategories().add(category3A);
- msg("Attaching transaction");
+ msg("Opening transaction");
final CDOTransaction transaction = session.openTransaction(new ResourceSetImpl());
msg("Creating resource");
@@ -75,11 +75,11 @@ public class InvalidationTest extends AbstractCDOTest
// ************************************************************* //
- msg("Attaching viewB");
- final CDOView viewB = session.openTransaction(new ResourceSetImpl());
+ msg("Opening view");
+ final CDOView view = session.openTransaction(new ResourceSetImpl());
msg("Loading resource");
- final CDOResource resourceB = viewB.getResource("/test1");
+ final CDOResource resourceB = view.getResource("/test1");
assertProxy(resourceB);
EList<EObject> contents = resourceB.getContents();
@@ -117,12 +117,13 @@ public class InvalidationTest extends AbstractCDOTest
transaction.commit();
msg("Checking after commit");
- boolean timedOut = new PollingTimeOuter(4, 100)
+ boolean timedOut = new PollingTimeOuter(200, 100)
{
@Override
protected boolean successful()
{
- return "CHANGED NAME".equals(category1B.getName());
+ String name = category1B.getName();
+ return "CHANGED NAME".equals(name);
}
}.timedOut();
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TDD.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TDD.java
index 401089e..f17027e 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TDD.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TDD.java
@@ -20,9 +20,9 @@ import java.lang.reflect.Method;
*/
public class TDD
{
- private static final AbstractOMTest test = new ChunkingTest();
+ private static final AbstractOMTest test = new InvalidationTest();
- private static final String METHOD_NAME = "testWriteNative";
+ private static final String METHOD_NAME = "testSeparateView";
public static void main(String[] args) throws Throwable
{
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java
index 9e945a8..f04432a 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java
@@ -17,7 +17,6 @@ import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl.MoveableLi
import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.protocol.model.CDOFeature;
import org.eclipse.emf.cdo.protocol.revision.CDOReferenceProxy;
-import org.eclipse.emf.cdo.protocol.revision.CDORevision;
import org.eclipse.emf.cdo.protocol.util.TransportException;
import org.eclipse.net4j.IChannel;
@@ -29,6 +28,7 @@ import org.eclipse.emf.internal.cdo.protocol.LoadRevisionByVersionRequest;
import org.eclipse.emf.internal.cdo.protocol.LoadRevisionRequest;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
/**
@@ -57,7 +57,7 @@ public class CDORevisionManagerImpl extends CDORevisionResolverImpl implements C
// Get appropriate chunk size
int chunkSize = session.getReferenceChunkSize();
- if (chunkSize == CDORevision.UNCHUNKED)
+ if (chunkSize == CDORevisionImpl.UNCHUNKED)
{
// Can happen if CDOSession.setReferenceChunkSize() was called meanwhile
chunkSize = Integer.MAX_VALUE;
@@ -204,22 +204,34 @@ public class CDORevisionManagerImpl extends CDORevisionResolverImpl implements C
@Override
protected CDORevisionImpl loadRevision(CDOID id, int referenceChunk)
{
- return sendLoadRequest(new LoadRevisionRequest(session.getChannel(), id, referenceChunk));
+ return send(new LoadRevisionRequest(session.getChannel(), id, referenceChunk)).get(0);
}
@Override
protected CDORevisionImpl loadRevisionByTime(CDOID id, int referenceChunk, long timeStamp)
{
- return sendLoadRequest(new LoadRevisionByTimeRequest(session.getChannel(), id, referenceChunk, timeStamp));
+ return send(new LoadRevisionByTimeRequest(session.getChannel(), id, referenceChunk, timeStamp)).get(0);
}
@Override
protected CDORevisionImpl loadRevisionByVersion(CDOID id, int referenceChunk, int version)
{
- return sendLoadRequest(new LoadRevisionByVersionRequest(session.getChannel(), id, referenceChunk, version));
+ return send(new LoadRevisionByVersionRequest(session.getChannel(), id, referenceChunk, version)).get(0);
}
- private CDORevisionImpl sendLoadRequest(LoadRevisionRequest request)
+ @Override
+ protected List<CDORevisionImpl> loadRevisions(Collection<CDOID> ids, int referenceChunk)
+ {
+ return send(new LoadRevisionRequest(session.getChannel(), ids, referenceChunk));
+ }
+
+ @Override
+ protected List<CDORevisionImpl> loadRevisionsByTime(Collection<CDOID> ids, int referenceChunk, long timeStamp)
+ {
+ return send(new LoadRevisionByTimeRequest(session.getChannel(), ids, referenceChunk, timeStamp));
+ }
+
+ private List<CDORevisionImpl> send(LoadRevisionRequest request)
{
try
{
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java
index 8374611..382987c 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java
@@ -12,7 +12,9 @@ package org.eclipse.emf.internal.cdo;
import org.eclipse.emf.cdo.internal.protocol.model.CDOFeatureImpl;
import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
+import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl.MoveableList;
import org.eclipse.emf.cdo.protocol.CDOID;
+import org.eclipse.emf.cdo.protocol.model.CDOFeature;
import org.eclipse.emf.cdo.protocol.revision.CDOReferenceProxy;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
@@ -27,6 +29,8 @@ import org.eclipse.emf.internal.cdo.util.FSMUtil;
import org.eclipse.emf.internal.cdo.util.ModelUtil;
import java.text.MessageFormat;
+import java.util.HashSet;
+import java.util.Set;
/**
* @author Eike Stepper
@@ -103,6 +107,59 @@ public final class CDOStore implements EStore
}
CDORevisionImpl revision = getRevisionForReading(cdoObject);
+ Object value = get(revision, cdoFeature, index);
+ if (cdoFeature.isReference())
+ {
+ if (cdoFeature.isMany() && value instanceof CDOID)
+ {
+ CDOID id = (CDOID)value;
+ loadAhead(revision, cdoFeature, id, index);
+ }
+
+ value = view.convertIDToObject(value);
+ }
+
+ return value;
+ }
+
+ private void loadAhead(CDORevisionImpl revision, CDOFeatureImpl cdoFeature, CDOID id, int index)
+ {
+ CDOSessionImpl session = view.getSession();
+ CDORevisionManagerImpl revisionManager = session.getRevisionManager();
+
+ int chunkSize = view.getLoadRevisionCollectionChunkSize();
+ if (chunkSize > 1 && !revisionManager.containsRevision(id))
+ {
+ MoveableList list = revision.getList(cdoFeature);
+ int fromIndex = index;
+ int toIndex = Math.min(index + chunkSize - 1, list.size());
+
+ Set<CDOID> notRegistered = new HashSet<CDOID>();
+ for (int i = fromIndex; i <= toIndex; i++)
+ {
+ Object element = list.get(i);
+ if (element instanceof CDOID)
+ {
+ if (!revisionManager.containsRevision((CDOID)element))
+ {
+ if (!notRegistered.contains(element))
+ {
+ notRegistered.add((CDOID)element);
+ }
+ }
+ }
+ }
+
+ if (!notRegistered.isEmpty())
+ {
+ int referenceChunk = session.getReferenceChunkSize();
+ revisionManager.getRevisions(notRegistered, referenceChunk);
+ }
+ }
+ }
+
+ private Object get(CDORevisionImpl revision, CDOFeature cdoFeature, int index)
+ {
Object result = revision.get(cdoFeature, index);
if (cdoFeature.isReference())
{
@@ -110,10 +167,7 @@ public final class CDOStore implements EStore
{
result = ((CDOReferenceProxy)result).resolve();
}
-
- result = ((CDOViewImpl)cdoObject.cdoView()).convertIDToObject(result);
}
-
return result;
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
index 8ef8291..0695148 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
@@ -81,10 +81,13 @@ public class CDOViewImpl extends org.eclipse.net4j.internal.util.event.Notifier
private InternalCDOObject lastLookupObject;
+ private int loadRevisionCollectionChunkSize;
+
public CDOViewImpl(int id, CDOSessionImpl session)
{
this.viewID = id;
this.session = session;
+ this.loadRevisionCollectionChunkSize = 1;
}
public int getViewID()
@@ -534,7 +537,6 @@ public class CDOViewImpl extends org.eclipse.net4j.internal.util.event.Notifier
if (dirtyObject != null)
{
CDOStateMachine.INSTANCE.invalidate(dirtyObject, timeStamp);
-
if (dirtyObjects != null && dirtyObject.eNotificationRequired())
{
dirtyObjects.add(dirtyObject);
@@ -780,4 +782,14 @@ public class CDOViewImpl extends org.eclipse.net4j.internal.util.event.Notifier
return MessageFormat.format("CDOViewResourcesEvent[{0}, {1}, {2}]", getView(), resourcePath, kind);
}
}
+
+ public int getLoadRevisionCollectionChunkSize()
+ {
+ return loadRevisionCollectionChunkSize;
+ }
+
+ public void setLoadRevisionCollectionChunkSize(int loadRevisionCollectionChunkSize)
+ {
+ this.loadRevisionCollectionChunkSize = loadRevisionCollectionChunkSize;
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionByTimeRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionByTimeRequest.java
index 4eb81f0..068eced 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionByTimeRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionByTimeRequest.java
@@ -20,6 +20,8 @@ import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
import org.eclipse.emf.internal.cdo.bundle.OM;
import java.io.IOException;
+import java.util.Collection;
+import java.util.Collections;
/**
* @author Eike Stepper
@@ -30,12 +32,17 @@ public class LoadRevisionByTimeRequest extends LoadRevisionRequest
private long timeStamp;
- public LoadRevisionByTimeRequest(IChannel channel, CDOID id, int referenceChunk, long timeStamp)
+ public LoadRevisionByTimeRequest(IChannel channel, Collection<CDOID> ids, int referenceChunk, long timeStamp)
{
- super(channel, id, referenceChunk);
+ super(channel, ids, referenceChunk);
this.timeStamp = timeStamp;
}
+ public LoadRevisionByTimeRequest(IChannel channel, CDOID id, int referenceChunk, long timeStamp)
+ {
+ this(channel, Collections.singleton(id), referenceChunk, timeStamp);
+ }
+
@Override
protected short getSignalID()
{
@@ -46,11 +53,7 @@ public class LoadRevisionByTimeRequest extends LoadRevisionRequest
protected void requesting(ExtendedDataOutputStream out) throws IOException
{
super.requesting(out);
- if (PROTOCOL.isEnabled())
- {
- PROTOCOL.format("Writing timeStamp: {0}", timeStamp);
- }
-
+ if (PROTOCOL.isEnabled()) PROTOCOL.format("Writing timeStamp: {0}", timeStamp);
out.writeLong(timeStamp);
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionByVersionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionByVersionRequest.java
index 93417bf..83541ae 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionByVersionRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionByVersionRequest.java
@@ -46,11 +46,7 @@ public class LoadRevisionByVersionRequest extends LoadRevisionRequest
protected void requesting(ExtendedDataOutputStream out) throws IOException
{
super.requesting(out);
- if (PROTOCOL.isEnabled())
- {
- PROTOCOL.format("Writing version: {0}", version);
- }
-
+ if (PROTOCOL.isEnabled()) PROTOCOL.format("Writing version: {0}", version);
out.writeInt(version);
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionRequest.java
index 3c7ffb6..2bb1195 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionRequest.java
@@ -14,7 +14,6 @@ import org.eclipse.emf.cdo.internal.protocol.CDOIDImpl;
import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.protocol.revision.CDORevision;
import org.eclipse.net4j.IChannel;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
@@ -27,25 +26,34 @@ import org.eclipse.emf.internal.cdo.CDOSessionPackageManager;
import org.eclipse.emf.internal.cdo.bundle.OM;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
/**
* @author Eike Stepper
*/
-public class LoadRevisionRequest extends CDOClientRequest<CDORevisionImpl>
+public class LoadRevisionRequest extends CDOClientRequest<List<CDORevisionImpl>>
{
private static final ContextTracer PROTOCOL = new ContextTracer(OM.DEBUG_PROTOCOL, LoadRevisionRequest.class);
- private CDOID id;
+ private Collection<CDOID> ids;
private int referenceChunk;
- public LoadRevisionRequest(IChannel channel, CDOID id, int referenceChunk)
+ public LoadRevisionRequest(IChannel channel, Collection<CDOID> ids, int referenceChunk)
{
super(channel);
- this.id = id;
+ this.ids = ids;
this.referenceChunk = referenceChunk;
}
+ public LoadRevisionRequest(IChannel channel, CDOID id, int referenceChunk)
+ {
+ this(channel, Collections.singleton(id), referenceChunk);
+ }
+
@Override
protected short getSignalID()
{
@@ -55,40 +63,45 @@ public class LoadRevisionRequest extends CDOClientRequest<CDORevisionImpl>
@Override
protected void requesting(ExtendedDataOutputStream out) throws IOException
{
- if (referenceChunk == CDORevision.UNCHUNKED)
- {
- if (PROTOCOL.isEnabled())
- {
- PROTOCOL.format("Writing ID: {0}", id);
- }
-
- CDOIDImpl.write(out, id);
- }
- else
- {
- if (PROTOCOL.isEnabled())
- {
- PROTOCOL.format("Writing ID: {0}", id);
- }
+ if (PROTOCOL.isEnabled()) PROTOCOL.format("Writing referenceChunk: {0}", referenceChunk);
+ out.writeInt(referenceChunk);
- CDOID negID = CDOIDImpl.create(-id.getValue());
- CDOIDImpl.write(out, negID);
+ if (PROTOCOL.isEnabled()) PROTOCOL.format("Writing {0} IDs", ids.size());
+ out.writeInt(ids.size());
- if (PROTOCOL.isEnabled())
- {
- PROTOCOL.format("Writing referenceChunk: {0}", referenceChunk);
- }
-
- out.writeInt(referenceChunk);
+ for (CDOID id : ids)
+ {
+ if (PROTOCOL.isEnabled()) PROTOCOL.format("Writing ID: {0}", id);
+ CDOIDImpl.write(out, id);
}
}
@Override
- protected CDORevisionImpl confirming(ExtendedDataInputStream in) throws IOException
+ public List<CDORevisionImpl> confirming(ExtendedDataInputStream in) throws IOException
{
CDOSessionImpl session = getSession();
CDORevisionManagerImpl revisionManager = session.getRevisionManager();
CDOSessionPackageManager packageManager = session.getPackageManager();
- return new CDORevisionImpl(in, revisionManager, packageManager);
+ ArrayList<CDORevisionImpl> revisions = new ArrayList<CDORevisionImpl>(ids.size());
+
+ if (PROTOCOL.isEnabled()) PROTOCOL.format("Reading {0} revisions", ids.size());
+ for (int i = 0; i < ids.size(); i++)
+ {
+ CDORevisionImpl revision = new CDORevisionImpl(in, revisionManager, packageManager);
+ revisions.add(revision);
+ }
+
+ int size = in.readInt();
+ if (size != 0)
+ {
+ if (PROTOCOL.isEnabled()) PROTOCOL.format("Reading {0} additional revisions", size);
+ for (int i = 0; i < size; i++)
+ {
+ CDORevisionImpl revision = new CDORevisionImpl(in, revisionManager, packageManager);
+ revisionManager.addRevision(revision);
+ }
+ }
+
+ return revisions;
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ProxyResolverURIResourceMap.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ProxyResolverURIResourceMap.java
index 76b9301..4fc363f 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ProxyResolverURIResourceMap.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ProxyResolverURIResourceMap.java
@@ -23,7 +23,7 @@ public final class ProxyResolverURIResourceMap implements Map<URI, Resource>
if (delegate == null)
{
delegate = new HashMap<URI, Resource>(); // TODO Cleanup of this lookup
- // cache?
+ // cache?
}
this.delegate = delegate;