Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-10-17 05:34:11 +0000
committerEike Stepper2010-10-17 05:34:11 +0000
commite01c89c27d1555d5aeaa7a11bf617b3cd92c48bb (patch)
tree4d651a1af91b96737cc40c63b82581c404d03445 /plugins
parent72e09a3c9196e551d3316607cc0d9f35a8dc2cb1 (diff)
downloadcdo-e01c89c27d1555d5aeaa7a11bf617b3cd92c48bb.tar.gz
cdo-e01c89c27d1555d5aeaa7a11bf617b3cd92c48bb.tar.xz
cdo-e01c89c27d1555d5aeaa7a11bf617b3cd92c48bb.zip
[327984] Consolidate revision cache implementations
https://bugs.eclipse.org/bugs/show_bug.cgi?id=327984
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/db/CDOCommonDBUtil.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/cache/DBRevisionCache.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF55
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionCache.java (renamed from plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCache.java)18
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionCacheAdder.java (renamed from plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCacheAdder.java)8
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionCacheFactory.java (renamed from plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCacheFactory.java)5
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionUtil.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCacheUtil.java130
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheImpl.java (renamed from plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/branch/BranchRevisionCache.java)20
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionManagerImpl.java21
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/EvictionEventImpl.java (renamed from plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/EvictionEventImpl.java)6
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/NOOPRevisionCache.java (renamed from plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/noop/NOOPRevisionCache.java)8
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/branch/BranchDispatcher.java195
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/DLRevisionHolder.java61
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/DLRevisionList.java252
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionCache.java444
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionHolder.java76
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionList.java70
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/RevisionHolder.java129
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/mem/MEMRevisionCache.java408
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/two/TwoLevelRevisionCache.java239
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevisionManager.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionCache.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionManager.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/SyntheticCDORevision.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.hibernate.server/config/cdo-server-new.xml27
-rwxr-xr-xplugins/org.eclipse.emf.cdo.examples.hibernate.server/config/cdo-server.xml33
-rw-r--r--plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db4o/src/org/eclipse/emf/cdo/server/internal/db4o/DB4OStoreAccessor.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreAccessor.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/ObjectivityStoreAccessor.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/CDOExtentCreator.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/OCLQueryHandler.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSession.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStoreAccessor.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/RepositorySynchronizer.java2
-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/IStoreAccessor.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BranchingTest.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ImportXML.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionHolderTest.java237
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionManagerTest.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_246456_Test.java77
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_289984_Test.java43
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_292372_Test.java70
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/AbstractCDORevisionCacheTest.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/AbstractDBRevisionCacheTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/AllTestsCDORevisionCache.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/DefaultRevisionCacheTest.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/LRURevisionCacheTest.java34
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/MEMRevisionCacheTest.java36
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/CDOWorkspaceImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java5
57 files changed, 112 insertions, 2735 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/db/CDOCommonDBUtil.java b/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/db/CDOCommonDBUtil.java
index 4a929b1952..6cbcaaa2ee 100644
--- a/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/db/CDOCommonDBUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/db/CDOCommonDBUtil.java
@@ -15,8 +15,8 @@ import org.eclipse.emf.cdo.common.id.CDOIDProvider;
import org.eclipse.emf.cdo.common.internal.db.cache.DBRevisionCache;
import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
import org.eclipse.emf.cdo.common.revision.CDOListFactory;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.IDBConnectionProvider;
diff --git a/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/cache/DBRevisionCache.java b/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/cache/DBRevisionCache.java
index 9e84c853cd..2e6ccfe60e 100644
--- a/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/cache/DBRevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/cache/DBRevisionCache.java
@@ -27,8 +27,8 @@ import org.eclipse.emf.cdo.common.protocol.CDODataInput;
import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
import org.eclipse.emf.cdo.common.revision.CDOListFactory;
import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
import org.eclipse.emf.cdo.internal.common.protocol.CDODataInputImpl;
import org.eclipse.emf.cdo.internal.common.protocol.CDODataOutputImpl;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
@@ -87,11 +87,6 @@ public class DBRevisionCache extends Lifecycle implements InternalCDORevisionCac
throw new UnsupportedOperationException();
}
- public boolean isSupportingBranches()
- {
- return false;
- }
-
public CDOIDProvider getIDProvider()
{
return idProvider;
@@ -419,9 +414,8 @@ public class DBRevisionCache extends Lifecycle implements InternalCDORevisionCac
*
* @param revision
* the revision to add to this cache
- * @return true, if successful
*/
- public boolean addRevision(CDORevision revision)
+ public void addRevision(CDORevision revision)
{
CheckUtil.checkArg(revision, "revision");
Connection connection = null;
@@ -438,8 +432,6 @@ public class DBRevisionCache extends Lifecycle implements InternalCDORevisionCac
update = createUpdateRevisedStatement((InternalCDORevision)revision);
update.update(connection);
}
-
- return true;
}
catch (DBException e)
{
diff --git a/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF
index fb25de5545..c5fe7f603e 100644
--- a/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF
@@ -23,7 +23,6 @@ Export-Package: org.eclipse.emf.cdo.common;version="4.0.0",
org.eclipse.emf.cdo.common.model.lob;version="4.0.0",
org.eclipse.emf.cdo.common.protocol;version="4.0.0",
org.eclipse.emf.cdo.common.revision;version="4.0.0",
- org.eclipse.emf.cdo.common.revision.cache;version="4.0.0",
org.eclipse.emf.cdo.common.revision.delta;version="4.0.0",
org.eclipse.emf.cdo.common.util;version="4.0.0",
org.eclipse.emf.cdo.internal.common;version="4.0.0";
@@ -83,60 +82,6 @@ Export-Package: org.eclipse.emf.cdo.common;version="4.0.0",
org.eclipse.emf.cdo.server.net4j,
org.eclipse.emf.cdo.ui,
org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.internal.common.revision.cache;version="4.0.0";
- x-friends:="org.eclipse.emf.cdo.common,
- org.eclipse.emf.cdo.common.db,
- org.eclipse.emf.cdo,
- org.eclipse.emf.cdo.net4j,
- org.eclipse.emf.cdo.server,
- org.eclipse.emf.cdo.server.net4j,
- org.eclipse.emf.cdo.ui,
- org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.internal.common.revision.cache.branch;version="4.0.0";
- x-friends:="org.eclipse.emf.cdo.common,
- org.eclipse.emf.cdo.common.db,
- org.eclipse.emf.cdo,
- org.eclipse.emf.cdo.net4j,
- org.eclipse.emf.cdo.server,
- org.eclipse.emf.cdo.server.net4j,
- org.eclipse.emf.cdo.ui,
- org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.internal.common.revision.cache.lru;version="4.0.0";
- x-friends:="org.eclipse.emf.cdo.common,
- org.eclipse.emf.cdo.common.db,
- org.eclipse.emf.cdo,
- org.eclipse.emf.cdo.net4j,
- org.eclipse.emf.cdo.server,
- org.eclipse.emf.cdo.server.net4j,
- org.eclipse.emf.cdo.ui,
- org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.internal.common.revision.cache.mem;version="4.0.0";
- x-friends:="org.eclipse.emf.cdo.common,
- org.eclipse.emf.cdo.common.db,
- org.eclipse.emf.cdo,
- org.eclipse.emf.cdo.net4j,
- org.eclipse.emf.cdo.server,
- org.eclipse.emf.cdo.server.net4j,
- org.eclipse.emf.cdo.ui,
- org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.internal.common.revision.cache.noop;version="4.0.0";
- x-friends:="org.eclipse.emf.cdo.common,
- org.eclipse.emf.cdo.common.db,
- org.eclipse.emf.cdo,
- org.eclipse.emf.cdo.net4j,
- org.eclipse.emf.cdo.server,
- org.eclipse.emf.cdo.server.net4j,
- org.eclipse.emf.cdo.ui,
- org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.internal.common.revision.cache.two;version="4.0.0";
- x-friends:="org.eclipse.emf.cdo.common,
- org.eclipse.emf.cdo.common.db,
- org.eclipse.emf.cdo,
- org.eclipse.emf.cdo.net4j,
- org.eclipse.emf.cdo.server,
- org.eclipse.emf.cdo.server.net4j,
- org.eclipse.emf.cdo.ui,
- org.eclipse.emf.cdo.tests",
org.eclipse.emf.cdo.internal.common.revision.delta;version="4.0.0";
x-friends:="org.eclipse.emf.cdo.common,
org.eclipse.emf.cdo.common.db,
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionCache.java
index 73a8b614d8..d18f44ec4d 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionCache.java
@@ -8,15 +8,12 @@
* Contributors:
* Eike Stepper - initial API and implementation
*/
-package org.eclipse.emf.cdo.common.revision.cache;
+package org.eclipse.emf.cdo.common.revision;
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.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-import org.eclipse.emf.cdo.internal.common.revision.cache.mem.MEMRevisionCache;
-import org.eclipse.emf.cdo.internal.common.revision.cache.noop.NOOPRevisionCache;
+import org.eclipse.emf.cdo.internal.common.revision.NOOPRevisionCache;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.INotifier;
@@ -27,20 +24,15 @@ import java.util.List;
/**
* @author Eike Stepper
- * @since 2.0
+ * @since 4.0
*/
-public interface CDORevisionCache extends INotifier
+public interface CDORevisionCache extends CDORevisionCacheAdder, INotifier
{
/**
* @since 3.0
*/
public static final CDORevisionCache NOOP = NOOPRevisionCache.INSTANCE;
- /**
- * @since 3.0
- */
- public boolean isSupportingBranches();
-
public EClass getObjectType(CDOID id);
/**
@@ -71,7 +63,7 @@ public interface CDORevisionCache extends INotifier
public CDORevisionCache getSource();
/**
- * May be <code>null</code> for certain cache implementations, e.g. {@link MEMRevisionCache}.
+ * May be <code>null</code> for certain cache implementations.
*
* @since 3.0
*/
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCacheAdder.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionCacheAdder.java
index c877519337..1302c892c8 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCacheAdder.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionCacheAdder.java
@@ -8,15 +8,13 @@
* Contributors:
* Eike Stepper - initial API and implementation
*/
-package org.eclipse.emf.cdo.common.revision.cache;
-
-import org.eclipse.emf.cdo.common.revision.CDORevision;
+package org.eclipse.emf.cdo.common.revision;
/**
* @author Eike Stepper
- * @since 3.0
+ * @since 4.0
*/
public interface CDORevisionCacheAdder
{
- public boolean addRevision(CDORevision revision);
+ public void addRevision(CDORevision revision);
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCacheFactory.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionCacheFactory.java
index 1191874734..6deec1d303 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCacheFactory.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionCacheFactory.java
@@ -8,14 +8,13 @@
* Contributors:
* Eike Stepper - initial API and implementation
*/
-package org.eclipse.emf.cdo.common.revision.cache;
+package org.eclipse.emf.cdo.common.revision;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
/**
* @author Eike Stepper
- * @since 3.0
+ * @since 4.0
*/
public interface CDORevisionCacheFactory
{
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionUtil.java
index 9c841e82b3..0b842c10b4 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionUtil.java
@@ -14,10 +14,10 @@ import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
import org.eclipse.emf.cdo.internal.common.messages.Messages;
import org.eclipse.emf.cdo.internal.common.revision.CDOFeatureMapEntryImpl;
+import org.eclipse.emf.cdo.internal.common.revision.CDORevisionCacheImpl;
import org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl;
import org.eclipse.emf.cdo.internal.common.revision.CDORevisionKeyImpl;
import org.eclipse.emf.cdo.internal.common.revision.CDORevisionManagerImpl;
@@ -47,6 +47,16 @@ public final class CDORevisionUtil
}
/**
+ * Creates and returns a new memory sensitive revision cache that supports branches.
+ *
+ * @since 4.0
+ */
+ public static CDORevisionCache createRevisionCache()
+ {
+ return new CDORevisionCacheImpl();
+ }
+
+ /**
* @since 4.0
*/
public static CDORevisionManager createRevisionManager()
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCacheUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCacheUtil.java
deleted file mode 100644
index c95900fad2..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCacheUtil.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/**
- * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.common.revision.cache;
-
-import org.eclipse.emf.cdo.internal.common.revision.cache.branch.BranchDispatcher;
-import org.eclipse.emf.cdo.internal.common.revision.cache.branch.BranchRevisionCache;
-import org.eclipse.emf.cdo.internal.common.revision.cache.lru.LRURevisionCache;
-import org.eclipse.emf.cdo.internal.common.revision.cache.mem.MEMRevisionCache;
-import org.eclipse.emf.cdo.internal.common.revision.cache.two.TwoLevelRevisionCache;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- */
-public final class CDORevisionCacheUtil
-{
- public static final int DEFAULT_CAPACITY_CURRENT = 1000;
-
- public static final int DEFAULT_CAPACITY_REVISED = 1000;
-
- private CDORevisionCacheUtil()
- {
- }
-
- /**
- * Creates and returns a new fixed size cache with two separate LRU (least-recently used) eviction policies for both
- * current revision and revised revisions.
- *
- * @deprecated Use createBranchRevisionCache() instead.
- */
- @Deprecated
- public static CDORevisionCache createLRUCache(int capacityCurrent, int capacityRevised)
- {
- LRURevisionCache cache = new LRURevisionCache();
- cache.setCapacityCurrent(capacityCurrent);
- cache.setCapacityRevised(capacityRevised);
- return cache;
- }
-
- /**
- * Creates and returns a new memory sensitive cache.
- *
- * @deprecated Use createBranchRevisionCache() instead.
- */
- @Deprecated
- public static CDORevisionCache createMEMCache()
- {
- return new MEMRevisionCache();
- }
-
- /**
- * Creates and returns a new two-level cache.
- */
- public static CDORevisionCache createTwoLevelCache(CDORevisionCache level1, CDORevisionCache level2)
- {
- TwoLevelRevisionCache cache = new TwoLevelRevisionCache();
- cache.setLevel1((InternalCDORevisionCache)level1);
- cache.setLevel2((InternalCDORevisionCache)level2);
- return cache;
- }
-
- /**
- * Creates and returns a new memory sensitive revision cache that supports branches.
- *
- * @since 3.0
- */
- public static CDORevisionCache createBranchRevisionCache()
- {
- return new BranchRevisionCache();
- }
-
- /**
- * Creates and returns a new branch dispatcher cache.
- *
- * @since 3.0
- */
- public static CDORevisionCache createBranchDispatcher(CDORevisionCacheFactory factory)
- {
- BranchDispatcher cache = new BranchDispatcher();
- cache.setFactory(factory);
- return cache;
- }
-
- /**
- * Creates and returns a new branch dispatcher cache.
- *
- * @since 3.0
- */
- public static CDORevisionCache createBranchDispatcher(CDORevisionCache protoType)
- {
- BranchDispatcher cache = new BranchDispatcher();
- cache.setFactory(new CDORevisionCacheFactory.PrototypeInstantiator(protoType));
- return cache;
- }
-
- /**
- * Creates and returns a new two-level cache with the first level being an LRU cache and the second level being a
- * memory sensitive cache.
- */
- public static CDORevisionCache createDefaultCache(int capacityCurrent, int capacityRevised)
- {
- return createTwoLevelCache(createLRUCache(capacityCurrent, capacityRevised), createMEMCache());
- }
-
- /**
- * Identical to calling {@link #createBranchRevisionCache() createBranchRevisionCache()} if
- * <code>supportingBranches</code> is <code>true</code>, {@link #createDefaultCache(int, int)
- * createDefaultCache(DEFAULT_CAPACITY_CURRENT, DEFAULT_CAPACITY_REVISED)} otherwise.
- *
- * @since 3.0
- */
- public static CDORevisionCache createDefaultCache(boolean supportingBranches)
- {
- // if (supportingBranches)
- {
- return createBranchRevisionCache();
- }
-
- // return createDefaultCache(DEFAULT_CAPACITY_CURRENT, DEFAULT_CAPACITY_REVISED);
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/branch/BranchRevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheImpl.java
index a7882baee4..cdd024534f 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/branch/BranchRevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheImpl.java
@@ -10,7 +10,7 @@
* Simon McDuff - bug 201266
* Simon McDuff - bug 230832
*/
-package org.eclipse.emf.cdo.internal.common.revision.cache.branch;
+package org.eclipse.emf.cdo.internal.common.revision;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
@@ -21,7 +21,6 @@ import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
import org.eclipse.emf.cdo.internal.common.bundle.OM;
-import org.eclipse.emf.cdo.internal.common.revision.cache.EvictionEventImpl;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
@@ -50,26 +49,21 @@ import java.util.Map.Entry;
/**
* @author Eike Stepper
*/
-public class BranchRevisionCache extends ReferenceQueueWorker<InternalCDORevision> implements InternalCDORevisionCache
+public class CDORevisionCacheImpl extends ReferenceQueueWorker<InternalCDORevision> implements InternalCDORevisionCache
{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_REVISION, BranchRevisionCache.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_REVISION, CDORevisionCacheImpl.class);
private static boolean disableGC;
private Map<CDOIDAndBranch, RevisionList> revisionLists = new HashMap<CDOIDAndBranch, RevisionList>();
- public BranchRevisionCache()
+ public CDORevisionCacheImpl()
{
}
public InternalCDORevisionCache instantiate(CDORevision revision)
{
- return new BranchRevisionCache();
- }
-
- public boolean isSupportingBranches()
- {
- return true;
+ return new CDORevisionCacheImpl();
}
public EClass getObjectType(CDOID id)
@@ -133,7 +127,7 @@ public class BranchRevisionCache extends ReferenceQueueWorker<InternalCDORevisio
return currentRevisions;
}
- public boolean addRevision(CDORevision revision)
+ public void addRevision(CDORevision revision)
{
CheckUtil.checkArg(revision, "revision");
CDOIDAndBranch key = CDOIDUtil.createIDAndBranch(revision.getID(), revision.getBranch());
@@ -147,7 +141,7 @@ public class BranchRevisionCache extends ReferenceQueueWorker<InternalCDORevisio
}
InternalCDORevision rev = (InternalCDORevision)revision;
- return list.addRevision(rev, createReference(key, rev));
+ list.addRevision(rev, createReference(key, rev));
}
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionManagerImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionManagerImpl.java
index 60bd33ffcf..7024987f90 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionManagerImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionManagerImpl.java
@@ -17,9 +17,9 @@ 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.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCacheUtil;
+import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
import org.eclipse.emf.cdo.internal.common.bundle.OM;
import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
import org.eclipse.emf.cdo.spi.common.revision.DetachedCDORevision;
@@ -379,7 +379,7 @@ public class CDORevisionManagerImpl extends Lifecycle implements InternalCDORevi
return results;
}
- public boolean addRevision(CDORevision revision)
+ public void addRevision(CDORevision revision)
{
if (revision != null)
{
@@ -394,11 +394,7 @@ public class CDORevisionManagerImpl extends Lifecycle implements InternalCDORevi
}
}
- boolean added = cache.addRevision(revision);
- if (!added)
- {
- return false;
- }
+ cache.addRevision(revision);
int oldVersion = revision.getVersion() - 1;
if (oldVersion >= CDORevision.UNSPECIFIED_VERSION)
@@ -411,8 +407,6 @@ public class CDORevisionManagerImpl extends Lifecycle implements InternalCDORevi
}
}
}
-
- return true;
}
@Override
@@ -426,12 +420,7 @@ public class CDORevisionManagerImpl extends Lifecycle implements InternalCDORevi
if (cache == null)
{
- cache = (InternalCDORevisionCache)CDORevisionCacheUtil.createDefaultCache(supportingBranches);
- }
-
- if (supportingBranches && !cache.isSupportingBranches())
- {
- throw new IllegalStateException("Revision cache does not support branches");
+ cache = (InternalCDORevisionCache)CDORevisionUtil.createRevisionCache();
}
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/EvictionEventImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/EvictionEventImpl.java
index 95e6642e6c..b1b0e591e6 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/EvictionEventImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/EvictionEventImpl.java
@@ -8,13 +8,13 @@
* Contributors:
* Eike Stepper - initial API and implementation
*/
-package org.eclipse.emf.cdo.internal.common.revision.cache;
+package org.eclipse.emf.cdo.internal.common.revision;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache.EvictionEvent;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCache.EvictionEvent;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.net4j.util.event.Event;
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/noop/NOOPRevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/NOOPRevisionCache.java
index a254b43dda..a7ecaf1ab2 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/noop/NOOPRevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/NOOPRevisionCache.java
@@ -8,7 +8,7 @@
* Contributors:
* Eike Stepper - initial API and implementation
*/
-package org.eclipse.emf.cdo.internal.common.revision.cache.noop;
+package org.eclipse.emf.cdo.internal.common.revision;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
@@ -18,7 +18,6 @@ import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
-import org.eclipse.net4j.util.CheckUtil;
import org.eclipse.net4j.util.lifecycle.Lifecycle;
import org.eclipse.emf.ecore.EClass;
@@ -75,10 +74,9 @@ public class NOOPRevisionCache extends Lifecycle implements InternalCDORevisionC
return null;
}
- public boolean addRevision(CDORevision revision)
+ public void addRevision(CDORevision revision)
{
- CheckUtil.checkArg(revision, "revision");
- return true;
+ // Do nothing
}
public InternalCDORevision removeRevision(CDOID id, CDOBranchVersion branchVersion)
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/branch/BranchDispatcher.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/branch/BranchDispatcher.java
deleted file mode 100644
index c8b3eaa110..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/branch/BranchDispatcher.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/**
- * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.common.revision.cache.branch;
-
-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.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCacheFactory;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
-
-import org.eclipse.net4j.util.lifecycle.Lifecycle;
-import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
-
-import org.eclipse.emf.ecore.EClass;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- */
-public class BranchDispatcher extends Lifecycle implements InternalCDORevisionCache
-{
- private Map<CDOBranch, InternalCDORevisionCache> caches = new HashMap<CDOBranch, InternalCDORevisionCache>();
-
- private CDORevisionCacheFactory factory;
-
- public BranchDispatcher()
- {
- }
-
- public InternalCDORevisionCache instantiate(CDORevision revision)
- {
- BranchDispatcher cache = new BranchDispatcher();
- cache.setFactory(factory);
- return cache;
- }
-
- public boolean isSupportingBranches()
- {
- return true;
- }
-
- public CDORevisionCacheFactory getFactory()
- {
- return factory;
- }
-
- public void setFactory(CDORevisionCacheFactory factory)
- {
- checkInactive();
- this.factory = factory;
- }
-
- public EClass getObjectType(CDOID id)
- {
- for (CDORevisionCache cache : getCaches())
- {
- EClass type = cache.getObjectType(id);
- if (type != null)
- {
- return type;
- }
- }
-
- return null;
- }
-
- public CDORevision getRevision(CDOID id, CDOBranchPoint branchPoint)
- {
- CDORevisionCache cache = getCache(branchPoint.getBranch());
- if (cache == null)
- {
- return null;
- }
-
- return cache.getRevision(id, branchPoint);
- }
-
- public CDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion)
- {
- CDORevisionCache cache = getCache(branchVersion.getBranch());
- if (cache == null)
- {
- return null;
- }
-
- return cache.getRevisionByVersion(id, branchVersion);
- }
-
- public CDORevision removeRevision(CDOID id, CDOBranchVersion branchVersion)
- {
- InternalCDORevisionCache cache = getCache(branchVersion.getBranch());
- if (cache == null)
- {
- return null;
- }
-
- return cache.removeRevision(id, branchVersion);
- }
-
- public boolean addRevision(CDORevision revision)
- {
- InternalCDORevisionCache cache;
- CDOBranch branch = revision.getBranch();
- synchronized (caches)
- {
- cache = caches.get(branch);
- if (cache == null)
- {
- cache = (InternalCDORevisionCache)factory.createRevisionCache(revision);
- LifecycleUtil.activate(cache);
- caches.put(branch, cache);
- }
- }
-
- return cache.addRevision(revision);
- }
-
- public List<CDORevision> getCurrentRevisions()
- {
- List<CDORevision> result = new ArrayList<CDORevision>();
- for (CDORevisionCache cache : getCaches())
- {
- result.addAll(cache.getCurrentRevisions());
- }
-
- return result;
- }
-
- public void clear()
- {
- for (InternalCDORevisionCache cache : getCaches())
- {
- cache.clear();
- }
- }
-
- public Map<CDOBranch, List<CDORevision>> getAllRevisions()
- {
- throw new UnsupportedOperationException();
- }
-
- public List<CDORevision> getRevisions(CDOBranchPoint branchPoint)
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- protected void doBeforeActivate() throws Exception
- {
- super.doBeforeActivate();
- checkState(factory, "factory");
- }
-
- @Override
- protected void doDeactivate() throws Exception
- {
- for (CDORevisionCache cache : getCaches())
- {
- LifecycleUtil.deactivate(cache);
- }
-
- super.doDeactivate();
- }
-
- private InternalCDORevisionCache getCache(CDOBranch branch)
- {
- synchronized (caches)
- {
- return caches.get(branch);
- }
- }
-
- private InternalCDORevisionCache[] getCaches()
- {
- synchronized (caches)
- {
- return caches.values().toArray(new InternalCDORevisionCache[caches.size()]);
- }
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/DLRevisionHolder.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/DLRevisionHolder.java
deleted file mode 100644
index a4590974d6..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/DLRevisionHolder.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.common.revision.cache.lru;
-
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-
-/**
- * @author Eike Stepper
- */
-public class DLRevisionHolder extends RevisionHolder
-{
- private DLRevisionList dlList;
-
- private DLRevisionHolder dlPrev;
-
- private DLRevisionHolder dlNext;
-
- public DLRevisionHolder(DLRevisionList list, InternalCDORevision revision)
- {
- super(revision);
- dlList = list;
- }
-
- public DLRevisionList getDLList()
- {
- return dlList;
- }
-
- protected void setDLList(DLRevisionList list)
- {
- dlList = list;
- }
-
- public DLRevisionHolder getDLPrev()
- {
- return dlPrev;
- }
-
- public void setDLPrev(DLRevisionHolder prev)
- {
- dlPrev = prev;
- }
-
- public DLRevisionHolder getDLNext()
- {
- return dlNext;
- }
-
- public void setDLNext(DLRevisionHolder next)
- {
- dlNext = next;
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/DLRevisionList.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/DLRevisionList.java
deleted file mode 100644
index 7e5669c4b5..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/DLRevisionList.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/**
- * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.common.revision.cache.lru;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.internal.common.messages.Messages;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public class DLRevisionList extends DLRevisionHolder
-{
- private int size;
-
- public DLRevisionList()
- {
- super(null, null);
- setDLHead(this);
- setDLTail(this);
- }
-
- public int size()
- {
- return size;
- }
-
- public DLRevisionHolder getDLHead()
- {
- return getDLNext();
- }
-
- public void setDLHead(DLRevisionHolder head)
- {
- setDLNext(head);
- }
-
- public DLRevisionHolder getDLTail()
- {
- return getDLPrev();
- }
-
- @Override
- protected void setDLList(DLRevisionList list)
- {
- if (getPrev() != null || getDLNext() != null || getDLList() != null)
- {
- throw new IllegalStateException(Messages.getString("DLRevisionList.0")); //$NON-NLS-1$
- }
-
- super.setDLList(list);
- }
-
- public void setDLTail(DLRevisionHolder tail)
- {
- setDLPrev(tail);
- }
-
- public DLRevisionHolder get(int index)
- {
- if (index < 0 || index >= size)
- {
- throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + size); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- DLRevisionHolder holder = this;
- if (index < size >> 1)
- {
- for (int i = 0; i <= index; i++)
- {
- holder = holder.getDLNext();
- }
- }
- else
- {
- for (int i = size; i > index; i--)
- {
- holder = holder.getDLPrev();
- }
- }
-
- return holder;
- }
-
- public void add(DLRevisionHolder holder)
- {
- addTail(holder);
- }
-
- protected void validateUnlink(DLRevisionHolder holder)
- {
- if (holder.getDLList() != null)
- {
- throw new IllegalArgumentException(MessageFormat.format(Messages.getString("DLRevisionList.3"), holder)); //$NON-NLS-1$
- }
- }
-
- protected void validateLink(DLRevisionHolder holder)
- {
- if (holder.getDLList() != this)
- {
- throw new IllegalArgumentException(MessageFormat.format(Messages.getString("DLRevisionList.5"), holder)); //$NON-NLS-1$
- }
- }
-
- public void addHead(DLRevisionHolder holder)
- {
- validateUnlink(holder);
-
- ++size;
- DLRevisionHolder head = getDLHead();
- head.setDLPrev(holder);
- holder.setDLNext(head);
- holder.setDLPrev(this);
- holder.setDLList(this);
- setDLHead(holder);
- }
-
- public void addTail(DLRevisionHolder holder)
- {
- validateUnlink(holder);
-
- ++size;
- DLRevisionHolder tail = getDLTail();
- tail.setDLNext(holder);
- holder.setDLPrev(tail);
- holder.setDLNext(this);
- holder.setDLList(this);
- setDLTail(holder);
- }
-
- public void remove(DLRevisionHolder holder)
- {
- validateLink(holder);
-
- --size;
- DLRevisionHolder prev = holder.getDLPrev();
- DLRevisionHolder next = holder.getDLNext();
-
- prev.setDLNext(next);
- holder.setDLPrev(null);
- holder.setDLNext(null);
- holder.setDLList(null);
- next.setDLPrev(prev);
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("DLRevisionList[size={0}]", size); //$NON-NLS-1$
- }
-
- @Override
- public int compareTo(long timeStamp)
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public long getCreated()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public DLRevisionList getDLList()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public CDOID getID()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public RevisionHolder getNext()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public RevisionHolder getPrev()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public long getRevised()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int getVersion()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean isCurrent()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean isLoaded()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean isValid(long timeStamp)
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setNext(RevisionHolder next)
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setPrev(RevisionHolder prev)
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public InternalCDORevision getRevision()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setRevision(InternalCDORevision revision)
- {
- // Ignore
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionCache.java
deleted file mode 100644
index ae62e5219b..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionCache.java
+++ /dev/null
@@ -1,444 +0,0 @@
-/**
- * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- * Simon McDuff - maintenance
- */
-package org.eclipse.emf.cdo.internal.common.revision.cache.lru;
-
-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.revision.CDORevision;
-import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
-import org.eclipse.emf.cdo.internal.common.bundle.OM;
-import org.eclipse.emf.cdo.internal.common.revision.cache.EvictionEventImpl;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
-
-import org.eclipse.net4j.util.CheckUtil;
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.lifecycle.Lifecycle;
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.emf.ecore.EClass;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- */
-public class LRURevisionCache extends Lifecycle implements InternalCDORevisionCache
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_REVISION, LRURevisionCache.class);
-
- private Map<CDOID, RevisionHolder> revisions = new HashMap<CDOID, RevisionHolder>();
-
- private int capacityCurrent;
-
- private int capacityRevised;
-
- private LRU currentLRU;
-
- private LRU revisedLRU;
-
- public LRURevisionCache()
- {
- }
-
- public InternalCDORevisionCache instantiate(CDORevision revision)
- {
- LRURevisionCache cache = new LRURevisionCache();
- cache.setCapacityCurrent(capacityCurrent);
- cache.setCapacityRevised(capacityRevised);
- return cache;
- }
-
- public boolean isSupportingBranches()
- {
- return false;
- }
-
- public int getCapacityCurrent()
- {
- return capacityCurrent;
- }
-
- /**
- * Sets the capacity of LRU cache for <em>current</em> revisions. A value of zero disables eviction completely such
- * that the cache will grow indefinetely.
- */
- public void setCapacityCurrent(int capacity)
- {
- capacityCurrent = capacity;
- if (currentLRU != null)
- {
- currentLRU.capacity(capacity);
- }
- }
-
- public int getCapacityRevised()
- {
- return capacityRevised;
- }
-
- /**
- * Sets the capacity of LRU cache for old (<em>revised</em>) revisions. A value of zero disables eviction completely
- * such that the cache will grow indefinetely.
- */
- public void setCapacityRevised(int capacity)
- {
- capacityRevised = capacity;
- if (revisedLRU != null)
- {
- revisedLRU.capacity(capacity);
- }
- }
-
- public synchronized List<CDORevision> getCurrentRevisions()
- {
- List<CDORevision> currentRevisions = new ArrayList<CDORevision>();
- for (RevisionHolder holder : revisions.values())
- {
- InternalCDORevision revision = holder.getRevision();
- if (revision != null && !revision.isHistorical())
- {
- currentRevisions.add(revision);
- }
- }
-
- return currentRevisions;
- }
-
- public synchronized EClass getObjectType(CDOID id)
- {
- RevisionHolder holder = getHolder(id);
- if (holder == null)
- {
- return null;
- }
-
- InternalCDORevision revision = holder.getRevision();
- return revision.getEClass();
- }
-
- public synchronized InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint)
- {
- RevisionHolder holder = getHolder(id);
- return getRevision(holder, branchPoint.getTimeStamp());
- }
-
- public synchronized InternalCDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion)
- {
- RevisionHolder holder = getHolder(id);
- while (holder != null)
- {
- int holderVersion = holder.getVersion();
- int version = branchVersion.getVersion();
- if (holderVersion > version)
- {
- holder = holder.getNext();
- }
- else if (holderVersion == version)
- {
- return holder.getRevision();
- }
- else
- {
- break;
- }
- }
-
- return null;
- }
-
- public synchronized boolean addRevision(CDORevision revision)
- {
- CheckUtil.checkArg(revision, "revision");
- if (TRACER.isEnabled())
- {
- TRACER.format(
- "Adding revision: {0}, timeStamp={1}, revised={2}, historical={3}", //$NON-NLS-1$
- revision, CDOCommonUtil.formatTimeStamp(revision.getTimeStamp()),
- CDOCommonUtil.formatTimeStamp(revision.getRevised()), revision.isHistorical());
- }
-
- int version = revision.getVersion();
- RevisionHolder lastHolder = null;
- RevisionHolder holder = getHolder(revision.getID());
- while (holder != null)
- {
- int holderVersion = holder.getVersion();
- if (holderVersion > version)
- {
- lastHolder = holder;
- holder = holder.getNext();
- }
- else if (holderVersion == version)
- {
- return false;
- }
- else
- {
- break;
- }
- }
-
- // Create holder only if require
- RevisionHolder newHolder = createHolder((InternalCDORevision)revision);
- LRU list = revision.isHistorical() ? revisedLRU : currentLRU;
- list.add((DLRevisionHolder)newHolder);
-
- adjustHolder((InternalCDORevision)revision, newHolder, lastHolder, holder);
- return true;
- }
-
- public synchronized InternalCDORevision removeRevision(CDOID id, CDOBranchVersion branchVersion)
- {
- InternalCDORevision revision = null;
- RevisionHolder holder = getHolder(id);
- while (holder != null)
- {
- int holderVersion = holder.getVersion();
- int version = branchVersion.getVersion();
- if (holderVersion > version)
- {
- holder = holder.getNext();
- }
- else
- {
- if (holderVersion == version)
- {
- revision = holder.getRevision();
- LRU list = revision.isHistorical() ? revisedLRU : currentLRU;
- list.remove((DLRevisionHolder)holder);
- removeHolder(holder);
- }
-
- holder = null;
- }
- }
-
- return revision;
- }
-
- public synchronized boolean removeRevisions(CDOID id, CDOBranch branch)
- {
- RevisionHolder lookupHolder = getHolder(id);
- RevisionHolder holder = lookupHolder;
- while (holder != null)
- {
- RevisionHolder nextHolder = holder.getNext();
- removeHolder(holder);
- holder = nextHolder;
- }
-
- return lookupHolder != null;
- }
-
- public synchronized void clear()
- {
- revisions.clear();
- currentLRU = new LRU(capacityCurrent);
- revisedLRU = new LRU(capacityRevised);
- }
-
- public Map<CDOBranch, List<CDORevision>> getAllRevisions()
- {
- throw new UnsupportedOperationException();
- }
-
- public List<CDORevision> getRevisions(CDOBranchPoint branchPoint)
- {
- throw new UnsupportedOperationException();
- }
-
- private InternalCDORevision getRevision(RevisionHolder holder, long timeStamp)
- {
- while (holder != null)
- {
- int indicator = holder.compareTo(timeStamp);
- if (indicator == 1)
- {
- // timeStamp is after holder timeSpan
- holder = holder.getNext();
- }
- else if (indicator == 0)
- {
- // timeStamp is within holder timeSpan
- return holder.getRevision();
- }
- else
- {
- // timeStamp is before holder timeSpan
- break;
- }
- }
-
- return null;
- }
-
- @Override
- protected void doActivate() throws Exception
- {
- super.doActivate();
- currentLRU = new LRU(capacityCurrent);
- revisedLRU = new LRU(capacityRevised);
- }
-
- @Override
- protected void doDeactivate() throws Exception
- {
- currentLRU = null;
- revisedLRU = null;
- super.doDeactivate();
- }
-
- public final synchronized RevisionHolder getHolder(CDOID id)
- {
- return revisions.get(id);
- }
-
- protected RevisionHolder createHolder(InternalCDORevision revision)
- {
- return new LRURevisionHolder(revision);
- }
-
- private void adjustHolder(InternalCDORevision revision, RevisionHolder holder, RevisionHolder prevHolder,
- RevisionHolder nextHolder)
- {
- if (prevHolder != null)
- {
- if (nextHolder == null)
- {
- nextHolder = prevHolder.getNext();
- }
-
- holder.setPrev(prevHolder);
- holder.setNext(nextHolder);
- prevHolder.setNext(holder);
- }
- else
- {
- holder.setNext(nextHolder);
- revisions.put(revision.getID(), holder);
- }
-
- reviseHolder(holder, nextHolder);
- }
-
- private void reviseHolder(RevisionHolder holder, RevisionHolder nextHolder)
- {
- if (nextHolder != null)
- {
- nextHolder.setPrev(holder);
- if (holder.isCurrent() && nextHolder.isCurrent())
- {
- currentLRU.remove((DLRevisionHolder)nextHolder);
-
- InternalCDORevision oldRevision = nextHolder.getRevision();
-
- if (oldRevision != null && oldRevision.getRevised() == CDORevision.UNSPECIFIED_DATE
- && holder.getCreated() > CDORevision.UNSPECIFIED_DATE
- && oldRevision.getVersion() == holder.getVersion() - 1)
- {
- revisedLRU.add((DLRevisionHolder)nextHolder);
- oldRevision.setRevised(holder.getCreated() - 1);
- }
- else
- {
- removeHolder(nextHolder);
- }
- }
- }
- }
-
- private synchronized void removeHolder(RevisionHolder holder)
- {
- CDOID id = holder.getID();
- RevisionHolder prev = holder.getPrev();
- RevisionHolder next = holder.getNext();
- if (next != null)
- {
- next.setPrev(prev);
- }
-
- if (prev != null)
- {
- prev.setNext(next);
- }
- else
- {
- if (next != null)
- {
- revisions.put(id, next);
- }
- else
- {
- revisions.remove(id);
- }
- }
-
- holder.setPrev(null);
- holder.setNext(null);
- }
-
- /**
- * @author Eike Stepper
- */
- private final class LRU extends LRURevisionList
- {
- public LRU(int capacity)
- {
- super(capacity);
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("LRU[size={0}, capacity={1}]", size(), capacity()); //$NON-NLS-1$
- }
-
- @Override
- protected void evict(LRURevisionHolder holder)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Evicting revision {0}v{1}", holder.getID(), holder.getVersion()); //$NON-NLS-1$
- }
-
- // Remember some values before the holder may be changed
- InternalCDORevision revision = holder.getRevision();
- boolean revised = !holder.isCurrent();
-
- super.evict(holder);
- removeHolder(holder);
-
- if (revision != null)
- {
- if (this == currentLRU && revised)
- {
- addRevision(revision);
- }
- else
- {
- IListener[] listeners = getListeners();
- if (listeners != null)
- {
- fireEvent(new EvictionEventImpl(LRURevisionCache.this, revision), listeners);
- }
- }
- }
- }
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionHolder.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionHolder.java
deleted file mode 100644
index 0039112668..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionHolder.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.common.revision.cache.lru;
-
-import org.eclipse.emf.cdo.internal.common.messages.Messages;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public class LRURevisionHolder extends DLRevisionHolder
-{
- private long usedStamp;
-
- public LRURevisionHolder(InternalCDORevision revision)
- {
- super(null, revision);
- usedStamp = System.currentTimeMillis();
- }
-
- @Override
- public LRURevisionList getDLList()
- {
- return (LRURevisionList)super.getDLList();
- }
-
- @Override
- protected void setDLList(DLRevisionList list)
- {
- if (list == null || list instanceof LRURevisionList)
- {
- super.setDLList(list);
- }
- else
- {
- throw new IllegalArgumentException(MessageFormat.format(
- Messages.getString("LRURevisionHolder.0"), LRURevisionList.class.getName(), list)); //$NON-NLS-1$
- }
- }
-
- public long getUsedStamp()
- {
- return usedStamp;
- }
-
- @Override
- public InternalCDORevision getRevision()
- {
- stamp();
- return super.getRevision();
- }
-
- protected void stamp()
- {
- usedStamp = System.currentTimeMillis();
- LRURevisionList list = getDLList();
- if (list != null)
- {
- synchronized (list)
- {
- list.remove(this);
- list.addHead(this);
- }
- }
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionList.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionList.java
deleted file mode 100644
index a0fe3d5620..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionList.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.common.revision.cache.lru;
-
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public class LRURevisionList extends DLRevisionList
-{
- private int capacity;
-
- public LRURevisionList(int capacity)
- {
- this.capacity = capacity;
- }
-
- public int capacity()
- {
- return capacity;
- }
-
- /**
- * Sets the capacity of LRU cache revisions. A value of zero disables eviction completely such that the cache will
- * grow indefinetely.
- */
- public void capacity(int capacity)
- {
- this.capacity = capacity;
- eviction();
- }
-
- @Override
- public void add(DLRevisionHolder holder)
- {
- addHead(holder);
- eviction();
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("LRURevisionList[size={0}, capacity={1}]", size(), capacity); //$NON-NLS-1$
- }
-
- protected void eviction()
- {
- if (capacity != 0)
- {
- while (size() > capacity)
- {
- evict((LRURevisionHolder)getDLTail());
- }
- }
- }
-
- protected void evict(LRURevisionHolder holder)
- {
- remove(holder);
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/RevisionHolder.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/RevisionHolder.java
deleted file mode 100644
index 7a5bbc8f62..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/RevisionHolder.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.common.revision.cache.lru;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public class RevisionHolder
-{
- private RevisionHolder prev;
-
- private RevisionHolder next;
-
- private InternalCDORevision revision;
-
- public RevisionHolder(InternalCDORevision revision)
- {
- setRevision(revision);
- }
-
- public CDOID getID()
- {
- return revision.getID();
- }
-
- public int getVersion()
- {
- return revision.getVersion();
- }
-
- public long getCreated()
- {
- return revision.getTimeStamp();
- }
-
- public long getRevised()
- {
- return revision.getRevised();
- }
-
- public boolean isCurrent()
- {
- return getRevised() == CDORevision.UNSPECIFIED_DATE;
- }
-
- public boolean isValid(long timeStamp)
- {
- return (getRevised() == CDORevision.UNSPECIFIED_DATE || getRevised() >= timeStamp) && timeStamp >= getCreated();
- }
-
- /**
- * Returns:
- * <ul>
- * <li>-1 if the revision is valid *before* the timestamp
- * <li>0 if the revision is valid *at* the timestamp
- * <li>1 if the revision is valid *after* the timestamp
- * </ul>
- */
- public int compareTo(long timeStamp)
- {
- if (timeStamp < getCreated())
- {
- return 1;
- }
-
- long revised = getRevised();
- if (revised != CDORevision.UNSPECIFIED_DATE && revised < timeStamp)
- {
- return -1;
- }
-
- return 0;
- }
-
- public RevisionHolder getPrev()
- {
- return prev;
- }
-
- public void setPrev(RevisionHolder prev)
- {
- this.prev = prev;
- }
-
- public RevisionHolder getNext()
- {
- return next;
- }
-
- public void setNext(RevisionHolder next)
- {
- this.next = next;
- }
-
- public boolean isLoaded()
- {
- return revision != null;
- }
-
- public InternalCDORevision getRevision()
- {
- return revision;
- }
-
- public void setRevision(InternalCDORevision revision)
- {
- this.revision = revision;
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("RevisionHolder[{0}]", revision); //$NON-NLS-1$
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/mem/MEMRevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/mem/MEMRevisionCache.java
deleted file mode 100644
index db1b275946..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/mem/MEMRevisionCache.java
+++ /dev/null
@@ -1,408 +0,0 @@
-/**
- * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- * Simon McDuff - bug 201266
- * Simon McDuff - bug 230832
- */
-package org.eclipse.emf.cdo.internal.common.revision.cache.mem;
-
-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.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.id.CDOIDUtil;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
-import org.eclipse.emf.cdo.internal.common.branch.CDOBranchVersionImpl;
-import org.eclipse.emf.cdo.internal.common.bundle.OM;
-import org.eclipse.emf.cdo.internal.common.messages.Messages;
-import org.eclipse.emf.cdo.internal.common.revision.cache.EvictionEventImpl;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
-
-import org.eclipse.net4j.util.CheckUtil;
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-import org.eclipse.net4j.util.ref.KeyedPhantomReference;
-import org.eclipse.net4j.util.ref.KeyedReference;
-import org.eclipse.net4j.util.ref.KeyedSoftReference;
-import org.eclipse.net4j.util.ref.KeyedStrongReference;
-import org.eclipse.net4j.util.ref.KeyedWeakReference;
-import org.eclipse.net4j.util.ref.ReferenceQueueWorker;
-import org.eclipse.net4j.util.ref.ReferenceType;
-
-import org.eclipse.emf.ecore.EClass;
-
-import java.lang.ref.Reference;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Map.Entry;
-
-/**
- * @author Eike Stepper
- */
-public class MEMRevisionCache extends ReferenceQueueWorker<InternalCDORevision> implements InternalCDORevisionCache
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_REVISION, MEMRevisionCache.class);
-
- private Map<CDOID, CacheList> cacheLists = new HashMap<CDOID, CacheList>();
-
- private ReferenceType referenceType;
-
- public MEMRevisionCache(ReferenceType referenceType)
- {
- setReferenceType(referenceType);
- }
-
- public MEMRevisionCache()
- {
- this(ReferenceType.SOFT);
- }
-
- public InternalCDORevisionCache instantiate(CDORevision revision)
- {
- return new MEMRevisionCache(referenceType);
- }
-
- public boolean isSupportingBranches()
- {
- return false;
- }
-
- public ReferenceType getReferenceType()
- {
- return referenceType;
- }
-
- public void setReferenceType(ReferenceType referenceType)
- {
- checkInactive();
- this.referenceType = referenceType;
- }
-
- public EClass getObjectType(CDOID id)
- {
- return null;
- }
-
- public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint)
- {
- synchronized (cacheLists)
- {
- CacheList list = cacheLists.get(id);
- if (list != null)
- {
- return list.getRevision(branchPoint.getTimeStamp());
- }
- }
-
- return null;
- }
-
- public InternalCDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion)
- {
- synchronized (cacheLists)
- {
- CacheList list = cacheLists.get(id);
- if (list != null)
- {
- int version = branchVersion.getVersion();
- return list.getRevisionByVersion(version);
- }
- }
-
- return null;
- }
-
- public List<CDORevision> getCurrentRevisions()
- {
- ArrayList<CDORevision> currentRevisions = new ArrayList<CDORevision>();
- synchronized (cacheLists)
- {
- for (Entry<CDOID, CacheList> entry : cacheLists.entrySet())
- {
- CacheList list = entry.getValue();
- InternalCDORevision revision = list.getRevision(CDORevision.UNSPECIFIED_DATE);
- if (revision != null)
- {
- currentRevisions.add(revision);
- }
- }
- }
-
- return currentRevisions;
- }
-
- public boolean addRevision(CDORevision revision)
- {
- CheckUtil.checkArg(revision, "revision");
- CDOID id = revision.getID();
- synchronized (cacheLists)
- {
- CacheList list = cacheLists.get(id);
- if (list == null)
- {
- list = new CacheList();
- cacheLists.put(id, list);
- }
-
- return list.addRevision((InternalCDORevision)revision);
- }
- }
-
- public InternalCDORevision removeRevision(CDOID id, CDOBranchVersion branchVersion)
- {
- synchronized (cacheLists)
- {
- CacheList list = cacheLists.get(id);
- if (list != null)
- {
- int version = branchVersion.getVersion();
- list.removeRevision(version);
- if (list.isEmpty())
- {
- cacheLists.remove(id);
- if (TRACER.isEnabled())
- {
- TRACER.format("Removed cache list of {0}", id); //$NON-NLS-1$
- }
- }
- }
- }
-
- return null;
- }
-
- public void clear()
- {
- synchronized (cacheLists)
- {
- cacheLists.clear();
- }
- }
-
- public Map<CDOBranch, List<CDORevision>> getAllRevisions()
- {
- throw new UnsupportedOperationException();
- }
-
- public List<CDORevision> getRevisions(CDOBranchPoint branchPoint)
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- @SuppressWarnings("unchecked")
- protected void work(Reference<? extends InternalCDORevision> reference)
- {
- KeyedReference<CDOIDAndVersion, InternalCDORevision> keyedRef = (KeyedReference<CDOIDAndVersion, InternalCDORevision>)reference;
- CDOIDAndVersion key = keyedRef.getKey();
- final CDOID id = key.getID();
- final CDOBranch branch = null;
- final int version = key.getVersion();
-
- InternalCDORevision revision = removeRevision(id, new CDOBranchVersionImpl(branch, version));
- if (revision == null)
- {
- IListener[] listeners = getListeners();
- if (listeners != null)
- {
- fireEvent(new EvictionEventImpl(this, CDORevisionUtil.createRevisionKey(id, branch, version)), listeners);
- }
- }
- else
- {
- // Should not happen with garbage collector triggered eviction
- IListener[] listeners = getListeners();
- if (listeners != null)
- {
- fireEvent(new EvictionEventImpl(this, revision), listeners);
- }
- }
- }
-
- protected KeyedReference<CDOIDAndVersion, InternalCDORevision> createReference(InternalCDORevision revision)
- {
- if (referenceType != null)
- {
- CDOIDAndVersion key = CDOIDUtil.createIDAndVersion(revision.getID(), revision.getVersion());
- switch (referenceType)
- {
- case STRONG:
- return new KeyedStrongReference<CDOIDAndVersion, InternalCDORevision>(key, revision);
-
- case SOFT:
- return new KeyedSoftReference<CDOIDAndVersion, InternalCDORevision>(key, revision, getQueue());
-
- case WEAK:
- return new KeyedWeakReference<CDOIDAndVersion, InternalCDORevision>(key, revision, getQueue());
-
- case PHANTOM:
- return new KeyedPhantomReference<CDOIDAndVersion, InternalCDORevision>(key, revision, getQueue());
- }
- }
-
- throw new IllegalStateException(MessageFormat.format(Messages.getString("MEMRevisionCache.1"), referenceType)); //$NON-NLS-1$
- }
-
- /**
- * @author Eike Stepper
- */
- public class CacheList extends LinkedList<KeyedReference<CDOIDAndVersion, InternalCDORevision>>
- {
- private static final long serialVersionUID = 1L;
-
- public CacheList()
- {
- }
-
- public InternalCDORevision getRevision(long timeStamp)
- {
- if (timeStamp == CDORevision.UNSPECIFIED_DATE)
- {
- KeyedReference<CDOIDAndVersion, InternalCDORevision> ref = isEmpty() ? null : getFirst();
- if (ref != null)
- {
- InternalCDORevision revision = ref.get();
- if (revision != null)
- {
- if (!revision.isHistorical())
- {
- return revision;
- }
- }
- else
- {
- removeFirst();
- }
- }
-
- return null;
- }
-
- for (Iterator<KeyedReference<CDOIDAndVersion, InternalCDORevision>> it = iterator(); it.hasNext();)
- {
- KeyedReference<CDOIDAndVersion, InternalCDORevision> ref = it.next();
- InternalCDORevision revision = ref.get();
- if (revision != null)
- {
- long created = revision.getTimeStamp();
- if (created <= timeStamp)
- {
- long revised = revision.getRevised();
- if (timeStamp <= revised || revised == CDORevision.UNSPECIFIED_DATE)
- {
- return revision;
- }
-
- break;
- }
- }
- else
- {
- it.remove();
- }
- }
-
- return null;
- }
-
- public InternalCDORevision getRevisionByVersion(int version)
- {
- for (Iterator<KeyedReference<CDOIDAndVersion, InternalCDORevision>> it = iterator(); it.hasNext();)
- {
- KeyedReference<CDOIDAndVersion, InternalCDORevision> ref = it.next();
- InternalCDORevision revision = ref.get();
- if (revision != null)
- {
- int v = revision.getVersion();
- if (v == version)
- {
- return revision;
- }
- else if (v < version)
- {
- break;
- }
- }
- else
- {
- it.remove();
- }
- }
-
- return null;
- }
-
- public void removeRevision(int version)
- {
- for (Iterator<KeyedReference<CDOIDAndVersion, InternalCDORevision>> it = iterator(); it.hasNext();)
- {
- KeyedReference<CDOIDAndVersion, InternalCDORevision> ref = it.next();
- CDOIDAndVersion key = ref.getKey();
- int v = key.getVersion();
- if (v == version)
- {
- it.remove();
- if (TRACER.isEnabled())
- {
- TRACER.format("Removed version {0} from cache list of {1}", version, key.getID()); //$NON-NLS-1$
- }
-
- break;
- }
- else if (v < version)
- {
- break;
- }
- }
- }
-
- public boolean addRevision(InternalCDORevision revision)
- {
- KeyedReference<CDOIDAndVersion, InternalCDORevision> reference = createReference(revision);
- int version = revision.getVersion();
- for (ListIterator<KeyedReference<CDOIDAndVersion, InternalCDORevision>> it = listIterator(); it.hasNext();)
- {
- KeyedReference<CDOIDAndVersion, InternalCDORevision> ref = it.next();
- InternalCDORevision foundRevision = ref.get();
- if (foundRevision != null)
- {
- CDOIDAndVersion key = ref.getKey();
- int v = key.getVersion();
- if (v == version)
- {
- return false;
- }
-
- if (v < version)
- {
- it.previous();
- it.add(reference);
- return true;
- }
- }
- else
- {
- it.remove();
- }
- }
-
- addLast(reference);
- return true;
- }
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/two/TwoLevelRevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/two/TwoLevelRevisionCache.java
deleted file mode 100644
index f75e0488fe..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/two/TwoLevelRevisionCache.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/**
- * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- * Simon McDuff - bug 201266
- * Simon McDuff - bug 230832
- */
-package org.eclipse.emf.cdo.internal.common.revision.cache.two;
-
-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.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
-import org.eclipse.emf.cdo.internal.common.bundle.OM;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
-
-import org.eclipse.net4j.util.CheckUtil;
-import org.eclipse.net4j.util.event.IEvent;
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.lifecycle.Lifecycle;
-import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.emf.ecore.EClass;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- */
-public class TwoLevelRevisionCache extends Lifecycle implements InternalCDORevisionCache, IListener
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_REVISION, TwoLevelRevisionCache.class);
-
- private InternalCDORevisionCache level1;
-
- private InternalCDORevisionCache level2;
-
- public TwoLevelRevisionCache()
- {
- }
-
- public InternalCDORevisionCache instantiate(CDORevision revision)
- {
- TwoLevelRevisionCache cache = new TwoLevelRevisionCache();
- cache.setLevel1(level1.instantiate(revision));
- cache.setLevel2(level2.instantiate(revision));
- return cache;
- }
-
- public boolean isSupportingBranches()
- {
- return false;
- }
-
- public InternalCDORevisionCache getLevel1()
- {
- return level1;
- }
-
- public void setLevel1(InternalCDORevisionCache level1)
- {
- this.level1 = level1;
- }
-
- public InternalCDORevisionCache getLevel2()
- {
- return level2;
- }
-
- public void setLevel2(InternalCDORevisionCache level2)
- {
- this.level2 = level2;
- }
-
- public EClass getObjectType(CDOID id)
- {
- EClass objectType = level1.getObjectType(id);
- if (objectType == null)
- {
- objectType = level2.getObjectType(id);
- }
-
- return objectType;
- }
-
- public CDORevision getRevision(CDOID id, CDOBranchPoint branchPoint)
- {
- CDORevision revision = level1.getRevision(id, branchPoint);
- if (revision == null)
- {
- revision = level2.getRevision(id, branchPoint);
- }
-
- return revision;
- }
-
- public CDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion)
- {
- CDORevision revision = level1.getRevisionByVersion(id, branchVersion);
- if (revision == null)
- {
- revision = level2.getRevisionByVersion(id, branchVersion);
- }
-
- return revision;
- }
-
- public List<CDORevision> getCurrentRevisions()
- {
- List<CDORevision> revisions = new ArrayList<CDORevision>();
- revisions.addAll(level1.getCurrentRevisions());
- revisions.addAll(level2.getCurrentRevisions());
- return revisions;
- }
-
- public boolean addRevision(CDORevision revision)
- {
- CheckUtil.checkArg(revision, "revision");
- boolean added = level1.addRevision(revision);
-
- // Bugzilla 292372: If a new current revision was added to level1, we must check whether
- // level2 contains a stale current revision, and revise that revision if possible
- if (added && !revision.isHistorical())
- {
- CDOID id = revision.getID();
- CDORevision revisionInLevel2 = level2.getRevision(id, revision);
- if (revisionInLevel2 != null && !revisionInLevel2.isHistorical())
- {
- // We can only revise if the revisions are consecutive
- if (revision.getVersion() == revisionInLevel2.getVersion() + 1)
- {
- ((InternalCDORevision)revisionInLevel2).setRevised(revision.getTimeStamp() - 1);
- }
- else
- {
- level2.removeRevision(id, revision.getBranch().getVersion(revisionInLevel2.getVersion()));
- }
- }
- }
-
- return added;
- }
-
- public CDORevision removeRevision(CDOID id, CDOBranchVersion branchVersion)
- {
- CDORevision revision1 = level1.removeRevision(id, branchVersion);
- CDORevision revision2 = level2.removeRevision(id, branchVersion);
- return revision1 != null ? revision1 : revision2;
- }
-
- public void clear()
- {
- level1.clear();
- level2.clear();
- }
-
- public Map<CDOBranch, List<CDORevision>> getAllRevisions()
- {
- throw new UnsupportedOperationException();
- }
-
- public List<CDORevision> getRevisions(CDOBranchPoint branchPoint)
- {
- throw new UnsupportedOperationException();
- }
-
- public void notifyEvent(IEvent event)
- {
- if (event instanceof EvictionEvent)
- {
- EvictionEvent e = (EvictionEvent)event;
- CDORevision revision = e.getRevision();
- if (revision != null)
- {
- CDORevisionCache cache = e.getSource();
- if (cache == level1)
- {
- evictedFromLevel1(revision);
- }
- else if (cache == level2)
- {
- evictedFromLevel2(revision);
- }
- }
- }
- }
-
- protected void evictedFromLevel1(CDORevision revision)
- {
- level2.addRevision(revision);
- if (TRACER.isEnabled())
- {
- TRACER.format("Recached revision {0}", revision); //$NON-NLS-1$
- }
- }
-
- protected void evictedFromLevel2(CDORevision revision)
- {
- }
-
- @Override
- protected void doBeforeActivate() throws Exception
- {
- super.doBeforeActivate();
- checkState(level1, "level1"); //$NON-NLS-1$
- checkState(level2, "level2"); //$NON-NLS-1$
- }
-
- @Override
- protected void doActivate() throws Exception
- {
- super.doActivate();
- level1.addListener(this);
- level2.addListener(this);
- LifecycleUtil.activate(level1);
- LifecycleUtil.activate(level2);
- }
-
- @Override
- protected void doDeactivate() throws Exception
- {
- LifecycleUtil.deactivate(level2);
- LifecycleUtil.deactivate(level1);
- level2.removeListener(this);
- level1.removeListener(this);
- super.doDeactivate();
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevisionManager.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevisionManager.java
index 82234ed0a4..ed47f64524 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevisionManager.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevisionManager.java
@@ -15,8 +15,8 @@ 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.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
import org.eclipse.net4j.util.lifecycle.Lifecycle;
@@ -39,6 +39,9 @@ public abstract class DelegatingCDORevisionManager extends Lifecycle implements
return getDelegate().getCache();
}
+ /**
+ * @since 4.0
+ */
public void setCache(CDORevisionCache cache)
{
getDelegate().setCache(cache);
@@ -84,9 +87,12 @@ public abstract class DelegatingCDORevisionManager extends Lifecycle implements
getDelegate().setSupportingBranches(on);
}
- public boolean addRevision(CDORevision revision)
+ /**
+ * @since 4.0
+ */
+ public void addRevision(CDORevision revision)
{
- return getDelegate().addRevision(revision);
+ getDelegate().addRevision(revision);
}
public boolean containsRevision(CDOID id, CDOBranchPoint branchPoint)
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionCache.java
index 50b5c1a5a8..2ed2d7ccc8 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionCache.java
@@ -15,7 +15,7 @@ import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.revision.CDOAllRevisionsProvider;
import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
import org.eclipse.net4j.util.lifecycle.ILifecycle;
@@ -29,8 +29,6 @@ public interface InternalCDORevisionCache extends CDORevisionCache, CDOAllRevisi
{
public InternalCDORevisionCache instantiate(CDORevision revision);
- public boolean addRevision(CDORevision revision);
-
public CDORevision removeRevision(CDOID id, CDOBranchVersion branchVersion);
public void clear();
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionManager.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionManager.java
index bde93bac5a..dea4dfc219 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionManager.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionManager.java
@@ -15,10 +15,10 @@ 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.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCacheAdder;
import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
import org.eclipse.emf.cdo.common.revision.CDORevisionManager;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCacheAdder;
import org.eclipse.net4j.util.lifecycle.ILifecycle;
@@ -48,6 +48,9 @@ public interface InternalCDORevisionManager extends CDORevisionManager, CDORevis
public InternalCDORevisionCache getCache();
+ /**
+ * @since 4.0
+ */
public void setCache(CDORevisionCache cache);
/**
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/SyntheticCDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/SyntheticCDORevision.java
index d439f7476c..cff8ef827f 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/SyntheticCDORevision.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/SyntheticCDORevision.java
@@ -13,8 +13,8 @@ package org.eclipse.emf.cdo.spi.common.revision;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
import org.eclipse.emf.cdo.common.revision.CDORevisionManager;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
import org.eclipse.emf.ecore.EClass;
diff --git a/plugins/org.eclipse.emf.cdo.examples.hibernate.server/config/cdo-server-new.xml b/plugins/org.eclipse.emf.cdo.examples.hibernate.server/config/cdo-server-new.xml
index 56c712c169..c8a58032a8 100644
--- a/plugins/org.eclipse.emf.cdo.examples.hibernate.server/config/cdo-server-new.xml
+++ b/plugins/org.eclipse.emf.cdo.examples.hibernate.server/config/cdo-server-new.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<cdoServer>
-<!--
- This is the new format for the cdo-server.xml which places the hibernate and teneo
+<!--
+ This is the new format for the cdo-server.xml which places the hibernate and teneo
properties inside the store and mappingprovider tags.
-->
@@ -19,25 +19,22 @@
<repository name="repo1">
<property name="overrideUUID" value=""/>
<property name="supportingAudits" value="false"/>
- <property name="verifyingRevisions" value="false"/>
- <property name="currentLRUCapacity" value="10000"/>
- <property name="revisedLRUCapacity" value="10000"/>
<store type="hibernate">
<mappingProvider type="teneo">
- <!--
- Teneo options:
- see: http://www.elver.org/hibernate/options.html
+ <!--
+ Teneo options:
+ see: http://www.elver.org/hibernate/options.html
or the org.eclipse.emf.teneo.PersistenceOptions class
-->
-
+
<!-- The following value must be set normally like this, use this in your app also -->
<property name="teneo.mapping.cascade_policy_on_non_containment" value="PERSIST,MERGE"/>
<!-- some demo settings -->
- <!--
- using an external xml file for annotations, note this xml file
+ <!--
+ using an external xml file for annotations, note this xml file
is located in the org.eclipse.emf.cdo.examples.hibernate.annotations
which is available on the cdo server by adding it to the CDOHibernateServer.launch configuration
-->
@@ -46,7 +43,7 @@
<property name="teneo.mapping.inheritance" value="JOINED"/>
<!-- create an index for each fk -->
<property name="teneo.mapping.add_index_for_fk" value="true"/>
-
+
</mappingProvider>
<!-- Hibernate properties , see: http://docs.jboss.org/hibernate/stable/core/reference/en/html_single/#configuration-optional -->
@@ -54,7 +51,7 @@
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.connection.pool_size" value="10"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
-
+
<!-- Setting for hsqldb -->
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
@@ -62,14 +59,14 @@
<property name="hibernate.connection.username" value="sa"/>
<property name="hibernate.connection.password" value=""/>
<property name="hibernate.connection.autocommit" value="true"/>
-
+
<!-- Setting for mysql -->
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/cdohibernate"/>
<property name="hibernate.connection.username" value="root"/>
<property name="hibernate.connection.password" value="root"/>
-
+
</store>
</repository>
diff --git a/plugins/org.eclipse.emf.cdo.examples.hibernate.server/config/cdo-server.xml b/plugins/org.eclipse.emf.cdo.examples.hibernate.server/config/cdo-server.xml
index 21b7a8118c..0179cf0a7d 100755
--- a/plugins/org.eclipse.emf.cdo.examples.hibernate.server/config/cdo-server.xml
+++ b/plugins/org.eclipse.emf.cdo.examples.hibernate.server/config/cdo-server.xml
@@ -14,29 +14,26 @@
<repository name="repo1">
<property name="overrideUUID" value=""/>
<property name="supportingAudits" value="false"/>
- <property name="verifyingRevisions" value="false"/>
- <property name="currentLRUCapacity" value="10000"/>
- <property name="revisedLRUCapacity" value="10000"/>
- <!--
+ <!--
NOTE: the following properties are currently defined on repository level.
In future builds of the CDO Hibernate store these properties are defined
within the store and mappingProvider tags.
-->
-
- <!--
- Teneo options:
- see: http://www.elver.org/hibernate/options.html
+
+ <!--
+ Teneo options:
+ see: http://www.elver.org/hibernate/options.html
or the org.eclipse.emf.teneo.PersistenceOptions class
-->
-
+
<!-- The following value must be set normally like this, use this in your app also -->
<property name="teneo.mapping.cascade_policy_on_non_containment" value="PERSIST,MERGE"/>
<!-- some demo settings -->
- <!--
- using an external xml file for annotations, note this xml file
+ <!--
+ using an external xml file for annotations, note this xml file
is located in the org.eclipse.emf.cdo.examples.hibernate.annotations
which is available on the cdo server by adding it to the CDOHibernateServer.launch configuration
-->
@@ -45,14 +42,14 @@
<property name="teneo.mapping.inheritance" value="JOINED"/>
<!-- create an index for each fk -->
<property name="teneo.mapping.add_index_for_fk" value="true"/>
-
+
<!-- Hibernate properties , see: http://docs.jboss.org/hibernate/stable/core/reference/en/html_single/#configuration-optional -->
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.connection.pool_size" value="10"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
-
+
<!-- Setting for hsqldb
-->
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
@@ -61,7 +58,7 @@
<property name="hibernate.connection.username" value="sa"/>
<property name="hibernate.connection.password" value=""/>
<!-- property name="hibernate.connection.autocommit" value="true"/-->
-
+
<!-- Setting for mysql
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
@@ -69,22 +66,22 @@
<property name="hibernate.connection.username" value="root"/>
<property name="hibernate.connection.password" value="root"/>
-->
-
+
<!-- Settings for derby
<property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect"/>
<property name="hibernate.connection.driver_class" value="org.apache.derby.jdbc.EmbeddedDriver"/>
<property name="hibernate.connection.url" value="jdbc:derby:cdohibernate;create=true"/>
-->
- <!--
+ <!--
<property name="hibernate.connection.username" value="root"/>
<property name="hibernate.connection.password" value="root"/>
-->
<store type="hibernate">
<mappingProvider type="teneo">
- <extension name="org.eclipse.emf.teneo.annotations.mapper.EFeatureAnnotator"
+ <extension name="org.eclipse.emf.teneo.annotations.mapper.EFeatureAnnotator"
value="org.eclipse.emf.cdo.examples.hibernate.server.CDOExampleEFeatureAnnotator"/>
</mappingProvider>
- <!--
+ <!--
<mappingProvider type="file">
<mappingFile location="/META-INF/generated_hbm.xml"/>
</mappingProvider>
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java
index b8b5ac9cba..80260fbaa6 100644
--- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java
+++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java
@@ -11,8 +11,8 @@
package org.eclipse.emf.cdo.examples.server;
import org.eclipse.emf.cdo.common.CDOCommonRepository.Type;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
import org.eclipse.emf.cdo.common.util.RepositoryStateChangedEvent;
import org.eclipse.emf.cdo.common.util.RepositoryTypeChangedEvent;
import org.eclipse.emf.cdo.examples.company.CompanyFactory;
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
index fc6e085ec9..1f2f40f184 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
@@ -26,8 +26,8 @@ import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
import org.eclipse.emf.cdo.common.protocol.CDODataInput;
import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCacheAdder;
import org.eclipse.emf.cdo.common.revision.CDORevisionHandler;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCacheAdder;
import org.eclipse.emf.cdo.common.util.CDOQueryInfo;
import org.eclipse.emf.cdo.eresource.EresourcePackage;
import org.eclipse.emf.cdo.server.IQueryHandler;
diff --git a/plugins/org.eclipse.emf.cdo.server.db4o/src/org/eclipse/emf/cdo/server/internal/db4o/DB4OStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server.db4o/src/org/eclipse/emf/cdo/server/internal/db4o/DB4OStoreAccessor.java
index ea67642a56..c55ee5fa1b 100644
--- a/plugins/org.eclipse.emf.cdo.server.db4o/src/org/eclipse/emf/cdo/server/internal/db4o/DB4OStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server.db4o/src/org/eclipse/emf/cdo/server/internal/db4o/DB4OStoreAccessor.java
@@ -20,8 +20,8 @@ import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.protocol.CDODataInput;
import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCacheAdder;
import org.eclipse.emf.cdo.common.revision.CDORevisionHandler;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCacheAdder;
import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
import org.eclipse.emf.cdo.common.util.CDOQueryInfo;
import org.eclipse.emf.cdo.eresource.EresourcePackage;
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreAccessor.java
index 05c161198d..758b16b1bd 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreAccessor.java
@@ -23,9 +23,9 @@ import org.eclipse.emf.cdo.common.model.CDOClassifierRef;
import org.eclipse.emf.cdo.common.protocol.CDODataInput;
import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCacheAdder;
import org.eclipse.emf.cdo.common.revision.CDORevisionData;
import org.eclipse.emf.cdo.common.revision.CDORevisionHandler;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCacheAdder;
import org.eclipse.emf.cdo.common.util.CDOQueryInfo;
import org.eclipse.emf.cdo.eresource.EresourcePackage;
import org.eclipse.emf.cdo.server.IQueryHandler;
diff --git a/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/ObjectivityStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/ObjectivityStoreAccessor.java
index df76b0542e..c998db6412 100644
--- a/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/ObjectivityStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/ObjectivityStoreAccessor.java
@@ -25,8 +25,8 @@ import org.eclipse.emf.cdo.common.model.EMFUtil;
import org.eclipse.emf.cdo.common.protocol.CDODataInput;
import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCacheAdder;
import org.eclipse.emf.cdo.common.revision.CDORevisionHandler;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCacheAdder;
import org.eclipse.emf.cdo.server.IQueryHandler;
import org.eclipse.emf.cdo.server.ISession;
import org.eclipse.emf.cdo.server.ITransaction;
diff --git a/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/CDOExtentCreator.java b/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/CDOExtentCreator.java
index ce3aeea161..94e922de98 100644
--- a/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/CDOExtentCreator.java
+++ b/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/CDOExtentCreator.java
@@ -16,8 +16,8 @@ import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCacheAdder;
import org.eclipse.emf.cdo.common.revision.CDORevisionHandler;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCacheAdder;
import org.eclipse.emf.cdo.server.IStoreAccessor;
import org.eclipse.emf.cdo.server.StoreThreadLocal;
import org.eclipse.emf.cdo.util.ObjectNotFoundException;
diff --git a/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/OCLQueryHandler.java b/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/OCLQueryHandler.java
index b371590f25..cde886265b 100644
--- a/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/OCLQueryHandler.java
+++ b/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/OCLQueryHandler.java
@@ -16,8 +16,8 @@ import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCacheAdder;
import org.eclipse.emf.cdo.common.revision.CDORevisionProvider;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCacheAdder;
import org.eclipse.emf.cdo.common.util.CDOQueryInfo;
import org.eclipse.emf.cdo.server.CDOServerUtil;
import org.eclipse.emf.cdo.server.IQueryContext;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java
index 94feee9d98..f13a106bc8 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java
@@ -1063,10 +1063,7 @@ public class TransactionCommitContext implements InternalCommitContext
{
if (revision != null)
{
- if (!revisionManager.addRevision(revision))
- {
- throw new IllegalStateException("Failed to register revision: " + revision);
- }
+ revisionManager.addRevision(revision);
}
monitor.worked();
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSession.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSession.java
index 7521d9804f..89e62301ca 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSession.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSession.java
@@ -12,8 +12,8 @@
package org.eclipse.emf.cdo.internal.server.embedded;
import org.eclipse.emf.cdo.common.model.lob.CDOLobStore;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
import org.eclipse.emf.cdo.internal.server.embedded.EmbeddedClientSessionConfiguration.RepositoryInfo;
import org.eclipse.emf.cdo.server.embedded.CDOSession;
import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStoreAccessor.java
index f441af1014..1d9dbbe13a 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStoreAccessor.java
@@ -20,8 +20,8 @@ import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.protocol.CDODataInput;
import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCacheAdder;
import org.eclipse.emf.cdo.common.revision.CDORevisionHandler;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCacheAdder;
import org.eclipse.emf.cdo.common.util.CDOQueryInfo;
import org.eclipse.emf.cdo.server.IQueryContext;
import org.eclipse.emf.cdo.server.IQueryHandler;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/RepositorySynchronizer.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/RepositorySynchronizer.java
index 4861dd0a8d..121b7b8548 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/RepositorySynchronizer.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/RepositorySynchronizer.java
@@ -16,7 +16,7 @@ import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.branch.CDOBranchCreatedEvent;
import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.internal.common.revision.cache.noop.NOOPRevisionCache;
+import org.eclipse.emf.cdo.internal.common.revision.NOOPRevisionCache;
import org.eclipse.emf.cdo.internal.server.bundle.OM;
import org.eclipse.emf.cdo.session.CDOSessionConfiguration;
import org.eclipse.emf.cdo.session.CDOSessionConfigurationFactory;
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 9d6c012e3e..b22ce1f038 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
@@ -204,17 +204,5 @@ public interface IRepository extends CDOCommonRepository, IQueryHandlerProvider,
* @since 3.0
*/
public static final String ENSURE_REFERENTIAL_INTEGRITY = "ensureReferentialIntegrity"; //$NON-NLS-1$
-
- /**
- * @since 2.0
- */
- @Deprecated
- public static final String CURRENT_LRU_CAPACITY = "currentLRUCapacity"; //$NON-NLS-1$
-
- /**
- * @since 2.0
- */
- @Deprecated
- public static final String REVISED_LRU_CAPACITY = "revisedLRUCapacity"; //$NON-NLS-1$
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreAccessor.java
index ace8bca776..7a33cbeff0 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreAccessor.java
@@ -20,9 +20,9 @@ import org.eclipse.emf.cdo.common.model.lob.CDOClob;
import org.eclipse.emf.cdo.common.model.lob.CDOLob;
import org.eclipse.emf.cdo.common.protocol.CDODataInput;
import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCacheAdder;
import org.eclipse.emf.cdo.common.revision.CDORevisionHandler;
import org.eclipse.emf.cdo.common.revision.CDORevisionProvider;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCacheAdder;
import org.eclipse.emf.cdo.common.util.CDOQueryInfo;
import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader;
import org.eclipse.emf.cdo.spi.common.commit.CDOChangeSetSegment;
@@ -105,7 +105,7 @@ public interface IStoreAccessor extends IQueryHandlerProvider, BranchLoader, Com
/**
* Reads a revision from the back-end that was valid at the given timeStamp in the given branch.
*
- * @since 3.0
+ * @since 4.0
*/
public InternalCDORevision readRevision(CDOID id, CDOBranchPoint branchPoint, int listChunk,
CDORevisionCacheAdder cache);
@@ -113,7 +113,7 @@ public interface IStoreAccessor extends IQueryHandlerProvider, BranchLoader, Com
/**
* Reads a revision with the given version in the given branch from the back-end.
*
- * @since 3.0
+ * @since 4.0
*/
public InternalCDORevision readRevisionByVersion(CDOID id, CDOBranchVersion branchVersion, int listChunk,
CDORevisionCacheAdder cache);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java
index 8159ff1c94..2d9cbc6202 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java
@@ -13,7 +13,6 @@ package org.eclipse.emf.cdo.tests;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_241464_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_243310_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_246442_Test;
-import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_246456_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_246622_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_248052_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_248124_Test;
@@ -58,8 +57,6 @@ import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_283985_CDOTest2;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_283985_SavePointTest;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_285008_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_289932_Test;
-import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_289984_Test;
-import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_292372_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_293283_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_294850_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_294859_Test;
@@ -148,7 +145,6 @@ public abstract class AllConfigs extends ConfigTestSuite
testClasses.add(PartialCommitTest.class);
testClasses.add(MetaTest.class);
testClasses.add(RevisionDeltaTest.class);
- testClasses.add(RevisionHolderTest.class);
testClasses.add(IndexReconstructionTest.class);
testClasses.add(AutoAttacherTest.class);
testClasses.add(SavePointTest.class);
@@ -179,7 +175,6 @@ public abstract class AllConfigs extends ConfigTestSuite
testClasses.add(Bugzilla_241464_Test.class);
testClasses.add(Bugzilla_243310_Test.class);
testClasses.add(Bugzilla_246442_Test.class);
- testClasses.add(Bugzilla_246456_Test.class);
testClasses.add(Bugzilla_246622_Test.class);
testClasses.add(Bugzilla_248052_Test.class);
testClasses.add(Bugzilla_248124_Test.class);
@@ -225,8 +220,6 @@ public abstract class AllConfigs extends ConfigTestSuite
testClasses.add(Bugzilla_283985_SavePointTest.class);
testClasses.add(Bugzilla_285008_Test.class);
testClasses.add(Bugzilla_289932_Test.class);
- testClasses.add(Bugzilla_289984_Test.class);
- testClasses.add(Bugzilla_292372_Test.class);
testClasses.add(Bugzilla_293283_Test.class);
testClasses.add(Bugzilla_294850_Test.class);
testClasses.add(Bugzilla_294859_Test.class);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BranchingTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BranchingTest.java
index f998066731..7724304f75 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BranchingTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BranchingTest.java
@@ -20,7 +20,7 @@ import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.internal.common.revision.cache.branch.BranchRevisionCache;
+import org.eclipse.emf.cdo.internal.common.revision.CDORevisionCacheImpl;
import org.eclipse.emf.cdo.internal.server.mem.MEMStore;
import org.eclipse.emf.cdo.server.IStore;
import org.eclipse.emf.cdo.session.CDOSession;
@@ -56,14 +56,14 @@ public class BranchingTest extends AbstractCDOTest
super.doSetUp();
skipUnlessBranching();
- Field disableGC = ReflectUtil.getField(BranchRevisionCache.class, "disableGC");
+ Field disableGC = ReflectUtil.getField(CDORevisionCacheImpl.class, "disableGC");
ReflectUtil.setValue(disableGC, null, true);
}
@Override
protected void doTearDown() throws Exception
{
- Field disableGC = ReflectUtil.getField(BranchRevisionCache.class, "disableGC");
+ Field disableGC = ReflectUtil.getField(CDORevisionCacheImpl.class, "disableGC");
ReflectUtil.setValue(disableGC, null, false);
super.doTearDown();
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ImportXML.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ImportXML.java
index 20f7641e93..98d2b1d411 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ImportXML.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ImportXML.java
@@ -14,7 +14,6 @@ import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
import org.eclipse.emf.cdo.net4j.CDOSessionConfiguration;
import org.eclipse.emf.cdo.server.CDOServerUtil;
import org.eclipse.emf.cdo.server.IRepository;
-import org.eclipse.emf.cdo.server.IRepository.Props;
import org.eclipse.emf.cdo.server.IStore;
import org.eclipse.emf.cdo.server.mem.MEMStoreUtil;
import org.eclipse.emf.cdo.server.net4j.CDONet4jServerUtil;
@@ -79,12 +78,9 @@ public class ImportXML
connector.close();
}
- @SuppressWarnings("deprecation")
private static IRepository createRepository()
{
Map<String, String> props = new HashMap<String, String>();
- props.put(Props.CURRENT_LRU_CAPACITY, "10000");
- props.put(Props.REVISED_LRU_CAPACITY, "10000");
return CDOServerUtil.createRepository(REPOSITORY_NAME, createStore(), props);
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionHolderTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionHolderTest.java
deleted file mode 100644
index 49958198d6..0000000000
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionHolderTest.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/**
- * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.tests;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.internal.common.revision.cache.lru.DLRevisionHolder;
-import org.eclipse.emf.cdo.internal.common.revision.cache.lru.LRURevisionCache;
-import org.eclipse.emf.cdo.internal.common.revision.cache.lru.LRURevisionHolder;
-import org.eclipse.emf.cdo.internal.common.revision.cache.lru.LRURevisionList;
-import org.eclipse.emf.cdo.internal.common.revision.cache.lru.RevisionHolder;
-
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public class RevisionHolderTest extends AbstractCDOTest
-{
- public void testChronology() throws Exception
- {
- LRURevisionCache cache = new LRURevisionCache();
- cache.activate();
-
- TestRevision r1v1 = new TestRevision(1, 1, 1);
- cache.addRevision(r1v1);
- assertEquals(CDORevision.UNSPECIFIED_DATE, r1v1.getRevised());
-
- TestRevision r1v2 = new TestRevision(1, 2, 6);
- cache.addRevision(r1v2);
- assertEquals(CDORevision.UNSPECIFIED_DATE, r1v2.getRevised());
- assertEquals(r1v2.getTimeStamp() - 1, r1v1.getRevised());
-
- TestRevision r1v3 = new TestRevision(1, 3, 11);
- cache.addRevision(r1v3);
- assertEquals(CDORevision.UNSPECIFIED_DATE, r1v3.getRevised());
- assertEquals(r1v3.getTimeStamp() - 1, r1v2.getRevised());
- assertEquals(r1v2.getTimeStamp() - 1, r1v1.getRevised());
-
- CDOID id = r1v1.getID();
-
- RevisionHolder h1v3 = cache.getHolder(id);
- assertEquals(r1v3, h1v3.getRevision());
-
- RevisionHolder h1v2 = h1v3.getNext();
- assertEquals(r1v2, h1v2.getRevision());
-
- RevisionHolder h1v1 = h1v2.getNext();
- assertEquals(r1v1, h1v1.getRevision());
- assertEquals(null, h1v1.getNext());
-
- h1v2 = h1v1.getPrev();
- assertEquals(r1v2, h1v2.getRevision());
-
- h1v3 = h1v2.getPrev();
- assertEquals(r1v3, h1v3.getRevision());
- assertEquals(null, h1v3.getPrev());
- }
-
- public void testAddHead() throws Exception
- {
- LinkedList<LRURevisionHolder> linkedList = new LinkedList<LRURevisionHolder>();
- LRURevisionList list = new LRURevisionList(100);
- validateList(list, 0);
- for (int i = 0; i < 10; i++)
- {
- LRURevisionHolder holder = new LRURevisionHolder(new TestRevision(i));
- linkedList.addFirst(holder);
- list.addHead(holder);
- validateList(list, i + 1);
- validateList(list, linkedList);
- }
- }
-
- public void testAddTail() throws Exception
- {
- LinkedList<LRURevisionHolder> linkedList = new LinkedList<LRURevisionHolder>();
- LRURevisionList list = new LRURevisionList(100);
- validateList(list, 0);
- for (int i = 0; i < 10; i++)
- {
- LRURevisionHolder holder = new LRURevisionHolder(new TestRevision(i));
- linkedList.addLast(holder);
- list.addTail(holder);
- validateList(list, i + 1);
- validateList(list, linkedList);
- }
- }
-
- public void testRemoveHead() throws Exception
- {
- LinkedList<LRURevisionHolder> linkedList = new LinkedList<LRURevisionHolder>();
- LRURevisionList list = new LRURevisionList(100);
- for (int i = 0; i < 10; i++)
- {
- LRURevisionHolder holder = new LRURevisionHolder(new TestRevision(i));
- linkedList.addLast(holder);
- list.addTail(holder);
- }
-
- validateList(list, 10);
- validateList(list, linkedList);
-
- LRURevisionHolder holder = linkedList.removeFirst();
- list.remove(holder);
- validateList(list, 9);
- validateList(list, linkedList);
- }
-
- public void testRemoveTail() throws Exception
- {
- LinkedList<LRURevisionHolder> linkedList = new LinkedList<LRURevisionHolder>();
- LRURevisionList list = new LRURevisionList(100);
- for (int i = 0; i < 10; i++)
- {
- LRURevisionHolder holder = new LRURevisionHolder(new TestRevision(i));
- linkedList.addLast(holder);
- list.addTail(holder);
- }
-
- validateList(list, 10);
- validateList(list, linkedList);
-
- LRURevisionHolder holder = linkedList.removeLast();
- list.remove(holder);
- validateList(list, 9);
- validateList(list, linkedList);
- }
-
- public void testRemoveMiddle() throws Exception
- {
- LinkedList<LRURevisionHolder> linkedList = new LinkedList<LRURevisionHolder>();
- LRURevisionList list = new LRURevisionList(100);
- for (int i = 0; i < 10; i++)
- {
- LRURevisionHolder holder = new LRURevisionHolder(new TestRevision(i));
- linkedList.addLast(holder);
- list.addTail(holder);
- }
-
- validateList(list, 10);
- validateList(list, linkedList);
-
- LRURevisionHolder holder = linkedList.remove(5);
- list.remove(holder);
- validateList(list, 9);
- validateList(list, linkedList);
- }
-
- public void testRemoveAll() throws Exception
- {
- LinkedList<LRURevisionHolder> linkedList = new LinkedList<LRURevisionHolder>();
- LRURevisionList list = new LRURevisionList(100);
- for (int i = 0; i < 10; i++)
- {
- LRURevisionHolder holder = new LRURevisionHolder(new TestRevision(i));
- linkedList.addLast(holder);
- list.addTail(holder);
- }
-
- validateList(list, 10);
- validateList(list, linkedList);
-
- for (int i = 10; i > 0; i--)
- {
- LRURevisionHolder holder = linkedList.remove(0);
- list.remove(holder);
- validateList(list, i - 1);
- validateList(list, linkedList);
- }
-
- validateList(list, 0);
- validateList(list, linkedList);
- }
-
- public void testRevised() throws Exception
- {
- LRURevisionCache cache = new LRURevisionCache();
- cache.activate();
-
- TestRevision r1v1 = new TestRevision(1, 1, 1);
- cache.addRevision(r1v1);
- assertEquals(CDORevision.UNSPECIFIED_DATE, r1v1.getRevised());
-
- TestRevision r1v3 = new TestRevision(1, 3, 11);
- cache.addRevision(r1v3);
- assertEquals(CDORevision.UNSPECIFIED_DATE, r1v3.getRevised());
- assertNotSame(r1v3.getTimeStamp() - 1, r1v1.getRevised());
-
- CDOID id = r1v1.getID();
-
- RevisionHolder h1v3 = cache.getHolder(id);
- assertEquals(r1v3, h1v3.getRevision());
- }
-
- private void validateList(LRURevisionList list, int size)
- {
- assertEquals(size, list.size());
- if (size == 0)
- {
- assertEquals(list.getDLHead(), list.getDLTail());
- }
- else
- {
- assertNotNull(list.getDLHead());
- assertNotNull(list.getDLTail());
- }
-
- assertEquals(list.getDLHead(), list.getDLHead().getDLNext().getDLPrev());
- assertEquals(list.getDLTail(), list.getDLTail().getDLPrev().getDLNext());
-
- DLRevisionHolder holder = list.getDLHead();
- for (int i = 0; i < size; i++)
- {
- assertEquals(holder, holder.getDLNext().getDLPrev());
- assertEquals(holder, holder.getDLPrev().getDLNext());
- }
- }
-
- private void validateList(LRURevisionList list, List<LRURevisionHolder> expected)
- {
- assertEquals(expected.size(), list.size());
- for (int i = 0; i < expected.size(); i++)
- {
- assertEquals(expected.get(i), list.get(i));
- }
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionManagerTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionManagerTest.java
index a8030230f2..390371aa5d 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionManagerTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionManagerTest.java
@@ -16,8 +16,8 @@ import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
+import org.eclipse.emf.cdo.internal.common.revision.CDORevisionCacheImpl;
import org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl;
-import org.eclipse.emf.cdo.internal.common.revision.cache.branch.BranchRevisionCache;
import org.eclipse.emf.cdo.internal.server.mem.MEMStore;
import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.server.StoreThreadLocal;
@@ -93,7 +93,7 @@ public class RevisionManagerTest extends AbstractCDOTest
skipUnlessConfig(MEM);
super.doSetUp();
- Field disableGC = ReflectUtil.getField(BranchRevisionCache.class, "disableGC");
+ Field disableGC = ReflectUtil.getField(CDORevisionCacheImpl.class, "disableGC");
ReflectUtil.setValue(disableGC, null, true);
repository = getRepository();
@@ -129,7 +129,7 @@ public class RevisionManagerTest extends AbstractCDOTest
StoreThreadLocal.release();
session.close();
- Field disableGC = ReflectUtil.getField(BranchRevisionCache.class, "disableGC");
+ Field disableGC = ReflectUtil.getField(CDORevisionCacheImpl.class, "disableGC");
ReflectUtil.setValue(disableGC, null, false);
super.doTearDown();
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_246456_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_246456_Test.java
deleted file mode 100644
index d8b8336ba0..0000000000
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_246456_Test.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Simon McDuff - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.tests.bugzilla;
-
-import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.internal.common.revision.cache.lru.LRURevisionCache;
-import org.eclipse.emf.cdo.internal.common.revision.cache.two.TwoLevelRevisionCache;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager;
-import org.eclipse.emf.cdo.tests.AbstractCDOTest;
-import org.eclipse.emf.cdo.tests.model1.Supplier;
-
-import org.eclipse.emf.spi.cdo.InternalCDOSession;
-import org.eclipse.emf.spi.cdo.InternalCDOTransaction;
-
-/**
- * See bug 246456
- *
- * @author Simon McDuff
- */
-public class Bugzilla_246456_Test extends AbstractCDOTest
-{
- public void testBugzilla_246456() throws Exception
- {
- msg("Opening session");
- InternalCDOSession session = (InternalCDOSession)openSession();
- InternalCDORevisionManager revisionManager = session.getRevisionManager();
- InternalCDORevisionCache cache = revisionManager.getCache();
- if (cache instanceof TwoLevelRevisionCache)
- {
- TwoLevelRevisionCache twoLevel = (TwoLevelRevisionCache)cache;
- InternalCDORevisionCache level1 = twoLevel.getLevel1();
- if (level1 instanceof LRURevisionCache)
- {
- LRURevisionCache lruCache = (LRURevisionCache)level1;
-
- msg("Opening transaction");
- InternalCDOTransaction transaction = (InternalCDOTransaction)session.openTransaction();
- lruCache.setCapacityRevised(10);
- lruCache.setCapacityCurrent(10);
-
- msg("Creating resource");
- CDOResource resource = transaction.createResource("/test1");
-
- msg("Creating supplier");
- Supplier supplier = getModel1Factory().createSupplier();
-
- msg("Adding supplier");
- resource.getContents().add(supplier);
-
- msg("Committing");
- transaction.commit();
- for (int i = 0; i < 10; i++)
- {
- Supplier supplier2 = getModel1Factory().createSupplier();
- resource.getContents().add(supplier2);
- transaction.commit();
- }
-
- Supplier supplier2 = getModel1Factory().createSupplier();
- resource.getContents().add(supplier2);
-
- msg("Committing");
- transaction.commit();
- }
- }
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_289984_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_289984_Test.java
deleted file mode 100644
index 76cc8ffc45..0000000000
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_289984_Test.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Simon McDuff - initial API and implementation
- */
-package org.eclipse.emf.cdo.tests.bugzilla;
-
-import org.eclipse.emf.cdo.internal.common.revision.cache.lru.LRURevisionCache;
-import org.eclipse.emf.cdo.tests.AbstractCDOTest;
-import org.eclipse.emf.cdo.tests.TestRevision;
-
-/**
- * Exception Holder RevisionHolder[AAA@OID297v1] does not belong to this list
- * <p>
- * See bug 289984
- *
- * @author Simon McDuff
- */
-public class Bugzilla_289984_Test extends AbstractCDOTest
-{
- public void testBugzilla_289984() throws Exception
- {
- LRURevisionCache cache = new LRURevisionCache();
- cache.setCapacityCurrent(2);
- cache.setCapacityRevised(4);
- cache.activate();
-
- TestRevision r1v1 = new TestRevision(1, 1, 1);
- cache.addRevision(r1v1);
-
- TestRevision r1v3 = new TestRevision(1, 3, 6);
- cache.addRevision(r1v3);
- cache.removeRevision(r1v3.getID(), r1v3.getBranch().getVersion(3));
-
- TestRevision r1v5 = new TestRevision(1, 5, 6);
- cache.addRevision(r1v5);
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_292372_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_292372_Test.java
deleted file mode 100644
index 2317f94d4b..0000000000
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_292372_Test.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.tests.bugzilla;
-
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.internal.common.revision.cache.lru.LRURevisionCache;
-import org.eclipse.emf.cdo.internal.common.revision.cache.mem.MEMRevisionCache;
-import org.eclipse.emf.cdo.internal.common.revision.cache.two.TwoLevelRevisionCache;
-import org.eclipse.emf.cdo.tests.AbstractCDOTest;
-import org.eclipse.emf.cdo.tests.TestRevision;
-
-/**
- * @author Eike Stepper
- */
-public class Bugzilla_292372_Test extends AbstractCDOTest
-{
- public void test()
- {
- LRURevisionCache lruCache = new LRURevisionCache();
- lruCache.setCapacityCurrent(2);
- lruCache.setCapacityRevised(2);
-
- MEMRevisionCache memCache = new MEMRevisionCache();
-
- TwoLevelRevisionCache twoLevelCache = new TwoLevelRevisionCache();
- twoLevelCache.setLevel1(lruCache);
- twoLevelCache.setLevel2(memCache);
- twoLevelCache.activate();
-
- TestRevision r1v1 = new TestRevision(9, 1, 10);
-
- TestRevision r2v1 = new TestRevision(1, 1, 10);
- TestRevision r2v2 = new TestRevision(1, 2, 20);
- TestRevision r2v3 = new TestRevision(1, 3, 30);
- TestRevision r2v4 = new TestRevision(1, 4, 40);
-
- // First we add the revision that will cause the problem later
- twoLevelCache.addRevision(r1v1);
-
- // Then we push other revisions to force r1v1 into the level-2 cache
- twoLevelCache.addRevision(r2v1);
- assertEquals(false, r2v1.isHistorical());
- twoLevelCache.addRevision(r2v2);
- assertEquals(true, r2v1.isHistorical());
- assertEquals(false, r2v2.isHistorical());
- twoLevelCache.addRevision(r2v3);
- assertEquals(true, r2v2.isHistorical());
- assertEquals(false, r2v3.isHistorical());
- twoLevelCache.addRevision(r2v4);
- assertEquals(true, r2v3.isHistorical());
- assertEquals(false, r2v4.isHistorical());
-
- // Now we add a revision r1v2 that SHOULD cause r1v1.revised to get set
- TestRevision r1v2 = new TestRevision(9, 2, 20);
- twoLevelCache.addRevision(r1v2); // Into L1 cache
- CDORevision r1v = twoLevelCache.getRevisionByVersion(r1v1.getID(), r1v1.getBranch().getVersion(1)); // From L2 cache
-
- // But it doesn't, cause twoLevelCache forgot to delegate to the L2,
- // so this will fail:
- assertEquals(true, r1v.isHistorical());
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java
index 0eacf4f739..d4ade6fd1f 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java
@@ -13,7 +13,7 @@ package org.eclipse.emf.cdo.tests.config.impl;
import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
-import org.eclipse.emf.cdo.internal.common.revision.cache.noop.NOOPRevisionCache;
+import org.eclipse.emf.cdo.internal.common.revision.NOOPRevisionCache;
import org.eclipse.emf.cdo.internal.net4j.CDONet4jSessionConfigurationImpl;
import org.eclipse.emf.cdo.internal.net4j.CDONet4jSessionImpl;
import org.eclipse.emf.cdo.internal.server.syncing.OfflineClone;
@@ -158,14 +158,11 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf
return repository;
}
- @SuppressWarnings("deprecation")
protected void initRepositoryProperties(Map<String, String> props)
{
props.put(Props.OVERRIDE_UUID, ""); // UUID := name !!!
props.put(Props.SUPPORTING_AUDITS, "false");
props.put(Props.SUPPORTING_BRANCHES, "false");
- props.put(Props.CURRENT_LRU_CAPACITY, "10000");
- props.put(Props.REVISED_LRU_CAPACITY, "10000");
}
public void registerRepository(InternalRepository repository)
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/AbstractCDORevisionCacheTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/AbstractCDORevisionCacheTest.java
index ead384fc63..c6d7be96ed 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/AbstractCDORevisionCacheTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/AbstractCDORevisionCacheTest.java
@@ -18,10 +18,8 @@ import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.internal.db.cache.DBRevisionCache;
import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.internal.common.revision.cache.lru.LRURevisionCache;
-import org.eclipse.emf.cdo.internal.common.revision.cache.mem.MEMRevisionCache;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
@@ -47,12 +45,8 @@ import java.util.List;
* @author Andre Dietisheim
* @see CDORevisionCache
* @see DBRevisionCache
- * @see LRURevisionCache
- * @see MEMRevisionCache
* @see DerbyDBRevisionCacheTest
* @see H2DBRevisionCacheTest
- * @see LRURevisionCacheTest
- * @see MEMRevisionCacheTest
* @see DefaultRevisionCacheTest
*/
public abstract class AbstractCDORevisionCacheTest extends AbstractOMTest
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/AbstractDBRevisionCacheTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/AbstractDBRevisionCacheTest.java
index 8117fb35df..f63cc8e08e 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/AbstractDBRevisionCacheTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/AbstractDBRevisionCacheTest.java
@@ -13,7 +13,7 @@ package org.eclipse.emf.cdo.tests.revisioncache;
import org.eclipse.emf.cdo.common.db.CDOCommonDBUtil;
import org.eclipse.emf.cdo.common.revision.CDOListFactory;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/AllTestsCDORevisionCache.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/AllTestsCDORevisionCache.java
index 420e77a4a5..3ee80af109 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/AllTestsCDORevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/AllTestsCDORevisionCache.java
@@ -26,8 +26,6 @@ public class AllTestsCDORevisionCache
// $JUnit-BEGIN$
suite.addTestSuite(DerbyDBRevisionCacheTest.class);
suite.addTestSuite(H2DBRevisionCacheTest.class);
- suite.addTestSuite(MEMRevisionCacheTest.class);
- suite.addTestSuite(LRURevisionCacheTest.class);
suite.addTestSuite(DefaultRevisionCacheTest.class);
// $JUnit-END$
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/DefaultRevisionCacheTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/DefaultRevisionCacheTest.java
index 217a2e9c4f..02f17b85de 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/DefaultRevisionCacheTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/DefaultRevisionCacheTest.java
@@ -11,7 +11,7 @@
*/
package org.eclipse.emf.cdo.tests.revisioncache;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCacheUtil;
+import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
@@ -23,6 +23,6 @@ public class DefaultRevisionCacheTest extends AbstractCDORevisionCacheTest
@Override
protected InternalCDORevisionCache createRevisionCache(CDOSession session) throws Exception
{
- return (InternalCDORevisionCache)CDORevisionCacheUtil.createDefaultCache(false);
+ return (InternalCDORevisionCache)CDORevisionUtil.createRevisionCache();
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/LRURevisionCacheTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/LRURevisionCacheTest.java
deleted file mode 100644
index cf8eb18f98..0000000000
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/LRURevisionCacheTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Andre Dietisheim - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.tests.revisioncache;
-
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCacheUtil;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
-
-/**
- * @author Andre Dietisheim
- */
-public class LRURevisionCacheTest extends AbstractCDORevisionCacheTest
-{
- public static final int DEFAULT_CAPACITY_CURRENT = 1000;
-
- public static final int DEFAULT_CAPACITY_REVISED = 1000;
-
- @SuppressWarnings("deprecation")
- @Override
- protected InternalCDORevisionCache createRevisionCache(CDOSession session) throws Exception
- {
- return (InternalCDORevisionCache)CDORevisionCacheUtil.createLRUCache(DEFAULT_CAPACITY_CURRENT,
- DEFAULT_CAPACITY_REVISED);
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/MEMRevisionCacheTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/MEMRevisionCacheTest.java
deleted file mode 100644
index 2993fd5926..0000000000
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/revisioncache/MEMRevisionCacheTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Andre Dietisheim - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.tests.revisioncache;
-
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCacheUtil;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
-
-/**
- * @author Andre Dietisheim
- */
-public class MEMRevisionCacheTest extends AbstractCDORevisionCacheTest
-{
- @Override
- public void testReturnsRemovedVersionWhenRemoving()
- {
- // test's not possible!
- // MemRevisionCache does always return null when removing revisions
- }
-
- @SuppressWarnings("deprecation")
- @Override
- protected InternalCDORevisionCache createRevisionCache(CDOSession session) throws Exception
- {
- return (InternalCDORevisionCache)CDORevisionCacheUtil.createMEMCache();
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/CDOWorkspaceImpl.java b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/CDOWorkspaceImpl.java
index 44b040783c..07a2f47c28 100644
--- a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/CDOWorkspaceImpl.java
+++ b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/CDOWorkspaceImpl.java
@@ -18,11 +18,11 @@ import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
import org.eclipse.emf.cdo.common.revision.CDORevisionHandler;
import org.eclipse.emf.cdo.common.revision.CDORevisionManager;
import org.eclipse.emf.cdo.common.revision.CDORevisionProvider;
import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDeltaUtil;
import org.eclipse.emf.cdo.internal.server.Repository;
import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
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 a7b6a79d48..03ba25df4b 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
@@ -770,10 +770,7 @@ public final class CDOStateMachine extends FiniteStateMachine<CDOState, CDOEvent
revision.adjustReferences(data.getReferenceAdjuster());
InternalCDORevisionManager revisionManager = transaction.getSession().getRevisionManager();
- if (!revisionManager.addRevision(revision))
- {
- throw new IllegalStateException("Revision was not registered: " + revision);
- }
+ revisionManager.addRevision(revision);
changeState(object, CDOState.CLEAN);
}

Back to the top