Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDReference.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOReference.java13
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassInfo.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java61
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOType.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java22
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionUtil.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassInfoImpl.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOTypeImpl.java47
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOFeatureMapEntryImpl.java67
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOListFeatureDeltaImpl.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOSingleValueFeatureDeltaImpl.java21
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/protocol/CDODataInputImpl.java74
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/protocol/CDODataOutputImpl.java37
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/BaseCDORevision.java23
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureMapEntry.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/ITypeMapping.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AbstractMappingStrategy.java13
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/TypeMappingRegistry.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractFeatureMapTableMapping.java605
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditFeatureMapTableMapping.java108
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditFeatureMapTableMappingWithRanges.java1218
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingFeatureMapTableMapping.java112
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingFeatureMapTableMappingWithRanges.java1511
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalAuditMappingStrategy.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalAuditMappingStrategyWithRanges.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingMappingStrategy.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingMappingStrategyWithRanges.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalNonAuditMappingStrategy.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/IMappingConstants.java20
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/NonAuditFeatureMapTableMapping.java583
-rw-r--r--plugins/org.eclipse.emf.cdo.server.mongodb/META-INF/MANIFEST.MF8
-rw-r--r--plugins/org.eclipse.emf.cdo.server.mongodb/pom.xml2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/internal/mongodb/MongoDBStore.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server/.settings/.api_filters9
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java21
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerExporter.java18
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerImporter.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalStore.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfigs.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/FeatureMapTest.java273
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/XRefTest.java18
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_289932_Test.java46
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ConfigTest.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java37
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOObjectReferenceImpl.java8
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOStoreImpl.java25
49 files changed, 196 insertions, 4960 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDReference.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDReference.java
index 4144c518ef..af666f1ca7 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDReference.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDReference.java
@@ -14,6 +14,7 @@ import org.eclipse.emf.cdo.common.protocol.CDODataInput;
import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import java.io.IOException;
@@ -32,15 +33,15 @@ public class CDOIDReference implements CDOReference<CDOID>
private CDOID sourceID;
- private EStructuralFeature sourceFeature;
+ private EReference sourceReference;
private int sourceIndex;
- public CDOIDReference(CDOID targetID, CDOID sourceID, EStructuralFeature sourceFeature, int sourceIndex)
+ public CDOIDReference(CDOID targetID, CDOID sourceID, EStructuralFeature sourceReference, int sourceIndex)
{
this.targetID = targetID;
this.sourceID = sourceID;
- this.sourceFeature = sourceFeature;
+ this.sourceReference = (EReference)sourceReference;
this.sourceIndex = sourceIndex;
}
@@ -51,7 +52,7 @@ public class CDOIDReference implements CDOReference<CDOID>
EClass eClass = (EClass)in.readCDOClassifierRefAndResolve();
String featureName = in.readString();
- sourceFeature = eClass.getEStructuralFeature(featureName);
+ sourceReference = (EReference)eClass.getEStructuralFeature(featureName);
sourceIndex = in.readXInt();
}
@@ -60,8 +61,8 @@ public class CDOIDReference implements CDOReference<CDOID>
{
out.writeCDOID(targetID);
out.writeCDOID(sourceID);
- out.writeCDOClassifierRef(sourceFeature.getEContainingClass());
- out.writeString(sourceFeature.getName());
+ out.writeCDOClassifierRef(sourceReference.getEContainingClass());
+ out.writeString(sourceReference.getName());
out.writeXInt(sourceIndex);
}
@@ -77,10 +78,17 @@ public class CDOIDReference implements CDOReference<CDOID>
return sourceID;
}
+ @Deprecated
@Override
public EStructuralFeature getSourceFeature()
{
- return sourceFeature;
+ return sourceReference;
+ }
+
+ @Override
+ public EReference getSourceReference()
+ {
+ return sourceReference;
}
@Override
@@ -95,7 +103,7 @@ public class CDOIDReference implements CDOReference<CDOID>
StringBuilder builder = new StringBuilder();
builder.append(sourceID);
builder.append(".");
- builder.append(sourceFeature.getName());
+ builder.append(sourceReference.getName());
if (sourceIndex != NO_INDEX)
{
builder.append("[");
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOReference.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOReference.java
index 977052f3b1..a76713dc06 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOReference.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOReference.java
@@ -11,10 +11,8 @@
package org.eclipse.emf.cdo.common.id;
import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.FeatureMap;
/**
* Represents a reference from one object to another object, possibly {@link CDOID} or CDOObject typed.
@@ -33,10 +31,17 @@ public interface CDOReference<OBJECT>
public OBJECT getSourceObject();
/**
- * Returns the source {@link EReference} or the source {@link EAttribute} if the source feature is a
- * {@link FeatureMap}.
+ * Returns the source {@link EReference}.
+ * @deprecated As of 4.10 use {@link #getSourceReference()}.
*/
+ @Deprecated
public EStructuralFeature getSourceFeature();
+ /**
+ * Returns the source {@link EReference}.
+ * @since 4.10
+ */
+ public EReference getSourceReference();
+
public int getSourceIndex();
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassInfo.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassInfo.java
index 9bbad98b40..ace54e4779 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassInfo.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassInfo.java
@@ -50,6 +50,11 @@ public interface CDOClassInfo extends Adapter
*/
public boolean hasPersistentOpposite(EStructuralFeature feature);
+ /**
+ * @since 4.10
+ */
+ public boolean hasPersistentFeatureMaps();
+
public EStructuralFeature[] getAllPersistentFeatures();
/**
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java
index d075cb76a2..a8ee048496 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java
@@ -15,6 +15,7 @@ package org.eclipse.emf.cdo.common.model;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.util.CDOException;
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.model.CDOClassInfoImpl;
@@ -22,6 +23,7 @@ import org.eclipse.emf.cdo.internal.common.model.CDOPackageInfoImpl;
import org.eclipse.emf.cdo.internal.common.model.CDOPackageRegistryImpl;
import org.eclipse.emf.cdo.internal.common.model.CDOPackageUnitImpl;
import org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
import org.eclipse.net4j.util.io.ExtendedDataInput;
import org.eclipse.net4j.util.io.ExtendedDataOutput;
@@ -44,7 +46,6 @@ import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.FeatureMapUtil;
import java.io.IOException;
@@ -288,11 +289,6 @@ public final class CDOModelUtil implements CDOModelConstants
*/
public static CDOType getType(EStructuralFeature feature)
{
- if (FeatureMapUtil.isFeatureMap(feature))
- {
- return CDOType.FEATURE_MAP_ENTRY;
- }
-
return getType(feature.getEType());
}
@@ -524,11 +520,6 @@ public final class CDOModelUtil implements CDOModelConstants
return CDOType.BIG_INTEGER;
}
- if (object instanceof FeatureMap.Entry)
- {
- return CDOType.FEATURE_MAP_ENTRY;
- }
-
if (object instanceof Throwable)
{
return CDOType.EXCEPTION;
@@ -726,6 +717,54 @@ public final class CDOModelUtil implements CDOModelConstants
}
/**
+ * @since 4.10
+ */
+ public static void checkNoFeatureMaps(StringBuilder builder, EPackage ePackage, boolean checkFeatureMapEntries)
+ {
+ for (TreeIterator<EObject> it = ePackage.eAllContents(); it.hasNext();)
+ {
+ EObject packageElement = it.next();
+ if (checkFeatureMapEntries && packageElement instanceof EClassifier)
+ {
+ EClassifier classifier = (EClassifier)packageElement;
+ if (FeatureMapUtil.isFeatureMapEntry(classifier))
+ {
+ builder.append(String.format("Package '%s' contains feature map entry '%s'", ePackage.getNsURI(), classifier.getName()));
+ builder.append("\n");
+ }
+ }
+ else if (packageElement instanceof EStructuralFeature)
+ {
+ EStructuralFeature feature = (EStructuralFeature)packageElement;
+ if (FeatureMapUtil.isFeatureMap(feature))
+ {
+ EClass eClass = feature.getEContainingClass();
+ builder.append(String.format("Package '%s' contains feature map '%s.%s'", ePackage.getNsURI(), eClass.getName(), feature.getName()));
+ builder.append("\n");
+ }
+ }
+ }
+ }
+
+ /**
+ * @since 4.10
+ */
+ public static void checkNoFeatureMaps(InternalCDOPackageUnit[] packageUnits, boolean checkFeatureMapEntries) throws CDOException
+ {
+ StringBuilder builder = new StringBuilder();
+ for (InternalCDOPackageUnit packageUnit : packageUnits)
+ {
+ EPackage ePackage = packageUnit.getTopLevelPackageInfo().getEPackage();
+ checkNoFeatureMaps(builder, ePackage, checkFeatureMapEntries);
+ }
+
+ if (builder.length() != 0)
+ {
+ throw new CDOException(builder.toString());
+ }
+ }
+
+ /**
* @since 4.0
*/
public static Map<EClass, List<EClass>> getSubTypes(EPackage.Registry packageRegistry)
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOType.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOType.java
index a7fa69ffc5..66c4a34718 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOType.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOType.java
@@ -133,8 +133,10 @@ public interface CDOType
/**
* @since 2.0
+ * @deprecated As of 4.5 {@link org.eclipse.emf.ecore.util.FeatureMap feature maps} are no longer supported.
*/
- public static final CDOType FEATURE_MAP_ENTRY = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.FEATURE_MAP_ENTRY;
+ @Deprecated
+ public static final CDOType FEATURE_MAP_ENTRY = null;
/**
* @since 4.3
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java
index dea292b4ee..31fb13e60d 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java
@@ -40,7 +40,6 @@ import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;
import java.io.ByteArrayInputStream;
@@ -242,26 +241,7 @@ public final class EMFUtil
builder.append('@');
builder.append(eStructuralFeature.getName());
- if (eStructuralFeature instanceof EAttribute)
- {
- FeatureMap featureMap = (FeatureMap)container.eGet(eStructuralFeature, false);
- for (int i = 0, size = featureMap.size(); i < size; ++i)
- {
- if (featureMap.getValue(i) == eObject)
- {
- EStructuralFeature entryFeature = featureMap.getEStructuralFeature(i);
- if (entryFeature instanceof EReference && ((EReference)entryFeature).isContainment())
- {
- builder.append('.');
- builder.append(i);
- return builder.toString();
- }
- }
- }
-
- builder.append(".-1");
- }
- else if (eStructuralFeature.isMany())
+ if (eStructuralFeature.isMany())
{
EList<?> eList = (EList<?>)container.eGet(eStructuralFeature, false);
int index = eList.indexOf(eObject);
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 523cd380fd..f9bfd55125 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
@@ -28,7 +28,6 @@ import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
import org.eclipse.emf.cdo.internal.common.commit.CDOChangeSetDataImpl;
import org.eclipse.emf.cdo.internal.common.commit.CDOChangeSetImpl;
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.CDORevisableImpl;
import org.eclipse.emf.cdo.internal.common.revision.CDORevisionCacheAuditing;
import org.eclipse.emf.cdo.internal.common.revision.CDORevisionCacheBranching;
@@ -37,7 +36,6 @@ 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;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionDeltaImpl;
-import org.eclipse.emf.cdo.spi.common.revision.CDOFeatureMapEntry;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionDelta;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager;
@@ -46,7 +44,6 @@ import org.eclipse.emf.cdo.spi.common.revision.ManagedRevisionProvider;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.FeatureMap;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
@@ -192,18 +189,22 @@ public final class CDORevisionUtil
/**
* @since 2.0
+ * @deprecated As of 4.5 {@link org.eclipse.emf.ecore.util.FeatureMap feature maps} are no longer supported.
*/
- public static FeatureMap.Entry createFeatureMapEntry(EStructuralFeature feature, Object value)
+ @Deprecated
+ public static org.eclipse.emf.ecore.util.FeatureMap.Entry createFeatureMapEntry(EStructuralFeature feature, Object value)
{
- return new CDOFeatureMapEntryImpl(feature, value);
+ throw new UnsupportedOperationException();
}
/**
* @since 3.0
+ * @deprecated As of 4.5 {@link org.eclipse.emf.ecore.util.FeatureMap feature maps} are no longer supported.
*/
- public static CDOFeatureMapEntry createCDOFeatureMapEntry()
+ @Deprecated
+ public static org.eclipse.emf.cdo.spi.common.revision.CDOFeatureMapEntry createCDOFeatureMapEntry()
{
- return new CDOFeatureMapEntryImpl();
+ throw new UnsupportedOperationException();
}
/**
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassInfoImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassInfoImpl.java
index f5b44b4037..9c8db801bb 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassInfoImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassInfoImpl.java
@@ -57,6 +57,8 @@ public final class CDOClassInfoImpl implements InternalCDOClassInfo, Adapter.Int
private EClass eClass;
+ private boolean hasPersistentFeatureMaps;
+
private final BitSet persistentBits = new BitSet();
private final BitSet persistentOppositeBits = new BitSet();
@@ -181,6 +183,12 @@ public final class CDOClassInfoImpl implements InternalCDOClassInfo, Adapter.Int
}
@Override
+ public boolean hasPersistentFeatureMaps()
+ {
+ return hasPersistentFeatureMaps;
+ }
+
+ @Override
public EStructuralFeature[] getAllPersistentFeatures()
{
return allPersistentFeatures;
@@ -336,7 +344,12 @@ public final class CDOClassInfoImpl implements InternalCDOClassInfo, Adapter.Int
persistentMapFeatures.add(feature);
}
- if (feature.isMany() || FeatureMapUtil.isFeatureMap(feature))
+ if (FeatureMapUtil.isFeatureMap(feature))
+ {
+ hasPersistentFeatureMaps = true;
+ }
+
+ if (feature.isMany())
{
settingsFeatureIndices[i] = settingsFeatureCount++;
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOTypeImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOTypeImpl.java
index 7f68ebfd8f..b471c6a17c 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOTypeImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOTypeImpl.java
@@ -23,7 +23,6 @@ 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.CDORevisionData;
-import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
import org.eclipse.emf.cdo.internal.common.messages.Messages;
import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
import org.eclipse.emf.cdo.spi.common.revision.CDOReferenceAdjuster;
@@ -38,7 +37,6 @@ import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.EStructuralFeature.Internal.DynamicValueHolder;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.ecore.util.FeatureMap;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -470,51 +468,6 @@ public abstract class CDOTypeImpl implements CDOType
}
};
- public static final CDOType FEATURE_MAP_ENTRY = new CDOTypeImpl("FEATURE_MAP_ENTRY", EcorePackage.EFEATURE_MAP_ENTRY, //$NON-NLS-1$
- false)
- {
- @Override
- protected FeatureMap.Entry doCopyValue(Object value)
- {
- FeatureMap.Entry entry = (FeatureMap.Entry)value;
- EStructuralFeature innerFeature = entry.getEStructuralFeature();
- Object innerValue = entry.getValue();
- CDOType innerType = CDOModelUtil.getType(innerFeature.getEType());
-
- Object innerCopy = innerType.copyValue(innerValue);
- return CDORevisionUtil.createFeatureMapEntry(innerFeature, innerCopy);
- }
-
- @Override
- public void writeValue(CDODataOutput out, Object value) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public FeatureMap.Entry readValue(CDODataInput in) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Object doAdjustReferences(CDOReferenceAdjuster adjuster, Object value, EStructuralFeature feature, int index)
- {
- FeatureMap.Entry entry = (FeatureMap.Entry)value;
- EStructuralFeature innerFeature = entry.getEStructuralFeature();
- Object innerValue = entry.getValue();
- CDOType innerType = CDOModelUtil.getType(innerFeature.getEType());
-
- Object innerCopy = innerType.adjustReferences(adjuster, innerValue, feature, index);
- if (innerCopy != innerValue) // Just an optimization for NOOP adjusters
- {
- value = CDORevisionUtil.createFeatureMapEntry(innerFeature, innerCopy);
- }
-
- return value;
- }
- };
-
public static final CDOType JAVA_CLASS = new ObjectType("JAVA_CLASS", EcorePackage.EJAVA_CLASS) //$NON-NLS-1$
{
@Override
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOFeatureMapEntryImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOFeatureMapEntryImpl.java
deleted file mode 100644
index 4cbcadd06d..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOFeatureMapEntryImpl.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, 2012, 2019 Eike Stepper (Loehne, 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;
-
-import org.eclipse.emf.cdo.spi.common.revision.CDOFeatureMapEntry;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public class CDOFeatureMapEntryImpl implements CDOFeatureMapEntry
-{
- private EStructuralFeature feature;
-
- private Object value;
-
- public CDOFeatureMapEntryImpl()
- {
- }
-
- public CDOFeatureMapEntryImpl(EStructuralFeature feature, Object value)
- {
- this.feature = feature;
- this.value = value;
- }
-
- @Override
- public EStructuralFeature getEStructuralFeature()
- {
- return feature;
- }
-
- @Override
- public void setEStructuralFeature(EStructuralFeature feature)
- {
- this.feature = feature;
- }
-
- @Override
- public Object getValue()
- {
- return value;
- }
-
- @Override
- public void setValue(Object value)
- {
- this.value = value;
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("CDOFeatureMapEntry({0}, {1})", feature.getName(), value); //$NON-NLS-1$
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOListFeatureDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOListFeatureDeltaImpl.java
index 39cf6e0b9a..8bd93805d1 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOListFeatureDeltaImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOListFeatureDeltaImpl.java
@@ -31,7 +31,6 @@ import org.eclipse.net4j.util.collection.Pair;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.FeatureMapUtil;
import java.io.IOException;
import java.lang.reflect.Array;
@@ -233,7 +232,7 @@ public class CDOListFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOL
{
case REMOVE:
{
- if (feature instanceof EReference || FeatureMapUtil.isFeatureMap(feature))
+ if (feature instanceof EReference)
{
Boolean result = cleanupWithNewRemoveDelta((CDORemoveFeatureDelta)featureDelta);
if (result != null)
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOSingleValueFeatureDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOSingleValueFeatureDeltaImpl.java
index 9a4c8ef6a1..871e5e3b5c 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOSingleValueFeatureDeltaImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOSingleValueFeatureDeltaImpl.java
@@ -15,7 +15,6 @@ 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.CDORevisionData;
-import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
import org.eclipse.emf.cdo.spi.common.revision.CDOReferenceAdjuster;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta.WithIndex;
@@ -25,8 +24,6 @@ import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.FeatureMap;
-import org.eclipse.emf.ecore.util.FeatureMapUtil;
import java.io.IOException;
import java.text.MessageFormat;
@@ -76,16 +73,6 @@ public abstract class CDOSingleValueFeatureDeltaImpl extends CDOFeatureDeltaImpl
}
EStructuralFeature feature = getFeature();
- if (FeatureMapUtil.isFeatureMap(feature))
- {
- FeatureMap.Entry entry = (FeatureMap.Entry)valueToWrite;
- feature = entry.getEStructuralFeature();
- valueToWrite = entry.getValue();
-
- int featureID = eClass.getFeatureID(feature);
- out.writeXInt(featureID);
- }
-
if (valueToWrite != null && valueToWrite != CDORevisionData.NIL && feature instanceof EReference)
{
valueToWrite = out.getIDProvider().provideCDOID(value);
@@ -97,14 +84,6 @@ public abstract class CDOSingleValueFeatureDeltaImpl extends CDOFeatureDeltaImpl
protected Object readValue(CDODataInput in, EClass eClass) throws IOException
{
EStructuralFeature feature = getFeature();
- if (FeatureMapUtil.isFeatureMap(feature))
- {
- int featureID = in.readXInt();
- feature = eClass.getEStructuralFeature(featureID);
- Object innerValue = in.readCDOFeatureValue(feature);
- return CDORevisionUtil.createFeatureMapEntry(feature, innerValue);
- }
-
return in.readCDOFeatureValue(feature);
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/protocol/CDODataInputImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/protocol/CDODataInputImpl.java
index 3bd52a7036..51160f3cbc 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/protocol/CDODataInputImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/protocol/CDODataInputImpl.java
@@ -86,18 +86,12 @@ import org.eclipse.net4j.util.io.ExtendedDataInput;
import org.eclipse.net4j.util.io.StringIO;
import org.eclipse.net4j.util.om.trace.ContextTracer;
-import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.EcoreFactory;
-import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.emf.ecore.util.FeatureMapUtil;
-import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
import java.io.IOException;
import java.text.MessageFormat;
@@ -532,13 +526,7 @@ public abstract class CDODataInputImpl extends ExtendedDataInput.Delegating impl
}
}
- Object value = null;
- CDOType type = null;
- boolean isFeatureMap = FeatureMapUtil.isFeatureMap(feature);
- if (!isFeatureMap)
- {
- type = CDOModelUtil.getType(feature.getEType());
- }
+ CDOType type = CDOModelUtil.getType(feature.getEType());
InternalCDOList list = (InternalCDOList)getListFactory().createList(size, size, referenceChunk);
if (feature instanceof EReference && list instanceof ConfigurableEquality)
@@ -548,64 +536,9 @@ public abstract class CDODataInputImpl extends ExtendedDataInput.Delegating impl
for (int j = 0; j < referenceChunk; j++)
{
- if (isFeatureMap)
- {
- EStructuralFeature innerFeature;
-
- boolean demandCreated = readBoolean();
- if (demandCreated)
- {
- EPackage ePackage = EcoreFactory.eINSTANCE.createEPackage();
- ePackage.setNsURI(readString());
-
- EClass eClass = EcoreFactory.eINSTANCE.createEClass();
- eClass.setName(readString());
- ePackage.getEClassifiers().add(eClass);
-
- if (readBoolean())
- {
- EReference eReference = EcoreFactory.eINSTANCE.createEReference();
- eReference.setEType(EcorePackage.Literals.EOBJECT);
- // if (isElement)
- // {
- // eReference.setContainment(true);
- // eReference.setResolveProxies(false);
- // }
- innerFeature = eReference;
- }
- else
- {
- EAttribute eAttribute = EcoreFactory.eINSTANCE.createEAttribute();
- eAttribute.setEType(XMLTypePackage.eINSTANCE.getAnySimpleType());
- innerFeature = eAttribute;
- }
-
- innerFeature.setName(readString());
- innerFeature.setDerived(true);
- innerFeature.setTransient(true);
- innerFeature.setVolatile(true);
- // if (isElement)
- // {
- // innerFeature.setUpperBound(ETypedElement.UNSPECIFIED_MULTIPLICITY);
- // }
- eClass.getEStructuralFeatures().add(innerFeature);
- }
- else
- {
- EClass eClass = (EClass)readCDOClassifierRefAndResolve();
- innerFeature = eClass.getEStructuralFeature(readXInt());
- }
-
- type = CDOModelUtil.getType(innerFeature.getEType());
- value = type.readValue(this);
- value = CDORevisionUtil.createFeatureMapEntry(innerFeature, value);
- }
- else
- {
- value = type.readValue(this);
- }
-
+ Object value = type.readValue(this);
list.set(j, value);
+
if (TRACER.isEnabled())
{
TRACER.trace(" " + value); //$NON-NLS-1$
@@ -619,6 +552,7 @@ public abstract class CDODataInputImpl extends ExtendedDataInput.Delegating impl
public Object readCDOFeatureValue(EStructuralFeature feature) throws IOException
{
CDOType type = CDOModelUtil.getType(feature);
+
Object value = type.readValue(this);
if (value instanceof CDOLob<?>)
{
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/protocol/CDODataOutputImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/protocol/CDODataOutputImpl.java
index 8fce04e48e..bc3c368297 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/protocol/CDODataOutputImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/protocol/CDODataOutputImpl.java
@@ -61,11 +61,8 @@ import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.FeatureMap;
-import org.eclipse.emf.ecore.util.FeatureMapUtil;
import java.io.IOException;
import java.text.MessageFormat;
@@ -499,39 +496,11 @@ public class CDODataOutputImpl extends ExtendedDataOutput.Delegating implements
}
CDOIDProvider idProvider = getIDProvider();
- boolean isFeatureMap = FeatureMapUtil.isFeatureMap(feature);
+
for (int j = 0; j < size; j++)
{
Object value = list.get(j, false);
- EStructuralFeature innerFeature = feature; // Prepare for possible feature map
- if (isFeatureMap)
- {
- FeatureMap.Entry entry = (FeatureMap.Entry)value;
- innerFeature = entry.getEStructuralFeature();
- value = entry.getValue();
-
- EClass eClass = innerFeature.getEContainingClass();
- EPackage ePackage = eClass.getEPackage();
- if (ePackage.getName() == null)
- {
- // Probably a demand-created DocumentRoot feature
- writeBoolean(true);
- writeString(ePackage.getNsURI());
- writeString(eClass.getName());
- writeBoolean(innerFeature instanceof EReference);
- writeString(innerFeature.getName());
- }
- else
- {
- writeBoolean(false);
- writeCDOClassifierRef(eClass);
-
- int featureID = eClass.getFeatureID(innerFeature);
- writeXInt(featureID);
- }
- }
-
- if (value != null && innerFeature instanceof EReference)
+ if (value != null && feature instanceof EReference)
{
value = idProvider.provideCDOID(value);
}
@@ -541,7 +510,7 @@ public class CDODataOutputImpl extends ExtendedDataOutput.Delegating implements
TRACER.trace(" " + value); //$NON-NLS-1$
}
- writeCDOFeatureValue(innerFeature, value);
+ writeCDOFeatureValue(feature, value);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/BaseCDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/BaseCDORevision.java
index a86907bb1c..c5c2b8033b 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/BaseCDORevision.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/BaseCDORevision.java
@@ -53,9 +53,6 @@ import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.FeatureMap;
-import org.eclipse.emf.ecore.util.FeatureMap.Entry;
-import org.eclipse.emf.ecore.util.FeatureMapUtil;
import java.io.IOException;
import java.lang.reflect.Array;
@@ -429,7 +426,6 @@ public abstract class BaseCDORevision extends AbstractCDORevision
}
else
{
- checkNoFeatureMap(feature);
if (feature instanceof EReference)
{
value = out.getIDProvider().provideCDOID(value);
@@ -465,17 +461,10 @@ public abstract class BaseCDORevision extends AbstractCDORevision
CDOList list = getValueAsList(i);
if (list != null)
{
- boolean isFeatureMap = FeatureMapUtil.isFeatureMap(feature);
for (int j = 0; j < list.size(); j++)
{
Object value = list.get(j, false);
EStructuralFeature innerFeature = feature; // Prepare for possible feature map
- if (isFeatureMap)
- {
- Entry entry = (FeatureMap.Entry)value;
- innerFeature = entry.getEStructuralFeature();
- value = entry.getValue();
- }
if (value != null && innerFeature instanceof EReference)
{
@@ -490,7 +479,6 @@ public abstract class BaseCDORevision extends AbstractCDORevision
}
else
{
- checkNoFeatureMap(feature);
Object value = getValue(i);
if (value != null && feature instanceof EReference)
{
@@ -878,7 +866,7 @@ public abstract class BaseCDORevision extends AbstractCDORevision
for (int i = 0; i < features.length; i++)
{
EStructuralFeature feature = features[i];
- if (feature instanceof EReference || FeatureMapUtil.isFeatureMap(feature))
+ if (feature instanceof EReference)
{
if (feature.isMany())
{
@@ -1230,12 +1218,13 @@ public abstract class BaseCDORevision extends AbstractCDORevision
}
}
+ /**
+ * @deprecated As of 4.5 {@link org.eclipse.emf.ecore.util.FeatureMap feature maps} are no longer supported.
+ */
+ @Deprecated
public static void checkNoFeatureMap(EStructuralFeature feature)
{
- if (FeatureMapUtil.isFeatureMap(feature))
- {
- throw new UnsupportedOperationException("Single-valued feature maps not yet handled");
- }
+ throw new UnsupportedOperationException();
}
public static Object remapID(Object value, Map<CDOID, CDOID> idMappings, boolean allowUnmappedTempIDs)
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureMapEntry.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureMapEntry.java
index b7498231ec..e4a5de0943 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureMapEntry.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureMapEntry.java
@@ -11,15 +11,16 @@
package org.eclipse.emf.cdo.spi.common.revision;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.FeatureMap;
/**
* If the meaning of this type isn't clear, there really should be more of a description here...
*
* @since 3.0
+ * @deprecated As of 4.5 {@link org.eclipse.emf.ecore.util.FeatureMap feature maps} are no longer supported.
* @author Martin Taal
*/
-public interface CDOFeatureMapEntry extends FeatureMap.Entry
+@Deprecated
+public interface CDOFeatureMapEntry extends org.eclipse.emf.ecore.util.FeatureMap.Entry
{
public void setEStructuralFeature(EStructuralFeature feature);
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/ITypeMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/ITypeMapping.java
index a7f21053e4..12cc121ca8 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/ITypeMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/ITypeMapping.java
@@ -8,7 +8,6 @@
* Contributors:
* Eike Stepper - initial API and implementation
* Stefan Winkler - major refactoring
- * Christopher Albert - 254455: [DB] Support FeatureMaps bug 254455
*/
package org.eclipse.emf.cdo.server.db.mapping;
@@ -223,7 +222,10 @@ public interface ITypeMapping
/**
* Provides a list of all DBTypes for which type mappings exist in the registry. This is used in feature map tables
* to create columns for all of these types.
+ *
+ * @deprecated As of 4.5 {@link org.eclipse.emf.ecore.util.FeatureMap feature maps} are no longer supported.
*/
+ @Deprecated
public Collection<DBType> getDefaultFeatureMapDBTypes();
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AbstractMappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AbstractMappingStrategy.java
index e0e34f3efd..ff20140fc3 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AbstractMappingStrategy.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AbstractMappingStrategy.java
@@ -64,7 +64,6 @@ import org.eclipse.emf.ecore.ENamedElement;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.FeatureMapUtil;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -718,20 +717,8 @@ public abstract class AbstractMappingStrategy extends Lifecycle implements IMapp
return doCreateListMapping(containingClass, feature);
}
- public final IListMapping createFeatureMapMapping(EClass containingClass, EStructuralFeature feature)
- {
- checkArg(FeatureMapUtil.isFeatureMap(feature), "Only FeatureMaps allowed"); //$NON-NLS-1$
- return doCreateFeatureMapMapping(containingClass, feature);
- }
-
public abstract IListMapping doCreateListMapping(EClass containingClass, EStructuralFeature feature);
- /**
- * @deprecated As 4.5 feature maps are no longer supported.
- */
- @Deprecated
- public abstract IListMapping doCreateFeatureMapMapping(EClass containingClass, EStructuralFeature feature);
-
@Override
protected void doDeactivate() throws Exception
{
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/TypeMappingRegistry.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/TypeMappingRegistry.java
index bd5b309a07..4b87c2c18e 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/TypeMappingRegistry.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/TypeMappingRegistry.java
@@ -50,7 +50,6 @@ import org.eclipse.emf.ecore.EcorePackage;
import java.text.MessageFormat;
import java.util.Collection;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
@@ -86,11 +85,6 @@ public class TypeMappingRegistry implements ITypeMapping.Registry, ITypeMapping.
private Map<String, ITypeMapping.Descriptor> typeMappingsById;
/**
- * A set of all known mapped DBTypes. This is needed for the feature map mappings.
- */
- private Set<DBType> defaultFeatureMapDBTypes;
-
- /**
* A populator which is used to keep the registry in sync with the registered factories of the
* {@link IManagedContainer}.
*/
@@ -125,7 +119,6 @@ public class TypeMappingRegistry implements ITypeMapping.Registry, ITypeMapping.
}
});
- defaultFeatureMapDBTypes = new HashSet<>();
typeMappingsById = new HashMap<>();
typeMappingByTypes = new HashMap<>();
classifierDefaultMapping = new HashMap<>();
@@ -264,8 +257,6 @@ public class TypeMappingRegistry implements ITypeMapping.Registry, ITypeMapping.
classifierDefaultMapping.put(eClassifier, dbType);
}
- defaultFeatureMapDBTypes.add(dbType);
-
typeMappingByTypes.put(sourceTargetPair, descriptor);
}
@@ -435,10 +426,11 @@ public class TypeMappingRegistry implements ITypeMapping.Registry, ITypeMapping.
return descriptor;
}
+ @Deprecated
@Override
public Collection<DBType> getDefaultFeatureMapDBTypes()
{
- return defaultFeatureMapDBTypes;
+ throw new UnsupportedOperationException();
}
/**
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractFeatureMapTableMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractFeatureMapTableMapping.java
deleted file mode 100644
index ae8c5390aa..0000000000
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractFeatureMapTableMapping.java
+++ /dev/null
@@ -1,605 +0,0 @@
-/*
- * Copyright (c) 2009-2013, 2015, 2016, 2018, 2019 Eike Stepper (Loehne, 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
- * Stefan Winkler - 271444: [DB] Multiple refactorings bug 271444
- * Christopher Albert - 254455: [DB] Support FeatureMaps bug 254455
- * Victor Roldan Betancort - Bug 283998: [DB] Chunk reading for multiple chunks fails
- * Stefan Winkler - Bug 285426: [DB] Implement user-defined typeMapping support
- * Stefan Winkler - Bug 329025: [DB] Support branching for range-based mapping strategy
- */
-package org.eclipse.emf.cdo.server.internal.db.mapping.horizontal;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDUtil;
-import org.eclipse.emf.cdo.common.revision.CDOList;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
-import org.eclipse.emf.cdo.server.IStoreAccessor.QueryXRefsContext;
-import org.eclipse.emf.cdo.server.IStoreChunkReader.Chunk;
-import org.eclipse.emf.cdo.server.db.IDBStore;
-import org.eclipse.emf.cdo.server.db.IDBStoreAccessor;
-import org.eclipse.emf.cdo.server.db.IDBStoreChunkReader;
-import org.eclipse.emf.cdo.server.db.IIDHandler;
-import org.eclipse.emf.cdo.server.db.IMetaDataManager;
-import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
-import org.eclipse.emf.cdo.server.db.mapping.ITypeMapping;
-import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-
-import org.eclipse.net4j.db.DBException;
-import org.eclipse.net4j.db.DBType;
-import org.eclipse.net4j.db.DBUtil;
-import org.eclipse.net4j.db.IDBDatabase;
-import org.eclipse.net4j.db.IDBPreparedStatement;
-import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability;
-import org.eclipse.net4j.db.ddl.IDBField;
-import org.eclipse.net4j.db.ddl.IDBIndex;
-import org.eclipse.net4j.db.ddl.IDBIndex.Type;
-import org.eclipse.net4j.db.ddl.IDBTable;
-import org.eclipse.net4j.util.ImplementationError;
-import org.eclipse.net4j.util.collection.MoveableList;
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.FeatureMap;
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * This abstract base class provides basic behavior needed for mapping many-valued attributes to tables.
- *
- * @author Eike Stepper
- * @since 3.0
- * @deprecated As 4.5 feature maps are no longer supported.
- */
-@Deprecated
-public abstract class AbstractFeatureMapTableMapping extends AbstractBasicListTableMapping
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, AbstractFeatureMapTableMapping.class);
-
- /**
- * The table of this mapping.
- */
- private IDBTable table;
-
- private FieldInfo[] keyFields;
-
- /**
- * The tags mapped to column names.
- */
- private Map<CDOID, String> tagMap = CDOIDUtil.createMap();
-
- /**
- * Column names.
- */
- private List<String> columnNames = new ArrayList<>();
-
- /**
- * The type mappings for the value fields.
- */
- private Map<CDOID, ITypeMapping> typeMappings = CDOIDUtil.createMap();
-
- // --------- SQL strings - see initSQLStrings() -----------------
- private String sqlSelectChunksPrefix;
-
- private String sqlOrderByIndex;
-
- protected String sqlInsert;
-
- private List<DBType> dbTypes;
-
- public AbstractFeatureMapTableMapping(IMappingStrategy mappingStrategy, EClass eClass, EStructuralFeature feature)
- {
- super(mappingStrategy, eClass, feature);
- initDBTypes();
- initTable();
- initSQLStrings();
- }
-
- private void initDBTypes()
- {
- // TODO add annotation processing here ...
- ITypeMapping.Registry registry = getTypeMappingRegistry();
- dbTypes = new ArrayList<>(registry.getDefaultFeatureMapDBTypes());
- }
-
- protected ITypeMapping.Registry getTypeMappingRegistry()
- {
- return ITypeMapping.Registry.INSTANCE;
- }
-
- private void initTable()
- {
- String tableName = getMappingStrategy().getTableName(getContainingClass(), getFeature());
- DBType idType = getMappingStrategy().getStore().getIDHandler().getDBType();
- int idLength = getMappingStrategy().getStore().getIDColumnLength();
-
- IDBDatabase database = getMappingStrategy().getStore().getDatabase();
- table = database.getSchema().getTable(tableName);
- if (table == null)
- {
- table = database.getSchemaTransaction().getWorkingCopy().addTable(tableName);
-
- IDBIndex index = table.addIndexEmpty(Type.NON_UNIQUE);
- for (FieldInfo fieldInfo : getKeyFields())
- {
- IDBField field = table.addField(fieldInfo.getName(), fieldInfo.getType(), fieldInfo.getPrecision());
- index.addIndexField(field);
- }
-
- // Add field for list index
- table.addField(FEATUREMAP_IDX, DBType.INTEGER);
-
- // Add field for FeatureMap tag (MetaID for Feature in CDO registry)
- table.addField(FEATUREMAP_TAG, idType, idLength);
-
- // Create columns for all DBTypes
- initTypeColumns(true);
-
- table.addIndex(Type.NON_UNIQUE, FEATUREMAP_IDX);
- table.addIndex(Type.NON_UNIQUE, FEATUREMAP_TAG);
- }
- else
- {
- initTypeColumns(false);
- }
- }
-
- private void initTypeColumns(boolean create)
- {
- for (DBType type : getDBTypes())
- {
- String column = FEATUREMAP_VALUE + "_" + type.name();
- if (create)
- {
- table.addField(column, type);
- }
-
- columnNames.add(column);
- }
- }
-
- private void initSQLStrings()
- {
- String tableName = getTable().getName();
- FieldInfo[] fields = getKeyFields();
-
- // ---------------- SELECT to read chunks ----------------------------
- StringBuilder builder = new StringBuilder();
- builder.append("SELECT ");
-
- builder.append(FEATUREMAP_TAG);
- builder.append(", ");
-
- Iterator<String> iter = columnNames.iterator();
- while (iter.hasNext())
- {
- builder.append(iter.next());
- if (iter.hasNext())
- {
- builder.append(", ");
- }
- }
-
- builder.append(" FROM ");
- builder.append(tableName);
- builder.append(" WHERE ");
-
- for (int i = 0; i < fields.length; i++)
- {
- builder.append(fields[i].getName());
- if (i + 1 < fields.length)
- {
- // more to come
- builder.append("=? AND ");
- }
- else
- {
- // last one
- builder.append("=? ");
- }
- }
-
- sqlSelectChunksPrefix = builder.toString();
-
- sqlOrderByIndex = " ORDER BY " + FEATUREMAP_IDX; //$NON-NLS-1$
-
- // INSERT with dynamic field name
- // TODO: Better: universal INSERT-Statement, because of stmt caching!
-
- // ----------------- INSERT - prefix -----------------
- builder = new StringBuilder("INSERT INTO ");
- builder.append(tableName);
- builder.append(" ("); //$NON-NLS-1$
- for (int i = 0; i < fields.length; i++)
- {
- builder.append(fields[i].getName());
- builder.append(", "); //$NON-NLS-1$
- }
-
- for (int i = 0; i < columnNames.size(); i++)
- {
- builder.append(columnNames.get(i));
- builder.append(", "); //$NON-NLS-1$
- }
-
- builder.append(FEATUREMAP_IDX);
- builder.append(", "); //$NON-NLS-1$
- builder.append(FEATUREMAP_TAG);
- builder.append(") VALUES ("); //$NON-NLS-1$
- for (int i = 0; i < fields.length + columnNames.size(); i++)
- {
- builder.append("?, ");
- }
-
- builder.append("?, ?)");
- sqlInsert = builder.toString();
- }
-
- protected final FieldInfo[] getKeyFields()
- {
- if (keyFields == null)
- {
- List<FieldInfo> list = new ArrayList<>(3);
-
- IDBStore store = getMappingStrategy().getStore();
- DBType type = store.getIDHandler().getDBType();
- int precision = store.getIDColumnLength();
- list.add(new FieldInfo(FEATUREMAP_REVISION_ID, type, precision));
-
- addKeyFields(list);
-
- keyFields = list.toArray(new FieldInfo[list.size()]);
- }
-
- return keyFields;
- }
-
- protected abstract void addKeyFields(List<FieldInfo> list);
-
- protected abstract void setKeyFields(PreparedStatement stmt, CDORevision revision) throws SQLException;
-
- @Override
- public Collection<IDBTable> getDBTables()
- {
- return Collections.singleton(table);
- }
-
- protected List<DBType> getDBTypes()
- {
- return dbTypes;
- }
-
- protected final IDBTable getTable()
- {
- return table;
- }
-
- protected final List<String> getColumnNames()
- {
- return columnNames;
- }
-
- protected final Map<CDOID, ITypeMapping> getTypeMappings()
- {
- return typeMappings;
- }
-
- protected final Map<CDOID, String> getTagMap()
- {
- return tagMap;
- }
-
- @Override
- public void readValues(IDBStoreAccessor accessor, InternalCDORevision revision, int listChunk)
- {
- MoveableList<Object> list = revision.getListOrNull(getFeature());
- if (list == null)
- {
- // Nothing to read take shortcut.
- return;
- }
-
- if (listChunk == 0 || list.size() == 0)
- {
- // Nothing to read take shortcut.
- return;
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Reading list values for feature {0}.{1} of {2}v{3}", getContainingClass().getName(), getFeature().getName(), revision.getID(),
- revision.getVersion());
- }
-
- String sql = sqlSelectChunksPrefix + sqlOrderByIndex;
-
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sql, ReuseProbability.HIGH);
- ResultSet resultSet = null;
-
- try
- {
- setKeyFields(stmt, revision);
-
- if (listChunk != CDORevision.UNCHUNKED)
- {
- stmt.setMaxRows(listChunk); // optimization - don't read unneeded rows.
- }
-
- resultSet = stmt.executeQuery();
- int currentIndex = 0;
-
- while ((listChunk == CDORevision.UNCHUNKED || --listChunk >= 0) && resultSet.next())
- {
- CDOID tag = idHandler.getCDOID(resultSet, 1);
- Object value = getTypeMapping(tag).readValue(resultSet);
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Read value for index {0} from result set: {1}", currentIndex, value);
- }
-
- list.set(currentIndex++, CDORevisionUtil.createFeatureMapEntry(getFeatureByTag(tag), value));
- }
- }
- catch (SQLException ex)
- {
- throw new DBException(ex);
- }
- finally
- {
- DBUtil.close(resultSet);
- DBUtil.close(stmt);
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Reading list values done for feature {0}.{1} of {2}v{3}", getContainingClass().getName(), getFeature().getName(), revision.getID(),
- revision.getVersion());
- }
- }
-
- private void addFeature(CDOID tag)
- {
- EStructuralFeature modelFeature = getFeatureByTag(tag);
-
- ITypeMapping typeMapping = getMappingStrategy().createValueMapping(modelFeature);
- String column = FEATUREMAP_VALUE + "_" + typeMapping.getDBType();
-
- tagMap.put(tag, column);
- typeMapping.setDBField(table, column);
- typeMappings.put(tag, typeMapping);
- }
-
- @Override
- public final void readChunks(IDBStoreChunkReader chunkReader, List<Chunk> chunks, String where)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Reading list chunk values for feature {0}.{1} of {2}v{3}", getContainingClass().getName(), getFeature().getName(),
- chunkReader.getRevision().getID(), chunkReader.getRevision().getVersion());
- }
-
- StringBuilder builder = new StringBuilder(sqlSelectChunksPrefix);
- if (where != null)
- {
- builder.append(" AND "); //$NON-NLS-1$
- builder.append(where);
- }
-
- builder.append(sqlOrderByIndex);
- String sql = builder.toString();
-
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = chunkReader.getAccessor().getDBConnection().prepareStatement(sql, ReuseProbability.LOW);
- ResultSet resultSet = null;
-
- try
- {
- setKeyFields(stmt, chunkReader.getRevision());
-
- resultSet = stmt.executeQuery();
-
- Chunk chunk = null;
- int chunkSize = 0;
- int chunkIndex = 0;
- int indexInChunk = 0;
-
- while (resultSet.next())
- {
- CDOID tag = idHandler.getCDOID(resultSet, 1);
- Object value = getTypeMapping(tag).readValue(resultSet);
-
- if (chunk == null)
- {
- chunk = chunks.get(chunkIndex++);
- chunkSize = chunk.size();
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Current chunk no. {0} is [start = {1}, size = {2}]", chunkIndex - 1, chunk.getStartIndex(), chunkSize);
- }
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Read value for chunk index {0} from result set: {1}", indexInChunk, value);
- }
-
- chunk.add(indexInChunk++, CDORevisionUtil.createFeatureMapEntry(getFeatureByTag(tag), value));
- if (indexInChunk == chunkSize)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Chunk finished");
- }
-
- chunk = null;
- indexInChunk = 0;
- }
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Reading list chunk values done for feature {0}.{1} of {2}", getContainingClass().getName(), getFeature(), chunkReader.getRevision());
- }
- }
- catch (SQLException ex)
- {
- throw new DBException(ex);
- }
- finally
- {
- DBUtil.close(resultSet);
- DBUtil.close(stmt);
- }
- }
-
- @Override
- public void writeValues(IDBStoreAccessor accessor, InternalCDORevision revision)
- {
- CDOList values = revision.getListOrNull(getFeature());
- if (values != null)
- {
- int idx = 0;
- for (Object element : values)
- {
- writeValue(accessor, revision, idx++, element);
- }
- }
- }
-
- protected final void writeValue(IDBStoreAccessor accessor, CDORevision revision, int idx, Object value)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing value for feature {0}.{1} index {2} of {3} : {4}", getContainingClass().getName(), //$NON-NLS-1$
- getFeature(), idx, revision, value);
- }
-
- FeatureMap.Entry entry = (FeatureMap.Entry)value;
- EStructuralFeature entryFeature = entry.getEStructuralFeature();
- CDOID tag = getTagByFeature(entryFeature, revision.getTimeStamp());
- ITypeMapping typeMapping = getTypeMapping(tag);
- String columnName = getColumnName(tag);
-
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlInsert, ReuseProbability.HIGH);
-
- try
- {
- setKeyFields(stmt, revision);
- int column = getKeyFields().length + 1;
-
- for (int i = 0; i < columnNames.size(); i++)
- {
- if (columnNames.get(i).equals(columnName))
- {
- typeMapping.setValue(stmt, column++, entry.getValue());
- }
- else
- {
- stmt.setNull(column++, getDBTypes().get(i).getCode());
- }
- }
-
- stmt.setInt(column++, idx);
- idHandler.setCDOID(stmt, column++, tag);
- DBUtil.update(stmt, true);
- }
- catch (SQLException e)
- {
- throw new DBException(e);
- }
- finally
- {
- DBUtil.close(stmt);
- }
- }
-
- /**
- * Get column name (lazy)
- *
- * @param tag
- * The feature's MetaID in CDO
- * @return the column name where the values are stored
- */
- protected String getColumnName(CDOID tag)
- {
- String column = tagMap.get(tag);
- if (column == null)
- {
- addFeature(tag);
- column = tagMap.get(tag);
- }
-
- return column;
- }
-
- /**
- * Get type mapping (lazy)
- *
- * @param tag
- * The feature's MetaID in CDO
- * @return the corresponding type mapping
- */
- protected ITypeMapping getTypeMapping(CDOID tag)
- {
- ITypeMapping typeMapping = typeMappings.get(tag);
- if (typeMapping == null)
- {
- addFeature(tag);
- typeMapping = typeMappings.get(tag);
- }
-
- return typeMapping;
- }
-
- /**
- * @param metaID
- * @return the column name where the values are stored
- */
- private EStructuralFeature getFeatureByTag(CDOID tag)
- {
- IMetaDataManager metaDataManager = getMappingStrategy().getStore().getMetaDataManager();
- return (EStructuralFeature)metaDataManager.getMetaInstance(tag);
- }
-
- /**
- * @param feature
- * The EStructuralFeature
- * @return The feature's MetaID in CDO
- */
- protected CDOID getTagByFeature(EStructuralFeature feature, long timeStamp)
- {
- IMetaDataManager metaDataManager = getMappingStrategy().getStore().getMetaDataManager();
- return metaDataManager.getMetaID(feature, timeStamp);
- }
-
- @Override
- public final boolean queryXRefs(IDBStoreAccessor accessor, String mainTableName, String mainTableWhere, QueryXRefsContext context, String idString)
- {
- /*
- * must never be called (a feature map is not associated with an EReference feature, so XRefs are nor supported
- * here)
- */
- throw new ImplementationError("Should never be called!");
- }
-
-}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java
index f5cb243d18..06d4e6cbd2 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java
@@ -72,7 +72,6 @@ import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.FeatureMapUtil;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -336,11 +335,6 @@ public abstract class AbstractHorizontalClassMapping implements IClassMapping, I
private IListMapping createListMapping(EStructuralFeature feature)
{
- if (FeatureMapUtil.isFeatureMap(feature))
- {
- return mappingStrategy.createFeatureMapMapping(eClass, feature);
- }
-
return mappingStrategy.createListMapping(eClass, feature);
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditFeatureMapTableMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditFeatureMapTableMapping.java
deleted file mode 100644
index 6d8adcb093..0000000000
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditFeatureMapTableMapping.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2009-2013, 2018, 2019 Eike Stepper (Loehne, 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
- * Stefan Winkler - 271444: [DB] Multiple refactorings bug 271444
- * Christopher Albert - 254455: [DB] Support FeatureMaps bug 254455
- */
-package org.eclipse.emf.cdo.server.internal.db.mapping.horizontal;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.server.db.IDBStoreAccessor;
-import org.eclipse.emf.cdo.server.db.IIDHandler;
-import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
-
-import org.eclipse.net4j.db.DBException;
-import org.eclipse.net4j.db.DBType;
-import org.eclipse.net4j.db.DBUtil;
-import org.eclipse.net4j.db.IDBPreparedStatement;
-import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.util.List;
-
-/**
- * This is a featuremap-table mapping for audit mode. It has ID and version columns and no delta support.
- *
- * @author Eike Stepper
- * @since 3.0
- * @deprecated As 4.5 feature maps are no longer supported.
- */
-@Deprecated
-public class AuditFeatureMapTableMapping extends AbstractFeatureMapTableMapping
-{
- private String sqlClear;
-
- public AuditFeatureMapTableMapping(IMappingStrategy mappingStrategy, EClass eClass, EStructuralFeature feature)
- {
- super(mappingStrategy, eClass, feature);
- initSQLStrings();
- }
-
- private void initSQLStrings()
- {
- // ----------- clear list -------------------------
- StringBuilder builder = new StringBuilder();
- builder.append("DELETE FROM "); //$NON-NLS-1$
- builder.append(getTable());
- builder.append(" WHERE "); //$NON-NLS-1$
- builder.append(LIST_REVISION_ID);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(LIST_REVISION_VERSION);
- builder.append("=? "); //$NON-NLS-1$
- sqlClear = builder.toString();
- }
-
- @Override
- protected void addKeyFields(List<FieldInfo> list)
- {
- list.add(new FieldInfo(FEATUREMAP_VERSION, DBType.INTEGER));
- }
-
- @Override
- protected void setKeyFields(PreparedStatement stmt, CDORevision revision) throws SQLException
- {
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- idHandler.setCDOID(stmt, 1, revision.getID());
- stmt.setInt(2, revision.getVersion());
- }
-
- @Override
- public void objectDetached(IDBStoreAccessor accessor, CDOID id, long revised)
- {
- // the audit list mapping does not care about revised references -> NOP
- }
-
- @Override
- public void rawDeleted(IDBStoreAccessor accessor, CDOID id, CDOBranch branch, int version)
- {
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlClear, ReuseProbability.HIGH);
-
- try
- {
- idHandler.setCDOID(stmt, 1, id);
- stmt.setInt(2, version);
- DBUtil.update(stmt, false);
- }
- catch (SQLException e)
- {
- throw new DBException(e);
- }
- finally
- {
- DBUtil.close(stmt);
- }
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditFeatureMapTableMappingWithRanges.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditFeatureMapTableMappingWithRanges.java
deleted file mode 100644
index e3bfa44a71..0000000000
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditFeatureMapTableMappingWithRanges.java
+++ /dev/null
@@ -1,1218 +0,0 @@
-/*
- * Copyright (c) 2010-2013, 2015, 2016, 2018, 2019 Eike Stepper (Loehne, 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
- * Stefan Winkler - Bug 271444: [DB] Multiple refactorings bug 271444
- * Christopher Albert - Bug 254455: [DB] Support FeatureMaps bug 254455
- * Victor Roldan Betancort - Bug 283998: [DB] Chunk reading for multiple chunks fails
- * Lothar Werzinger - Bug 296440: [DB] Change RDB schema to improve scalability of to-many references in audit mode
- * Stefan Winkler - cleanup, merge and maintenance
- * Stefan Winkler - Bug 285426: [DB] Implement user-defined typeMapping support
- * Stefan Winkler - Bug 329025: [DB] Support branching for range-based mapping strategy
- */
-package org.eclipse.emf.cdo.server.internal.db.mapping.horizontal;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDUtil;
-import org.eclipse.emf.cdo.common.revision.CDOList;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
-import org.eclipse.emf.cdo.common.revision.delta.CDOAddFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOClearFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOContainerFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
-import org.eclipse.emf.cdo.common.revision.delta.CDOListFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOMoveFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDORemoveFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOUnsetFeatureDelta;
-import org.eclipse.emf.cdo.server.IRepository;
-import org.eclipse.emf.cdo.server.IStoreAccessor.QueryXRefsContext;
-import org.eclipse.emf.cdo.server.IStoreChunkReader.Chunk;
-import org.eclipse.emf.cdo.server.db.IDBStore;
-import org.eclipse.emf.cdo.server.db.IDBStoreAccessor;
-import org.eclipse.emf.cdo.server.db.IDBStoreChunkReader;
-import org.eclipse.emf.cdo.server.db.IIDHandler;
-import org.eclipse.emf.cdo.server.db.mapping.IListMappingDeltaSupport;
-import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
-import org.eclipse.emf.cdo.server.db.mapping.ITypeMapping;
-import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-
-import org.eclipse.net4j.db.DBException;
-import org.eclipse.net4j.db.DBType;
-import org.eclipse.net4j.db.DBUtil;
-import org.eclipse.net4j.db.IDBDatabase;
-import org.eclipse.net4j.db.IDBPreparedStatement;
-import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability;
-import org.eclipse.net4j.db.ddl.IDBIndex.Type;
-import org.eclipse.net4j.db.ddl.IDBTable;
-import org.eclipse.net4j.util.ImplementationError;
-import org.eclipse.net4j.util.collection.MoveableList;
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.FeatureMap;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * This is a featuremap-table mapping for audit mode. It is optimized for frequent insert operations at the list's end,
- * which causes just 1 DB row to be changed. This is achieved by introducing a version range (columns
- * {@link IMappingConstants#LIST_REVISION_VERSION_ADDED cdo_version_added} and
- * {@link IMappingConstants#LIST_REVISION_VERSION_REMOVED cdo_version_removed}) which records for which revisions a particular
- * entry existed. Also, this mapping is mainly optimized for potentially very large lists: the need for having the
- * complete list stored in memory to do in-the-middle-moved and inserts is traded in for a few more DB access
- * operations.
- *
- * @author Eike Stepper
- * @author Stefan Winkler
- * @author Lothar Werzinger
- * @since 3.0
- * @deprecated As 4.5 feature maps are no longer supported.
- */
-@Deprecated
-public class AuditFeatureMapTableMappingWithRanges extends AbstractBasicListTableMapping implements IListMappingDeltaSupport
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, AuditFeatureMapTableMappingWithRanges.class);
-
- /**
- * Used to clean up lists for detached objects.
- */
- private static final int FINAL_VERSION = Integer.MAX_VALUE;
-
- /**
- * The table of this mapping.
- */
- private IDBTable table;
-
- /**
- * Column names.
- */
- private List<String> columnNames = new ArrayList<>();
-
- /**
- * The type mappings for the value fields.
- */
- private Map<CDOID, ITypeMapping> typeMappings = CDOIDUtil.createMap();
-
- /**
- * The tags mapped to column names
- */
- private Map<CDOID, String> tagMap = CDOIDUtil.createMap();
-
- private List<DBType> dbTypes;
-
- // --------- SQL strings - see initSQLStrings() -----------------
- private String sqlSelectChunksPrefix;
-
- private String sqlOrderByIndex;
-
- private String sqlInsert;
-
- private String sqlRemoveEntry;
-
- private String sqlDeleteEntry;
-
- private String sqlUpdateIndex;
-
- private String sqlGetValue;
-
- private String sqlClearList;
-
- private String sqlDeleteList;
-
- public AuditFeatureMapTableMappingWithRanges(IMappingStrategy mappingStrategy, EClass eClass, EStructuralFeature feature)
- {
- super(mappingStrategy, eClass, feature);
- initDBTypes();
- initTable();
- initSQLStrings();
- }
-
- private void initDBTypes()
- {
- // TODO add annotation processing here ...
- ITypeMapping.Registry registry = ITypeMapping.Registry.INSTANCE;
- dbTypes = new ArrayList<>(registry.getDefaultFeatureMapDBTypes());
- }
-
- private void initTable()
- {
- String tableName = getMappingStrategy().getTableName(getContainingClass(), getFeature());
- IDBStore store = getMappingStrategy().getStore();
- DBType idType = store.getIDHandler().getDBType();
- int idLength = store.getIDColumnLength();
-
- IDBDatabase database = getMappingStrategy().getStore().getDatabase();
- table = database.getSchema().getTable(tableName);
- if (table == null)
- {
- table = database.getSchemaTransaction().getWorkingCopy().addTable(tableName);
- table.addField(FEATUREMAP_REVISION_ID, idType, idLength);
- table.addField(FEATUREMAP_VERSION_ADDED, DBType.INTEGER);
- table.addField(FEATUREMAP_VERSION_REMOVED, DBType.INTEGER);
- table.addField(FEATUREMAP_IDX, DBType.INTEGER);
- table.addField(FEATUREMAP_TAG, idType, idLength);
-
- initTypeColumns(true);
-
- // TODO think about indices
- table.addIndex(Type.NON_UNIQUE, FEATUREMAP_REVISION_ID);
- table.addIndex(Type.NON_UNIQUE, FEATUREMAP_VERSION_ADDED);
- table.addIndex(Type.NON_UNIQUE, FEATUREMAP_VERSION_REMOVED);
- table.addIndex(Type.NON_UNIQUE, FEATUREMAP_IDX);
- table.addIndex(Type.NON_UNIQUE, FEATUREMAP_TAG);
- }
- else
- {
- initTypeColumns(false);
- }
- }
-
- private void initTypeColumns(boolean create)
- {
- for (DBType type : getDBTypes())
- {
- String column = FEATUREMAP_VALUE + "_" + type.name();
- if (create)
- {
- table.addField(column, type);
- }
-
- columnNames.add(column);
- }
- }
-
- private void initSQLStrings()
- {
- String tableName = getTable().getName();
-
- // ---------------- SELECT to read chunks ----------------------------
- StringBuilder builder = new StringBuilder();
- builder.append("SELECT "); //$NON-NLS-1$
-
- builder.append(FEATUREMAP_TAG);
- builder.append(", "); //$NON-NLS-1$
-
- Iterator<String> iter = columnNames.iterator();
- while (iter.hasNext())
- {
- builder.append(iter.next());
- if (iter.hasNext())
- {
- builder.append(", "); //$NON-NLS-1$
- }
- }
-
- builder.append(" FROM "); //$NON-NLS-1$
- builder.append(tableName);
- builder.append(" WHERE "); //$NON-NLS-1$
- builder.append(FEATUREMAP_REVISION_ID);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_ADDED);
- builder.append("<=? AND ("); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_REMOVED);
- builder.append(" IS NULL OR "); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_REMOVED);
- builder.append(">?)"); //$NON-NLS-1$
- sqlSelectChunksPrefix = builder.toString();
-
- sqlOrderByIndex = " ORDER BY " + FEATUREMAP_IDX; //$NON-NLS-1$
-
- // ----------------- INSERT - prefix -----------------
- builder = new StringBuilder("INSERT INTO "); //$NON-NLS-1$
- builder.append(tableName);
- builder.append("("); //$NON-NLS-1$
- builder.append(FEATUREMAP_REVISION_ID);
- builder.append(", "); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_ADDED);
- builder.append(", "); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_REMOVED);
- builder.append(", "); //$NON-NLS-1$
- builder.append(FEATUREMAP_IDX);
- builder.append(", "); //$NON-NLS-1$
- builder.append(FEATUREMAP_TAG);
-
- for (int i = 0; i < columnNames.size(); i++)
- {
- builder.append(", "); //$NON-NLS-1$
- builder.append(columnNames.get(i));
- }
-
- builder.append(") VALUES (?, ?, ?, ?, ?"); //$NON-NLS-1$
- for (int i = 0; i < columnNames.size(); i++)
- {
- builder.append(", ?"); //$NON-NLS-1$
- }
-
- builder.append(")"); //$NON-NLS-1$
- sqlInsert = builder.toString();
-
- // ----------------- remove current entry -----------------
- builder = new StringBuilder("UPDATE "); //$NON-NLS-1$
- builder.append(tableName);
- builder.append(" SET "); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_REMOVED);
- builder.append("=? "); //$NON-NLS-1$
- builder.append(" WHERE "); //$NON-NLS-1$
- builder.append(FEATUREMAP_REVISION_ID);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_IDX);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_REMOVED);
- builder.append(" IS NULL"); //$NON-NLS-1$
- sqlRemoveEntry = builder.toString();
-
- // ----------------- delete temporary entry -----------------
- builder = new StringBuilder("DELETE FROM "); //$NON-NLS-1$
- builder.append(tableName);
- builder.append(" WHERE "); //$NON-NLS-1$
- builder.append(FEATUREMAP_REVISION_ID);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_IDX);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_ADDED);
- builder.append("=?"); //$NON-NLS-1$
- sqlDeleteEntry = builder.toString();
-
- // ----------------- update index -----------------
- builder = new StringBuilder("UPDATE "); //$NON-NLS-1$
- builder.append(tableName);
- builder.append(" SET "); //$NON-NLS-1$
- builder.append(FEATUREMAP_IDX);
- builder.append("=? WHERE "); //$NON-NLS-1$
- builder.append(FEATUREMAP_REVISION_ID);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_ADDED);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_IDX);
- builder.append("=?"); //$NON-NLS-1$
- sqlUpdateIndex = builder.toString();
-
- // ----------------- get current value -----------------
- builder = new StringBuilder("SELECT "); //$NON-NLS-1$
- builder.append(FEATUREMAP_TAG);
- builder.append(", "); //$NON-NLS-1$
-
- iter = columnNames.iterator();
- while (iter.hasNext())
- {
- builder.append(iter.next());
- if (iter.hasNext())
- {
- builder.append(", "); //$NON-NLS-1$
- }
- }
-
- builder.append(" FROM "); //$NON-NLS-1$
- builder.append(tableName);
- builder.append(" WHERE "); //$NON-NLS-1$
- builder.append(FEATUREMAP_REVISION_ID);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_IDX);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_REMOVED);
- builder.append(" IS NULL"); //$NON-NLS-1$
- sqlGetValue = builder.toString();
-
- // ----------- clear list items -------------------------
- builder = new StringBuilder("UPDATE "); //$NON-NLS-1$
- builder.append(tableName);
- builder.append(" SET "); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_REMOVED);
- builder.append("=? "); //$NON-NLS-1$
- builder.append(" WHERE "); //$NON-NLS-1$
- builder.append(FEATUREMAP_REVISION_ID);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_REMOVED);
- builder.append(" IS NULL"); //$NON-NLS-1$
- sqlClearList = builder.toString();
-
- // ----------- delete temporary list items -------------------------
- builder = new StringBuilder("DELETE FROM "); //$NON-NLS-1$
- builder.append(tableName);
- builder.append(" WHERE "); //$NON-NLS-1$
- builder.append(FEATUREMAP_REVISION_ID);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_ADDED);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_REMOVED);
- builder.append(" IS NULL"); //$NON-NLS-1$
- sqlDeleteList = builder.toString();
- }
-
- protected List<DBType> getDBTypes()
- {
- return dbTypes;
- }
-
- @Override
- public Collection<IDBTable> getDBTables()
- {
- return Collections.singleton(table);
- }
-
- protected final IDBTable getTable()
- {
- return table;
- }
-
- protected final List<String> getColumnNames()
- {
- return columnNames;
- }
-
- protected final Map<CDOID, ITypeMapping> getTypeMappings()
- {
- return typeMappings;
- }
-
- protected final Map<CDOID, String> getTagMap()
- {
- return tagMap;
- }
-
- @Override
- public void readValues(IDBStoreAccessor accessor, InternalCDORevision revision, int listChunk)
- {
- MoveableList<Object> list = revision.getListOrNull(getFeature());
- if (list == null)
- {
- // Nothing to read take shortcut.
- return;
- }
-
- if (listChunk == 0 || list.size() == 0)
- {
- // Nothing to read take shortcut.
- return;
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Reading list values for feature {0}.{1} of {2}v{3}", getContainingClass().getName(), getFeature() //$NON-NLS-1$
- .getName(), revision.getID(), revision.getVersion());
- }
-
- String sql = sqlSelectChunksPrefix + sqlOrderByIndex;
-
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sql, ReuseProbability.HIGH);
- ResultSet resultSet = null;
-
- try
- {
- idHandler.setCDOID(stmt, 1, revision.getID());
- stmt.setInt(2, revision.getVersion());
- stmt.setInt(3, revision.getVersion());
-
- if (listChunk != CDORevision.UNCHUNKED)
- {
- stmt.setMaxRows(listChunk); // optimization - don't read unneeded rows.
- }
-
- resultSet = stmt.executeQuery();
-
- int currentIndex = 0;
- while ((listChunk == CDORevision.UNCHUNKED || --listChunk >= 0) && resultSet.next())
- {
- CDOID tag = idHandler.getCDOID(resultSet, 1);
- Object value = getTypeMapping(tag).readValue(resultSet);
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Read value for index {0} from result set: {1}", currentIndex, value); //$NON-NLS-1$
- }
-
- list.set(currentIndex++, CDORevisionUtil.createFeatureMapEntry(getFeatureByTag(tag), value));
- }
- }
- catch (SQLException ex)
- {
- throw new DBException(ex);
- }
- finally
- {
- DBUtil.close(resultSet);
- DBUtil.close(stmt);
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Reading list values done for feature {0}.{1} of {2}v{3}", getContainingClass().getName(), //$NON-NLS-1$
- getFeature().getName(), revision.getID(), revision.getVersion());
- }
- }
-
- private void addFeature(CDOID tag)
- {
- EStructuralFeature modelFeature = getFeatureByTag(tag);
-
- ITypeMapping typeMapping = getMappingStrategy().createValueMapping(modelFeature);
- String column = FEATUREMAP_VALUE + "_" + typeMapping.getDBType(); //$NON-NLS-1$
-
- tagMap.put(tag, column);
- typeMapping.setDBField(table, column);
- typeMappings.put(tag, typeMapping);
- }
-
- @Override
- public final void readChunks(IDBStoreChunkReader chunkReader, List<Chunk> chunks, String where)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Reading list chunk values for feature {0}.{1} of {2}v{3}", getContainingClass().getName(), //$NON-NLS-1$
- getFeature().getName(), chunkReader.getRevision().getID(), chunkReader.getRevision().getVersion());
- }
-
- StringBuilder builder = new StringBuilder(sqlSelectChunksPrefix);
- if (where != null)
- {
- builder.append(" AND "); //$NON-NLS-1$
- builder.append(where);
- }
-
- builder.append(sqlOrderByIndex);
- String sql = builder.toString();
-
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = chunkReader.getAccessor().getDBConnection().prepareStatement(sql, ReuseProbability.LOW);
- ResultSet resultSet = null;
-
- try
- {
- idHandler.setCDOID(stmt, 1, chunkReader.getRevision().getID());
- stmt.setInt(2, chunkReader.getRevision().getVersion());
- stmt.setInt(3, chunkReader.getRevision().getVersion());
-
- resultSet = stmt.executeQuery();
-
- Chunk chunk = null;
- int chunkSize = 0;
- int chunkIndex = 0;
- int indexInChunk = 0;
-
- while (resultSet.next())
- {
- CDOID tag = idHandler.getCDOID(resultSet, 1);
- Object value = getTypeMapping(tag).readValue(resultSet);
-
- if (chunk == null)
- {
- chunk = chunks.get(chunkIndex++);
- chunkSize = chunk.size();
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Current chunk no. {0} is [start = {1}, size = {2}]", chunkIndex - 1, chunk.getStartIndex(), //$NON-NLS-1$
- chunkSize);
- }
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Read value for chunk index {0} from result set: {1}", indexInChunk, value); //$NON-NLS-1$
- }
-
- chunk.add(indexInChunk++, CDORevisionUtil.createFeatureMapEntry(getFeatureByTag(tag), value));
- if (indexInChunk == chunkSize)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Chunk finished"); //$NON-NLS-1$
- }
-
- chunk = null;
- indexInChunk = 0;
- }
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Reading list chunk values done for feature {0}.{1} of {2}", getContainingClass().getName(), //$NON-NLS-1$
- getFeature(), chunkReader.getRevision());
- }
- }
- catch (SQLException ex)
- {
- throw new DBException(ex);
- }
- finally
- {
- DBUtil.close(resultSet);
- DBUtil.close(stmt);
- }
- }
-
- @Override
- public void writeValues(IDBStoreAccessor accessor, InternalCDORevision revision)
- {
- CDOList values = revision.getListOrNull(getFeature());
- if (values != null)
- {
- int idx = 0;
- for (Object element : values)
- {
- writeValue(accessor, revision, idx++, element);
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing done"); //$NON-NLS-1$
- }
- }
- }
-
- protected final void writeValue(IDBStoreAccessor accessor, CDORevision revision, int idx, Object value)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing value for feature {0}.{1} index {2} of {3} : {4}", getContainingClass().getName(), //$NON-NLS-1$
- getFeature(), idx, revision, value);
- }
-
- addEntry(accessor, revision.getID(), revision.getVersion(), idx, value, revision.getTimeStamp());
- }
-
- /**
- * Get column name (lazy).
- *
- * @param tag
- * The feature's MetaID in CDO
- * @return the column name where the values are stored
- */
- protected String getColumnName(CDOID tag)
- {
- String column = tagMap.get(tag);
- if (column == null)
- {
- addFeature(tag);
- column = tagMap.get(tag);
- }
-
- return column;
- }
-
- /**
- * Get type mapping (lazy).
- *
- * @param tag
- * The feature's MetaID in CDO
- * @return the corresponding type mapping
- */
- protected ITypeMapping getTypeMapping(CDOID tag)
- {
- ITypeMapping typeMapping = typeMappings.get(tag);
- if (typeMapping == null)
- {
- addFeature(tag);
- typeMapping = typeMappings.get(tag);
- }
-
- return typeMapping;
- }
-
- /**
- * @param metaID
- * @return the column name where the values are stored
- */
- private EStructuralFeature getFeatureByTag(CDOID tag)
- {
- return (EStructuralFeature)getMappingStrategy().getStore().getMetaDataManager().getMetaInstance(tag);
- }
-
- /**
- * @param feature
- * The EStructuralFeature
- * @return The feature's MetaID in CDO
- */
- protected CDOID getTagByFeature(EStructuralFeature feature, long timestamp)
- {
- return getMappingStrategy().getStore().getMetaDataManager().getMetaID(feature, timestamp);
- }
-
- /**
- * Clear a list of a given revision.
- *
- * @param accessor
- * the accessor to use
- * @param id
- * the id of the revision from which to remove all items
- */
- public void clearList(IDBStoreAccessor accessor, CDOID id, int oldVersion, int newVersion)
- {
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmtDeleteTemp = accessor.getDBConnection().prepareStatement(sqlDeleteList, ReuseProbability.HIGH);
- IDBPreparedStatement stmtClear = accessor.getDBConnection().prepareStatement(sqlClearList, ReuseProbability.HIGH);
-
- try
- {
- // delete temporary entries
- idHandler.setCDOID(stmtDeleteTemp, 1, id);
- stmtDeleteTemp.setInt(2, newVersion);
-
- int result = DBUtil.update(stmtDeleteTemp, false);
- if (TRACER.isEnabled())
- {
- TRACER.format("DeleteList result: {0}", result); //$NON-NLS-1$
- }
-
- // clear rest of the list
- stmtClear.setInt(1, newVersion);
- idHandler.setCDOID(stmtClear, 2, id);
-
- result = DBUtil.update(stmtClear, false);
- if (TRACER.isEnabled())
- {
- TRACER.format("ClearList result: {0}", result); //$NON-NLS-1$
- }
- }
- catch (SQLException e)
- {
- throw new DBException(e);
- }
- finally
- {
- DBUtil.close(stmtClear);
- DBUtil.close(stmtDeleteTemp);
- }
- }
-
- @Override
- public void objectDetached(IDBStoreAccessor accessor, CDOID id, long revised)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("objectRevised {0}: {1}", id, revised); //$NON-NLS-1$
- }
-
- CDOBranch main = getMappingStrategy().getStore().getRepository().getBranchManager().getMainBranch();
-
- // get revision from cache to find out version number
- CDORevision revision = getMappingStrategy().getStore().getRepository().getRevisionManager().getRevision(id, main.getHead(),
- /* chunksize = */0, CDORevision.DEPTH_NONE, true);
-
- // set cdo_revision_removed for all list items (so we have no NULL values)
- clearList(accessor, id, revision.getVersion(), FINAL_VERSION);
- }
-
- @Override
- public void rawDeleted(IDBStoreAccessor accessor, CDOID id, CDOBranch branch, int version)
- {
- throw new UnsupportedOperationException("Raw deletion does not work in range-based mappings");
- }
-
- @Override
- public void processDelta(final IDBStoreAccessor accessor, final CDOID id, final int branchId, int oldVersion, final int newVersion, long created,
- CDOListFeatureDelta delta)
- {
- IRepository repo = accessor.getStore().getRepository();
- InternalCDORevision originalRevision = (InternalCDORevision)repo.getRevisionManager().getRevision(id, repo.getBranchManager().getMainBranch().getHead(),
- /* chunksize = */0, CDORevision.DEPTH_NONE, true);
-
- int oldListSize = originalRevision.size(getFeature());
-
- if (TRACER.isEnabled())
- {
- TRACER.format("ListTableMapping.processDelta for revision {0} - previous list size: {1}", originalRevision, //$NON-NLS-1$
- oldListSize);
- }
-
- // let the visitor collect the changes
- ListDeltaVisitor visitor = new ListDeltaVisitor(accessor, originalRevision, oldVersion, newVersion, created);
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Processing deltas..."); //$NON-NLS-1$
- }
-
- for (CDOFeatureDelta listDelta : delta.getListChanges())
- {
- listDelta.accept(visitor);
- }
- }
-
- private class ListDeltaVisitor implements CDOFeatureDeltaVisitor
- {
- private IDBStoreAccessor accessor;
-
- private InternalCDORevision originalRevision;
-
- private CDOID id;
-
- private int oldVersion;
-
- private int newVersion;
-
- private int lastIndex;
-
- private long timestamp;
-
- public ListDeltaVisitor(IDBStoreAccessor accessor, InternalCDORevision originalRevision, int oldVersion, int newVersion, long timestamp)
- {
- this.accessor = accessor;
- this.originalRevision = originalRevision;
- id = this.originalRevision.getID();
- this.oldVersion = oldVersion;
- this.newVersion = newVersion;
- lastIndex = originalRevision.size(getFeature()) - 1;
- this.timestamp = timestamp;
- }
-
- @Override
- public void visit(CDOMoveFeatureDelta delta)
- {
- int fromIdx = delta.getOldPosition();
- int toIdx = delta.getNewPosition();
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Delta Moving: {0} to {1}", fromIdx, toIdx); //$NON-NLS-1$
- }
-
- Object value = getValue(accessor, id, fromIdx);
-
- // remove the item
- removeEntry(accessor, id, oldVersion, newVersion, fromIdx);
-
- // adjust indexes and shift either up or down
- if (fromIdx < toIdx)
- {
- moveOneUp(accessor, id, oldVersion, newVersion, fromIdx + 1, toIdx);
- }
- else
- { // fromIdx > toIdx here
- moveOneDown(accessor, id, oldVersion, newVersion, toIdx, fromIdx - 1);
- }
-
- // create the item
- addEntry(accessor, id, newVersion, toIdx, value, timestamp);
- }
-
- @Override
- public void visit(CDOAddFeatureDelta delta)
- {
- int startIndex = delta.getIndex();
- int endIndex = lastIndex;
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Delta Adding at: {0}", startIndex); //$NON-NLS-1$
- }
-
- if (startIndex <= endIndex)
- {
- // make room for the new item
- moveOneDown(accessor, id, oldVersion, newVersion, startIndex, endIndex);
- }
-
- // create the item
- addEntry(accessor, id, newVersion, startIndex, delta.getValue(), timestamp);
-
- ++lastIndex;
- }
-
- @Override
- public void visit(CDORemoveFeatureDelta delta)
- {
- int startIndex = delta.getIndex();
- int endIndex = lastIndex;
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Delta Removing at: {0}", startIndex); //$NON-NLS-1$
- }
-
- // remove the item
- removeEntry(accessor, id, oldVersion, newVersion, startIndex);
-
- // make room for the new item
- moveOneUp(accessor, id, oldVersion, newVersion, startIndex + 1, endIndex);
-
- --lastIndex;
- }
-
- @Override
- public void visit(CDOSetFeatureDelta delta)
- {
- int index = delta.getIndex();
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Delta Setting at: {0}", index); //$NON-NLS-1$
- }
-
- // remove the item
- removeEntry(accessor, id, oldVersion, newVersion, index);
-
- // create the item
- addEntry(accessor, id, newVersion, index, delta.getValue(), timestamp);
- }
-
- @Override
- public void visit(CDOUnsetFeatureDelta delta)
- {
- if (delta.getFeature().isUnsettable())
- {
- throw new ImplementationError("Should not be called"); //$NON-NLS-1$
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Delta Unsetting"); //$NON-NLS-1$
- }
-
- clearList(accessor, id, oldVersion, newVersion);
- lastIndex = -1;
- }
-
- @Override
- public void visit(CDOListFeatureDelta delta)
- {
- throw new ImplementationError("Should not be called"); //$NON-NLS-1$
- }
-
- @Override
- public void visit(CDOClearFeatureDelta delta)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Delta Clearing"); //$NON-NLS-1$
- }
-
- clearList(accessor, id, oldVersion, newVersion);
- lastIndex = -1;
- }
-
- @Override
- public void visit(CDOContainerFeatureDelta delta)
- {
- throw new ImplementationError("Should not be called"); //$NON-NLS-1$
- }
-
- private void moveOneUp(IDBStoreAccessor accessor, CDOID id, int oldVersion, int newVersion, int startIndex, int endIndex)
- {
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH);
-
- try
- {
- for (int index = startIndex; index <= endIndex; ++index)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("moveOneUp moving: {0} -> {1}", index, index - 1); //$NON-NLS-1$
- }
-
- int column = 1;
- stmt.setInt(column++, index - 1);
- idHandler.setCDOID(stmt, column++, id);
- stmt.setInt(column++, newVersion);
- stmt.setInt(column++, index);
-
- int result = DBUtil.update(stmt, false);
- switch (result)
- {
- case 0:
- Object value = getValue(accessor, id, index);
- if (TRACER.isEnabled())
- {
- TRACER.format("moveOneUp remove: {0}", index); //$NON-NLS-1$
- }
-
- removeEntry(accessor, id, oldVersion, newVersion, index);
- if (TRACER.isEnabled())
- {
- TRACER.format("moveOneUp add: {0}", index - 1); //$NON-NLS-1$
- }
-
- addEntry(accessor, id, newVersion, index - 1, value, timestamp);
- break;
-
- case 1:
- if (TRACER.isEnabled())
- {
- TRACER.format("moveOneUp updated: {0} -> {1}", index, index - 1); //$NON-NLS-1$
- }
-
- break;
-
- default:
- if (TRACER.isEnabled())
- {
- TRACER.format("moveOneUp Too many results: {0} -> {1}: {2}", index, index + 1, result); //$NON-NLS-1$
- }
-
- throw new DBException("Too many results"); //$NON-NLS-1$
- }
- }
- }
- catch (SQLException e)
- {
- throw new DBException(e);
- }
- finally
- {
- DBUtil.close(stmt);
- }
- }
-
- private void moveOneDown(IDBStoreAccessor accessor, CDOID id, int oldVersion, int newVersion, int startIndex, int endIndex)
- {
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH);
-
- try
- {
- for (int index = endIndex; index >= startIndex; --index)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("moveOneDown moving: {0} -> {1}", index, index + 1); //$NON-NLS-1$
- }
-
- int column = 1;
- stmt.setInt(column++, index + 1);
- idHandler.setCDOID(stmt, column++, id);
- stmt.setInt(column++, newVersion);
- stmt.setInt(column++, index);
-
- int result = DBUtil.update(stmt, false);
- switch (result)
- {
- case 0:
- Object value = getValue(accessor, id, index);
- if (TRACER.isEnabled())
- {
- TRACER.format("moveOneDown remove: {0}", index); //$NON-NLS-1$
- }
-
- removeEntry(accessor, id, oldVersion, newVersion, index);
- if (TRACER.isEnabled())
- {
- TRACER.format("moveOneDown add: {0}", index + 1); //$NON-NLS-1$
- }
-
- addEntry(accessor, id, newVersion, index + 1, value, timestamp);
- break;
-
- case 1:
- if (TRACER.isEnabled())
- {
- TRACER.format("moveOneDown updated: {0} -> {1}", index, index + 1); //$NON-NLS-1$
- }
-
- break;
-
- default:
- if (TRACER.isEnabled())
- {
- TRACER.format("moveOneDown Too many results: {0} -> {1}: {2}", index, index + 1, result); //$NON-NLS-1$
- }
-
- throw new DBException("Too many results"); //$NON-NLS-1$
- }
- }
- }
- catch (SQLException e)
- {
- throw new DBException(e);
- }
- finally
- {
- DBUtil.close(stmt);
- }
- }
- }
-
- private void addEntry(IDBStoreAccessor accessor, CDOID id, int version, int index, Object value, long timestamp)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Adding value for feature() {0}.{1} index {2} of {3}v{4} : {5}", //$NON-NLS-1$
- getContainingClass().getName(), getFeature().getName(), index, id, version, value);
- }
-
- FeatureMap.Entry entry = (FeatureMap.Entry)value;
- EStructuralFeature entryFeature = entry.getEStructuralFeature();
- CDOID tag = getTagByFeature(entryFeature, timestamp);
- ITypeMapping typeMapping = getTypeMapping(tag);
- String columnName = getColumnName(tag);
-
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlInsert, ReuseProbability.HIGH);
-
- try
- {
- int column = 1;
- idHandler.setCDOID(stmt, column++, id);
- stmt.setInt(column++, version);
- stmt.setNull(column++, DBType.INTEGER.getCode()); // versionRemoved
- stmt.setInt(column++, index);
- idHandler.setCDOID(stmt, column++, tag);
-
- for (int i = 0; i < columnNames.size(); i++)
- {
- if (columnNames.get(i).equals(columnName))
- {
- typeMapping.setValue(stmt, column++, entry.getValue());
- }
- else
- {
- stmt.setNull(column++, getDBTypes().get(i).getCode());
- }
- }
-
- DBUtil.update(stmt, true);
- }
- catch (SQLException e)
- {
- throw new DBException(e);
- }
- catch (IllegalStateException e)
- {
- throw new DBException(e);
- }
- finally
- {
- DBUtil.close(stmt);
- }
- }
-
- private void removeEntry(IDBStoreAccessor accessor, CDOID id, int oldVersion, int newVersion, int index)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Removing value for feature() {0}.{1} index {2} of {3}v{4}", //$NON-NLS-1$
- getContainingClass().getName(), getFeature().getName(), index, id, newVersion);
- }
-
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlDeleteEntry, ReuseProbability.HIGH);
-
- try
- {
- // try to delete a temporary entry first
- int column = 1;
- idHandler.setCDOID(stmt, column++, id);
- stmt.setInt(column++, index);
- stmt.setInt(column++, newVersion);
-
- int result = DBUtil.update(stmt, false);
- if (result == 1)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("removeEntry deleted: {0}", index); //$NON-NLS-1$
- }
- }
- else if (result > 1)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("removeEntry Too many results: {0}: {1}", index, result); //$NON-NLS-1$
- }
-
- throw new DBException("Too many results"); //$NON-NLS-1$
- }
- else
- {
- // no temporary entry found, so mark the entry as removed
- DBUtil.close(stmt);
- stmt = accessor.getDBConnection().prepareStatement(sqlRemoveEntry, ReuseProbability.HIGH);
-
- column = 1;
- stmt.setInt(column++, newVersion);
- idHandler.setCDOID(stmt, column++, id);
- stmt.setInt(column++, index);
- DBUtil.update(stmt, true);
- }
- }
- catch (SQLException e)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Removing value for feature() {0}.{1} index {2} of {3}v{4} FAILED {5}", //$NON-NLS-1$
- getContainingClass().getName(), getFeature().getName(), index, id, newVersion, e.getMessage());
- }
-
- throw new DBException(e);
- }
- catch (IllegalStateException e)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Removing value for feature() {0}.{1} index {2} of {3}v{4} FAILED {5}", //$NON-NLS-1$
- getContainingClass().getName(), getFeature().getName(), index, id, newVersion, e.getMessage());
- }
-
- throw new DBException(e);
- }
- finally
- {
- DBUtil.close(stmt);
- }
- }
-
- private FeatureMap.Entry getValue(IDBStoreAccessor accessor, CDOID id, int index)
- {
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlGetValue, ReuseProbability.HIGH);
-
- try
- {
- int column = 1;
- idHandler.setCDOID(stmt, column++, id);
- stmt.setInt(column++, index);
-
- ResultSet resultSet = stmt.executeQuery();
- if (!resultSet.next())
- {
- throw new DBException("getValue expects exactly one result");
- }
-
- CDOID tag = idHandler.getCDOID(resultSet, 1);
- Object value = getTypeMapping(tag).readValue(resultSet);
- FeatureMap.Entry result = CDORevisionUtil.createFeatureMapEntry(getFeatureByTag(tag), value);
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Read value (index {0}) from result set: {1}", index, result); //$NON-NLS-1$
- }
-
- return result;
- }
- catch (SQLException e)
- {
- throw new DBException(e);
- }
- finally
- {
- DBUtil.close(stmt);
- }
- }
-
- @Override
- public final boolean queryXRefs(IDBStoreAccessor accessor, String mainTableName, String mainTableWhere, QueryXRefsContext context, String idString)
- {
- // must never be called (a feature map is not associated with an EReference feature, so XRefs are nor supported
- // here)
- throw new ImplementationError("Should never be called!");
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingFeatureMapTableMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingFeatureMapTableMapping.java
deleted file mode 100644
index af0746c47f..0000000000
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingFeatureMapTableMapping.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2010-2013, 2018, 2019 Eike Stepper (Loehne, 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
- * Stefan Winkler - Bug 271444: [DB] Multiple refactorings bug 271444
- * Christopher Albert - Bug 254455: [DB] Support FeatureMaps bug 254455
- * Stefan Winkler - derived branch mapping from audit mapping
- */
-package org.eclipse.emf.cdo.server.internal.db.mapping.horizontal;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.server.db.IDBStoreAccessor;
-import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
-
-import org.eclipse.net4j.db.DBException;
-import org.eclipse.net4j.db.DBType;
-import org.eclipse.net4j.db.DBUtil;
-import org.eclipse.net4j.db.IDBPreparedStatement;
-import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.util.List;
-
-/**
- * This is a featuremap-table mapping for audit mode. It has ID and version columns and no delta support.
- *
- * @author Eike Stepper
- * @author Stefan Winkler
- * @since 3.0
- * @deprecated As 4.5 feature maps are no longer supported.
- */
-@Deprecated
-public class BranchingFeatureMapTableMapping extends AbstractFeatureMapTableMapping
-{
- private String sqlClear;
-
- public BranchingFeatureMapTableMapping(IMappingStrategy mappingStrategy, EClass eClass, EStructuralFeature feature)
- {
- super(mappingStrategy, eClass, feature);
- initSQLStrings();
- }
-
- private void initSQLStrings()
- {
- // ----------- clear list -------------------------
- StringBuilder builder = new StringBuilder();
- builder.append("DELETE FROM "); //$NON-NLS-1$
- builder.append(getTable());
- builder.append(" WHERE "); //$NON-NLS-1$
- builder.append(LIST_REVISION_ID);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(LIST_REVISION_BRANCH);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(LIST_REVISION_VERSION);
- builder.append("=?"); //$NON-NLS-1$
- sqlClear = builder.toString();
- }
-
- @Override
- protected void addKeyFields(List<FieldInfo> list)
- {
- list.add(new FieldInfo(FEATUREMAP_BRANCH, DBType.INTEGER));
- list.add(new FieldInfo(FEATUREMAP_VERSION, DBType.INTEGER));
- }
-
- @Override
- protected void setKeyFields(PreparedStatement stmt, CDORevision revision) throws SQLException
- {
- getMappingStrategy().getStore().getIDHandler().setCDOID(stmt, 1, revision.getID());
- stmt.setInt(2, revision.getBranch().getID());
- stmt.setInt(3, revision.getVersion());
- }
-
- @Override
- public void objectDetached(IDBStoreAccessor accessor, CDOID id, long revised)
- {
- // the audit list mapping does not care about revised references -> NOP
- }
-
- @Override
- public void rawDeleted(IDBStoreAccessor accessor, CDOID id, CDOBranch branch, int version)
- {
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlClear, ReuseProbability.HIGH);
-
- try
- {
- getMappingStrategy().getStore().getIDHandler().setCDOID(stmt, 1, id);
- stmt.setInt(2, branch.getID());
- stmt.setInt(3, version);
- DBUtil.update(stmt, false);
- }
- catch (SQLException e)
- {
- throw new DBException(e);
- }
- finally
- {
- DBUtil.close(stmt);
- }
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingFeatureMapTableMappingWithRanges.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingFeatureMapTableMappingWithRanges.java
deleted file mode 100644
index ade68a7775..0000000000
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingFeatureMapTableMappingWithRanges.java
+++ /dev/null
@@ -1,1511 +0,0 @@
-/*
- * Copyright (c) 2010-2013, 2015, 2016, 2018, 2019 Eike Stepper (Loehne, 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:
- * Stefan Winkler - initial API and implementation taken from AuditFeatureMapTableMappingWithRanges
- * Stefan Winkler - Bug 329025: [DB] Support branching for range-based mapping strategy
- */
-package org.eclipse.emf.cdo.server.internal.db.mapping.horizontal;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDUtil;
-import org.eclipse.emf.cdo.common.revision.CDOList;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
-import org.eclipse.emf.cdo.common.revision.delta.CDOAddFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOClearFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOContainerFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
-import org.eclipse.emf.cdo.common.revision.delta.CDOListFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOMoveFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDORemoveFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOUnsetFeatureDelta;
-import org.eclipse.emf.cdo.server.IStoreAccessor.QueryXRefsContext;
-import org.eclipse.emf.cdo.server.IStoreChunkReader;
-import org.eclipse.emf.cdo.server.IStoreChunkReader.Chunk;
-import org.eclipse.emf.cdo.server.db.IDBStore;
-import org.eclipse.emf.cdo.server.db.IDBStoreAccessor;
-import org.eclipse.emf.cdo.server.db.IDBStoreChunkReader;
-import org.eclipse.emf.cdo.server.db.IIDHandler;
-import org.eclipse.emf.cdo.server.db.mapping.IListMappingDeltaSupport;
-import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
-import org.eclipse.emf.cdo.server.db.mapping.ITypeMapping;
-import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager;
-import org.eclipse.emf.cdo.spi.server.InternalRepository;
-
-import org.eclipse.net4j.db.DBException;
-import org.eclipse.net4j.db.DBType;
-import org.eclipse.net4j.db.DBUtil;
-import org.eclipse.net4j.db.IDBDatabase;
-import org.eclipse.net4j.db.IDBPreparedStatement;
-import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability;
-import org.eclipse.net4j.db.ddl.IDBIndex.Type;
-import org.eclipse.net4j.db.ddl.IDBTable;
-import org.eclipse.net4j.util.ImplementationError;
-import org.eclipse.net4j.util.collection.MoveableList;
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.FeatureMap;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * This is a featuremap-table mapping for audit mode. It is optimized for frequent insert operations at the list's end,
- * which causes just 1 DB row to be changed. This is achieved by introducing a version range (columns
- * {@link IMappingConstants#LIST_REVISION_VERSION_ADDED cdo_version_added} and
- * {@link IMappingConstants#LIST_REVISION_VERSION_REMOVED cdo_version_removed}) which records for which revisions a particular
- * entry existed. Also, this mapping is mainly optimized for potentially very large lists: the need for having the
- * complete list stored in memory to do in-the-middle-moved and inserts is traded in for a few more DB access
- * operations.
- *
- * @author Eike Stepper
- * @author Stefan Winkler
- * @author Lothar Werzinger
- * @since 3.0
- * @deprecated As 4.5 feature maps are no longer supported.
- */
-@Deprecated
-public class BranchingFeatureMapTableMappingWithRanges extends AbstractBasicListTableMapping implements IListMappingDeltaSupport
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, BranchingFeatureMapTableMappingWithRanges.class);
-
- /**
- * Used to clean up lists for detached objects.
- */
- private static final int FINAL_VERSION = Integer.MAX_VALUE;
-
- /**
- * The table of this mapping.
- */
- private IDBTable table;
-
- /**
- * The tags mapped to column names
- */
- private Map<CDOID, String> tagMap;
-
- /**
- * Column name Set
- */
- private List<String> columnNames;
-
- /**
- * The type mappings for the value fields.
- */
- private Map<CDOID, ITypeMapping> typeMappings;
-
- private List<DBType> dbTypes;
-
- // --------- SQL strings - see initSQLStrings() -----------------
- private String sqlSelectChunksPrefix;
-
- private String sqlOrderByIndex;
-
- private String sqlInsert;
-
- private String sqlRemoveEntry;
-
- private String sqlDeleteEntry;
-
- private String sqlUpdateIndex;
-
- private String sqlGetValue;
-
- private String sqlClearList;
-
- public BranchingFeatureMapTableMappingWithRanges(IMappingStrategy mappingStrategy, EClass eClass, EStructuralFeature feature)
- {
- super(mappingStrategy, eClass, feature);
- initDBTypes();
- initTable();
- initSQLStrings();
- }
-
- private void initDBTypes()
- {
- // TODO add annotation processing here ...
- ITypeMapping.Registry registry = ITypeMapping.Registry.INSTANCE;
- dbTypes = new ArrayList<>(registry.getDefaultFeatureMapDBTypes());
- }
-
- private void initTable()
- {
- String tableName = getMappingStrategy().getTableName(getContainingClass(), getFeature());
- IDBStore store = getMappingStrategy().getStore();
- DBType idType = store.getIDHandler().getDBType();
- int idLength = store.getIDColumnLength();
-
- IDBDatabase database = getMappingStrategy().getStore().getDatabase();
- table = database.getSchema().getTable(tableName);
- if (table == null)
- {
- table = database.getSchemaTransaction().getWorkingCopy().addTable(tableName);
- table.addField(FEATUREMAP_REVISION_ID, idType, idLength);
- table.addField(LIST_REVISION_BRANCH, DBType.INTEGER);
- table.addField(FEATUREMAP_VERSION_ADDED, DBType.INTEGER);
- table.addField(FEATUREMAP_VERSION_REMOVED, DBType.INTEGER);
- table.addField(FEATUREMAP_IDX, DBType.INTEGER);
- table.addField(FEATUREMAP_TAG, idType, idLength);
-
- tagMap = CDOIDUtil.createMap();
- typeMappings = CDOIDUtil.createMap();
- columnNames = new ArrayList<>();
-
- initTypeColumns(true);
-
- table.addIndex(Type.NON_UNIQUE, FEATUREMAP_REVISION_ID);
- table.addIndex(Type.NON_UNIQUE, LIST_REVISION_BRANCH);
- table.addIndex(Type.NON_UNIQUE, FEATUREMAP_VERSION_ADDED);
- table.addIndex(Type.NON_UNIQUE, FEATUREMAP_VERSION_REMOVED);
- table.addIndex(Type.NON_UNIQUE, FEATUREMAP_IDX);
- table.addIndex(Type.NON_UNIQUE, FEATUREMAP_TAG);
- }
- else
- {
- initTypeColumns(false);
- }
- }
-
- private void initTypeColumns(boolean create)
- {
- for (DBType type : getDBTypes())
- {
- String column = FEATUREMAP_VALUE + "_" + type.name();
- if (create)
- {
- table.addField(column, type);
- }
-
- columnNames.add(column);
- }
- }
-
- private void initSQLStrings()
- {
- String tableName = getTable().getName();
-
- // ---------------- SELECT to read chunks ----------------------------
- StringBuilder builder = new StringBuilder();
- builder.append("SELECT "); //$NON-NLS-1$
-
- builder.append(FEATUREMAP_IDX);
- builder.append(", "); //$NON-NLS-1$
- builder.append(FEATUREMAP_TAG);
- builder.append(", "); //$NON-NLS-1$
-
- Iterator<String> iter = columnNames.iterator();
- while (iter.hasNext())
- {
- builder.append(iter.next());
- if (iter.hasNext())
- {
- builder.append(", "); //$NON-NLS-1$
- }
- }
-
- builder.append(" FROM "); //$NON-NLS-1$
- builder.append(tableName);
- builder.append(" WHERE "); //$NON-NLS-1$
- builder.append(FEATUREMAP_REVISION_ID);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_BRANCH);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_ADDED);
- builder.append("<=? AND ("); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_REMOVED);
- builder.append(" IS NULL OR "); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_REMOVED);
- builder.append(">?)"); //$NON-NLS-1$
- sqlSelectChunksPrefix = builder.toString();
-
- sqlOrderByIndex = " ORDER BY " + FEATUREMAP_IDX; //$NON-NLS-1$
-
- // ----------------- INSERT - prefix -----------------
- builder = new StringBuilder("INSERT INTO "); //$NON-NLS-1$
- builder.append(tableName);
- builder.append("("); //$NON-NLS-1$
- builder.append(FEATUREMAP_REVISION_ID);
- builder.append(", "); //$NON-NLS-1$
- builder.append(FEATUREMAP_BRANCH);
- builder.append(", "); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_ADDED);
- builder.append(", "); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_REMOVED);
- builder.append(", "); //$NON-NLS-1$
- builder.append(FEATUREMAP_IDX);
- builder.append(", "); //$NON-NLS-1$
- builder.append(FEATUREMAP_TAG);
-
- for (int i = 0; i < columnNames.size(); i++)
- {
- builder.append(", "); //$NON-NLS-1$
- builder.append(columnNames.get(i));
- }
-
- builder.append(") VALUES (?, ?, ?, ?, ?, ?"); //$NON-NLS-1$
- for (int i = 0; i < columnNames.size(); i++)
- {
- builder.append(", ?"); //$NON-NLS-1$
- }
-
- builder.append(")"); //$NON-NLS-1$
- sqlInsert = builder.toString();
-
- // ----------------- remove current entry -----------------
- builder = new StringBuilder("UPDATE "); //$NON-NLS-1$
- builder.append(tableName);
- builder.append(" SET "); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_REMOVED);
- builder.append("=? "); //$NON-NLS-1$
- builder.append(" WHERE "); //$NON-NLS-1$
- builder.append(FEATUREMAP_REVISION_ID);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_BRANCH);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_IDX);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_REMOVED);
- builder.append(" IS NULL"); //$NON-NLS-1$
- sqlRemoveEntry = builder.toString();
-
- // ----------------- delete temporary entry -----------------
- builder = new StringBuilder("DELETE FROM "); //$NON-NLS-1$
- builder.append(tableName);
- builder.append(" WHERE "); //$NON-NLS-1$
- builder.append(FEATUREMAP_REVISION_ID);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_BRANCH);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_IDX);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_ADDED);
- builder.append("=?"); //$NON-NLS-1$
- sqlDeleteEntry = builder.toString();
-
- // ----------------- update index -----------------
- builder = new StringBuilder("UPDATE "); //$NON-NLS-1$
- builder.append(tableName);
- builder.append(" SET "); //$NON-NLS-1$
- builder.append(FEATUREMAP_IDX);
- builder.append("=? WHERE "); //$NON-NLS-1$
- builder.append(FEATUREMAP_REVISION_ID);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_BRANCH);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_ADDED);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_IDX);
- builder.append("=?"); //$NON-NLS-1$
- sqlUpdateIndex = builder.toString();
-
- // ----------------- get current value -----------------
- builder = new StringBuilder("SELECT "); //$NON-NLS-1$
- builder.append(FEATUREMAP_TAG);
- builder.append(", "); //$NON-NLS-1$
-
- iter = columnNames.iterator();
- while (iter.hasNext())
- {
- builder.append(iter.next());
- if (iter.hasNext())
- {
- builder.append(", "); //$NON-NLS-1$
- }
- }
-
- builder.append(" FROM "); //$NON-NLS-1$
- builder.append(tableName);
- builder.append(" WHERE "); //$NON-NLS-1$
- builder.append(FEATUREMAP_REVISION_ID);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_BRANCH);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_IDX);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_REMOVED);
- builder.append(" IS NULL"); //$NON-NLS-1$
- sqlGetValue = builder.toString();
-
- // ----------- clear list items -------------------------
- builder = new StringBuilder("UPDATE "); //$NON-NLS-1$
- builder.append(tableName);
- builder.append(" SET "); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_REMOVED);
- builder.append("=? "); //$NON-NLS-1$
- builder.append(" WHERE "); //$NON-NLS-1$
- builder.append(FEATUREMAP_REVISION_ID);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_BRANCH);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_VERSION_REMOVED);
- builder.append(" IS NULL"); //$NON-NLS-1$
- sqlClearList = builder.toString();
- }
-
- @Override
- public Collection<IDBTable> getDBTables()
- {
- return Collections.singleton(table);
- }
-
- protected List<DBType> getDBTypes()
- {
- return dbTypes;
- }
-
- protected final IDBTable getTable()
- {
- return table;
- }
-
- protected final List<String> getColumnNames()
- {
- return columnNames;
- }
-
- protected final Map<CDOID, ITypeMapping> getTypeMappings()
- {
- return typeMappings;
- }
-
- protected final Map<CDOID, String> getTagMap()
- {
- return tagMap;
- }
-
- @Override
- public void readValues(IDBStoreAccessor accessor, InternalCDORevision revision, int listChunk)
- {
- MoveableList<Object> list = revision.getListOrNull(getFeature());
- if (list == null)
- {
- // Nothing to read take shortcut.
- return;
- }
-
- int valuesToRead = list.size();
-
- if (listChunk != CDORevision.UNCHUNKED && listChunk < valuesToRead)
- {
- valuesToRead = listChunk;
- }
-
- if (valuesToRead == 0)
- {
- // Nothing to read take shortcut.
- return;
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Reading list values for feature {0}.{1} of {2}", getContainingClass().getName(), getFeature() //$NON-NLS-1$
- .getName(), revision);
- }
-
- String sql = sqlSelectChunksPrefix + sqlOrderByIndex;
-
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sql, ReuseProbability.HIGH);
- ResultSet resultSet = null;
-
- IStoreChunkReader baseReader = null;
-
- try
- {
- CDOID id = revision.getID();
- int branchID = revision.getBranch().getID();
-
- idHandler.setCDOID(stmt, 1, id);
- stmt.setInt(2, branchID);
- stmt.setInt(3, revision.getVersion());
- stmt.setInt(4, revision.getVersion());
-
- stmt.setMaxRows(valuesToRead); // optimization - don't read unneeded rows.
-
- resultSet = stmt.executeQuery();
-
- int currentIndex = 0;
-
- while (valuesToRead > 0 && resultSet.next())
- {
- int index = resultSet.getInt(1);
- if (index > currentIndex)
- {
- if (baseReader == null)
- {
- baseReader = createBaseChunkReader(accessor, id, branchID);
- }
-
- baseReader.addRangedChunk(currentIndex, index);
- if (TRACER.isEnabled())
- {
- TRACER.format("Scheduling range {0}-{1} to be read from base revision", currentIndex, index); //$NON-NLS-1$
- }
-
- valuesToRead -= index - currentIndex;
- currentIndex = index;
- }
-
- CDOID tag = idHandler.getCDOID(resultSet, 2);
- Object value = getTypeMapping(tag).readValue(resultSet);
- if (TRACER.isEnabled())
- {
- TRACER.format("Read value for index {0} from result set: {1}", currentIndex, value); //$NON-NLS-1$
- }
-
- list.set(currentIndex++, CDORevisionUtil.createFeatureMapEntry(getFeatureByTag(tag), value));
- valuesToRead--;
- }
-
- if (valuesToRead > 0)
- {
- if (baseReader == null)
- {
- baseReader = createBaseChunkReader(accessor, id, branchID);
- }
-
- baseReader.addRangedChunk(currentIndex, currentIndex + valuesToRead);
- }
- }
- catch (SQLException ex)
- {
- throw new DBException(ex);
- }
- finally
- {
- DBUtil.close(resultSet);
- DBUtil.close(stmt);
- }
-
- if (baseReader != null)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Reading base revision chunks for featureMap {0}.{1} of {2} from base revision {3}", //$NON-NLS-1$
- getContainingClass().getName(), getFeature().getName(), revision, baseReader.getRevision());
- }
-
- List<Chunk> baseChunks = baseReader.executeRead();
- for (Chunk chunk : baseChunks)
- {
- int startIndex = chunk.getStartIndex();
- for (int i = 0; i < chunk.size(); i++)
- {
- list.set(startIndex + i, chunk.get(i));
- }
- }
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Reading list values done for feature {0}.{1} of {2}", getContainingClass().getName(), //$NON-NLS-1$
- getFeature().getName(), revision);
- }
- }
-
- @Override
- public final void readChunks(IDBStoreChunkReader chunkReader, List<Chunk> chunks, String where)
- {
- CDORevision revision = chunkReader.getRevision();
- if (TRACER.isEnabled())
- {
- TRACER.format("Reading list chunk values for feature {0}.{1} of {2}", getContainingClass().getName(), //$NON-NLS-1$
- getFeature().getName(), revision);
- }
-
- StringBuilder builder = new StringBuilder(sqlSelectChunksPrefix);
- if (where != null)
- {
- builder.append(" AND "); //$NON-NLS-1$
- builder.append(where);
- }
-
- builder.append(sqlOrderByIndex);
- String sql = builder.toString();
-
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = chunkReader.getAccessor().getDBConnection().prepareStatement(sql, ReuseProbability.LOW);
- ResultSet resultSet = null;
- IStoreChunkReader baseReader = null;
-
- try
- {
- idHandler.setCDOID(stmt, 1, revision.getID());
- stmt.setInt(2, revision.getBranch().getID());
- stmt.setInt(3, revision.getVersion());
- stmt.setInt(4, revision.getVersion());
-
- resultSet = stmt.executeQuery();
-
- int nextDBIndex = Integer.MAX_VALUE; // next available DB index
- if (resultSet.next())
- {
- nextDBIndex = resultSet.getInt(1);
- }
-
- for (Chunk chunk : chunks)
- {
- int startIndex = chunk.getStartIndex();
- int missingValueStartIndex = -1;
-
- for (int i = 0; i < chunk.size(); i++)
- {
- int nextListIndex = startIndex + i; // next expected list index
-
- if (nextDBIndex == nextListIndex)
- {
- // DB value is available. check first if missing indexes were present before.
- if (missingValueStartIndex != -1)
- {
- // read missing indexes from missingValueStartIndex to currentIndex
- if (baseReader == null)
- {
- baseReader = createBaseChunkReader(chunkReader.getAccessor(), chunkReader.getRevision().getID(), chunkReader.getRevision().getBranch().getID());
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Scheduling range {0}-{1} to be read from base revision", missingValueStartIndex, //$NON-NLS-1$
- nextListIndex);
- }
-
- baseReader.addRangedChunk(missingValueStartIndex, nextListIndex);
-
- // reset missingValueStartIndex
- missingValueStartIndex = -1;
- }
-
- // now read value and set to chunk
- CDOID tag = idHandler.getCDOID(resultSet, 2);
- Object value = getTypeMapping(tag).readValue(resultSet);
- if (TRACER.isEnabled())
- {
- TRACER.format("ChunkReader read value for index {0} from result set: {1}", nextDBIndex, value); //$NON-NLS-1$
- }
-
- chunk.add(i, CDORevisionUtil.createFeatureMapEntry(getFeatureByTag(tag), value));
-
- // advance DB cursor and read next available index
- if (resultSet.next())
- {
- nextDBIndex = resultSet.getInt(1);
- }
- else
- {
- // no more DB indexes available, but we have to continue checking for gaps, therefore set to MAX_VALUE
- nextDBIndex = Integer.MAX_VALUE;
- }
- }
- else
- {
- // gap between next DB index and next list index detected.
- // skip until end of chunk or until DB value becomes available
- if (missingValueStartIndex == -1)
- {
- missingValueStartIndex = nextListIndex;
- }
- }
- }
-
- // chunk complete. check for missing values at the end of the chunk.
- if (missingValueStartIndex != -1)
- {
- // read missing indexes from missingValueStartIndex to last chunk index
- if (baseReader == null)
- {
- baseReader = createBaseChunkReader(chunkReader.getAccessor(), chunkReader.getRevision().getID(), chunkReader.getRevision().getBranch().getID());
- }
- baseReader.addRangedChunk(missingValueStartIndex, chunk.getStartIndex() + chunk.size());
- }
- }
- }
- catch (SQLException ex)
- {
- throw new DBException(ex);
- }
- finally
- {
- DBUtil.close(resultSet);
- DBUtil.close(stmt);
- }
-
- // now read missing values from base revision.
- if (baseReader != null)
- {
- List<Chunk> baseChunks = baseReader.executeRead();
-
- Iterator<Chunk> thisIterator = chunks.iterator();
- Chunk thisChunk = thisIterator.next();
-
- for (Chunk baseChunk : baseChunks)
- {
- int baseStartIndex = baseChunk.getStartIndex();
-
- while (baseStartIndex > thisChunk.getStartIndex() + thisChunk.size())
- {
- // advance thisChunk, because it does not match baseChunk
- thisChunk = thisIterator.next();
- }
-
- // baseChunk now corresponds to this chunk, but startIndex of baseChunk may be higher.
- // therefore calculate offset
- int offset = thisChunk.getStartIndex() - baseStartIndex;
-
- // and copy values.
- for (int i = 0; i < baseChunk.size(); i++)
- {
- thisChunk.add(i + offset, baseChunk.get(i));
- }
- } // finally, continue with the next baseChunk
-
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Reading list chunk values done for feature {0}.{1} of {2}", getContainingClass().getName(), //$NON-NLS-1$
- getFeature(), revision);
- }
- }
-
- @Override
- public void writeValues(IDBStoreAccessor accessor, InternalCDORevision revision)
- {
- CDOList values = revision.getListOrNull(getFeature());
- if (values != null)
- {
- int idx = 0;
- for (Object element : values)
- {
- writeValue(accessor, revision, idx++, element);
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing done"); //$NON-NLS-1$
- }
- }
- }
-
- protected final void writeValue(IDBStoreAccessor accessor, CDORevision revision, int idx, Object value)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing value for feature {0}.{1} index {2} of {3} : {4}", getContainingClass().getName(), //$NON-NLS-1$
- getFeature(), idx, revision, value);
- }
-
- addEntry(accessor, revision.getID(), revision.getBranch().getID(), revision.getVersion(), idx, value, revision.getTimeStamp());
- }
-
- /**
- * Get column name (lazy).
- *
- * @param tag
- * The feature's MetaID in CDO
- * @return the column name where the values are stored
- */
- protected String getColumnName(CDOID tag)
- {
- String column = tagMap.get(tag);
- if (column == null)
- {
- addFeature(tag);
- column = tagMap.get(tag);
- }
-
- return column;
- }
-
- /**
- * Get type mapping (lazy).
- *
- * @param tag
- * The feature's MetaID in CDO
- * @return the corresponding type mapping
- */
- protected ITypeMapping getTypeMapping(CDOID tag)
- {
- ITypeMapping typeMapping = typeMappings.get(tag);
- if (typeMapping == null)
- {
- addFeature(tag);
- typeMapping = typeMappings.get(tag);
- }
-
- return typeMapping;
- }
-
- private void addFeature(CDOID tag)
- {
- EStructuralFeature modelFeature = getFeatureByTag(tag);
-
- ITypeMapping typeMapping = getMappingStrategy().createValueMapping(modelFeature);
- String column = FEATUREMAP_VALUE + "_" + typeMapping.getDBType(); //$NON-NLS-1$
-
- tagMap.put(tag, column);
- typeMapping.setDBField(table, column);
- typeMappings.put(tag, typeMapping);
- }
-
- /**
- * @param metaID
- * @return the column name where the values are stored
- */
- private EStructuralFeature getFeatureByTag(CDOID tag)
- {
- return (EStructuralFeature)getMappingStrategy().getStore().getMetaDataManager().getMetaInstance(tag);
- }
-
- /**
- * @param feature
- * The EStructuralFeature
- * @return The feature's MetaID in CDO
- */
- protected CDOID getTagByFeature(EStructuralFeature feature, long created)
- {
- return getMappingStrategy().getStore().getMetaDataManager().getMetaID(feature, created);
- }
-
- /**
- * Clear a list of a given revision.
- *
- * @param accessor
- * the accessor to use
- * @param id
- * the id of the revision from which to remove all items
- */
- public void clearList(IDBStoreAccessor accessor, CDOID id, int branchId, int oldVersion, int newVersion, int lastIndex, long timestamp)
- {
- // check for each index if the value exists in the current branch
- for (int i = 0; i <= lastIndex; i++)
- {
- if (getValue(accessor, id, branchId, i, false) == null)
- {
- // if not, add a historic entry for missing ones.
- addHistoricEntry(accessor, id, branchId, 0, newVersion, i, getValueFromBase(accessor, id, branchId, i), timestamp);
- }
- }
-
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlClearList, ReuseProbability.HIGH);
-
- try
- {
- // clear rest of the list
- stmt.setInt(1, newVersion);
- idHandler.setCDOID(stmt, 2, id);
- stmt.setInt(3, branchId);
-
- int result = DBUtil.update(stmt, false);
- if (TRACER.isEnabled())
- {
- TRACER.format("ClearList result: {0}", result); //$NON-NLS-1$
- }
- }
- catch (SQLException e)
- {
- throw new DBException(e);
- }
- finally
- {
- DBUtil.close(stmt);
- }
- }
-
- @Override
- public void objectDetached(IDBStoreAccessor accessor, CDOID id, long revised)
- {
- InternalCDORevision revision = (InternalCDORevision)accessor.getTransaction().getRevision(id);
- int branchId = accessor.getTransaction().getBranch().getID();
-
- if (TRACER.isEnabled())
- {
- TRACER.format("objectDetached {1}", revision); //$NON-NLS-1$
- }
-
- clearList(accessor, id, branchId, revision.getVersion(), FINAL_VERSION, revision.size(getFeature()) - 1, revised);
- }
-
- @Override
- public void rawDeleted(IDBStoreAccessor accessor, CDOID id, CDOBranch branch, int version)
- {
- throw new UnsupportedOperationException("Raw deletion does not work in range-based mappings");
- }
-
- @Override
- public void processDelta(final IDBStoreAccessor accessor, final CDOID id, final int branchId, int oldVersion, final int newVersion, long created,
- CDOListFeatureDelta delta)
- {
- List<CDOFeatureDelta> listChanges = delta.getListChanges();
- if (listChanges.size() == 0)
- {
- // nothing to do.
- return;
- }
-
- InternalCDORevision originalRevision = (InternalCDORevision)accessor.getTransaction().getRevision(id);
- int oldListSize = originalRevision.size(getFeature());
-
- if (TRACER.isEnabled())
- {
- TRACER.format("ListTableMapping.processDelta for revision {0} - previous list size: {1}", originalRevision, //$NON-NLS-1$
- oldListSize);
- }
-
- // let the visitor collect the changes
- ListDeltaVisitor visitor = new ListDeltaVisitor(accessor, originalRevision, branchId, oldVersion, newVersion, created);
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Processing deltas..."); //$NON-NLS-1$
- }
-
- // optimization: it's only necessary to process deltas
- // starting with the last feature delta which clears the list
- // (any operation before the clear is cascaded by it anyway)
- int index = listChanges.size() - 1;
- while (index > 0)
- {
- CDOFeatureDelta listDelta = listChanges.get(index);
- if (listDelta instanceof CDOClearFeatureDelta || listDelta instanceof CDOUnsetFeatureDelta)
- {
- break;
- }
- index--;
- }
- while (index < listChanges.size())
- {
- listChanges.get(index++).accept(visitor);
- }
- }
-
- private class ListDeltaVisitor implements CDOFeatureDeltaVisitor
- {
- private IDBStoreAccessor accessor;
-
- private InternalCDORevision originalRevision;
-
- private CDOID id;
-
- private int branchID;
-
- private int oldVersion;
-
- private int newVersion;
-
- private int lastIndex;
-
- private long timestamp;
-
- public ListDeltaVisitor(IDBStoreAccessor accessor, InternalCDORevision originalRevision, int targetBranchID, int oldVersion, int newVersion, long timestamp)
- {
- this.accessor = accessor;
- this.originalRevision = originalRevision;
- id = this.originalRevision.getID();
- branchID = targetBranchID;
- this.oldVersion = oldVersion;
- this.newVersion = newVersion;
- lastIndex = originalRevision.size(getFeature()) - 1;
- this.timestamp = timestamp;
- }
-
- @Override
- public void visit(CDOMoveFeatureDelta delta)
- {
- int fromIdx = delta.getOldPosition();
- int toIdx = delta.getNewPosition();
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Delta Moving: {0} to {1}", fromIdx, toIdx); //$NON-NLS-1$
- }
-
- Object value = getValue(accessor, id, branchID, fromIdx, true);
-
- // remove the item
- removeEntry(accessor, id, branchID, oldVersion, newVersion, fromIdx, timestamp);
-
- // adjust indexes and shift either up or down
- if (fromIdx < toIdx)
- {
- moveOneUp(accessor, id, branchID, oldVersion, newVersion, fromIdx + 1, toIdx);
- }
- else
- { // fromIdx > toIdx here
- moveOneDown(accessor, id, branchID, oldVersion, newVersion, toIdx, fromIdx - 1);
- }
-
- // create the item
- addEntry(accessor, id, branchID, newVersion, toIdx, value, timestamp);
- }
-
- @Override
- public void visit(CDOAddFeatureDelta delta)
- {
- int startIndex = delta.getIndex();
- int endIndex = lastIndex;
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Delta Adding at: {0}", startIndex); //$NON-NLS-1$
- }
-
- if (startIndex <= endIndex)
- {
- // make room for the new item
- moveOneDown(accessor, id, branchID, oldVersion, newVersion, startIndex, endIndex);
- }
-
- // create the item
- addEntry(accessor, id, branchID, newVersion, startIndex, delta.getValue(), timestamp);
-
- ++lastIndex;
- }
-
- @Override
- public void visit(CDORemoveFeatureDelta delta)
- {
- int startIndex = delta.getIndex();
- int endIndex = lastIndex;
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Delta Removing at: {0}", startIndex); //$NON-NLS-1$
- }
-
- // remove the item
- removeEntry(accessor, id, branchID, oldVersion, newVersion, startIndex, timestamp);
-
- // make room for the new item
- moveOneUp(accessor, id, branchID, oldVersion, newVersion, startIndex + 1, endIndex);
-
- --lastIndex;
- }
-
- @Override
- public void visit(CDOSetFeatureDelta delta)
- {
- int index = delta.getIndex();
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Delta Setting at: {0}", index); //$NON-NLS-1$
- }
-
- // remove the item
- removeEntry(accessor, id, branchID, oldVersion, newVersion, index, timestamp);
-
- // create the item
- addEntry(accessor, id, branchID, newVersion, index, delta.getValue(), timestamp);
- }
-
- @Override
- public void visit(CDOUnsetFeatureDelta delta)
- {
- if (delta.getFeature().isUnsettable())
- {
- throw new ImplementationError("Should not be called"); //$NON-NLS-1$
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Delta Unsetting"); //$NON-NLS-1$
- }
-
- clearList(accessor, id, branchID, oldVersion, newVersion, lastIndex, timestamp);
- lastIndex = -1;
- }
-
- @Override
- public void visit(CDOListFeatureDelta delta)
- {
- throw new ImplementationError("Should not be called"); //$NON-NLS-1$
- }
-
- @Override
- public void visit(CDOClearFeatureDelta delta)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Delta Clearing"); //$NON-NLS-1$
- }
-
- clearList(accessor, id, branchID, oldVersion, newVersion, lastIndex, timestamp);
- lastIndex = -1;
- }
-
- @Override
- public void visit(CDOContainerFeatureDelta delta)
- {
- throw new ImplementationError("Should not be called"); //$NON-NLS-1$
- }
-
- private void moveOneUp(IDBStoreAccessor accessor, CDOID id, int branchId, int oldVersion, int newVersion, int startIndex, int endIndex)
- {
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH);
-
- try
- {
- for (int index = startIndex; index <= endIndex; ++index)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("moveOneUp moving: {0} -> {1}", index, index - 1); //$NON-NLS-1$
- }
-
- int column = 1;
- stmt.setInt(column++, index - 1);
- idHandler.setCDOID(stmt, startIndex++, id);
- stmt.setInt(column++, branchId);
- stmt.setInt(column++, newVersion);
- stmt.setInt(column++, index);
-
- int result = DBUtil.update(stmt, false);
- switch (result)
- {
- case 1:
- // entry for current revision was already present.
- // index update succeeded.
- if (TRACER.isEnabled())
- {
- TRACER.format("moveOneUp updated: {0} -> {1}", index, index - 1); //$NON-NLS-1$
- }
-
- break;
- case 0:
- Object value = getValue(accessor, id, branchId, index, false);
-
- if (value != null)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("moveOneUp remove: {0}", index); //$NON-NLS-1$
- }
-
- removeEntry(accessor, id, branchId, oldVersion, newVersion, index, timestamp);
- }
- else
- {
- value = getValueFromBase(accessor, id, branchId, index);
- {
- TRACER.format("moveOneUp add historic entry at: {0}", index); //$NON-NLS-1$
- }
-
- addHistoricEntry(accessor, id, branchId, 0, newVersion, index, value, timestamp);
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("moveOneUp add: {0}", index - 1); //$NON-NLS-1$
- }
-
- addEntry(accessor, id, branchId, newVersion, index - 1, value, timestamp);
- break;
- default:
- if (TRACER.isEnabled())
- {
- TRACER.format("moveOneUp Too many results: {0} -> {1}: {2}", index, index + 1, result); //$NON-NLS-1$
- }
-
- throw new DBException("Too many results"); //$NON-NLS-1$
- }
- }
- }
- catch (SQLException e)
- {
- throw new DBException(e);
- }
- finally
- {
- DBUtil.close(stmt);
- }
- }
-
- private void moveOneDown(IDBStoreAccessor accessor, CDOID id, int branchId, int oldVersion, int newVersion, int startIndex, int endIndex)
- {
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH);
-
- try
- {
- for (int index = endIndex; index >= startIndex; --index)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("moveOneDown moving: {0} -> {1}", index, index + 1); //$NON-NLS-1$
- }
-
- int column = 1;
- stmt.setInt(column++, index + 1);
- idHandler.setCDOID(stmt, column++, id);
- stmt.setInt(column++, branchId);
- stmt.setInt(column++, newVersion);
- stmt.setInt(column++, index);
-
- int result = DBUtil.update(stmt, false);
- switch (result)
- {
- case 1:
- // entry for current revision was already present.
- // index update succeeded.
- if (TRACER.isEnabled())
- {
- TRACER.format("moveOneDown updated: {0} -> {1}", index, index + 1); //$NON-NLS-1$
- }
-
- break;
- case 0:
- Object value = getValue(accessor, id, branchId, index, false);
- if (value != null)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("moveOneDown remove: {0}", index); //$NON-NLS-1$
- }
-
- removeEntry(accessor, id, branchId, oldVersion, newVersion, index, timestamp);
- }
- else
- {
- value = getValueFromBase(accessor, id, branchId, index);
- {
- TRACER.format("moveOneDown add historic entry at: {0}", index); //$NON-NLS-1$
- }
-
- addHistoricEntry(accessor, id, branchId, 0, newVersion, index, value, timestamp);
- }
-
- addEntry(accessor, id, branchId, newVersion, index + 1, value, timestamp);
- break;
- default:
- if (TRACER.isEnabled())
- {
- TRACER.format("moveOneDown Too many results: {0} -> {1}: {2}", index, index + 1, result); //$NON-NLS-1$
- }
-
- throw new DBException("Too many results"); //$NON-NLS-1$
- }
- }
- }
- catch (SQLException e)
- {
- throw new DBException(e);
- }
- finally
- {
- DBUtil.close(stmt);
- }
- }
- }
-
- private void addEntry(IDBStoreAccessor accessor, CDOID id, int branchId, int version, int index, Object value, long timestamp)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Adding value for feature() {0}.{1} index {2} of {3}v{4} : {5}", //$NON-NLS-1$
- getContainingClass().getName(), getFeature().getName(), index, id, version, value);
- }
-
- FeatureMap.Entry entry = (FeatureMap.Entry)value;
- EStructuralFeature entryFeature = entry.getEStructuralFeature();
- CDOID tag = getTagByFeature(entryFeature, timestamp);
- String columnName = getColumnName(tag);
-
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlInsert, ReuseProbability.HIGH);
-
- try
- {
- int column = 1;
- idHandler.setCDOID(stmt, column++, id);
- stmt.setInt(column++, branchId);
- stmt.setInt(column++, version);
- stmt.setNull(column++, DBType.INTEGER.getCode()); // versionRemoved
- stmt.setInt(column++, index);
- idHandler.setCDOID(stmt, column++, tag);
-
- for (int i = 0; i < columnNames.size(); i++)
- {
- if (columnNames.get(i).equals(columnName))
- {
- getTypeMapping(tag).setValue(stmt, column++, entry.getValue());
- }
- else
- {
- stmt.setNull(column++, getDBTypes().get(i).getCode());
- }
- }
-
- DBUtil.update(stmt, true);
- }
- catch (SQLException e)
- {
- throw new DBException(e);
- }
- catch (IllegalStateException e)
- {
- throw new DBException(e);
- }
- finally
- {
- DBUtil.close(stmt);
- }
- }
-
- private void addHistoricEntry(IDBStoreAccessor accessor, CDOID id, int branchId, int versionAdded, int versionRemoved, int index, Object value,
- long timestamp)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Adding historic value for feature {0}.{1} index {2} of {3}:{4}v{5}-v{6} : {7}", //$NON-NLS-1$
- getContainingClass().getName(), getFeature().getName(), index, id, branchId, versionAdded, versionRemoved, value);
- }
-
- FeatureMap.Entry entry = (FeatureMap.Entry)value;
- EStructuralFeature entryFeature = entry.getEStructuralFeature();
- CDOID tag = getTagByFeature(entryFeature, timestamp);
- ITypeMapping typeMapping = getTypeMapping(tag);
- String columnName = getColumnName(tag);
-
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlInsert, ReuseProbability.HIGH);
-
- try
- {
- int column = 1;
- idHandler.setCDOID(stmt, column++, id);
- stmt.setInt(column++, branchId);
- stmt.setInt(column++, versionAdded);
- stmt.setNull(column++, versionRemoved);
- stmt.setInt(column++, index);
- idHandler.setCDOID(stmt, column++, tag);
-
- for (int i = 0; i < columnNames.size(); i++)
- {
- if (columnNames.get(i).equals(columnName))
- {
- typeMapping.setValue(stmt, column++, entry.getValue());
- }
- else
- {
- stmt.setNull(column++, getDBTypes().get(i).getCode());
- }
- }
-
- DBUtil.update(stmt, true);
- }
- catch (SQLException e)
- {
- throw new DBException(e);
- }
- catch (IllegalStateException e)
- {
- throw new DBException(e);
- }
- finally
- {
- DBUtil.close(stmt);
- }
- }
-
- private void removeEntry(IDBStoreAccessor accessor, CDOID id, int branchId, int oldVersion, int newVersion, int index, long timestamp)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Removing value for feature() {0}.{1} index {2} of {3}v{4}", //$NON-NLS-1$
- getContainingClass().getName(), getFeature().getName(), index, id, newVersion);
- }
-
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlDeleteEntry, ReuseProbability.HIGH);
-
- try
- {
- // try to delete a temporary entry first
- int column = 1;
- idHandler.setCDOID(stmt, column++, id);
- stmt.setInt(column++, branchId);
- stmt.setInt(column++, index);
- stmt.setInt(column++, newVersion);
-
- int result = DBUtil.update(stmt, false);
- if (result == 1)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("removeEntry deleted: {0}", index); //$NON-NLS-1$
- }
- }
- else if (result > 1)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("removeEntry Too many results: {0}: {1}", index, result); //$NON-NLS-1$
- }
-
- throw new DBException("Too many results"); //$NON-NLS-1$
- }
- else
- {
- // no temporary entry found, so mark the entry as removed
- DBUtil.close(stmt);
- stmt = accessor.getDBConnection().prepareStatement(sqlRemoveEntry, ReuseProbability.HIGH);
-
- column = 1;
- stmt.setInt(column++, newVersion);
- idHandler.setCDOID(stmt, column++, id);
- stmt.setInt(column++, branchId);
- stmt.setInt(column++, index);
- result = DBUtil.update(stmt, false);
-
- if (result == 0)
- {
- // no entry removed -> this means that we are in a branch and
- // the entry has not been modified since the branch fork.
- // therefore, we have to copy the base value and mark it as removed
- Object value = getValueFromBase(accessor, id, branchId, index);
- addHistoricEntry(accessor, id, branchId, 0, newVersion, index, value, timestamp);
- }
- }
- }
- catch (SQLException e)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Removing value for feature() {0}.{1} index {2} of {3}v{4} FAILED {5}", //$NON-NLS-1$
- getContainingClass().getName(), getFeature().getName(), index, id, newVersion, e.getMessage());
- }
-
- throw new DBException(e);
- }
- catch (IllegalStateException e)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Removing value for feature() {0}.{1} index {2} of {3}v{4} FAILED {5}", //$NON-NLS-1$
- getContainingClass().getName(), getFeature().getName(), index, id, newVersion, e.getMessage());
- }
-
- throw new DBException(e);
- }
- finally
- {
- DBUtil.close(stmt);
- }
- }
-
- private FeatureMap.Entry getValue(IDBStoreAccessor accessor, CDOID id, int branchId, int index, boolean getFromBase)
- {
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlGetValue, ReuseProbability.HIGH);
- FeatureMap.Entry result = null;
-
- try
- {
- int column = 1;
- idHandler.setCDOID(stmt, column++, id);
- stmt.setInt(column++, branchId);
- stmt.setInt(column++, index);
-
- ResultSet resultSet = stmt.executeQuery();
- if (resultSet.next())
- {
- CDOID tag = idHandler.getCDOID(resultSet, 1);
- Object value = getTypeMapping(tag).readValue(resultSet);
- result = CDORevisionUtil.createFeatureMapEntry(getFeatureByTag(tag), value);
- }
- else
- {
- // value is not in this branch.
- // -> read from base revision
- if (getFromBase)
- {
- result = getValueFromBase(accessor, id, branchId, index);
- } // else: result remains null
- }
- if (TRACER.isEnabled())
- {
- TRACER.format("Read value (index {0}) from result set: {1}", index, result); //$NON-NLS-1$
- }
- }
- catch (SQLException e)
- {
- throw new DBException(e);
- }
- finally
- {
- DBUtil.close(stmt);
- }
-
- return result;
- }
-
- /**
- * Read a single value (at a given index) from the base revision
- *
- * @param accessor
- * the DBStoreAccessor
- * @param id
- * the ID of the revision
- * @param branchID
- * the ID of the current (child) branch
- * @param index
- * the index to read the value from
- * @return the value which is at index <code>index</code> in revision with ID <code>id</code> in the parent branch at
- * the base of this branch (indicated by <code>branchID</code>).
- */
- private FeatureMap.Entry getValueFromBase(IDBStoreAccessor accessor, CDOID id, int branchID, int index)
- {
- IStoreChunkReader chunkReader = createBaseChunkReader(accessor, id, branchID);
- chunkReader.addSimpleChunk(index);
- List<Chunk> chunks = chunkReader.executeRead();
- return (FeatureMap.Entry)chunks.get(0).get(0);
- }
-
- private IStoreChunkReader createBaseChunkReader(IDBStoreAccessor accessor, CDOID id, int branchID)
- {
- InternalRepository repository = (InternalRepository)accessor.getStore().getRepository();
-
- CDOBranchManager branchManager = repository.getBranchManager();
- CDOBranch branch = branchManager.getBranch(branchID);
- CDOBranchPoint base = branch.getBase();
- if (base.getBranch() == null)
- {
- throw new IllegalArgumentException("Base branch is null: " + branch);
- }
-
- InternalCDORevisionManager revisionManager = repository.getRevisionManager();
- InternalCDORevision baseRevision = revisionManager.getRevision(id, base, 0, CDORevision.DEPTH_NONE, true);
-
- return accessor.createChunkReader(baseRevision, getFeature());
- }
-
- @Override
- public final boolean queryXRefs(IDBStoreAccessor accessor, String mainTableName, String mainTableWhere, QueryXRefsContext context, String idString)
- {
- // must never be called (a feature map is not associated with an EReference feature, so XRefs are nor supported
- // here)
- throw new ImplementationError("Should never be called!");
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalAuditMappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalAuditMappingStrategy.java
index b8191d6ece..fa8a7bb75f 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalAuditMappingStrategy.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalAuditMappingStrategy.java
@@ -57,13 +57,6 @@ public class HorizontalAuditMappingStrategy extends AbstractHorizontalMappingStr
return new AuditListTableMapping(this, containingClass, feature);
}
- @Deprecated
- @Override
- public IListMapping doCreateFeatureMapMapping(EClass containingClass, EStructuralFeature feature)
- {
- return new AuditFeatureMapTableMapping(this, containingClass, feature);
- }
-
@Override
public String getListJoin(String attrTable, String listTable)
{
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalAuditMappingStrategyWithRanges.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalAuditMappingStrategyWithRanges.java
index cb7330b329..757ab22ca5 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalAuditMappingStrategyWithRanges.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalAuditMappingStrategyWithRanges.java
@@ -46,13 +46,6 @@ public class HorizontalAuditMappingStrategyWithRanges extends HorizontalAuditMap
return new AuditListTableMappingWithRanges(this, containingClass, feature);
}
- @Deprecated
- @Override
- public IListMapping doCreateFeatureMapMapping(EClass containingClass, EStructuralFeature feature)
- {
- return new AuditFeatureMapTableMappingWithRanges(this, containingClass, feature);
- }
-
@Override
protected String modifyListJoin(String attrTable, String listTable, String join)
{
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingMappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingMappingStrategy.java
index 8f7037457a..85b2224ea8 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingMappingStrategy.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingMappingStrategy.java
@@ -71,13 +71,6 @@ public class HorizontalBranchingMappingStrategy extends AbstractHorizontalMappin
return new BranchingListTableMapping(this, containingClass, feature);
}
- @Deprecated
- @Override
- public IListMapping doCreateFeatureMapMapping(EClass containingClass, EStructuralFeature feature)
- {
- return new BranchingFeatureMapTableMapping(this, containingClass, feature);
- }
-
@Override
public String getListJoin(String attrTable, String listTable)
{
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingMappingStrategyWithRanges.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingMappingStrategyWithRanges.java
index d4f08c69b3..fa987993e0 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingMappingStrategyWithRanges.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingMappingStrategyWithRanges.java
@@ -77,13 +77,6 @@ public class HorizontalBranchingMappingStrategyWithRanges extends HorizontalBran
return new BranchingListTableMappingWithRanges(this, containingClass, feature);
}
- @Deprecated
- @Override
- public IListMapping doCreateFeatureMapMapping(EClass containingClass, EStructuralFeature feature)
- {
- return new BranchingFeatureMapTableMappingWithRanges(this, containingClass, feature);
- }
-
@Override
protected void rawExportList(CDODataOutput out, IDBConnection connection, IListMapping listMapping, IDBTable attrTable, String attrSuffix) throws IOException
{
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalNonAuditMappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalNonAuditMappingStrategy.java
index 5dd691400f..5f440fde3f 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalNonAuditMappingStrategy.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalNonAuditMappingStrategy.java
@@ -59,13 +59,6 @@ public class HorizontalNonAuditMappingStrategy extends AbstractHorizontalMapping
return new NonAuditListTableMapping(this, containingClass, feature);
}
- @Deprecated
- @Override
- public IListMapping doCreateFeatureMapMapping(EClass containingClass, EStructuralFeature feature)
- {
- return new NonAuditFeatureMapTableMapping(this, containingClass, feature);
- }
-
@Override
protected IClassMapping doCreateClassMapping(EClass eClass)
{
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/IMappingConstants.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/IMappingConstants.java
index be15895749..96d33a3290 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/IMappingConstants.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/IMappingConstants.java
@@ -56,24 +56,4 @@ public interface IMappingConstants
public static final String LIST_IDX = "CDO_IDX"; //$NON-NLS-1$
public static final String LIST_VALUE = "CDO_VALUE"; //$NON-NLS-1$
-
- /*
- * Field names of featuremap tables
- */
-
- public static final String FEATUREMAP_REVISION_ID = LIST_REVISION_ID;
-
- public static final String FEATUREMAP_VERSION = LIST_REVISION_VERSION;
-
- public static final String FEATUREMAP_VERSION_ADDED = LIST_REVISION_VERSION_ADDED;
-
- public static final String FEATUREMAP_VERSION_REMOVED = LIST_REVISION_VERSION_REMOVED;
-
- public static final String FEATUREMAP_BRANCH = LIST_REVISION_BRANCH;
-
- public static final String FEATUREMAP_IDX = LIST_IDX;
-
- public static final String FEATUREMAP_TAG = LIST_FEATURE;
-
- public static final String FEATUREMAP_VALUE = LIST_VALUE;
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/NonAuditFeatureMapTableMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/NonAuditFeatureMapTableMapping.java
deleted file mode 100644
index ea7793847d..0000000000
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/NonAuditFeatureMapTableMapping.java
+++ /dev/null
@@ -1,583 +0,0 @@
-/*
- * Copyright (c) 2009-2013, 2015, 2016, 2018, 2019 Eike Stepper (Loehne, 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
- * Stefan Winkler - 271444: [DB] Multiple refactorings bug 271444
- * Christopher Albert - 254455: [DB] Support FeatureMaps bug 254455
- * Stefan Winkler - Bug 329025: [DB] Support branching for range-based mapping strategy
- */
-package org.eclipse.emf.cdo.server.internal.db.mapping.horizontal;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.delta.CDOAddFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOClearFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOContainerFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
-import org.eclipse.emf.cdo.common.revision.delta.CDOListFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOMoveFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDORemoveFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOUnsetFeatureDelta;
-import org.eclipse.emf.cdo.server.db.IDBStoreAccessor;
-import org.eclipse.emf.cdo.server.db.IIDHandler;
-import org.eclipse.emf.cdo.server.db.mapping.IListMappingDeltaSupport;
-import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
-import org.eclipse.emf.cdo.server.db.mapping.ITypeMapping;
-
-import org.eclipse.net4j.db.DBException;
-import org.eclipse.net4j.db.DBUtil;
-import org.eclipse.net4j.db.IDBPreparedStatement;
-import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability;
-import org.eclipse.net4j.util.ImplementationError;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.FeatureMap;
-
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * This is a featuremap-to-table mapping optimized for non-audit-mode. It doesn't care about version and has delta
- * support.
- *
- * @author Eike Stepper
- * @since 3.0
- * @deprecated As 4.5 feature maps are no longer supported.
- */
-@Deprecated
-public class NonAuditFeatureMapTableMapping extends AbstractFeatureMapTableMapping implements IListMappingDeltaSupport
-{
- private static final int TEMP_INDEX = -1;
-
- private static final int UNBOUNDED_MOVE = -1;
-
- private String sqlClear;
-
- private String sqlUpdateIndex;
-
- private String sqlUpdateValue;
-
- private String sqlDeleteItem;
-
- private String sqlMoveDownWithLimit;
-
- private String sqlMoveDown;
-
- private String sqlMoveUpWithLimit;
-
- private String sqlMoveUp;
-
- public NonAuditFeatureMapTableMapping(IMappingStrategy mappingStrategy, EClass eClass, EStructuralFeature feature)
- {
- super(mappingStrategy, eClass, feature);
- initSQLStrings();
- }
-
- private void initSQLStrings()
- {
- // TODO: add key fields length support
-
- StringBuilder builder = new StringBuilder();
-
- // ----------- clear list -------------------------
-
- builder.append("DELETE FROM "); //$NON-NLS-1$
- builder.append(getTable());
- builder.append(" WHERE "); //$NON-NLS-1$
- builder.append(FEATUREMAP_REVISION_ID);
- builder.append("=? "); //$NON-NLS-1$
-
- sqlClear = builder.toString();
-
- builder.append(" AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_IDX);
- builder.append("=? "); //$NON-NLS-1$
-
- sqlDeleteItem = builder.toString();
-
- // ----------- update one item index --------------
- builder = new StringBuilder();
- builder.append("UPDATE "); //$NON-NLS-1$
- builder.append(getTable());
- builder.append(" SET "); //$NON-NLS-1$
- builder.append(FEATUREMAP_IDX);
- builder.append("=? "); //$NON-NLS-1$
- builder.append(" WHERE "); //$NON-NLS-1$
- builder.append(FEATUREMAP_REVISION_ID);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_IDX);
- builder.append("=? "); //$NON-NLS-1$
- sqlUpdateIndex = builder.toString();
-
- // ----------- update one item value --------------
- builder = new StringBuilder();
- builder.append("UPDATE "); //$NON-NLS-1$
- builder.append(getTable());
- builder.append(" SET "); //$NON-NLS-1$
-
- builder.append(FEATUREMAP_TAG);
- builder.append("=?,"); //$NON-NLS-1$
-
- Iterator<String> iter = getColumnNames().iterator();
- while (iter.hasNext())
- {
- String column = iter.next();
- builder.append(column);
- builder.append("=?"); //$NON-NLS-1$
-
- if (iter.hasNext())
- {
- builder.append(", "); //$NON-NLS-1$
- }
- }
-
- builder.append(" WHERE "); //$NON-NLS-1$
- builder.append(FEATUREMAP_REVISION_ID);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_IDX);
- builder.append("=? "); //$NON-NLS-1$
- sqlUpdateValue = builder.toString();
-
- // ----------- move down --------------
- builder = new StringBuilder();
- builder.append("UPDATE "); //$NON-NLS-1$
- builder.append(getTable());
- builder.append(" SET "); //$NON-NLS-1$
- builder.append(FEATUREMAP_IDX);
- builder.append("="); //$NON-NLS-1$
- builder.append(FEATUREMAP_IDX);
- builder.append("-1 WHERE "); //$NON-NLS-1$
- builder.append(FEATUREMAP_REVISION_ID);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_IDX);
- builder.append(">? "); //$NON-NLS-1$
- sqlMoveDown = builder.toString();
-
- builder.append(" AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_IDX);
- builder.append("<=?"); //$NON-NLS-1$
- sqlMoveDownWithLimit = builder.toString();
-
- // ----------- move up --------------
- builder = new StringBuilder();
- builder.append("UPDATE "); //$NON-NLS-1$
- builder.append(getTable());
- builder.append(" SET "); //$NON-NLS-1$
- builder.append(FEATUREMAP_IDX);
- builder.append("="); //$NON-NLS-1$
- builder.append(FEATUREMAP_IDX);
- builder.append("+1 WHERE "); //$NON-NLS-1$
- builder.append(FEATUREMAP_REVISION_ID);
- builder.append("=? AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_IDX);
- builder.append(">=? "); //$NON-NLS-1$
- sqlMoveUp = builder.toString();
-
- builder.append(" AND "); //$NON-NLS-1$
- builder.append(FEATUREMAP_IDX);
- builder.append("<?"); //$NON-NLS-1$
- sqlMoveUpWithLimit = builder.toString();
- }
-
- @Override
- protected void addKeyFields(List<FieldInfo> list)
- {
- // Do nothing
- }
-
- @Override
- protected void setKeyFields(PreparedStatement stmt, CDORevision revision) throws SQLException
- {
- getMappingStrategy().getStore().getIDHandler().setCDOID(stmt, 1, revision.getID());
- }
-
- @Override
- public void objectDetached(IDBStoreAccessor accessor, CDOID id, long revised)
- {
- clearList(accessor, id);
- }
-
- /**
- * Clear a list of a given revision.
- *
- * @param accessor
- * the accessor to use
- * @param id
- * the id of the revision from which to remove all items
- */
- public void clearList(IDBStoreAccessor accessor, CDOID id)
- {
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlClear, ReuseProbability.HIGH);
-
- try
- {
- idHandler.setCDOID(stmt, 1, id);
- DBUtil.update(stmt, false);
- }
- catch (SQLException e)
- {
- throw new DBException(e);
- }
- finally
- {
- DBUtil.close(stmt);
- }
- }
-
- @Override
- public void rawDeleted(IDBStoreAccessor accessor, CDOID id, CDOBranch branch, int version)
- {
- clearList(accessor, id);
- }
-
- /**
- * Insert a list item at a specified position.
- *
- * @param accessor
- * the accessor to use
- * @param id
- * the id of the revision to insert the value
- * @param index
- * the index where to insert the element
- * @param value
- * the value to insert.
- */
- public void insertListItem(IDBStoreAccessor accessor, CDOID id, int index, Object value, long timestamp)
- {
- move1up(accessor, id, index, UNBOUNDED_MOVE);
- insertValue(accessor, id, index, value, timestamp);
- }
-
- private void insertValue(IDBStoreAccessor accessor, CDOID id, int index, Object value, long timestamp)
- {
- FeatureMap.Entry entry = (FeatureMap.Entry)value;
- EStructuralFeature entryFeature = entry.getEStructuralFeature();
- CDOID tag = getTagByFeature(entryFeature, timestamp);
- ITypeMapping typeMapping = getTypeMapping(tag);
- String columnName = getColumnName(tag);
-
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlInsert, ReuseProbability.HIGH);
-
- try
- {
- idHandler.setCDOID(stmt, 1, id);
- int column = getKeyFields().length + 1;
-
- for (int i = 0; i < getColumnNames().size(); i++)
- {
- if (getColumnNames().get(i).equals(columnName))
- {
- typeMapping.setValue(stmt, column++, entry.getValue());
- }
- else
- {
- stmt.setNull(column++, getDBTypes().get(i).getCode());
- }
- }
-
- stmt.setInt(column++, index);
- idHandler.setCDOID(stmt, column++, tag);
- DBUtil.update(stmt, true);
- }
- catch (SQLException e)
- {
- throw new DBException(e);
- }
- finally
- {
- DBUtil.close(stmt);
- }
- }
-
- /**
- * Move a list item from one position to another. Indices between both positions are updated so that the list remains
- * consistent.
- *
- * @param accessor
- * the accessor to use
- * @param id
- * the id of the revision in which to move the item
- * @param oldPosition
- * the old position of the item.
- * @param newPosition
- * the new position of the item.
- */
- public void moveListItem(IDBStoreAccessor accessor, CDOID id, int oldPosition, int newPosition)
- {
- if (oldPosition == newPosition)
- {
- return;
- }
-
- // move element away temporarily
- updateOneIndex(accessor, id, oldPosition, TEMP_INDEX);
-
- // move elements in between
- if (oldPosition < newPosition)
- {
- move1down(accessor, id, oldPosition, newPosition);
- }
- else
- {
- // oldPosition > newPosition -- equal case is handled above
- move1up(accessor, id, newPosition, oldPosition);
- }
-
- // move temporary element to new position
- updateOneIndex(accessor, id, TEMP_INDEX, newPosition);
- }
-
- private void updateOneIndex(IDBStoreAccessor accessor, CDOID id, int oldIndex, int newIndex)
- {
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH);
-
- try
- {
- stmt.setInt(1, newIndex);
- idHandler.setCDOID(stmt, 2, id);
- stmt.setInt(3, oldIndex);
- DBUtil.update(stmt, true);
- }
- catch (SQLException e)
- {
- throw new DBException(e);
- }
- finally
- {
- DBUtil.close(stmt);
- }
- }
-
- /**
- * Remove a list item from a specified a position.
- *
- * @param accessor
- * the accessor to use
- * @param id
- * the id of the revision from which to remove the item
- * @param index
- * the index of the item to remove
- */
- public void removeListItem(IDBStoreAccessor accessor, CDOID id, int index)
- {
- deleteItem(accessor, id, index);
- move1down(accessor, id, index, UNBOUNDED_MOVE);
- }
-
- /**
- * Move references downwards to close a gap at position <code>index</code>. Only indexes starting with
- * <code>index + 1</code> and ending with <code>upperIndex</code> are moved down.
- */
- private void move1down(IDBStoreAccessor accessor, CDOID id, int index, int upperIndex)
- {
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(upperIndex == UNBOUNDED_MOVE ? sqlMoveDown : sqlMoveDownWithLimit,
- ReuseProbability.HIGH);
-
- try
- {
- idHandler.setCDOID(stmt, 1, id);
- stmt.setInt(2, index);
- if (upperIndex != UNBOUNDED_MOVE)
- {
- stmt.setInt(3, upperIndex);
- }
-
- DBUtil.update(stmt, false);
- }
- catch (SQLException e)
- {
- throw new DBException(e);
- }
- finally
- {
- DBUtil.close(stmt);
- }
- }
-
- /**
- * Move references downwards to close a gap at position <code>index</code>. Only indexes starting with
- * <code>index + 1</code> and ending with <code>upperIndex</code> are moved down.
- */
- private void move1up(IDBStoreAccessor accessor, CDOID id, int index, int upperIndex)
- {
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(upperIndex == UNBOUNDED_MOVE ? sqlMoveUp : sqlMoveUpWithLimit,
- ReuseProbability.HIGH);
-
- try
- {
- idHandler.setCDOID(stmt, 1, id);
- stmt.setInt(2, index);
- if (upperIndex != UNBOUNDED_MOVE)
- {
- stmt.setInt(3, upperIndex);
- }
-
- DBUtil.update(stmt, false);
- }
- catch (SQLException e)
- {
- throw new DBException(e);
- }
- finally
- {
- DBUtil.close(stmt);
- }
- }
-
- private void deleteItem(IDBStoreAccessor accessor, CDOID id, int index)
- {
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlDeleteItem, ReuseProbability.HIGH);
-
- try
- {
- idHandler.setCDOID(stmt, 1, id);
- stmt.setInt(2, index);
- DBUtil.update(stmt, true);
- }
- catch (SQLException e)
- {
- throw new DBException(e);
- }
- finally
- {
- DBUtil.close(stmt);
- }
- }
-
- /**
- * Set a value at a specified position to the given value.
- *
- * @param accessor
- * the accessor to use
- * @param id
- * the id of the revision to set the value
- * @param index
- * the index of the item to set
- * @param value
- * the value to be set.
- */
- public void setListItem(IDBStoreAccessor accessor, CDOID id, int index, Object value, long timestamp)
- {
- FeatureMap.Entry entry = (FeatureMap.Entry)value;
- EStructuralFeature entryFeature = entry.getEStructuralFeature();
- CDOID tag = getTagByFeature(entryFeature, timestamp);
- ITypeMapping mapping = getTypeMapping(tag);
- String columnName = getColumnName(tag);
-
- IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler();
- IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlUpdateValue, ReuseProbability.HIGH);
-
- try
- {
- idHandler.setCDOID(stmt, 1, tag);
- int column = 2;
-
- for (int i = 0; i < getColumnNames().size(); i++)
- {
- if (getColumnNames().get(i).equals(columnName))
- {
- mapping.setValue(stmt, column++, entry.getValue());
- }
- else
- {
- stmt.setNull(column++, getDBTypes().get(i).getCode());
- }
- }
-
- idHandler.setCDOID(stmt, column++, id);
- stmt.setInt(column++, index);
- DBUtil.update(stmt, true);
- }
- catch (SQLException e)
- {
- throw new DBException(e);
- }
- finally
- {
- DBUtil.close(stmt);
- }
- }
-
- @Override
- public void processDelta(final IDBStoreAccessor accessor, final CDOID id, final int branchId, int oldVersion, final int newVersion, final long created,
- CDOListFeatureDelta listDelta)
- {
- CDOFeatureDeltaVisitor visitor = new CDOFeatureDeltaVisitor()
- {
- @Override
- public void visit(CDOMoveFeatureDelta delta)
- {
- moveListItem(accessor, id, delta.getOldPosition(), delta.getNewPosition());
- }
-
- @Override
- public void visit(CDOAddFeatureDelta delta)
- {
- insertListItem(accessor, id, delta.getIndex(), delta.getValue(), created);
- }
-
- @Override
- public void visit(CDORemoveFeatureDelta delta)
- {
- removeListItem(accessor, id, delta.getIndex());
- }
-
- @Override
- public void visit(CDOSetFeatureDelta delta)
- {
- setListItem(accessor, id, delta.getIndex(), delta.getValue(), created);
- }
-
- @Override
- public void visit(CDOUnsetFeatureDelta delta)
- {
- if (delta.getFeature().isUnsettable())
- {
- throw new ImplementationError("Should not be called"); //$NON-NLS-1$
- }
-
- clearList(accessor, id);
- }
-
- @Override
- public void visit(CDOListFeatureDelta delta)
- {
- throw new ImplementationError("Should not be called"); //$NON-NLS-1$
- }
-
- @Override
- public void visit(CDOClearFeatureDelta delta)
- {
- clearList(accessor, id);
- }
-
- @Override
- public void visit(CDOContainerFeatureDelta delta)
- {
- throw new ImplementationError("Should not be called"); //$NON-NLS-1$
- }
- };
-
- for (CDOFeatureDelta delta : listDelta.getListChanges())
- {
- delta.accept(visitor);
- }
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.server.mongodb/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.server.mongodb/META-INF/MANIFEST.MF
index 690d44bd04..410ed8e605 100644
--- a/plugins/org.eclipse.emf.cdo.server.mongodb/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.server.mongodb/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.emf.cdo.server.mongodb;singleton:=true
-Bundle-Version: 4.1.0.qualifier
+Bundle-Version: 4.1.1.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -11,9 +11,9 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ClassPath: .
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.emf.cdo.server;bundle-version="[4.0.0,5.0.0)";visibility:=reexport
-Export-Package: org.eclipse.emf.cdo.server.internal.mongodb;version="4.1.0";x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo.tests.mongodb",
- org.eclipse.emf.cdo.server.internal.mongodb.bundle;version="4.1.0";x-internal:=true,
- org.eclipse.emf.cdo.server.mongodb;version="4.1.0"
+Export-Package: org.eclipse.emf.cdo.server.internal.mongodb;version="4.1.1";x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo.tests.mongodb",
+ org.eclipse.emf.cdo.server.internal.mongodb.bundle;version="4.1.1";x-internal:=true,
+ org.eclipse.emf.cdo.server.mongodb;version="4.1.1"
Import-Package: com.mongodb;version="[3.0.0,4.0.0)",
com.mongodb.gridfs;version="[3.0.0,4.0.0)",
com.mongodb.util;version="[3.0.0,4.0.0)",
diff --git a/plugins/org.eclipse.emf.cdo.server.mongodb/pom.xml b/plugins/org.eclipse.emf.cdo.server.mongodb/pom.xml
index a0acbe4e59..38bad29f99 100644
--- a/plugins/org.eclipse.emf.cdo.server.mongodb/pom.xml
+++ b/plugins/org.eclipse.emf.cdo.server.mongodb/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.eclipse.emf.cdo</groupId>
<artifactId>org.eclipse.emf.cdo.server.mongodb</artifactId>
- <version>4.1.0-SNAPSHOT</version>
+ <version>4.1.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/internal/mongodb/MongoDBStore.java b/plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/internal/mongodb/MongoDBStore.java
index 050d1142c8..0f98d67da7 100644
--- a/plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/internal/mongodb/MongoDBStore.java
+++ b/plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/internal/mongodb/MongoDBStore.java
@@ -21,7 +21,6 @@ import org.eclipse.emf.cdo.server.internal.mongodb.bundle.OM;
import org.eclipse.emf.cdo.server.mongodb.IMongoDBStore;
import org.eclipse.emf.cdo.server.mongodb.IMongoDBStoreAccessor;
import org.eclipse.emf.cdo.spi.server.InternalRepository;
-import org.eclipse.emf.cdo.spi.server.InternalStore.NoFeatureMaps;
import org.eclipse.emf.cdo.spi.server.InternalStore.NoHandleRevisions;
import org.eclipse.emf.cdo.spi.server.InternalStore.NoLargeObjects;
import org.eclipse.emf.cdo.spi.server.InternalStore.NoQueryXRefs;
@@ -65,8 +64,7 @@ import java.util.Set;
* @author Eike Stepper
*/
@SuppressWarnings("deprecation")
-public class MongoDBStore extends Store implements IMongoDBStore, //
- NoQueryXRefs, NoLargeObjects, NoFeatureMaps, NoHandleRevisions, NoRawAccess
+public class MongoDBStore extends Store implements IMongoDBStore, NoQueryXRefs, NoLargeObjects, NoHandleRevisions, NoRawAccess
{
public static final String TYPE = "mongodb"; //$NON-NLS-1$
diff --git a/plugins/org.eclipse.emf.cdo.server/.settings/.api_filters b/plugins/org.eclipse.emf.cdo.server/.settings/.api_filters
index 90ff7e2d11..45d0047032 100644
--- a/plugins/org.eclipse.emf.cdo.server/.settings/.api_filters
+++ b/plugins/org.eclipse.emf.cdo.server/.settings/.api_filters
@@ -287,6 +287,15 @@
</message_arguments>
</filter>
</resource>
+ <resource path="src/org/eclipse/emf/cdo/server/CDOServerExporter.java" type="org.eclipse.emf.cdo.server.CDOServerExporter$XMLConstants">
+ <filter id="389242988">
+ <message_arguments>
+ <message_argument value="org.eclipse.emf.cdo.server.CDOServerExporter.XMLConstants"/>
+ <message_argument value="TYPE_FEATURE_MAP"/>
+ <message_argument value="FeatureMap"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="src/org/eclipse/emf/cdo/server/CDOServerImporter.java" type="org.eclipse.emf.cdo.server.CDOServerImporter$Binary">
<filter id="576725006">
<message_arguments>
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
index d37097abeb..5879663fe1 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
@@ -45,6 +45,7 @@ import org.eclipse.emf.cdo.common.revision.CDORevisionHandler;
import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
+import org.eclipse.emf.cdo.common.util.CDOException;
import org.eclipse.emf.cdo.common.util.CDOQueryInfo;
import org.eclipse.emf.cdo.common.util.CDOTimeProvider;
import org.eclipse.emf.cdo.common.util.CurrentTimeProvider;
@@ -114,6 +115,7 @@ import org.eclipse.net4j.util.container.Container;
import org.eclipse.net4j.util.container.IManagedContainer;
import org.eclipse.net4j.util.container.IPluginContainer;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+import org.eclipse.net4j.util.om.OMPlatform;
import org.eclipse.net4j.util.om.monitor.Monitor;
import org.eclipse.net4j.util.om.monitor.OMMonitor;
import org.eclipse.net4j.util.om.monitor.ProgressDistributor;
@@ -157,6 +159,9 @@ public class Repository extends Container<Object> implements InternalRepository,
private static final String PROP_UUID = "org.eclipse.emf.cdo.server.repositoryUUID"; //$NON-NLS-1$
+ private static final boolean DISABLE_FEATURE_MAP_CHECKS = OMPlatform.INSTANCE
+ .isProperty("org.eclipse.emf.cdo.internal.server.Repository.DISABLE_FEATURE_MAP_CHECKS");
+
private String name;
private String uuid;
@@ -1255,6 +1260,22 @@ public class Repository extends Container<Object> implements InternalRepository,
@Override
public void commit(InternalCommitContext commitContext, OMMonitor monitor)
{
+ if (!DISABLE_FEATURE_MAP_CHECKS)
+ {
+ InternalCDORevision[] newObjects = commitContext.getNewObjects();
+ if (newObjects != null && newObjects.length != 0)
+ {
+ for (int i = 0; i < newObjects.length; i++)
+ {
+ InternalCDORevision revision = newObjects[i];
+ if (revision.getClassInfo().hasPersistentFeatureMaps())
+ {
+ throw new CDOException(revision + " contains a feature map");
+ }
+ }
+ }
+ }
+
if (commitContext.isTreeRestructuring())
{
synchronized (commitTransactionLock)
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerExporter.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerExporter.java
index b74a489016..2d9926e362 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerExporter.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerExporter.java
@@ -52,8 +52,6 @@ import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.FeatureMap;
-import org.eclipse.emf.ecore.util.FeatureMapUtil;
import org.xml.sax.SAXException;
@@ -538,7 +536,11 @@ public abstract class CDOServerExporter<OUT>
*/
public static final String TYPE_BYTE_ARRAY = "ByteArray";
- public static final String TYPE_FEATURE_MAP = "FeatureMap";
+ /**
+ * @deprecated As of 4.5 {@link org.eclipse.emf.ecore.util.FeatureMap feature maps} are no longer supported.
+ */
+ @Deprecated
+ public static final String TYPE_FEATURE_MAP = null;
public static final String LOBS = "lobs";
@@ -797,16 +799,6 @@ public abstract class CDOServerExporter<OUT>
out.attribute(featureType, Date.class.getSimpleName());
out.attribute(FEATURE_VALUE, date.getTime());
}
- else if (FeatureMapUtil.isFeatureMap(feature))
- {
- FeatureMap.Entry entry = (FeatureMap.Entry)value;
- EStructuralFeature innerFeature = entry.getEStructuralFeature();
- Object innerValue = entry.getValue();
-
- out.attribute(featureType, TYPE_FEATURE_MAP);
- out.attribute(FEATURE_INNER_FEATURE, innerFeature.getName());
- exportFeature(out, innerFeature, FEATURE_INNER_TYPE, innerValue);
- }
else if (value instanceof byte[])
{
byte[] array = (byte[])value;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerImporter.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerImporter.java
index 1973eb7fac..15a3c2b557 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerImporter.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerImporter.java
@@ -33,7 +33,6 @@ import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.CDORevisionData;
import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
import org.eclipse.emf.cdo.common.revision.CDORevisionHandler;
-import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
import org.eclipse.emf.cdo.internal.server.ServerDebugUtil;
import org.eclipse.emf.cdo.server.CDOServerExporter.Statistics;
import org.eclipse.emf.cdo.server.IStoreAccessor.Raw2;
@@ -807,17 +806,6 @@ public abstract class CDOServerImporter
return CDOLobUtil.createClob(id, size);
}
- if (TYPE_FEATURE_MAP.equals(type))
- {
- String innerFeatureName = attributes.getValue(FEATURE_INNER_FEATURE);
- EStructuralFeature innerFeature = revision.getEClass().getEStructuralFeature(innerFeatureName);
-
- String innerType = attributes.getValue(FEATURE_INNER_TYPE);
- Object innerValue = value(attributes, innerType);
-
- return CDORevisionUtil.createFeatureMapEntry(innerFeature, innerValue);
- }
-
return value(attributes, type);
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalStore.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalStore.java
index 2c129b1880..7984df107c 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalStore.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalStore.java
@@ -103,7 +103,9 @@ public interface InternalStore extends IStore, ILifecycle
*
* @author Eike Stepper
* @since 4.0
+ * @deprecated As of 4.5 {@link org.eclipse.emf.ecore.util.FeatureMap feature maps} are no longer supported.
*/
+ @Deprecated
public interface NoFeatureMaps
{
}
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfigs.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfigs.java
index 0d076140b6..2eec194606 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfigs.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfigs.java
@@ -94,9 +94,6 @@ public abstract class DBConfigs extends AllConfigs
// testClasses.remove(AttributeTest.class);
// testClasses.add(DISABLE_AttributeTest.class);
- // testClasses.remove(FeatureMapTest.class);
- // testClasses.add(DISABLE_FeatureMapTest.class);
-
// XXX [PSQL] disabled because of Bug 290095
// using skipconfig in DBAnnotationTest
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 f63107fba7..77a44288d6 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
@@ -99,7 +99,6 @@ public class AllConfigs extends ConfigTestSuite
testClasses.add(LockingSequenceTest.class);
testClasses.add(MultiValuedOfAttributeTest.class);
testClasses.add(MapTest.class);
- // testClasses.add(FeatureMapTest.class);
testClasses.add(AdapterManagerTest.class);
testClasses.add(ConflictResolverTest.class);
testClasses.add(ConflictResolverExtendedTest.class);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/FeatureMapTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/FeatureMapTest.java
deleted file mode 100644
index bdbf3059df..0000000000
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/FeatureMapTest.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Copyright (c) 2009-2013, 2016, 2018 Eike Stepper (Loehne, 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
- * Stefan Winkler - enhanced test cases
- */
-package org.eclipse.emf.cdo.tests;
-
-import org.eclipse.emf.cdo.common.model.EMFUtil;
-import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.tests.model5.Doctor;
-import org.eclipse.emf.cdo.tests.model5.TestFeatureMap;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.util.CDOUtil;
-import org.eclipse.emf.cdo.util.CommitException;
-
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EcorePackage;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.ecore.util.ExtendedMetaData;
-import org.eclipse.emf.ecore.util.FeatureMap;
-
-import java.util.List;
-
-/**
- * @author Simon McDuff
- */
-@Deprecated
-public class FeatureMapTest extends AbstractCDOTest
-{
- private EPackage pkg;
-
- private EClass dummy;
-
- private EAttribute name;
-
- private EClass fmapContainer;
-
- private EAttribute string1;
-
- private EAttribute integer;
-
- private EAttribute fMap;
-
- private EAttribute string2;
-
- private EAttribute longObj;
-
- private EAttribute bool;
-
- private EReference ref1;
-
- private EReference ref2;
-
- private CDOSession session;
-
- private CDOTransaction tx;
-
- private CDOResource resource;
-
- private EObject dummyObj;
-
- @Override
- protected void doSetUp() throws Exception
- {
- super.doSetUp();
-
- final EcorePackage epackage = EcorePackage.eINSTANCE;
-
- pkg = createUniquePackage();
-
- dummy = EMFUtil.createEClass(pkg, "Dummy", false, false);
- name = EMFUtil.createEAttribute(dummy, "name", epackage.getEString());
- fmapContainer = EMFUtil.createEClass(pkg, "FMapContainer", false, false);
-
- string1 = EMFUtil.createEAttribute(fmapContainer, "string1", epackage.getEString());
- string1.setUpperBound(-1);
-
- integer = EMFUtil.createEAttribute(fmapContainer, "integer", epackage.getEInt());
- integer.setUpperBound(-1);
-
- fMap = EMFUtil.createEAttribute(fmapContainer, "fmap", epackage.getEFeatureMapEntry());
- fMap.setUpperBound(-1);
-
- string2 = EMFUtil.createEAttribute(fmapContainer, "string2", epackage.getEString());
- string2.setUpperBound(-1);
-
- longObj = EMFUtil.createEAttribute(fmapContainer, "longObj", epackage.getELongObject());
- longObj.setUpperBound(-1);
-
- bool = EMFUtil.createEAttribute(fmapContainer, "bool", epackage.getEBoolean());
-
- ref1 = EMFUtil.createEReference(fmapContainer, "ref1", dummy, true, true);
- ref1.setUpperBound(-1);
-
- ref2 = EMFUtil.createEReference(fmapContainer, "ref2", dummy, true, false);
-
- ExtendedMetaData.INSTANCE.setFeatureKind(fMap, ExtendedMetaData.GROUP_FEATURE);
-
- ExtendedMetaData.INSTANCE.setGroup(string1, fMap);
- ExtendedMetaData.INSTANCE.setGroup(string2, fMap);
- ExtendedMetaData.INSTANCE.setGroup(integer, fMap);
- ExtendedMetaData.INSTANCE.setGroup(longObj, fMap);
- ExtendedMetaData.INSTANCE.setGroup(bool, fMap);
- ExtendedMetaData.INSTANCE.setGroup(ref1, fMap);
- ExtendedMetaData.INSTANCE.setGroup(ref2, fMap);
- if (!isConfig(LEGACY))
- {
- CDOUtil.prepareDynamicEPackage(pkg);
- }
-
- dummyObj = pkg.getEFactoryInstance().create(dummy);
- dummyObj.eSet(name, "DummyName");
-
- session = openSession();
- tx = session.openTransaction();
- resource = tx.getOrCreateResource(getResourcePath("/test/" + System.currentTimeMillis()));
- session.getPackageRegistry().putEPackage(pkg);
- resource.getContents().add(dummyObj);
- tx.commit();
- }
-
- @Override
- protected void doTearDown() throws Exception
- {
- pkg = null;
- dummy = null;
- name = null;
- fmapContainer = null;
- string1 = null;
- integer = null;
- fMap = null;
- string2 = null;
- longObj = null;
- bool = null;
- ref1 = null;
- ref2 = null;
- session = null;
- tx = null;
- resource = null;
- dummyObj = null;
- super.doTearDown();
- }
-
- public void _testAddDifferentTypes() throws CommitException
- {
- EObject fMapObj = EcoreUtil.create(fmapContainer);
-
- FeatureMap fm = (FeatureMap)fMapObj.eGet(fMap);
- fm.add(string1, "Hello");
- fm.add(string2, "lorem ipsum dolor sit amet");
- fm.add(string1, "World");
- fm.add(integer, 5);
- fm.add(bool, true);
- fm.add(ref1, dummyObj);
- fm.add(longObj, 12345678901234567L);
- fm.add(ref2, dummyObj);
- fm.add(bool, false); // Overwrites bool=true
- fm.add(ref2, null); // Overwrites ref2=dummyObj
-
- assertEquals(8, fm.size());
-
- resource.getContents().add(fMapObj);
- tx.commit();
-
- purgeCaches();
-
- EObject fMapObjDb = resource.getContents().get(1);
- FeatureMap fmDb = (FeatureMap)fMapObjDb.eGet(fMap);
- EObject dummyDb = resource.getContents().get(0);
-
- assertEquals(8, fmDb.size());
- assertEquals("Hello", fmDb.getValue(0));
- assertEquals(string1, fmDb.getEStructuralFeature(0));
-
- assertEquals("lorem ipsum dolor sit amet", fmDb.getValue(1));
- assertEquals(string2, fmDb.getEStructuralFeature(1));
-
- assertEquals("World", fmDb.getValue(2));
- assertEquals(string1, fmDb.getEStructuralFeature(2));
-
- assertEquals(5, fmDb.getValue(3));
- assertEquals(integer, fmDb.getEStructuralFeature(3));
-
- assertEquals(false, (boolean)(Boolean)fmDb.getValue(4));
- assertEquals(bool, fmDb.getEStructuralFeature(4));
-
- assertEquals(dummyDb, fmDb.getValue(5));
- assertEquals(ref1, fmDb.getEStructuralFeature(5));
-
- assertEquals(12345678901234567L, fmDb.getValue(6));
- assertEquals(longObj, fmDb.getEStructuralFeature(6));
-
- assertNull(fmDb.getValue(7));
- assertEquals(ref2, fmDb.getEStructuralFeature(7));
- }
-
- @Skips("Postgresql")
- public void _testFeatureMaps() throws Exception
- {
- skipStoreWithoutFeatureMaps();
-
- EReference feature = getModel5Package().getTestFeatureMap_Doctors();
-
- CDOSession session = openSession();
- CDOTransaction transaction = session.openTransaction();
- CDOResource resource = transaction.createResource(getResourcePath("/res1"));
-
- TestFeatureMap featureMap = getModel5Factory().createTestFeatureMap();
- FeatureMap people = featureMap.getPeople();
-
- Doctor doctor1 = getModel5Factory().createDoctor();
- Doctor doctor2 = getModel5Factory().createDoctor();
-
- resource.getContents().add(doctor1);
- resource.getContents().add(doctor2);
-
- people.add(feature, doctor1);
- people.add(feature, doctor2);
-
- int featureMapIndex = resource.getContents().size();
- resource.getContents().add(featureMap);
-
- assertEquals(doctor1, people.get(0).getValue());
- List<?> doctors = (List<?>)people.get(feature, true);
- assertEquals(doctor1, doctors.get(0));
- assertEquals(doctor2, doctors.get(1));
- transaction.commit();
-
- clearCache(getRepository().getRevisionManager());
-
- session = openSession();
- transaction = session.openTransaction();
- resource = transaction.getResource(getResourcePath("/res1"));
-
- featureMap = (TestFeatureMap)resource.getContents().get(featureMapIndex);
- doctors = (List<?>)featureMap.getPeople().get(feature, true);
- assertInstanceOf(Doctor.class, doctors.get(0));
- assertInstanceOf(Doctor.class, doctors.get(1));
- }
-
- private void purgeCaches()
- {
- // according to Eike's comment at Bug 249681, client caches are
- // ignored, if a new session is opened.
- // server caches are wiped by the clearCache call.
-
- String path = resource.getPath();
-
- tx.close();
- session.close();
-
- clearCache(getRepository().getRevisionManager());
-
- session = openSession();
- session.getPackageRegistry().putEPackage(pkg);
-
- tx = session.openTransaction();
-
- resource = tx.getResource(getResourcePath(path));
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/XRefTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/XRefTest.java
index cef4175638..c90b2cb0a9 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/XRefTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/XRefTest.java
@@ -204,7 +204,7 @@ public class XRefTest extends AbstractCDOTest
{
CDOObjectReference result = results.get(0);
assertEquals(0, result.getSourceIndex());
- assertEquals(ref.getName(), result.getSourceFeature().getName());
+ assertEquals(ref.getName(), result.getSourceReference().getName());
CDOObject sourceObject = results.get(0).getSourceObject();
assertEquals(3, sourceObject.eGet(sourceObject.eClass().getEStructuralFeature("id")));
}
@@ -214,7 +214,7 @@ public class XRefTest extends AbstractCDOTest
{
CDOObjectReference result = results.get(0);
assertEquals(1, result.getSourceIndex());
- assertEquals(ref.getName(), result.getSourceFeature().getName());
+ assertEquals(ref.getName(), result.getSourceReference().getName());
CDOObject sourceObject = results.get(0).getSourceObject();
assertEquals(1, sourceObject.eGet(sourceObject.eClass().getEStructuralFeature("id")));
}
@@ -228,7 +228,7 @@ public class XRefTest extends AbstractCDOTest
for (CDOObjectReference result : results)
{
- assertEquals(ref.getName(), results.get(0).getSourceFeature().getName());
+ assertEquals(ref.getName(), results.get(0).getSourceReference().getName());
CDOObject sourceObject = result.getSourceObject();
Integer id = (Integer)sourceObject.eGet(sourceObject.eClass().getEStructuralFeature("id"));
@@ -323,7 +323,7 @@ public class XRefTest extends AbstractCDOTest
CDOObjectReference result = results.get(0);
assertEquals(0, result.getSourceIndex());
- assertEquals(ref.getName(), result.getSourceFeature().getName());
+ assertEquals(ref.getName(), result.getSourceReference().getName());
CDOObject sourceObject = results.get(0).getSourceObject();
assertEquals(3, sourceObject.eGet(sourceObject.eClass().getEStructuralFeature("id")));
}
@@ -336,7 +336,7 @@ public class XRefTest extends AbstractCDOTest
for (CDOObjectReference result : results)
{
- assertEquals(ref.getName(), results.get(0).getSourceFeature().getName());
+ assertEquals(ref.getName(), results.get(0).getSourceReference().getName());
CDOObject sourceObject = result.getSourceObject();
Integer id = (Integer)sourceObject.eGet(sourceObject.eClass().getEStructuralFeature("id"));
@@ -420,12 +420,12 @@ public class XRefTest extends AbstractCDOTest
assertEquals(2, results.size());
assertEquals(0, results.get(0).getSourceIndex());
- assertEquals(ab5, results.get(0).getSourceFeature());
+ assertEquals(ab5, results.get(0).getSourceReference());
assertEquals(a1, results.get(0).getSourceObject());
assertEquals(b1, results.get(0).getTargetObject());
assertEquals(0, results.get(1).getSourceIndex());
- assertEquals(ab6, results.get(1).getSourceFeature());
+ assertEquals(ab6, results.get(1).getSourceReference());
assertEquals(a1, results.get(1).getSourceObject());
assertEquals(b1, results.get(1).getTargetObject());
@@ -497,7 +497,7 @@ public class XRefTest extends AbstractCDOTest
assertEquals(1, results.size());
assertEquals(0, results.get(0).getSourceIndex());
- assertEquals(ab5, results.get(0).getSourceFeature());
+ assertEquals(ab5, results.get(0).getSourceReference());
assertEquals(a1, results.get(0).getSourceObject());
assertEquals(b1, results.get(0).getTargetObject());
@@ -569,7 +569,7 @@ public class XRefTest extends AbstractCDOTest
assertEquals(1, results.size());
assertEquals(0, results.get(0).getSourceIndex());
- assertEquals(ab6, results.get(0).getSourceFeature());
+ assertEquals(ab6, results.get(0).getSourceReference());
assertEquals(a1, results.get(0).getSourceObject());
assertEquals(b1, results.get(0).getTargetObject());
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_289932_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_289932_Test.java
deleted file mode 100644
index 7fc8d6028c..0000000000
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_289932_Test.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, 2012, 2016, 2018 Eike Stepper (Loehne, 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.eresource.CDOResource;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.tests.AbstractCDOTest;
-import org.eclipse.emf.cdo.tests.model5.Doctor;
-import org.eclipse.emf.cdo.tests.model5.TestFeatureMap;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-
-/**
- * Objects that are contained by a transient feature could be persisted
- * <p>
- * See bug 289932
- *
- * @author Simon McDuff
- */
-@Deprecated
-public class Bugzilla_289932_Test extends AbstractCDOTest
-{
- public void _testBugzilla_289932() throws Exception
- {
- CDOSession session = openSession();
- session.getPackageRegistry().putEPackage(getModel5Package());
- CDOTransaction transaction = session.openTransaction();
- CDOResource res1 = transaction.createResource(getResourcePath("/res1"));
-
- TestFeatureMap testFeatureMap = getModel5Factory().createTestFeatureMap();
- Doctor doctor = getModel5Factory().createDoctor();
- testFeatureMap.getDoctors().add(doctor);
- res1.getContents().add(testFeatureMap);
- transaction.commit();
-
- // Transient feature for Doctor, should not persist it.
- assertTransient(doctor);
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ConfigTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ConfigTest.java
index 1d26cddf58..f6784eac04 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ConfigTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ConfigTest.java
@@ -20,7 +20,6 @@ import org.eclipse.emf.cdo.spi.server.InternalRepository;
import org.eclipse.emf.cdo.spi.server.InternalStore.NoChangeSets;
import org.eclipse.emf.cdo.spi.server.InternalStore.NoCommitInfos;
import org.eclipse.emf.cdo.spi.server.InternalStore.NoDurableLocking;
-import org.eclipse.emf.cdo.spi.server.InternalStore.NoFeatureMaps;
import org.eclipse.emf.cdo.spi.server.InternalStore.NoHandleRevisions;
import org.eclipse.emf.cdo.spi.server.InternalStore.NoLargeObjects;
import org.eclipse.emf.cdo.spi.server.InternalStore.NoQueryXRefs;
@@ -735,11 +734,6 @@ public abstract class ConfigTest extends AbstractOMTest implements IConstants
skipTest(getRepository().getStore() instanceof NoLargeObjects);
}
- protected void skipStoreWithoutFeatureMaps()
- {
- skipTest(getRepository().getStore() instanceof NoFeatureMaps);
- }
-
protected void skipStoreWithoutHandleRevisions()
{
skipTest(getRepository().getStore() instanceof NoHandleRevisions);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
index 1817fe087e..4ca6bb0368 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
@@ -60,13 +60,10 @@ import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.BasicEObjectImpl;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EStoreEObjectImpl;
-import org.eclipse.emf.ecore.impl.EStoreEObjectImpl.BasicEStoreFeatureMap;
import org.eclipse.emf.ecore.impl.MinimalEStoreEObjectImpl;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.Resource.Internal;
import org.eclipse.emf.ecore.util.EcoreEMap;
-import org.eclipse.emf.ecore.util.FeatureMap;
-import org.eclipse.emf.ecore.util.FeatureMapUtil;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.emf.spi.cdo.CDOStore;
import org.eclipse.emf.spi.cdo.FSMUtil;
@@ -707,16 +704,9 @@ public class CDOObjectImpl extends MinimalEStoreEObjectImpl implements InternalC
if (result == null)
{
EStructuralFeature eStructuralFeature = eDynamicFeature(dynamicFeatureID);
- if (classInfo.isPersistent(dynamicFeatureID))
+ if (classInfo.isPersistent(dynamicFeatureID) && eStructuralFeature.isMany())
{
- if (FeatureMapUtil.isFeatureMap(eStructuralFeature))
- {
- eSettings[index] = result = createFeatureMap(eStructuralFeature);
- }
- else if (eStructuralFeature.isMany())
- {
- eSettings[index] = result = createList(eStructuralFeature);
- }
+ eSettings[index] = result = createList(eStructuralFeature);
}
}
@@ -1296,10 +1286,14 @@ public class CDOObjectImpl extends MinimalEStoreEObjectImpl implements InternalC
return str;
}
+ /**
+ * @deprecated As of 4.5 {@link org.eclipse.emf.ecore.util.FeatureMap feature maps} are no longer supported.
+ */
+ @Deprecated
@Override
- protected final FeatureMap createFeatureMap(EStructuralFeature eStructuralFeature)
+ protected final org.eclipse.emf.ecore.util.FeatureMap createFeatureMap(EStructuralFeature eStructuralFeature)
{
- return new CDOStoreFeatureMap(eStructuralFeature);
+ throw new UnsupportedOperationException();
}
@Override
@@ -3231,19 +3225,4 @@ public class CDOObjectImpl extends MinimalEStoreEObjectImpl implements InternalC
return oldObject;
}
}
-
- /**
- * For internal use only.
- *
- * @author Eike Stepper
- */
- private final class CDOStoreFeatureMap extends BasicEStoreFeatureMap
- {
- private static final long serialVersionUID = 1L;
-
- public CDOStoreFeatureMap(EStructuralFeature eStructuralFeature)
- {
- super(CDOObjectImpl.this, eStructuralFeature);
- }
- }
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOObjectReferenceImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOObjectReferenceImpl.java
index 486b4c13d0..0f1b1281f6 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOObjectReferenceImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOObjectReferenceImpl.java
@@ -16,6 +16,7 @@ import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDReference;
import org.eclipse.emf.cdo.view.CDOView;
+import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
/**
@@ -58,6 +59,7 @@ public class CDOObjectReferenceImpl implements CDOObjectReference
return delegate.getSourceObject();
}
+ @Deprecated
@Override
public EStructuralFeature getSourceFeature()
{
@@ -65,6 +67,12 @@ public class CDOObjectReferenceImpl implements CDOObjectReference
}
@Override
+ public EReference getSourceReference()
+ {
+ return delegate.getSourceReference();
+ }
+
+ @Override
public int getSourceIndex()
{
return delegate.getSourceIndex();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOStoreImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOStoreImpl.java
index c9fb171469..18b3112852 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOStoreImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOStoreImpl.java
@@ -21,7 +21,6 @@ import org.eclipse.emf.cdo.common.model.CDOType;
import org.eclipse.emf.cdo.common.revision.CDOElementProxy;
import org.eclipse.emf.cdo.common.revision.CDOList;
import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDOAddFeatureDeltaImpl;
@@ -50,8 +49,6 @@ import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.InternalEObject.EStore;
-import org.eclipse.emf.ecore.util.FeatureMap;
-import org.eclipse.emf.ecore.util.FeatureMapUtil;
import org.eclipse.emf.spi.cdo.CDOStore;
import org.eclipse.emf.spi.cdo.FSMUtil;
import org.eclipse.emf.spi.cdo.InternalCDOObject;
@@ -838,17 +835,6 @@ public final class CDOStoreImpl implements CDOStore
{
value = view.convertObjectToID(value, true);
}
- else if (FeatureMapUtil.isFeatureMap(feature))
- {
- FeatureMap.Entry entry = (FeatureMap.Entry)value;
- EStructuralFeature innerFeature = entry.getEStructuralFeature();
- Object innerValue = entry.getValue();
- Object convertedValue = view.convertObjectToID(innerValue);
- if (convertedValue != innerValue)
- {
- value = CDORevisionUtil.createFeatureMapEntry(innerFeature, convertedValue);
- }
- }
else
{
CDOType type = CDOModelUtil.getType(feature.getEType());
@@ -909,17 +895,6 @@ public final class CDOStoreImpl implements CDOStore
{
value = convertIDToObject(view, eObject, feature, index, value);
}
- else if (FeatureMapUtil.isFeatureMap(feature))
- {
- FeatureMap.Entry entry = (FeatureMap.Entry)value;
- EStructuralFeature innerFeature = entry.getEStructuralFeature();
- Object innerValue = entry.getValue();
- Object convertedValue = convertIDToObject(view, eObject, feature, index, innerValue);
- if (convertedValue != innerValue)
- {
- value = FeatureMapUtil.createEntry(innerFeature, convertedValue);
- }
- }
else
{
CDOType type = CDOModelUtil.getType(feature.getEType());

Back to the top