Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2020-05-27 06:10:44 +0000
committerEike Stepper2020-05-27 06:10:44 +0000
commitec70f5640902d2f957b70a3b7df4be6ef8a49d8b (patch)
treeb61ef68d8d0d2dac32704986c6c445f2c0a0a572
parent2662faf94c9f96e32766475a2b61463137193c31 (diff)
downloadcdo-ec70f5640902d2f957b70a3b7df4be6ef8a49d8b.tar.gz
cdo-ec70f5640902d2f957b70a3b7df4be6ef8a49d8b.tar.xz
cdo-ec70f5640902d2f957b70a3b7df4be6ef8a49d8b.zip
[563615] Provide option to detect and report the use of legacy models
https://bugs.eclipse.org/bugs/show_bug.cgi?id=563615
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java
index ca64c83d0f..84e8f99343 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java
@@ -98,6 +98,7 @@ import org.eclipse.net4j.util.container.SingleDeltaContainerEvent;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.lifecycle.LifecycleException;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+import org.eclipse.net4j.util.om.OMPlatform;
import org.eclipse.net4j.util.om.log.OMLogger;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.ref.KeyedReference;
@@ -135,6 +136,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -154,6 +156,10 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb
private static final String SAFE_RENAME = "~renamed";
+ private static final Set<String> LEGACY_MODELS = OMPlatform.INSTANCE.isProperty("org.eclipse.emf.cdo.view.REPORT_LEGACY_MODELS")
+ ? Collections.synchronizedSet(new HashSet<>())
+ : null;
+
private static final ThreadLocal<Lock> NEXT_VIEW_LOCK = new ThreadLocal<>();
private final ViewAndState[] viewAndStates = ViewAndState.create(this);
@@ -2086,8 +2092,7 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb
object.cdoInternalSetRevision(revision);
// Before setting the state to CLEAN (that can trigger a duplicate loading and instantiation of the current
- // object)
- // we make sure that object is registered - without throwing exception if it is already the case
+ // object) we make sure that object is registered - without throwing exception if it is already the case
registerObjectIfNotRegistered(object);
object.cdoInternalSetState(CDOState.CLEAN);
@@ -2412,6 +2417,15 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb
@Override
public void registerObject(InternalCDOObject object)
{
+ if (LEGACY_MODELS != null && CDOUtil.isLegacyObject(object))
+ {
+ String nsURI = object.eClass().getEPackage().getNsURI();
+ if (LEGACY_MODELS.add(nsURI))
+ {
+ OM.LOG.info("Legacy model detected: " + nsURI);
+ }
+ }
+
synchronized (getViewMonitor())
{
lockView();

Back to the top