summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-01-19 13:07:17 (EST)
committerEike Stepper2008-01-19 13:07:17 (EST)
commit0854fd2b21a48f762649686f04b998dca92a0313 (patch)
tree212107b9447286a66e6df9867ac50bb57c4fc607
parentd7fe98ed474dd9250adc05b630053fd1af8ca844 (diff)
downloadcdo-0854fd2b21a48f762649686f04b998dca92a0313.zip
cdo-0854fd2b21a48f762649686f04b998dca92a0313.tar.gz
cdo-0854fd2b21a48f762649686f04b998dca92a0313.tar.bz2
[214752] Concurrency problem with getRevision()
https://bugs.eclipse.org/bugs/show_bug.cgi?id=214752
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java40
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStore.java126
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStoreAccessor.java71
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStoreChunkReader.java13
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/NOOPStore.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/NOOPStoreAccessor.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java20
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java21
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Store.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadRevisionIndication.java13
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepository.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStore.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreWriter.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/net4j/org/eclipse/net4j/tests/AbstractOMTest.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java38
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ChunkingTest.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ChunkingWithMEMTest.java79
-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.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransactionHandler.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectMerger.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java20
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/VerifyRevisionRequest.java6
27 files changed, 287 insertions, 252 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
index 0f3d19d..d742fdc 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
@@ -100,11 +100,13 @@ public class DBStore extends Store implements IDBStore
return schema;
}
+ @Override
public boolean hasAuditingSupport()
{
return true;
}
+ @Override
public boolean hasBranchingSupport()
{
return false;
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java
index f6d5f9f..fa849c1 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java
@@ -16,7 +16,6 @@ import org.eclipse.emf.cdo.internal.protocol.model.CDOFeatureImpl;
import org.eclipse.emf.cdo.internal.protocol.model.CDOPackageImpl;
import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
import org.eclipse.emf.cdo.protocol.CDOIDRange;
-import org.eclipse.emf.cdo.server.IStoreWriter;
import org.eclipse.emf.cdo.server.IView;
import org.eclipse.emf.cdo.server.db.IClassMapping;
import org.eclipse.emf.cdo.server.db.IDBStoreWriter;
@@ -27,7 +26,6 @@ import org.eclipse.net4j.db.DBException;
import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.ddl.IDBTable;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
-import org.eclipse.net4j.util.transaction.ITransaction;
import java.sql.PreparedStatement;
import java.sql.SQLException;
@@ -45,23 +43,6 @@ public class DBStoreWriter extends DBStoreReader implements IDBStoreWriter
super(store, view);
}
- @Override
- public void release() throws DBException
- {
- try
- {
- getConnection().commit();
- }
- catch (SQLException ex)
- {
- throw new DBException(ex);
- }
- finally
- {
- super.release();
- }
- }
-
public void writePackages(CDOPackageImpl... cdoPackages)
{
for (CDOPackageImpl cdoPackage : cdoPackages)
@@ -194,13 +175,30 @@ public class DBStoreWriter extends DBStoreReader implements IDBStoreWriter
mapping.writeRevision(this, revision);
}
- public void rollback(IView view, ITransaction<IStoreWriter> storeTransaction)
+ public void commit()
+ {
+ try
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Committing transaction: {0}", getView());
+ }
+
+ getConnection().commit();
+ }
+ catch (SQLException ex)
+ {
+ throw new DBException(ex);
+ }
+ }
+
+ public void rollback()
{
try
{
if (TRACER.isEnabled())
{
- TRACER.format("Rolling back transaction: {0}", view);
+ TRACER.format("Rolling back transaction: {0}", getView());
}
getConnection().rollback();
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStore.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStore.java
index 1f0db30..ab731f6 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStore.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStore.java
@@ -17,9 +17,13 @@ import org.eclipse.emf.cdo.server.ISession;
import org.eclipse.emf.cdo.server.IView;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
/**
* @author Simon McDuff
@@ -28,70 +32,120 @@ public class MEMStore extends Store
{
public static final String TYPE = "mem";
- private Map<CDOID, List<CDORevision>> mapOfRevisions = new HashMap<CDOID, List<CDORevision>>();
+ private Map<CDOID, List<CDORevision>> revisions = new HashMap<CDOID, List<CDORevision>>()
+ {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String toString()
+ {
+ List<Entry<CDOID, List<CDORevision>>> entries = new ArrayList<Entry<CDOID, List<CDORevision>>>(entrySet());
+ Collections.sort(entries, new Comparator<Entry<CDOID, List<CDORevision>>>()
+ {
+ public int compare(Entry<CDOID, List<CDORevision>> o1, Entry<CDOID, List<CDORevision>> o2)
+ {
+ return o1.getKey().compareTo(o2.getKey());
+ }
+ });
+
+ StringBuilder builder = new StringBuilder();
+ for (Entry<CDOID, List<CDORevision>> entry : entries)
+ {
+ builder.append(entry.getKey());
+ builder.append(" -->");
+ for (CDORevision revision : entry.getValue())
+ {
+ builder.append(" ");
+ builder.append(revision);
+ }
+
+ builder.append("\n");
+ }
+
+ return builder.toString();
+ }
+ };
public MEMStore()
{
super(TYPE);
}
- public synchronized CDORevision getRevision(CDOID rev)
+ public synchronized CDORevision getRevision(CDOID id)
{
- List<CDORevision> list = getList(rev);
- if (list.size() == 0)
+ List<CDORevision> list = revisions.get(id);
+ if (list != null)
{
- return null;
+ return list.get(list.size() - 1);
}
- return list.get(list.size() - 1);
+ return null;
}
- public synchronized List<CDORevision> getList(CDOID rev)
+ public synchronized CDORevision getRevisionByVersion(CDOID id, int version)
{
- List<CDORevision> list = mapOfRevisions.get(rev);
- if (list == null)
+ List<CDORevision> list = revisions.get(id);
+ if (list != null)
{
- list = new ArrayList<CDORevision>();
- mapOfRevisions.put(rev, list);
+ return getRevisionByVersion(list, version);
}
- return list;
+ return null;
}
- public synchronized CDORevision getRevision(CDOID rev, int version)
+ public synchronized void addRevision(CDORevision revision)
{
- List<CDORevision> list = getList(rev);
- for (CDORevision revision : list)
+ CDOID id = revision.getID();
+ List<CDORevision> list = revisions.get(id);
+ if (list == null)
{
- if (revision.getVersion() == version) return revision;
+ list = new ArrayList<CDORevision>();
+ revisions.put(id, list);
}
- return null;
+
+ CDORevision rev = getRevisionByVersion(list, revision.getVersion());
+ if (rev != null)
+ {
+ throw new IllegalStateException("Concurrent modification of revision " + rev);
+ }
+
+ list.add(revision);
}
- public synchronized void addRevision(CDORevision revision)
+ public synchronized boolean removeRevision(CDORevision revision)
{
- CDORevision rev = getRevision(revision.getID(), revision.getVersion());
- if (rev == null)
+ CDOID id = revision.getID();
+ List<CDORevision> list = revisions.get(id);
+ if (list == null)
{
- getList(revision.getID()).add(revision);
+ return false;
}
+
+ for (Iterator<CDORevision> it = list.iterator(); it.hasNext();)
+ {
+ CDORevision rev = it.next();
+ if (rev.getVersion() == revision.getVersion())
+ {
+ it.remove();
+ return true;
+ }
+ }
+
+ return false;
}
+ @Override
public boolean hasWriteDeltaSupport()
{
return true;
}
+ @Override
public boolean hasAuditingSupport()
{
return true;
}
- public boolean hasBranchingSupport()
- {
- return false;
- }
-
public void repairAfterCrash()
{
}
@@ -105,4 +159,24 @@ public class MEMStore extends Store
{
return new MEMStoreAccessor(this, view);
}
+
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ revisions.clear();
+ super.doDeactivate();
+ }
+
+ private CDORevision getRevisionByVersion(List<CDORevision> list, int version)
+ {
+ for (CDORevision revision : list)
+ {
+ if (revision.getVersion() == version)
+ {
+ return revision;
+ }
+ }
+
+ return null;
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStoreAccessor.java
index da73fe1..d80ab49 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStoreAccessor.java
@@ -18,7 +18,6 @@ import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.protocol.model.CDOClassRef;
import org.eclipse.emf.cdo.protocol.model.CDOFeature;
import org.eclipse.emf.cdo.protocol.model.CDOPackageInfo;
-import org.eclipse.emf.cdo.protocol.revision.CDODuplicateRevisionException;
import org.eclipse.emf.cdo.protocol.revision.CDORevision;
import org.eclipse.emf.cdo.server.ISession;
import org.eclipse.emf.cdo.server.IStoreChunkReader;
@@ -27,7 +26,6 @@ import org.eclipse.emf.cdo.server.IStoreWriter;
import org.eclipse.emf.cdo.server.IView;
import org.eclipse.net4j.util.io.CloseableIterator;
-import org.eclipse.net4j.util.transaction.ITransaction;
import java.util.ArrayList;
import java.util.Collection;
@@ -39,7 +37,7 @@ import java.util.List;
*/
public class MEMStoreAccessor extends StoreAccessor implements IStoreReader, IStoreWriter
{
- List<CDORevisionImpl> listToCommit = new ArrayList<CDORevisionImpl>();
+ List<CDORevision> newRevisions = new ArrayList<CDORevision>();
public MEMStoreAccessor(MEMStore store, ISession session)
{
@@ -84,23 +82,28 @@ public class MEMStoreAccessor extends StoreAccessor implements IStoreReader, ISt
public CDORevision readRevision(CDOID id, int referenceChunk)
{
- CDORevisionImpl revStore = (CDORevisionImpl)getStore().getRevision(id);
- CDORevisionImpl newRevision = new CDORevisionImpl(this.getStore().getRepository().getRevisionManager(), revStore
- .getCDOClass(), revStore.getID());
- newRevision.setResourceID(revStore.getResourceID());
-
- for (CDOFeature feature : revStore.getCDOClass().getAllFeatures())
- {
- if (feature.isMany())
- {
- newRevision.setListSize(feature, revStore.getList(feature).size());
- for (int i = 0; i < referenceChunk; i++)
- {
- newRevision.getList(feature).set(i, revStore.get(feature, i));
- }
- }
- }
- return newRevision;
+ CDORevisionImpl storeRevision = (CDORevisionImpl)getStore().getRevision(id);
+ // IRevisionManager revisionManager = getStore().getRepository().getRevisionManager();
+ // CDORevisionImpl newRevision = new CDORevisionImpl(revisionManager, storeRevision.getCDOClass(), storeRevision
+ // .getID());
+ // newRevision.setResourceID(storeRevision.getResourceID());
+ //
+ // for (CDOFeature feature : storeRevision.getCDOClass().getAllFeatures())
+ // {
+ // if (feature.isMany())
+ // {
+ // newRevision.setListSize(feature, storeRevision.getList(feature).size());
+ // MoveableList list = newRevision.getList(feature);
+ // int size = referenceChunk == CDORevision.UNCHUNKED ? list.size() : referenceChunk;
+ // for (int i = 0; i < size; i++)
+ // {
+ // list.set(i, storeRevision.get(feature, i));
+ // }
+ // }
+ // }
+ //
+ // return newRevision;
+ return storeRevision;
}
public CDORevision readRevisionByTime(CDOID id, int referenceChunk, long timeStamp)
@@ -129,32 +132,34 @@ public class MEMStoreAccessor extends StoreAccessor implements IStoreReader, ISt
public void writeRevision(CDORevisionImpl revision)
{
- getStore().addRevision(revision);
+ newRevisions.add(revision);
}
@Override
public void writeRevisionDelta(CDORevisionDeltaImpl delta)
{
- CDORevisionImpl revision2 = (CDORevisionImpl)getStore().getRevision(delta.getID());
- if (delta.getOriginVersion() != revision2.getVersion())
- {
- throw new CDODuplicateRevisionException(revision2);
- }
-
- CDORevisionImpl newRevision = new CDORevisionImpl(revision2);
+ CDORevisionImpl revision = (CDORevisionImpl)getStore().getRevision(delta.getID());
+ CDORevisionImpl newRevision = new CDORevisionImpl(revision);
delta.apply(newRevision);
- listToCommit.add(newRevision);
+ newRevisions.add(newRevision);
}
@Override
public void release()
{
- for (CDORevisionImpl rev : listToCommit)
- getStore().addRevision(rev);
+ newRevisions.clear();
+ }
+
+ public void commit()
+ {
+ MEMStore store = getStore();
+ for (CDORevision revision : newRevisions)
+ {
+ store.addRevision(revision);
+ }
}
- public void rollback(IView view, ITransaction<IStoreWriter> storeTransaction)
+ public void rollback()
{
- listToCommit.clear();
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStoreChunkReader.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStoreChunkReader.java
index 1f54d47..c1900d7 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStoreChunkReader.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStoreChunkReader.java
@@ -32,20 +32,19 @@ public class MEMStoreChunkReader extends StoreChunkReader
public List<Chunk> executeRead()
{
MEMStore store = getStoreReader().getStore();
- for (Chunk chunk : getChunks())
+ List<Chunk> chunks = getChunks();
+ for (Chunk chunk : chunks)
{
int startIndex = chunk.getStartIndex();
- int size = chunk.size();
- CDORevisionImpl revisionMEM = (CDORevisionImpl)store.getRevision(getRevision().getID());
-
- for (int i = 0; i < size; i++)
+ CDORevisionImpl revision = (CDORevisionImpl)store.getRevision(getRevision().getID());
+ for (int i = 0; i < chunk.size(); i++)
{
- Object object = revisionMEM.get(getFeature(), startIndex + i);
+ Object object = revision.get(getFeature(), startIndex + i);
chunk.addID(i, (CDOID)object);
}
}
- return this.getChunks();
+ return chunks;
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/NOOPStore.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/NOOPStore.java
index 9e5ac1a..dcb2c84 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/NOOPStore.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/NOOPStore.java
@@ -25,16 +25,12 @@ public class NOOPStore extends Store
super(TYPE);
}
+ @Override
public boolean hasAuditingSupport()
{
return true;
}
- public boolean hasBranchingSupport()
- {
- return false;
- }
-
public void repairAfterCrash()
{
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/NOOPStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/NOOPStoreAccessor.java
index d7be96e..0436818 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/NOOPStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/NOOPStoreAccessor.java
@@ -24,7 +24,6 @@ import org.eclipse.emf.cdo.server.IStoreWriter;
import org.eclipse.emf.cdo.server.IView;
import org.eclipse.net4j.util.io.CloseableIterator;
-import org.eclipse.net4j.util.transaction.ITransaction;
import java.util.Collection;
import java.util.Collections;
@@ -108,7 +107,11 @@ public class NOOPStoreAccessor extends StoreAccessor implements IStoreReader, IS
{
}
- public void rollback(IView view, ITransaction<IStoreWriter> storeTransaction)
+ public void commit()
+ {
+ }
+
+ public void rollback()
{
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
index 9644a67..2175602 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
@@ -31,18 +31,6 @@ import java.util.UUID;
*/
public class Repository extends Container<IRepositoryElement> implements IRepository
{
- public static final String PROP_OVERRIDE_UUID = "overrideUUID";
-
- public static final String PROP_SUPPORTING_REVISION_DELTAS = "supportingRevisionDeltas";
-
- public static final String PROP_SUPPORTING_AUDITS = "supportingAudits";
-
- public static final String PROP_VERIFYING_REVISIONS = "verifyingRevisions";
-
- public static final String PROP_CURRENT_LRU_CAPACITY = "currentLRUCapacity";
-
- public static final String PROP_REVISED_LRU_CAPACITY = "revisedLRUCapacity";
-
private static final long INITIAL_META_ID_VALUE = 1;
private String name;
@@ -99,7 +87,7 @@ public class Repository extends Container<IRepositoryElement> implements IReposi
{
if (uuid == null)
{
- String value = getProperties().get(PROP_OVERRIDE_UUID);
+ String value = getProperties().get(IRepository.PROP_OVERRIDE_UUID);
uuid = StringUtil.isEmpty(value) ? UUID.randomUUID().toString() : value;
}
@@ -125,7 +113,7 @@ public class Repository extends Container<IRepositoryElement> implements IReposi
{
if (supportingRevisionDeltas == null)
{
- String value = getProperties().get(PROP_SUPPORTING_REVISION_DELTAS);
+ String value = getProperties().get(IRepository.PROP_SUPPORTING_REVISION_DELTAS);
supportingRevisionDeltas = value == null ? false : Boolean.valueOf(value);
}
@@ -136,7 +124,7 @@ public class Repository extends Container<IRepositoryElement> implements IReposi
{
if (supportingAudits == null)
{
- String value = getProperties().get(PROP_SUPPORTING_AUDITS);
+ String value = getProperties().get(IRepository.PROP_SUPPORTING_AUDITS);
supportingAudits = value == null ? false : Boolean.valueOf(value);
}
@@ -147,7 +135,7 @@ public class Repository extends Container<IRepositoryElement> implements IReposi
{
if (verifyingRevisions == null)
{
- String value = getProperties().get(PROP_VERIFYING_REVISIONS);
+ String value = getProperties().get(IRepository.PROP_VERIFYING_REVISIONS);
verifyingRevisions = value == null ? false : Boolean.valueOf(value);
}
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 92efc3a..e8e790e 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
@@ -21,9 +21,9 @@ import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl.MoveableLi
import org.eclipse.emf.cdo.internal.protocol.revision.delta.CDORevisionDeltaImpl;
import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.protocol.model.CDOFeature;
-import org.eclipse.emf.cdo.protocol.revision.CDODuplicateRevisionException;
import org.eclipse.emf.cdo.protocol.revision.CDOReferenceProxy;
import org.eclipse.emf.cdo.protocol.revision.CDORevision;
+import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.server.IRevisionManager;
import org.eclipse.emf.cdo.server.IStoreChunkReader;
import org.eclipse.emf.cdo.server.IStoreReader;
@@ -42,10 +42,6 @@ import java.util.List;
*/
public class RevisionManager extends CDORevisionResolverImpl implements IRevisionManager
{
- public static final String PROP_CURRENT_LRU_CAPACITY = "currentLRUCapacity";
-
- public static final String PROP_REVISED_LRU_CAPACITY = "revisedLRUCapacity";
-
private Repository repository;
private CDOPathFeatureImpl cdoPathFeature;
@@ -257,8 +253,8 @@ public class RevisionManager extends CDORevisionResolverImpl implements IRevisio
protected void doBeforeActivate() throws Exception
{
super.doBeforeActivate();
- setCurrentLRUCapacity(getLRUCapacity(PROP_CURRENT_LRU_CAPACITY));
- setRevisedLRUCapacity(getLRUCapacity(PROP_REVISED_LRU_CAPACITY));
+ setCurrentLRUCapacity(getLRUCapacity(IRepository.PROP_CURRENT_LRU_CAPACITY));
+ setRevisedLRUCapacity(getLRUCapacity(IRepository.PROP_REVISED_LRU_CAPACITY));
}
protected int getLRUCapacity(String prop)
@@ -327,7 +323,7 @@ public class RevisionManager extends CDORevisionResolverImpl implements IRevisio
.getOriginVersion(), true);
if (oldRevision == null)
{
- throw new IllegalArgumentException("Cannot retrieve origin revision");
+ throw new IllegalStateException("Can not retrieve origin revision");
}
dirtyRevision = new CDORevisionImpl(oldRevision);
@@ -336,15 +332,6 @@ public class RevisionManager extends CDORevisionResolverImpl implements IRevisio
// Can throw an exception if duplicate
storeWriter.writeRevision(dirtyRevision);
}
-
- // Look if we already have it in our cache revision
- CDORevisionImpl currentVersion = getRevisionByVersion(revisionDelta.getID(), 0, revisionDelta.getDirtyVersion(),
- false);
-
- if (currentVersion != null)
- {
- throw new CDODuplicateRevisionException(currentVersion);
- }
}
public void phase2(IStoreWriter storeWriter)
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Store.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Store.java
index 3f5c171..444236b 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Store.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Store.java
@@ -77,4 +77,14 @@ public abstract class Store extends Lifecycle implements IStore
{
return false;
}
+
+ public boolean hasAuditingSupport()
+ {
+ return false;
+ }
+
+ public boolean hasBranchingSupport()
+ {
+ return false;
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java
index 2bd17a5..47379d6 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java
@@ -123,13 +123,15 @@ public class CommitTransactionIndication extends CDOServerIndication
writeRevisions(storeTransaction, dirtyObjects);
// addRevisions(storeTransaction, dirtyObjects);
+ storeWriter.commit();
storeTransaction.commit();
}
catch (RuntimeException ex)
{
OM.LOG.error(ex);
rollbackMessage = ex.getLocalizedMessage();
- storeWriter.rollback(view, storeTransaction);
+ storeWriter.rollback();
+ storeTransaction.rollback();
}
}
finally
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 22476d4..c99b480 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
@@ -116,7 +116,7 @@ public class LoadRevisionIndication extends CDOReadIndication
{
Session session = getSession();
List<CDORevisionImpl> additionalRevisions = new ArrayList<CDORevisionImpl>();
- Set<CDOID> revisions = new HashSet<CDOID>();
+ Set<CDOID> revisionIDs = new HashSet<CDOID>();
if (PROTOCOL.isEnabled())
{
PROTOCOL.format("Writing {0} revisions", ids.length);
@@ -124,7 +124,7 @@ public class LoadRevisionIndication extends CDOReadIndication
for (CDOID id : ids)
{
- revisions.add(id);
+ revisionIDs.add(id);
}
// Need to fetch the rule first.
@@ -133,11 +133,11 @@ public class LoadRevisionIndication extends CDOReadIndication
{
if (PROTOCOL.isEnabled())
{
- PROTOCOL.format("Collecting more objects based on rules");
+ PROTOCOL.format("Collecting more revisions based on rules");
}
CDORevisionImpl revisionContext = getRevision(contextID);
- collectRevisions(revisionContext, revisions, additionalRevisions, visitedFetchRules);
+ collectRevisions(revisionContext, revisionIDs, additionalRevisions, visitedFetchRules);
}
for (CDOID id : ids)
@@ -146,7 +146,7 @@ public class LoadRevisionIndication extends CDOReadIndication
revision.write(out, session, referenceChunk);
if (loadRevisionCollectionChunkSize > 0)
{
- collectRevisions(revision, revisions, additionalRevisions, visitedFetchRules);
+ collectRevisions(revision, revisionIDs, additionalRevisions, visitedFetchRules);
}
}
@@ -165,7 +165,8 @@ public class LoadRevisionIndication extends CDOReadIndication
protected CDORevisionImpl getRevision(CDOID id)
{
- return getRevisionManager().getRevision(id, referenceChunk);
+ RevisionManager revisionManager = getRevisionManager();
+ return revisionManager.getRevision(id, referenceChunk);
}
private void collectRevisions(CDORevisionImpl revision, Set<CDOID> revisions,
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java
index 10b2c59..8fff7d6 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java
@@ -52,6 +52,11 @@ public final class CDOServerUtil
container.putElement(RepositoryFactory.PRODUCT_GROUP, RepositoryFactory.TYPE, repository.getName(), repository);
}
+ public static IRepository getRepository(IManagedContainer container, String name)
+ {
+ return RepositoryFactory.get(container, name);
+ }
+
public static Element getRepositoryConfig(String repositoryName) throws ParserConfigurationException, SAXException,
IOException
{
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepository.java
index a015ed6..9f88c2f 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepository.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepository.java
@@ -19,6 +19,18 @@ import java.util.Map;
*/
public interface IRepository extends IContainer<IRepositoryElement>
{
+ public static final String PROP_OVERRIDE_UUID = "overrideUUID";
+
+ public static final String PROP_SUPPORTING_REVISION_DELTAS = "supportingRevisionDeltas";
+
+ public static final String PROP_SUPPORTING_AUDITS = "supportingAudits";
+
+ public static final String PROP_VERIFYING_REVISIONS = "verifyingRevisions";
+
+ public static final String PROP_CURRENT_LRU_CAPACITY = "currentLRUCapacity";
+
+ public static final String PROP_REVISED_LRU_CAPACITY = "revisedLRUCapacity";
+
public String getName();
public void setName(String name);
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStore.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStore.java
index f9c3611..caaccba 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStore.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStore.java
@@ -20,36 +20,36 @@ public interface IStore extends IRepositoryElement
public String getStoreType();
/**
- * Returns if this store supports the writing of modified revisions in terms of deltas.
+ * Returns if this store supports the writing of modified newRevisions in terms of deltas.
* <p>
* The contract includes that store implementations with write delta support must also implement
* {@link IStoreWriter#writeRevisionDelta(org.eclipse.emf.cdo.internal.protocol.revision.delta.CDORevisionDeltaImpl) IStoreWriter.writeRevisionDelta(CDORevisionDeltaImpl)}
* to not throw an <code>UnsupportedOperationException</code>.
*
- * @return <code>true</code> if this store supports the writing of modified revisions in terms of deltas,
+ * @return <code>true</code> if this store supports the writing of modified newRevisions in terms of deltas,
* <code>false</code> otherwise.
*/
public boolean hasWriteDeltaSupport();
/**
- * Returns if this store supports the retrieval of historical revisions.
+ * Returns if this store supports the retrieval of historical newRevisions.
* <p>
* The contract includes that store implementations with auditing support must also implement
* {@link IStoreReader#readRevisionByTime(org.eclipse.emf.cdo.protocol.CDOID, int, long) IStoreReader.readRevisionByTime(CDOID, int, long)}
* to not throw an <code>UnsupportedOperationException</code>.
*
- * @return <code>true</code> if this store supports the retrieval of historical revisions, <code>false</code>
+ * @return <code>true</code> if this store supports the retrieval of historical newRevisions, <code>false</code>
* otherwise.
*/
public boolean hasAuditingSupport();
/**
- * Returns if this store supports the storage of concurrent revisions in separate branches.
+ * Returns if this store supports the storage of concurrent newRevisions in separate branches.
* <p>
* Note: This is reserved for future use by the framework. There is currently no support for branching in the
* framework!
*
- * @return <code>true</code> if this store supports the storage of concurrent revisions in separate branches,
+ * @return <code>true</code> if this store supports the storage of concurrent newRevisions in separate branches,
* <code>false</code> otherwise.
*/
public boolean hasBranchingSupport();
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreWriter.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreWriter.java
index d9f3614..c9f5d61 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreWriter.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreWriter.java
@@ -21,8 +21,6 @@ import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.protocol.model.CDOClass;
import org.eclipse.emf.cdo.protocol.model.CDOFeature;
-import org.eclipse.net4j.util.transaction.ITransaction;
-
/**
* @author Eike Stepper
*/
@@ -46,12 +44,13 @@ public interface IStoreWriter extends IStoreReader
*/
public void writePackages(CDOPackageImpl... cdoPackages);
+ public CDOID primeNewObject(CDOClass cdoClass);
+
public void writeRevision(CDORevisionImpl revision);
public void writeRevisionDelta(CDORevisionDeltaImpl delta);
- public CDOID primeNewObject(CDOClass cdoClass);
+ public void commit();
- // TODO Remove storeTransaction parameter
- public void rollback(IView view, ITransaction<IStoreWriter> storeTransaction);
+ public void rollback();
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/net4j/org/eclipse/net4j/tests/AbstractOMTest.java b/plugins/org.eclipse.emf.cdo.tests/net4j/org/eclipse/net4j/tests/AbstractOMTest.java
index e296c6b..e20a413 100644
--- a/plugins/org.eclipse.emf.cdo.tests/net4j/org/eclipse/net4j/tests/AbstractOMTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/net4j/org/eclipse/net4j/tests/AbstractOMTest.java
@@ -105,11 +105,10 @@ public abstract class AbstractOMTest extends TestCase
{
}
- protected static void msg(String m)
+ protected static void msg(Object m)
{
if (consoleEnabled)
{
- IOUtil.OUT().println();
IOUtil.OUT().println("--> " + m);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java
index dc38067..001e632 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java
@@ -18,6 +18,7 @@ import org.eclipse.emf.cdo.internal.server.ContainerRepositoryProvider;
import org.eclipse.emf.cdo.internal.server.Repository;
import org.eclipse.emf.cdo.internal.server.StoreUtil;
import org.eclipse.emf.cdo.server.CDOServerUtil;
+import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.server.IStore;
import org.eclipse.emf.cdo.tests.model1.Model1Package;
import org.eclipse.emf.cdo.util.CDOUtil;
@@ -41,12 +42,6 @@ public abstract class AbstractCDOTest extends AbstractTransportTest
public static final String REPOSITORY_NAME = "repo1";
@Override
- protected boolean useJVMTransport()
- {
- return false;
- }
-
- @Override
protected IManagedContainer createContainer()
{
IManagedContainer container = super.createContainer();
@@ -56,11 +51,17 @@ public abstract class AbstractCDOTest extends AbstractTransportTest
return container;
}
+ protected IStore createStore()
+ {
+ return StoreUtil.createMEMStore();
+ }
+
protected Repository createRepository()
{
Map<String, String> props = new HashMap<String, String>();
- // props.put(RevisionManager.PROP_CURRENT_LRU_CAPACITY, "20");
- // props.put(RevisionManager.PROP_REVISED_LRU_CAPACITY, "20");
+ // props.put(IRepository.PROP_SUPPORTING_REVISION_DELTAS, "true");
+ // props.put(IRepository.PROP_CURRENT_LRU_CAPACITY, "20");
+ // props.put(IRepository.PROP_REVISED_LRU_CAPACITY, "20");
IStore store = createStore();
@@ -73,28 +74,11 @@ public abstract class AbstractCDOTest extends AbstractTransportTest
return repository;
}
- protected IStore createStore()
+ protected IRepository getRepository()
{
- return StoreUtil.createMEMStore();
+ return CDOServerUtil.getRepository(container, REPOSITORY_NAME);
}
- // protected DBStore createDBStore()
- // {
- // IMappingStrategy mappingStrategy = new HorizontalMappingStrategy();
- // IDBAdapter dbAdapter = new DerbyAdapter();
- //
- // Properties properties = new Properties();
- // properties.put("driverClass", "org.apache.derby.jdbc.EmbeddedDataSource");
- // properties.put("databaseName", "C:/temp/cdo-repo1");
- // properties.put("createDatabase", "create");
- // DataSource dataSource = DBUtil.createDataSource(properties);
- // ConnectionProvider connectionProvider = DBUtil.createConnectionProvider(dataSource);
- //
- // DBStore store = new DBStore(mappingStrategy, dbAdapter, connectionProvider);
- // mappingStrategy.setStore(store);
- // return store;
- // }
-
@Override
protected void doSetUp() throws Exception
{
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ChunkingTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ChunkingTest.java
index 0012d08..64d036b 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ChunkingTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ChunkingTest.java
@@ -17,8 +17,6 @@ import org.eclipse.emf.cdo.tests.model1.Customer;
import org.eclipse.emf.cdo.tests.model1.Model1Factory;
import org.eclipse.emf.cdo.tests.model1.SalesOrder;
-import org.eclipse.net4j.util.io.IOUtil;
-
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
@@ -76,9 +74,9 @@ public class ChunkingTest extends AbstractCDOTest
int i = 0;
for (Iterator<SalesOrder> it = salesOrders.iterator(); it.hasNext();)
{
- IOUtil.OUT().println(i++);
+ msg(i++);
SalesOrder salesOrder = it.next();
- IOUtil.OUT().println(salesOrder);
+ msg(salesOrder);
}
}
@@ -175,7 +173,7 @@ public class ChunkingTest extends AbstractCDOTest
resource.getContents().add(customer);
for (EObject element : resource.getContents())
{
- IOUtil.OUT().println(element);
+ msg(element);
}
transaction.commit();
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ChunkingWithMEMTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ChunkingWithMEMTest.java
index 4df5c3b..c205cfd 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ChunkingWithMEMTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ChunkingWithMEMTest.java
@@ -14,9 +14,7 @@ package org.eclipse.emf.cdo.tests;
import org.eclipse.emf.cdo.CDOSession;
import org.eclipse.emf.cdo.CDOTransaction;
import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.internal.server.MEMStore;
import org.eclipse.emf.cdo.internal.server.Repository;
-import org.eclipse.emf.cdo.internal.server.RepositoryFactory;
import org.eclipse.emf.cdo.internal.server.RevisionManager;
import org.eclipse.emf.cdo.protocol.revision.CDORevision;
import org.eclipse.emf.cdo.server.IStore;
@@ -24,8 +22,6 @@ import org.eclipse.emf.cdo.tests.model1.Customer;
import org.eclipse.emf.cdo.tests.model1.Model1Factory;
import org.eclipse.emf.cdo.tests.model1.SalesOrder;
-import org.eclipse.net4j.util.io.IOUtil;
-
import org.eclipse.emf.common.util.EList;
import java.util.HashMap;
@@ -37,33 +33,6 @@ import java.util.Map;
*/
public class ChunkingWithMEMTest extends AbstractCDOTest
{
- @Override
- protected IStore createStore()
- {
- return new MEMStore();
- }
-
- @Override
- protected Repository createRepository()
- {
- Map<String, String> props = new HashMap<String, String>();
- IStore store = createStore();
- Repository repository = new Repository()
- {
- @Override
- protected RevisionManager createRevisionManager()
- {
- return new TestRevisionManager(this);
- }
- };
-
- repository.setName(REPOSITORY_NAME);
- repository.setProperties(props);
- repository.setStore(store);
- store.setRepository(repository);
- return repository;
- }
-
public void testReadNative() throws Exception
{
CDORevision revisionToRemove = null;
@@ -94,14 +63,11 @@ public class ChunkingWithMEMTest extends AbstractCDOTest
msg("Committing");
transaction.commit();
+ session.close();
}
- // ************************************************************* //
- Repository repos = (Repository)container.getElement(RepositoryFactory.PRODUCT_GROUP, RepositoryFactory.TYPE,
- REPOSITORY_NAME);
- TestRevisionManager revManagerTest = (TestRevisionManager)repos.getRevisionManager();
- // Remove a specific version
- revManagerTest.removeRevision(revisionToRemove);
+ TestRevisionManager revisionManager = (TestRevisionManager)getRepository().getRevisionManager();
+ revisionManager.removeRevision(revisionToRemove);
msg("Opening session");
CDOSession session = openModel1Session();
@@ -117,10 +83,12 @@ public class ChunkingWithMEMTest extends AbstractCDOTest
int i = 0;
for (Iterator<SalesOrder> it = salesOrders.iterator(); it.hasNext();)
{
- IOUtil.OUT().println(i++);
+ msg(i++);
SalesOrder salesOrder = it.next();
- IOUtil.OUT().println(salesOrder);
+ msg(salesOrder);
}
+
+ session.close();
}
public void testWriteNative() throws Exception
@@ -154,14 +122,11 @@ public class ChunkingWithMEMTest extends AbstractCDOTest
msg("Committing");
transaction.commit();
revisionToRemove = customer.cdoRevision();
+ session.close();
}
- // ************************************************************* //
- Repository repos = (Repository)container.getElement(RepositoryFactory.PRODUCT_GROUP, RepositoryFactory.TYPE,
- REPOSITORY_NAME);
- TestRevisionManager revManagerTest = (TestRevisionManager)repos.getRevisionManager();
-
- revManagerTest.removeRevision(revisionToRemove);
+ TestRevisionManager revisionManager = (TestRevisionManager)getRepository().getRevisionManager();
+ revisionManager.removeRevision(revisionToRemove);
msg("Opening session");
CDOSession session = openModel1Session();
@@ -184,6 +149,30 @@ public class ChunkingWithMEMTest extends AbstractCDOTest
}
transaction.commit();
+ session.close();
+ }
+
+ @Override
+ protected Repository createRepository()
+ {
+ Map<String, String> props = new HashMap<String, String>();
+ // props.put(IRepository.PROP_SUPPORTING_REVISION_DELTAS, "true");
+
+ IStore store = createStore();
+ Repository repository = new Repository()
+ {
+ @Override
+ protected RevisionManager createRevisionManager()
+ {
+ return new TestRevisionManager(this);
+ }
+ };
+
+ repository.setName(REPOSITORY_NAME);
+ repository.setProperties(props);
+ repository.setStore(store);
+ store.setRepository(repository);
+ return repository;
}
/**
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 2d3723e..cfd1a36 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
@@ -21,9 +21,9 @@ import java.lang.reflect.Method;
*/
public class TDD
{
- private static final AbstractOMTest test = new InitialTest();
+ private static final AbstractOMTest test = new ChunkingWithMEMTest();
- private static final String METHOD_NAME = "testOpenSession";
+ private static final String METHOD_NAME = "testWriteNative";
public static void main(String[] args) throws Throwable
{
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
index 0c60282..16a408e 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
@@ -2141,7 +2141,7 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
{
try
{
- getSite().getShell().getDisplay().syncExec(new Runnable()
+ getSite().getShell().getDisplay().asyncExec(new Runnable()
{
public void run()
{
@@ -2168,7 +2168,7 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
{
try
{
- selectionViewer.getControl().getDisplay().syncExec(new Runnable()
+ selectionViewer.getControl().getDisplay().asyncExec(new Runnable()
{
public void run()
{
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransactionHandler.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransactionHandler.java
index 2dc6762..701f895 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransactionHandler.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransactionHandler.java
@@ -14,6 +14,8 @@ package org.eclipse.emf.cdo;
import org.eclipse.emf.cdo.protocol.revision.delta.CDOFeatureDelta;
/**
+ * TODO Enhance API: Return exceptions instead of letting them be thrown
+ *
* @author Eike Stepper
*/
public interface CDOTransactionHandler
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectMerger.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectMerger.java
index 7904374..4308a08 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectMerger.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectMerger.java
@@ -28,7 +28,7 @@ public class CDOObjectMerger extends CDORevisionMerger
public void merge(InternalCDOObject object, CDORevisionDelta delta)
{
CDORevisionImpl revision = new CDORevisionImpl((CDORevisionImpl)object.cdoRevision());
- revision.increaseVersion();
+ revision.setTransactional();
object.cdoInternalSetRevision(revision);
object.cdoInternalSetState(CDOState.DIRTY);
merge(revision, delta);
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 7ad2dd1..eccf56c 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.CDORevisionResolverImpl;
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.CDODuplicateRevisionException;
import org.eclipse.emf.cdo.protocol.revision.CDOReferenceProxy;
import org.eclipse.emf.cdo.protocol.revision.CDORevision;
import org.eclipse.emf.cdo.protocol.util.TransportException;
@@ -29,7 +28,6 @@ import org.eclipse.emf.internal.cdo.protocol.LoadRevisionByVersionRequest;
import org.eclipse.emf.internal.cdo.protocol.LoadRevisionRequest;
import org.eclipse.net4j.channel.IChannel;
-import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
import org.eclipse.net4j.internal.util.om.trace.PerfTracer;
import org.eclipse.net4j.signal.failover.IFailOverStrategy;
@@ -42,8 +40,6 @@ import java.util.List;
*/
public class CDORevisionManagerImpl extends CDORevisionResolverImpl implements CDORevisionManager
{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_REVISION, CDORevisionManagerImpl.class);
-
private static final PerfTracer LOADING = new PerfTracer(OM.PERF_REVISION_LOADING, CDORevisionManagerImpl.class);
private CDOSessionImpl session;
@@ -60,22 +56,6 @@ public class CDORevisionManagerImpl extends CDORevisionResolverImpl implements C
return session;
}
- @Override
- public void addRevision(CDORevisionImpl revision) throws CDODuplicateRevisionException
- {
- try
- {
- super.addRevision(revision);
- }
- catch (CDODuplicateRevisionException ignore)
- {
- if (TRACER.isEnabled())
- {
- TRACER.trace("Ignorable exception on client side", ignore);
- }
- }
- }
-
public CDOID resolveReferenceProxy(CDOReferenceProxy referenceProxy)
{
// Get proxy values
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java
index 6cae226..e583705 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java
@@ -441,8 +441,8 @@ public final class CDOStateMachine extends FiniteStateMachine<CDOState, CDOEvent
{
// Copy revision
CDORevisionImpl revision = new CDORevisionImpl((CDORevisionImpl)object.cdoRevision());
+ revision.setTransactional();
object.cdoInternalSetRevision(revision);
- revision.increaseVersion();
CDOViewImpl view = (CDOViewImpl)object.cdoView();
CDOTransactionImpl transaction = view.toTransaction();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/VerifyRevisionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/VerifyRevisionRequest.java
index ec61ab6..4f4e146 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/VerifyRevisionRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/VerifyRevisionRequest.java
@@ -62,8 +62,8 @@ public class VerifyRevisionRequest extends CDOClientRequest<List<CDORevisionImpl
{
PROTOCOL.format("Writing {0} IDs and versions", revisions.size());
}
- out.writeInt(revisions.size());
+ out.writeInt(revisions.size());
for (CDORevisionImpl revision : revisions)
{
CDOID id = revision.getID();
@@ -72,6 +72,7 @@ public class VerifyRevisionRequest extends CDOClientRequest<List<CDORevisionImpl
{
PROTOCOL.format("Writing ID and version: {0}v{1}", id, version);
}
+
CDOIDImpl.write(out, id);
out.writeInt(version);
}
@@ -81,11 +82,11 @@ public class VerifyRevisionRequest extends CDOClientRequest<List<CDORevisionImpl
protected List<CDORevisionImpl> confirming(ExtendedDataInputStream in) throws IOException
{
ArrayList<CDORevisionImpl> result = new ArrayList<CDORevisionImpl>();
-
if (PROTOCOL.isEnabled())
{
PROTOCOL.format("Reading {0} timeStamps", revisions.size());
}
+
for (CDORevisionImpl revision : revisions)
{
long revised = in.readLong();
@@ -93,6 +94,7 @@ public class VerifyRevisionRequest extends CDOClientRequest<List<CDORevisionImpl
{
PROTOCOL.format("Reading timeStamp: {0}", revised);
}
+
if (revised != CDORevision.UNSPECIFIED_DATE)
{
revision.setRevised(revised);