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/io/CDODataInput.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/io/CDODataOutput.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java20
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOType.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionUtil.java13
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/io/CDODataInputImpl.java51
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/io/CDODataOutputImpl.java36
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOTypeImpl.java51
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOFeatureMapEntryImpl.java48
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOListImpl.java14
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOListFeatureDeltaImpl.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOSingleValueFeatureDeltaImpl.java31
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/AbstractCDORevision.java40
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOList.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevision.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/IListMapping.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AbstractMappingStrategy.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDORevisionInstantiator.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDORevisionTuplizer.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/WrappedHibernateList.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadChunkIndication.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model5/model/model5.ecore4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model5/src/org/eclipse/emf/cdo/tests/model5/TestFeatureMap.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model5/src/org/eclipse/emf/cdo/tests/model5/impl/Model5PackageImpl.java20
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/MultiValuedOfAttributeTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOLegacyWrapper.java79
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java42
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOFeatureAnalyzerUI.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadChunkRequest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOListWithElementProxiesImpl.java3
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/RevisionAdjuster.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java6
40 files changed, 333 insertions, 230 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/io/CDODataInput.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/io/CDODataInput.java
index b44c15d2ae..81ee1229f4 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/io/CDODataInput.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/io/CDODataInput.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Eike Stepper - initial API and implementation
* Simon McDuff - maintenance
@@ -69,13 +69,13 @@ public interface CDODataInput extends ExtendedDataInput
public CDORevision readCDORevision() throws IOException;
- public CDOList readCDOList(CDORevision revision, EStructuralFeature feature) throws IOException;
+ public CDOList readCDOList(EClass owner, EStructuralFeature feature) throws IOException;
public Object readCDOFeatureValue(EStructuralFeature feature) throws IOException;
public CDORevisionDelta readCDORevisionDelta() throws IOException;
- public CDOFeatureDelta readCDOFeatureDelta(EClass eClass) throws IOException;
+ public CDOFeatureDelta readCDOFeatureDelta(EClass owner) throws IOException;
/**
* Read either a CDORevision or a primitive value.
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/io/CDODataOutput.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/io/CDODataOutput.java
index a379284f9f..76f089076e 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/io/CDODataOutput.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/io/CDODataOutput.java
@@ -71,13 +71,13 @@ public interface CDODataOutput extends ExtendedDataOutput
public void writeCDORevision(CDORevision revision, int referenceChunk) throws IOException;
- public void writeCDOList(CDOList list, EStructuralFeature feature, int referenceChunk) throws IOException;
+ public void writeCDOList(EClass owner, EStructuralFeature feature, CDOList list, int referenceChunk) throws IOException;
- public void writeCDOFeatureValue(Object value, EStructuralFeature feature) throws IOException;
+ public void writeCDOFeatureValue(EStructuralFeature feature, Object value) throws IOException;
public void writeCDORevisionDelta(CDORevisionDelta revisionDelta) throws IOException;
- public void writeCDOFeatureDelta(CDOFeatureDelta featureDelta, EClass eClass) throws IOException;
+ public void writeCDOFeatureDelta(EClass owner, CDOFeatureDelta featureDelta) throws IOException;
/**
* Write either a CDORevision or a primitive value.
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 306a4382d5..bd313851f6 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
@@ -4,7 +4,7 @@
* 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
*/
@@ -29,6 +29,7 @@ import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.util.FeatureMapUtil;
import java.io.IOException;
import java.text.MessageFormat;
@@ -176,15 +177,22 @@ public final class CDOModelUtil
return isCorePackage(eClass.getEPackage()) && ROOT_CLASS_NAME.equals(eClass.getName());
}
- public static CDOType getType(int typeID)
+ /**
+ * @since 2.0
+ */
+ public static CDOType getType(EStructuralFeature feature)
{
- CDOTypeImpl type = CDOTypeImpl.ids.get(typeID);
- if (type == null)
+ if (FeatureMapUtil.isFeatureMap(feature))
{
- throw new IllegalStateException(MessageFormat.format(Messages.getString("CDOModelUtil.6"), typeID)); //$NON-NLS-1$
+ return CDOType.FEATURE_MAP_ENTRY;
}
- return type;
+ return CDOModelUtil.getType(feature.getEType());
+ }
+
+ public static CDOType getType(int typeID)
+ {
+ return CDOTypeImpl.getType(typeID);
}
/**
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 0b49ac7323..4a5f34fb49 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
@@ -4,7 +4,7 @@
* 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
*/
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 f672693a69..5755b0a71d 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
@@ -4,7 +4,7 @@
* 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
*/
@@ -12,13 +12,14 @@ package org.eclipse.emf.cdo.common.revision;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDTemp;
-import org.eclipse.emf.cdo.common.io.CDODataInput;
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.CDORevisionImpl;
import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.FeatureMap;
-import java.io.IOException;
import java.util.Map;
/**
@@ -35,7 +36,7 @@ public final class CDORevisionUtil
/**
* @since 2.0
*/
- public static CDORevision create(EClass eClass, CDOID id)
+ public static CDORevision createRevision(EClass eClass, CDOID id)
{
return new CDORevisionImpl(eClass, id);
}
@@ -43,9 +44,9 @@ public final class CDORevisionUtil
/**
* @since 2.0
*/
- public static CDORevision read(CDODataInput in) throws IOException
+ public static FeatureMap.Entry createFeatureMapEntry(EStructuralFeature feature, Object value)
{
- return new CDORevisionImpl(in);
+ return new CDOFeatureMapEntryImpl(feature, value);
}
public static Object remapID(Object value, Map<CDOIDTemp, CDOID> idMappings)
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/io/CDODataInputImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/io/CDODataInputImpl.java
index 28b51b7745..151741210c 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/io/CDODataInputImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/io/CDODataInputImpl.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Eike Stepper - initial API and implementation
* Simon McDuff - http://bugs.eclipse.org/213402
@@ -40,6 +40,7 @@ import org.eclipse.emf.cdo.internal.common.id.CDOIDMetaRangeImpl;
import org.eclipse.emf.cdo.internal.common.id.CDOIDTempMetaImpl;
import org.eclipse.emf.cdo.internal.common.id.CDOIDTempObjectImpl;
import org.eclipse.emf.cdo.internal.common.messages.Messages;
+import org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDOAddFeatureDeltaImpl;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDOClearFeatureDeltaImpl;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDOContainerFeatureDeltaImpl;
@@ -65,6 +66,7 @@ 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.EStructuralFeature;
+import org.eclipse.emf.ecore.util.FeatureMapUtil;
import java.io.IOException;
import java.text.MessageFormat;
@@ -212,13 +214,13 @@ public abstract class CDODataInputImpl extends ExtendedDataInput.Delegating impl
boolean notNull = readBoolean();
if (notNull)
{
- return CDORevisionUtil.read(this);
+ return new CDORevisionImpl(this);
}
return null;
}
- public CDOList readCDOList(CDORevision revision, EStructuralFeature feature) throws IOException
+ public CDOList readCDOList(EClass owner, EStructuralFeature feature) throws IOException
{
int referenceChunk;
int size = readInt();
@@ -240,11 +242,30 @@ public abstract class CDODataInputImpl extends ExtendedDataInput.Delegating impl
}
}
- CDOType type = CDOModelUtil.getType(feature.getEType());
+ Object value = null;
+ CDOType type = null;
+ boolean isFeatureMap = FeatureMapUtil.isFeatureMap(feature);
+ if (!isFeatureMap)
+ {
+ type = CDOModelUtil.getType(feature.getEType());
+ }
+
InternalCDOList list = (InternalCDOList)getListFactory().createList(size, size, referenceChunk);
for (int j = 0; j < referenceChunk; j++)
{
- Object value = type.readValue(this);
+ if (isFeatureMap)
+ {
+ int featureID = readInt();
+ EStructuralFeature innerFeature = owner.getEStructuralFeature(featureID);
+ type = CDOModelUtil.getType(innerFeature.getEType());
+ value = type.readValue(this);
+ value = CDORevisionUtil.createFeatureMapEntry(innerFeature, value);
+ }
+ else
+ {
+ value = type.readValue(this);
+ }
+
list.set(j, value);
if (TRACER.isEnabled())
{
@@ -257,7 +278,7 @@ public abstract class CDODataInputImpl extends ExtendedDataInput.Delegating impl
public Object readCDOFeatureValue(EStructuralFeature feature) throws IOException
{
- CDOType type = CDOModelUtil.getType(feature.getEType());
+ CDOType type = CDOModelUtil.getType(feature);
if (type.canBeNull() && !feature.isMany())
{
if (readBoolean())
@@ -274,35 +295,35 @@ public abstract class CDODataInputImpl extends ExtendedDataInput.Delegating impl
return new CDORevisionDeltaImpl(this);
}
- public CDOFeatureDelta readCDOFeatureDelta(EClass eClass) throws IOException
+ public CDOFeatureDelta readCDOFeatureDelta(EClass owner) throws IOException
{
int typeOrdinal = readInt();
CDOFeatureDelta.Type type = CDOFeatureDelta.Type.values()[typeOrdinal];
switch (type)
{
case ADD:
- return new CDOAddFeatureDeltaImpl(this, eClass);
+ return new CDOAddFeatureDeltaImpl(this, owner);
case SET:
- return new CDOSetFeatureDeltaImpl(this, eClass);
+ return new CDOSetFeatureDeltaImpl(this, owner);
case LIST:
- return new CDOListFeatureDeltaImpl(this, eClass);
+ return new CDOListFeatureDeltaImpl(this, owner);
case MOVE:
- return new CDOMoveFeatureDeltaImpl(this, eClass);
+ return new CDOMoveFeatureDeltaImpl(this, owner);
case CLEAR:
- return new CDOClearFeatureDeltaImpl(this, eClass);
+ return new CDOClearFeatureDeltaImpl(this, owner);
case REMOVE:
- return new CDORemoveFeatureDeltaImpl(this, eClass);
+ return new CDORemoveFeatureDeltaImpl(this, owner);
case CONTAINER:
- return new CDOContainerFeatureDeltaImpl(this, eClass);
+ return new CDOContainerFeatureDeltaImpl(this, owner);
case UNSET:
- return new CDOUnsetFeatureDeltaImpl(this, eClass);
+ return new CDOUnsetFeatureDeltaImpl(this, owner);
default:
throw new IOException(MessageFormat.format(Messages.getString("CDODataInputImpl.5"), typeOrdinal)); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/io/CDODataOutputImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/io/CDODataOutputImpl.java
index f587293fd6..48103ae012 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/io/CDODataOutputImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/io/CDODataOutputImpl.java
@@ -4,7 +4,7 @@
* 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
*/
@@ -13,6 +13,7 @@ package org.eclipse.emf.cdo.internal.common.io;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
+import org.eclipse.emf.cdo.common.id.CDOIDProvider;
import org.eclipse.emf.cdo.common.id.CDOID.Type;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
import org.eclipse.emf.cdo.common.model.CDOClassifierRef;
@@ -45,6 +46,9 @@ 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.FeatureMapUtil;
+import org.eclipse.emf.ecore.util.FeatureMap.Entry;
import java.io.IOException;
import java.text.MessageFormat;
@@ -161,7 +165,8 @@ public abstract class CDODataOutputImpl extends ExtendedDataOutput.Delegating im
}
}
- public void writeCDOList(CDOList list, EStructuralFeature feature, int referenceChunk) throws IOException
+ public void writeCDOList(EClass owner, EStructuralFeature feature, CDOList list, int referenceChunk)
+ throws IOException
{
// TODO Simon: Could most of this stuff be moved into the list?
// (only if protected methods of this class don't need to become public)
@@ -204,12 +209,25 @@ public abstract class CDODataOutputImpl extends ExtendedDataOutput.Delegating im
writeInt(size);
}
+ CDOIDProvider idProvider = getIDProvider();
+ boolean isFeatureMap = FeatureMapUtil.isFeatureMap(feature);
for (int j = 0; j < size; j++)
{
Object value = list.get(j, false);
- if (value != null && feature instanceof EReference)
+ EStructuralFeature innerFeature = feature; // Prepare for possible feature map
+ if (isFeatureMap)
{
- value = getIDProvider().provideCDOID(value);
+ Entry entry = (FeatureMap.Entry)value;
+ innerFeature = entry.getEStructuralFeature();
+ value = entry.getValue();
+
+ int featureID = owner.getFeatureID(innerFeature);
+ writeInt(featureID);
+ }
+
+ if (value != null && innerFeature instanceof EReference)
+ {
+ value = idProvider.provideCDOID(value);
}
if (TRACER.isEnabled())
@@ -217,16 +235,16 @@ public abstract class CDODataOutputImpl extends ExtendedDataOutput.Delegating im
TRACER.trace(" " + value); //$NON-NLS-1$
}
- writeCDOFeatureValue(value, feature);
+ writeCDOFeatureValue(innerFeature, value);
}
}
- public void writeCDOFeatureValue(Object value, EStructuralFeature feature) throws IOException
+ public void writeCDOFeatureValue(EStructuralFeature feature, Object value) throws IOException
{
// TODO We could certainly optimized this: When a feature is a reference, NIL is only possible in the case where
// unsettable == true. (TO be verified)
- CDOType type = CDOModelUtil.getType(feature.getEType());
+ CDOType type = CDOModelUtil.getType(feature);
if (type.canBeNull())
{
if (!feature.isMany())
@@ -258,9 +276,9 @@ public abstract class CDODataOutputImpl extends ExtendedDataOutput.Delegating im
((CDORevisionDeltaImpl)revisionDelta).write(this);
}
- public void writeCDOFeatureDelta(CDOFeatureDelta featureDelta, EClass eClass) throws IOException
+ public void writeCDOFeatureDelta(EClass owner, CDOFeatureDelta featureDelta) throws IOException
{
- ((CDOFeatureDeltaImpl)featureDelta).write(this, eClass);
+ ((CDOFeatureDeltaImpl)featureDelta).write(this, owner);
}
public void writeCDORevisionOrPrimitive(Object value) throws IOException
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 a5e9a86470..0c6ed93c6b 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
@@ -13,16 +13,20 @@ package org.eclipse.emf.cdo.internal.common.model;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
import org.eclipse.emf.cdo.common.model.CDOType;
import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
+import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
import org.eclipse.emf.cdo.internal.common.messages.Messages;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EEnumLiteral;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.util.FeatureMap;
import java.io.IOException;
import java.math.BigDecimal;
@@ -37,8 +41,7 @@ import java.util.Map;
*/
public abstract class CDOTypeImpl implements CDOType
{
- // TODO Use an array
- public static Map<Integer, CDOTypeImpl> ids = new HashMap<Integer, CDOTypeImpl>();
+ private static Map<Integer, CDOTypeImpl> ids = new HashMap<Integer, CDOTypeImpl>();
private static final byte BOOLEAN_DEFAULT_PRIMITIVE = 0;
@@ -508,35 +511,40 @@ public abstract class CDOTypeImpl implements CDOType
@Override
public Object copyValue(Object value)
{
- return 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);
}
public void writeValue(CDODataOutput out, Object value) throws IOException
{
- // TODO: implement CDOTypeImpl.enclosing_method(enclosing_method_arguments)
throw new UnsupportedOperationException();
- // CDOFeatureMapEntryDataTypeImpl featureMapEntry = (CDOFeatureMapEntryDataTypeImpl)value;
- // out.writeString(featureMapEntry.getURI());
- // out.writeCDOID(out.getIDProvider().provideCDOID(featureMapEntry.getObject()));
}
public Object readValue(CDODataInput in) throws IOException
{
- // TODO: implement CDOTypeImpl.enclosing_method(enclosing_method_arguments)
throw new UnsupportedOperationException();
- // String uri = in.readString();
- // Object id = in.readCDOID();
- // return new CDOFeatureMapEntryDataTypeImpl(uri, id);
}
@Override
public Object doAdjustReferences(CDOReferenceAdjuster adjuster, Object value)
{
- // TODO: implement CDOTypeImpl.enclosing_method(enclosing_method_arguments)
- throw new UnsupportedOperationException();
- // CDOFeatureMapEntryDataTypeImpl featureMapEntry = (CDOFeatureMapEntryDataTypeImpl)value;
- // featureMapEntry.adjustReferences(adjuster);
- // return value;
+ 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);
+ if (innerCopy != innerValue)
+ {
+ value = CDORevisionUtil.createFeatureMapEntry(innerFeature, innerCopy);
+ }
+
+ return value;
}
};
@@ -625,6 +633,17 @@ public abstract class CDOTypeImpl implements CDOType
return value;
}
+ public static CDOType getType(int typeID)
+ {
+ CDOTypeImpl type = ids.get(typeID);
+ if (type == null)
+ {
+ throw new IllegalStateException(MessageFormat.format(Messages.getString("CDOModelUtil.6"), typeID)); //$NON-NLS-1$
+ }
+
+ return type;
+ }
+
/**
* @author Eike Stepper
*/
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
new file mode 100644
index 0000000000..11a57ffea7
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOFeatureMapEntryImpl.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.internal.common.revision;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.FeatureMap;
+
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOFeatureMapEntryImpl implements FeatureMap.Entry
+{
+ private EStructuralFeature feature;
+
+ private Object value;
+
+ public CDOFeatureMapEntryImpl(EStructuralFeature feature, Object value)
+ {
+ this.feature = feature;
+ this.value = value;
+ }
+
+ public EStructuralFeature getEStructuralFeature()
+ {
+ return feature;
+ }
+
+ public Object getValue()
+ {
+ return 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/CDOListImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOListImpl.java
index f21de27ded..8d28d0ef87 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOListImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOListImpl.java
@@ -4,7 +4,7 @@
* 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
@@ -17,12 +17,11 @@ import org.eclipse.emf.cdo.common.revision.CDOList;
import org.eclipse.emf.cdo.common.revision.CDOListFactory;
import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDOList;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.net4j.util.collection.MoveableArrayList;
-import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EStructuralFeature;
/**
* @author Simon McDuff
@@ -44,7 +43,7 @@ public class CDOListImpl extends MoveableArrayList<Object> implements InternalCD
super(initialCapacity);
for (int j = 0; j < size; j++)
{
- this.add(InternalCDORevision.UNINITIALIZED);
+ this.add(UNINITIALIZED);
}
}
@@ -67,9 +66,12 @@ public class CDOListImpl extends MoveableArrayList<Object> implements InternalCD
return super.get(index);
}
- public void adjustReferences(CDOReferenceAdjuster revisionAdjuster, EClass classifier)
+ /**
+ * There's a duplicate of this method in WrappedHibernateList!!!
+ */
+ public void adjustReferences(CDOReferenceAdjuster revisionAdjuster, EStructuralFeature feature)
{
- CDOType type = CDOModelUtil.getType(classifier);
+ CDOType type = CDOModelUtil.getType(feature);
int size = size();
for (int i = 0; i < size; i++)
{
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java
index 81002ca0da..f498b93e09 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Eike Stepper - initial API and implementation
* Simon McDuff - http://bugs.eclipse.org/201266
@@ -63,7 +63,7 @@ public class CDORevisionImpl extends AbstractCDORevision
}
else
{
- CDOType type = CDOModelUtil.getType(classifier);
+ CDOType type = CDOModelUtil.getType(feature);
setValue(i, type.copyValue(source.values[i]));
}
}
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 0b1bac55bf..12226a0aad 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
@@ -4,7 +4,7 @@
* 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
@@ -25,6 +25,7 @@ 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;
@@ -79,7 +80,7 @@ public class CDOListFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOL
out.writeInt(featureDeltas.size());
for (CDOFeatureDelta featureDelta : featureDeltas)
{
- out.writeCDOFeatureDelta(featureDelta, eClass);
+ out.writeCDOFeatureDelta(eClass, featureDelta);
}
}
@@ -158,7 +159,8 @@ public class CDOListFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOL
private void cleanupWithNewDelta(CDOFeatureDelta featureDelta)
{
EStructuralFeature feature = getFeature();
- if (feature instanceof EReference && featureDelta instanceof CDORemoveFeatureDelta)
+ if ((feature instanceof EReference || FeatureMapUtil.isFeatureMap(feature))
+ && featureDelta instanceof CDORemoveFeatureDelta)
{
int indexToRemove = ((CDORemoveFeatureDelta)featureDelta).getIndex();
reconstructAddedIndicesWithNoCopy();
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java
index 917d1c3bde..bd57162811 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java
@@ -120,7 +120,7 @@ public class CDORevisionDeltaImpl implements InternalCDORevisionDelta
out.writeInt(featureDeltas.size());
for (CDOFeatureDelta featureDelta : featureDeltas.values())
{
- out.writeCDOFeatureDelta(featureDelta, eClass);
+ out.writeCDOFeatureDelta(eClass, featureDelta);
}
}
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 a42ea48e20..85f32d001b 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
@@ -4,7 +4,7 @@
* 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
@@ -15,11 +15,15 @@ import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
+import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
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 org.eclipse.emf.ecore.util.FeatureMap.Entry;
import java.io.IOException;
@@ -43,7 +47,18 @@ public abstract class CDOSingleValueFeatureDeltaImpl extends CDOFeatureDeltaImpl
{
super(in, eClass);
index = in.readInt();
- newValue = in.readCDOFeatureValue(getFeature());
+ EStructuralFeature feature = getFeature();
+ if (FeatureMapUtil.isFeatureMap(feature))
+ {
+ int featureID = in.readInt();
+ feature = eClass.getEStructuralFeature(featureID);
+ Object innerValue = in.readCDOFeatureValue(feature);
+ newValue = CDORevisionUtil.createFeatureMapEntry(feature, innerValue);
+ }
+ else
+ {
+ newValue = in.readCDOFeatureValue(feature);
+ }
}
@Override
@@ -53,12 +68,22 @@ public abstract class CDOSingleValueFeatureDeltaImpl extends CDOFeatureDeltaImpl
out.writeInt(index);
Object valueToWrite = newValue;
EStructuralFeature feature = getFeature();
+ if (FeatureMapUtil.isFeatureMap(feature))
+ {
+ FeatureMap.Entry entry = (Entry)valueToWrite;
+ feature = entry.getEStructuralFeature();
+ valueToWrite = entry.getValue();
+
+ int featureID = eClass.getFeatureID(feature);
+ out.writeInt(featureID);
+ }
+
if (valueToWrite != null && feature instanceof EReference)
{
valueToWrite = out.getIDProvider().provideCDOID(newValue);
}
- out.writeCDOFeatureValue(valueToWrite, feature);
+ out.writeCDOFeatureValue(feature, valueToWrite);
}
public int getIndex()
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/AbstractCDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/AbstractCDORevision.java
index 0071370f1f..f036b3b34a 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/AbstractCDORevision.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/AbstractCDORevision.java
@@ -32,6 +32,7 @@ import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDeltaUtil;
import org.eclipse.emf.cdo.internal.common.bundle.OM;
import org.eclipse.emf.cdo.internal.common.messages.Messages;
+import org.eclipse.net4j.util.ImplementationError;
import org.eclipse.net4j.util.collection.MoveableList;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.om.trace.PerfTracer;
@@ -40,6 +41,7 @@ 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.FeatureMapUtil;
import java.io.IOException;
import java.text.MessageFormat;
@@ -483,20 +485,19 @@ public abstract class AbstractCDORevision implements InternalCDORevision
for (int i = 0; i < features.length; i++)
{
EStructuralFeature feature = features[i];
- if (feature instanceof EReference)
+ if (feature instanceof EReference || FeatureMapUtil.isFeatureMap(feature))
{
- EReference reference = (EReference)feature;
- if (reference.isMany())
+ if (feature.isMany())
{
InternalCDOList list = (InternalCDOList)getValueAsList(i);
if (list != null)
{
- list.adjustReferences(revisionAdjuster, reference.getEReferenceType());
+ list.adjustReferences(revisionAdjuster, feature);
}
}
else
{
- CDOType type = CDOModelUtil.getType(feature.getEType());
+ CDOType type = CDOModelUtil.getType(feature);
setValue(i, type.adjustReferences(revisionAdjuster, getValue(i)));
}
}
@@ -526,7 +527,7 @@ public abstract class AbstractCDORevision implements InternalCDORevision
value = feature.getDefaultValue();
if (value != null)
{
- CDOType type = CDOModelUtil.getType(feature.getEType());
+ CDOType type = CDOModelUtil.getType(feature);
value = type.convertToCDO(feature.getEType(), value);
}
}
@@ -590,7 +591,7 @@ public abstract class AbstractCDORevision implements InternalCDORevision
MoveableList<Object> list = getList(feature, size);
for (int j = list.size(); j < size; j++)
{
- list.add(InternalCDORevision.UNINITIALIZED);
+ list.add(InternalCDOList.UNINITIALIZED);
}
}
@@ -607,38 +608,45 @@ public abstract class AbstractCDORevision implements InternalCDORevision
private void readValues(CDODataInput in) throws IOException
{
+ EClass owner = getEClass();
EStructuralFeature[] features = classInfo.getAllPersistentFeatures();
initValues(features);
for (int i = 0; i < features.length; i++)
{
+ Object value;
EStructuralFeature feature = features[i];
if (feature.isMany())
{
- setValue(i, in.readCDOList(this, feature));
+ value = in.readCDOList(owner, feature);
}
else
{
- setValue(i, in.readCDOFeatureValue(feature));
+ value = in.readCDOFeatureValue(feature);
if (TRACER.isEnabled())
{
- TRACER.format("Read feature {0}: {1}", feature.getName(), getValue(i)); //$NON-NLS-1$
+ TRACER.format("Read feature {0}: {1}", feature.getName(), value); //$NON-NLS-1$
}
}
+
+ setValue(i, value);
}
}
private void writeValues(CDODataOutput out, int referenceChunk) throws IOException
{
+ EClass owner = getEClass();
EStructuralFeature[] features = classInfo.getAllPersistentFeatures();
for (int i = 0; i < features.length; i++)
{
EStructuralFeature feature = features[i];
if (feature.isMany())
{
- out.writeCDOList(getValueAsList(i), feature, referenceChunk);
+ CDOList list = getValueAsList(i);
+ out.writeCDOList(owner, feature, list, referenceChunk);
}
else
{
+ checkNoFeatureMap(feature);
Object value = getValue(i);
if (value != null && feature instanceof EReference)
{
@@ -650,11 +658,19 @@ public abstract class AbstractCDORevision implements InternalCDORevision
TRACER.format("Writing feature {0}: {1}", feature.getName(), value); //$NON-NLS-1$
}
- out.writeCDOFeatureValue(value, feature);
+ out.writeCDOFeatureValue(feature, value);
}
}
}
+ public static void checkNoFeatureMap(EStructuralFeature feature)
+ {
+ if (FeatureMapUtil.isFeatureMap(feature))
+ {
+ throw new ImplementationError("Single-valued feature maps not handled, yet."); //$NON-NLS-1$
+ }
+ }
+
public static Object remapID(Object value, Map<CDOIDTemp, CDOID> idMappings)
{
if (value instanceof CDOIDTemp)
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOList.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOList.java
index 088a56e383..ec4ed45d00 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOList.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOList.java
@@ -4,7 +4,7 @@
* 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
@@ -13,9 +13,10 @@ package org.eclipse.emf.cdo.spi.common.revision;
import org.eclipse.emf.cdo.common.revision.CDOList;
import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
+import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
-import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EStructuralFeature;
/**
* @author Simon McDuff
@@ -23,10 +24,12 @@ import org.eclipse.emf.ecore.EClassifier;
*/
public interface InternalCDOList extends CDOList
{
+ public static final Object UNINITIALIZED = CDORevisionUtil.UNINITIALIZED;
+
/**
* Adjusts references according to the passed adjuster and resynchronizes indexes.
*/
- public void adjustReferences(CDOReferenceAdjuster adjuster, EClass classifier);
+ public void adjustReferences(CDOReferenceAdjuster adjuster, EStructuralFeature feature);
/**
* Clones the list.
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevision.java
index c6648f016b..e7fba9eb41 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevision.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevision.java
@@ -17,7 +17,6 @@ import org.eclipse.emf.cdo.common.revision.CDOList;
import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjustable;
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.ecore.EStructuralFeature;
@@ -29,8 +28,6 @@ import java.io.IOException;
*/
public interface InternalCDORevision extends CDORevision, CDORevisionData, CDOReferenceAdjustable
{
- public static final Object UNINITIALIZED = CDORevisionUtil.UNINITIALIZED;
-
/**
* The equivalent of <code>EStructuralFeatureImpl.NIL</code> (i.e. explicit <code>null</code>).
*/
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/IListMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/IListMapping.java
index c26ce2b807..e394d5473e 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/IListMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/IListMapping.java
@@ -16,6 +16,7 @@ import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.server.IStoreChunkReader.Chunk;
import org.eclipse.emf.cdo.server.db.IDBStoreAccessor;
import org.eclipse.emf.cdo.server.db.IDBStoreChunkReader;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDOList;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.net4j.db.ddl.IDBTable;
@@ -68,7 +69,7 @@ public interface IListMapping
* @param listChunk
* indicating the lazy loading behavior: {@link CDORevision#UNCHUNKED} means that the whole list should be
* read. Else, if <code>listChunk >= 0</code>, the list is filled with
- * {@link InternalCDORevision#UNINITIALIZED} and only the first <code>listChunk</code> values are read.
+ * {@link InternalCDOList#UNINITIALIZED} and only the first <code>listChunk</code> values are read.
*/
public void readValues(IDBStoreAccessor accessor, InternalCDORevision revision, int listChunk);
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
index fe350fa98b..6add665953 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
@@ -176,7 +176,7 @@ public class DBStoreAccessor extends LongIDStoreAccessor implements IDBStoreAcce
return null;
}
- InternalCDORevision revision = (InternalCDORevision)CDORevisionUtil.create(eClass, id);
+ InternalCDORevision revision = (InternalCDORevision)CDORevisionUtil.createRevision(eClass, id);
IMappingStrategy mappingStrategy = getStore().getMappingStrategy();
IClassMapping mapping = mappingStrategy.getClassMapping(eClass);
@@ -204,7 +204,7 @@ public class DBStoreAccessor extends LongIDStoreAccessor implements IDBStoreAcce
}
EClass eClass = getObjectType(id);
- InternalCDORevision revision = (InternalCDORevision)CDORevisionUtil.create(eClass, id);
+ InternalCDORevision revision = (InternalCDORevision)CDORevisionUtil.createRevision(eClass, id);
IClassMappingAuditSupport mapping = (IClassMappingAuditSupport)mappingStrategy.getClassMapping(eClass);
if (mapping.readRevisionByTime(this, revision, timeStamp, listChunk))
@@ -221,7 +221,7 @@ public class DBStoreAccessor extends LongIDStoreAccessor implements IDBStoreAcce
IMappingStrategy mappingStrategy = getStore().getMappingStrategy();
EClass eClass = getObjectType(id);
- InternalCDORevision revision = (InternalCDORevision)CDORevisionUtil.create(eClass, id);
+ InternalCDORevision revision = (InternalCDORevision)CDORevisionUtil.createRevision(eClass, id);
IClassMapping mapping = mappingStrategy.getClassMapping(eClass);
boolean success = false;
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 4ad991dd2e..689590dc7c 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
@@ -385,7 +385,7 @@ public abstract class AbstractMappingStrategy extends Lifecycle implements IMapp
public ITypeMapping createValueMapping(EStructuralFeature feature)
{
- CDOType type = CDOModelUtil.getType(feature.getEType());
+ CDOType type = CDOModelUtil.getType(feature);
if (type == CDOType.BOOLEAN || type == CDOType.BOOLEAN_OBJECT)
{
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java
index 42b99fd730..c330724c79 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java
@@ -23,6 +23,7 @@ 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.CDODBSchema;
import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDOList;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.net4j.db.DBException;
@@ -287,7 +288,7 @@ public abstract class AbstractListTableMapping implements IListMapping
TRACER.format("Adding UNINITIALIZED for index {0} ", list.size()); //$NON-NLS-1$
}
- list.add(InternalCDORevision.UNINITIALIZED);
+ list.add(InternalCDOList.UNINITIALIZED);
}
}
catch (SQLException ex)
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDORevisionInstantiator.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDORevisionInstantiator.java
index c2961e93d9..97a04e35f8 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDORevisionInstantiator.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDORevisionInstantiator.java
@@ -43,7 +43,7 @@ public class CDORevisionInstantiator implements Instantiator
public Object instantiate(Serializable id)
{
- return CDORevisionUtil.create(eClass, CDOIDHibernateFactoryImpl.getInstance().createCDOID(id, eClass.getName()));
+ return CDORevisionUtil.createRevision(eClass, CDOIDHibernateFactoryImpl.getInstance().createCDOID(id, eClass.getName()));
}
public boolean isInstance(Object object)
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDORevisionTuplizer.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDORevisionTuplizer.java
index b0772fea7a..23f4f5a901 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDORevisionTuplizer.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDORevisionTuplizer.java
@@ -4,7 +4,7 @@
* 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
* Martin Taal - changed handling of propertygetters/setters
@@ -225,10 +225,12 @@ public class CDORevisionTuplizer extends AbstractEntityTuplizer
EStructuralFeature feature = getEClass().getEStructuralFeature(mappedProperty.getName());
if (feature instanceof EReference && feature.isMany())
{
+ // TODO Clarify feature maps
return new CDOManyReferenceGetter(this, mappedProperty.getName());
}
else if (feature instanceof EReference)
{
+ // TODO Clarify feature maps
return new CDOReferenceGetter(this, mappedProperty.getName());
}
@@ -283,11 +285,13 @@ public class CDORevisionTuplizer extends AbstractEntityTuplizer
EStructuralFeature feature = getEClass().getEStructuralFeature(mappedProperty.getName());
if (feature instanceof EReference && feature.isMany())
{
+ // TODO Clarify feature maps
return new CDOManyReferenceSetter(this, mappedProperty.getName());
}
if (feature instanceof EReference)
{
+ // TODO Clarify feature maps
return new CDOReferenceSetter(this, mappedProperty.getName());
}
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/WrappedHibernateList.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/WrappedHibernateList.java
index 252a9675b8..e044d9bab7 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/WrappedHibernateList.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/WrappedHibernateList.java
@@ -20,8 +20,8 @@ import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.server.internal.hibernate.HibernateUtil;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDOList;
-import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EStructuralFeature;
import java.util.ArrayList;
import java.util.Collection;
@@ -90,9 +90,12 @@ public class WrappedHibernateList implements InternalCDOList
}
}
- public void adjustReferences(CDOReferenceAdjuster adjuster, EClass classifier)
+ /**
+ * There's a duplicate of this method in CDOListImpl!!!
+ */
+ public void adjustReferences(CDOReferenceAdjuster adjuster, EStructuralFeature feature)
{
- CDOType type = CDOModelUtil.getType(classifier);
+ CDOType type = CDOModelUtil.getType(feature);
int size = size();
for (int i = 0; i < size; i++)
{
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java
index b1ceefa255..afafa0d73d 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java
@@ -23,6 +23,7 @@ import org.eclipse.emf.cdo.server.IStoreChunkReader;
import org.eclipse.emf.cdo.server.StoreThreadLocal;
import org.eclipse.emf.cdo.server.IStoreAccessor.AdditionalRevisionCache;
import org.eclipse.emf.cdo.server.IStoreChunkReader.Chunk;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDOList;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.net4j.util.collection.MoveableList;
@@ -126,7 +127,7 @@ public class RevisionManager extends CDORevisionResolverImpl implements IRevisio
int fromIndex = -1;
for (int j = chunkStart; j < chunkEnd; j++)
{
- if (list.get(j) == InternalCDORevision.UNINITIALIZED)
+ if (list.get(j) == InternalCDOList.UNINITIALIZED)
{
if (fromIndex == -1)
{
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
index d0f51e9f60..c8c0d1b9d6 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
@@ -368,6 +368,7 @@ public class Session extends Container<IView> implements ISession, CDOIDProvider
for (int i = 0; i < features.length; i++)
{
EStructuralFeature feature = features[i];
+ // TODO Clarify feature maps
if (feature instanceof EReference && !feature.isMany() && ((EReference)feature).isContainment())
{
Object value = revision.getValue(feature);
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadChunkIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadChunkIndication.java
index a29b1c0d6e..fc3089e550 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadChunkIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadChunkIndication.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Eike Stepper - initial API and implementation
* Simon McDuff - http://bugs.eclipse.org/210868
@@ -92,7 +92,7 @@ public class LoadChunkIndication extends CDOReadIndication
InternalCDORevision revision = getRepository().getRevisionManager().getRevisionByVersion(id, 0, version);
getRepository().getRevisionManager().ensureChunk(revision, feature, fromIndex, toIndex + 1);
- CDOType type = CDOModelUtil.getType(feature.getEType());
+ CDOType type = CDOModelUtil.getType(feature);
MoveableList<Object> list = revision.getList(feature);
for (int i = fromIndex; i <= toIndex; i++)
{
diff --git a/plugins/org.eclipse.emf.cdo.tests.model5/model/model5.ecore b/plugins/org.eclipse.emf.cdo.tests.model5/model/model5.ecore
index e4b9ac0b0d..b994aa3df5 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model5/model/model5.ecore
+++ b/plugins/org.eclipse.emf.cdo.tests.model5/model/model5.ecore
@@ -5,13 +5,13 @@
nsURI="http://www.eclipse.org/emf/CDO/tests/model5/1.0.0" nsPrefix="model5">
<eClassifiers xsi:type="ecore:EClass" name="TestFeatureMap">
<eStructuralFeatures xsi:type="ecore:EReference" name="managers" upperBound="-1"
- eType="#//Manager">
+ eType="#//Manager" transient="true">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="group" value="#people"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="doctors" upperBound="-1"
- eType="#//Doctor" containment="true">
+ eType="#//Doctor" transient="true" containment="true">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="group" value="#people"/>
</eAnnotations>
diff --git a/plugins/org.eclipse.emf.cdo.tests.model5/src/org/eclipse/emf/cdo/tests/model5/TestFeatureMap.java b/plugins/org.eclipse.emf.cdo.tests.model5/src/org/eclipse/emf/cdo/tests/model5/TestFeatureMap.java
index 02ec28e4fb..1f9b90923a 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model5/src/org/eclipse/emf/cdo/tests/model5/TestFeatureMap.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model5/src/org/eclipse/emf/cdo/tests/model5/TestFeatureMap.java
@@ -50,7 +50,7 @@ public interface TestFeatureMap extends EObject
*
* @return the value of the '<em>Managers</em>' reference list.
* @see org.eclipse.emf.cdo.tests.model5.Model5Package#getTestFeatureMap_Managers()
- * @model extendedMetaData="group='#people'"
+ * @model transient="true" extendedMetaData="group='#people'"
* @generated
*/
EList<Manager> getManagers();
@@ -66,7 +66,7 @@ public interface TestFeatureMap extends EObject
*
* @return the value of the '<em>Doctors</em>' containment reference list.
* @see org.eclipse.emf.cdo.tests.model5.Model5Package#getTestFeatureMap_Doctors()
- * @model containment="true" extendedMetaData="group='#people'"
+ * @model containment="true" transient="true" extendedMetaData="group='#people'"
* @generated
*/
EList<Doctor> getDoctors();
diff --git a/plugins/org.eclipse.emf.cdo.tests.model5/src/org/eclipse/emf/cdo/tests/model5/impl/Model5PackageImpl.java b/plugins/org.eclipse.emf.cdo.tests.model5/src/org/eclipse/emf/cdo/tests/model5/impl/Model5PackageImpl.java
index 0562f720dc..354609b683 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model5/src/org/eclipse/emf/cdo/tests/model5/impl/Model5PackageImpl.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model5/src/org/eclipse/emf/cdo/tests/model5/impl/Model5PackageImpl.java
@@ -164,15 +164,9 @@ public class Model5PackageImpl extends EPackageImpl implements Model5Package
/**
* Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
- * Simple dependencies are satisfied by calling this method on all dependent packages before doing anything else. This
- * method drives initialization for interdependent packages directly, in parallel with this package, itself.
* <p>
- * Of this package and its interdependencies, all packages which have not yet been registered by their URI values are
- * first created and registered. The packages are then initialized in two steps: meta-model objects for all of the
- * packages are created before any are initialized, since one package's meta-model objects may refer to those of
- * another.
- * <p>
- * Invocation of this method will not affect any packages that have already been initialized. <!-- begin-user-doc -->
+ * This method is used to initialize {@link Model5Package#eINSTANCE} when that field is accessed. Clients should not
+ * invoke it directly. Instead, they should simply access that field to obtain the package. <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #eNS_URI
@@ -186,8 +180,8 @@ public class Model5PackageImpl extends EPackageImpl implements Model5Package
return (Model5Package)EPackage.Registry.INSTANCE.getEPackage(Model5Package.eNS_URI);
// Obtain or create and register package
- Model5PackageImpl theModel5Package = (Model5PackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof Model5PackageImpl ? EPackage.Registry.INSTANCE
- .getEPackage(eNS_URI)
+ Model5PackageImpl theModel5Package = (Model5PackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof Model5PackageImpl ? EPackage.Registry.INSTANCE
+ .get(eNS_URI)
: new Model5PackageImpl());
isInited = true;
@@ -201,6 +195,8 @@ public class Model5PackageImpl extends EPackageImpl implements Model5Package
// Mark meta-data to indicate it can't be changed
theModel5Package.freeze();
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(Model5Package.eNS_URI, theModel5Package);
return theModel5Package;
}
@@ -568,10 +564,10 @@ public class Model5PackageImpl extends EPackageImpl implements Model5Package
initEClass(testFeatureMapEClass, TestFeatureMap.class, "TestFeatureMap", !IS_ABSTRACT, !IS_INTERFACE,
IS_GENERATED_INSTANCE_CLASS);
initEReference(getTestFeatureMap_Managers(), this.getManager(), null, "managers", null, 0, -1,
- TestFeatureMap.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES,
+ TestFeatureMap.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES,
!IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getTestFeatureMap_Doctors(), this.getDoctor(), null, "doctors", null, 0, -1, TestFeatureMap.class,
- !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE,
+ IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE,
!IS_DERIVED, IS_ORDERED);
initEAttribute(getTestFeatureMap_People(), ecorePackage.getEFeatureMapEntry(), "people", null, 0, -1,
TestFeatureMap.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE,
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/MultiValuedOfAttributeTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/MultiValuedOfAttributeTest.java
index 3b3b664eb0..60d7a9da10 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/MultiValuedOfAttributeTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/MultiValuedOfAttributeTest.java
@@ -33,7 +33,7 @@ import java.util.List;
*/
public class MultiValuedOfAttributeTest extends AbstractCDOTest
{
- public void _testFeatureMaps() throws Exception
+ public void testFeatureMaps() throws Exception
{
{
CDOSession session = openSession(getModel5Package());
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOLegacyWrapper.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOLegacyWrapper.java
index 9804644297..c690444632 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOLegacyWrapper.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOLegacyWrapper.java
@@ -238,38 +238,6 @@ public abstract class CDOLegacyWrapper extends CDOObjectWrapper
{
Object instanceValue = getInstanceValue(instance, feature, packageRegistry);
CDOObjectImpl.instanceToRevisionFeature(view, revision, feature, instanceValue);
- // if (feature.isMany())
- // {
- // List<Object> revisionList = revision.getList(feature); // TODO lazy?
- // revisionList.clear();
- //
- // if (instanceValue != null)
- // {
- // InternalEList<?> instanceList = (InternalEList<?>)instanceValue;
- // if (!instanceList.isEmpty())
- // {
- // for (Iterator<?> it = instanceList.basicIterator(); it.hasNext();)
- // {
- // Object instanceElement = it.next();
- // if (instanceElement != null && feature instanceof EReference)
- // {
- // instanceElement = view.convertObjectToID(instanceElement);
- // }
- //
- // revisionList.add(instanceElement);
- // }
- // }
- // }
- // }
- // else
- // {
- // if (instanceValue != null && feature instanceof EReference)
- // {
- // instanceValue = view.convertObjectToID(instanceValue);
- // }
- //
- // revision.setValue(feature, instanceValue);
- // }
}
/**
@@ -326,53 +294,6 @@ public abstract class CDOLegacyWrapper extends CDOObjectWrapper
// Attempt 4
Object value = revision.getValue(feature);
view.getStore().set(instance, feature, Notification.NO_INDEX, value);
-
- // // Attempt 3
- // Object value = revision.getValue(feature);
- // instance.eSet(feature, value);
-
- // // Attempt 2
- // CDOObjectImpl.revisionToInstanceFeature(this, revision, feature);
-
- // // Attempt 1
- // Object value = revision.getValue(feature);
- // if (feature.isMany())
- // {
- // InternalEList<Object> instanceList = (InternalEList<Object>)getInstanceValue(instance, feature, packageRegistry);
- // if (instanceList != null)
- // {
- // clearEList(instanceList);
- // if (value != null)
- // {
- // List<?> revisionList = (List<?>)value;
- // if (feature instanceof EReference)
- // {
- // for (Object element : revisionList)
- // {
- // element = getEObjectFromPotentialID(view, feature, element);
- // instanceList.basicAdd(element, null);
- // }
- // }
- // else
- // {
- // // TODO Is this only for multi-valued attributes??
- // for (Object element : revisionList)
- // {
- // instanceList.basicAdd(element, null);
- // }
- // }
- // }
- // }
- // }
- // else
- // {
- // if (feature instanceof EReference)
- // {
- // value = getEObjectFromPotentialID(view, feature, value);
- // }
- //
- // setInstanceValue(instance, feature, value);
- // }
}
protected Resource.Internal getInstanceResource(InternalEObject instance)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java
index edb60132a1..e2a1a73c9d 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java
@@ -18,6 +18,7 @@ import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.model.CDOModelUtil;
import org.eclipse.emf.cdo.common.model.CDOType;
import org.eclipse.emf.cdo.common.revision.CDOList;
+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;
@@ -44,6 +45,7 @@ import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.InternalEObject.EStore;
import org.eclipse.emf.ecore.impl.EStoreEObjectImpl;
+import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.FeatureMapUtil;
import org.eclipse.emf.spi.cdo.CDOElementProxy;
import org.eclipse.emf.spi.cdo.InternalCDOObject;
@@ -217,6 +219,7 @@ public final class CDOStore implements EStore
TRACER.format("contains({0}, {1}, {2})", cdoObject, feature, value); //$NON-NLS-1$
}
+ // TODO Clarify feature maps
if (feature instanceof EReference)
{
value = cdoObject.cdoView().convertObjectToID(value, true);
@@ -234,6 +237,7 @@ public final class CDOStore implements EStore
TRACER.format("indexOf({0}, {1}, {2})", cdoObject, feature, value); //$NON-NLS-1$
}
+ // TODO Clarify feature maps
if (feature instanceof EReference)
{
value = cdoObject.cdoView().convertObjectToID(value, true);
@@ -251,6 +255,7 @@ public final class CDOStore implements EStore
TRACER.format("lastIndexOf({0}, {1}, {2})", cdoObject, feature, value); //$NON-NLS-1$
}
+ // TODO Clarify feature maps
if (feature instanceof EReference)
{
value = cdoObject.cdoView().convertObjectToID(value, true);
@@ -282,6 +287,7 @@ public final class CDOStore implements EStore
InternalCDORevision revision = getRevisionForReading(cdoObject);
Object[] result = revision.toArray(feature);
+ // TODO Clarify feature maps
if (feature instanceof EReference)
{
for (int i = 0; i < result.length; i++)
@@ -326,6 +332,7 @@ public final class CDOStore implements EStore
CDOFeatureDelta delta = new CDOSetFeatureDeltaImpl(feature, index, value);
InternalCDORevision revision = getRevisionForWriting(cdoObject, delta);
+ // TODO Clarify feature maps
if (feature instanceof EReference)
{
Object oldValue = revision.basicGet(feature, index);
@@ -341,8 +348,8 @@ public final class CDOStore implements EStore
/**
* @since 2.0
*/
- public Object convertToEMF(EObject eObject, InternalCDORevision revision, EStructuralFeature feature,
- int index, Object value)
+ public Object convertToEMF(EObject eObject, InternalCDORevision revision, EStructuralFeature feature, int index,
+ Object value)
{
if (value != null)
{
@@ -369,6 +376,7 @@ public final class CDOStore implements EStore
}
}
+ // TODO Clarify feature maps
if (feature instanceof EReference)
{
// The EReference condition should be in the CDOType.convertToCDO. Since common package do not have access to
@@ -377,14 +385,14 @@ public final class CDOStore implements EStore
}
else if (FeatureMapUtil.isFeatureMap(feature))
{
- // TODO Handle feature maps!
- // EStructuralFeatureMapEntryDataTypeImpl entry = (EStructuralFeatureMapEntryDataTypeImpl)value;
- // EStructuralFeature feature = (EStructuralFeature)view.getResourceSet().getEObject(
- // URI.createURI(entry.getURI()), true);
- // Object object = view.convertIDToObject(entry.getObject());
- // value = FeatureMapUtil.createEntry(feature, object);
- throw new UnsupportedOperationException(
- "Feature maps currently not supported. See https://bugs.eclipse.org/249436"); //$NON-NLS-1$
+ FeatureMap.Entry entry = (FeatureMap.Entry)value;
+ EStructuralFeature innerFeature = entry.getEStructuralFeature();
+ Object innerValue = entry.getValue();
+ Object convertedValue = view.convertIDToObject(innerValue);
+ if (convertedValue != innerValue)
+ {
+ value = FeatureMapUtil.createEntry(innerFeature, convertedValue);
+ }
}
else
{
@@ -418,12 +426,14 @@ public final class CDOStore implements EStore
}
else if (FeatureMapUtil.isFeatureMap(feature))
{
- // TODO Handle feature maps!
- // FeatureMap.Entry entry = (FeatureMap.Entry)value;
- // String uri = EcoreUtil.getURI(entry.getEStructuralFeature()).toString();
- // value = CDORevisionUtil.createFeatureMapEntry(uri, entry.getValue());
- throw new UnsupportedOperationException(
- "Feature maps currently not supported. See https://bugs.eclipse.org/249436"); //$NON-NLS-1$
+ 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
{
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOFeatureAnalyzerUI.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOFeatureAnalyzerUI.java
index 2225a1d106..f1f38db878 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOFeatureAnalyzerUI.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOFeatureAnalyzerUI.java
@@ -4,7 +4,7 @@
* 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
@@ -104,7 +104,9 @@ public class CDOFeatureAnalyzerUI extends CDOAbstractFeatureRuleAnalyzer
@Override
protected void doPreTraverseFeature(CDOObject cdoObject, EStructuralFeature feature, int index)
{
- // Don`t handle containment relationship TODO Simon: Do yu really mean containment here? The check is different...
+ // Don`t handle containment relationship
+ // TODO Simon: Do you really mean containment here? The check is different...
+ // TODO Clarify feature maps
if (feature instanceof EReference)
{
if (lastElapseTimeBetweenOperations > maxTimeBetweenOperation || currentClusterOfFetchRule == null)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadChunkRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadChunkRequest.java
index 2fcd505651..a6d23642ec 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadChunkRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadChunkRequest.java
@@ -105,7 +105,7 @@ public class LoadChunkRequest extends CDOClientRequest<Object>
@Override
protected Object confirming(CDODataInput in) throws IOException
{
- CDOType type = CDOModelUtil.getType(feature.getEType());
+ CDOType type = CDOModelUtil.getType(feature);
Object accessID = null;
MoveableList<Object> list = revision.getList(feature);
for (int i = fromIndex; i <= toIndex; i++)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOListWithElementProxiesImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOListWithElementProxiesImpl.java
index 79557ca22a..ee69ad5ff1 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOListWithElementProxiesImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOListWithElementProxiesImpl.java
@@ -17,7 +17,6 @@ import org.eclipse.emf.cdo.common.revision.CDOList;
import org.eclipse.emf.cdo.common.revision.CDOListFactory;
import org.eclipse.emf.cdo.internal.common.revision.CDOListImpl;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDOList;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.spi.cdo.CDOElementProxy;
@@ -56,7 +55,7 @@ public class CDOListWithElementProxiesImpl extends CDOListImpl
Object element = super.get(index);
- return element instanceof CDOElementProxy ? InternalCDORevision.UNINITIALIZED : element;
+ return element instanceof CDOElementProxy ? UNINITIALIZED : element;
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
index 08c2590e32..7d29e5f909 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
@@ -895,12 +895,12 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
{
public CDORevision createRevision(EClass eClass, CDOID id)
{
- return CDORevisionUtil.create(eClass, id);
+ return CDORevisionUtil.createRevision(eClass, id);
}
public CDORevision createRevision(CDODataInput in) throws IOException
{
- return CDORevisionUtil.read(in);
+ return in.readCDORevision();
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java
index 52a0f340c2..d55c2dd1ac 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java
@@ -4,7 +4,7 @@
* 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
**************************************************************************/
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/RevisionAdjuster.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/RevisionAdjuster.java
index a9d1cd18ef..0a01fd97bb 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/RevisionAdjuster.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/RevisionAdjuster.java
@@ -18,6 +18,7 @@ import org.eclipse.emf.cdo.common.revision.delta.CDOContainerFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDOListFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta;
+import org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDOFeatureDeltaVisitorImpl;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDOListFeatureDeltaImpl;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDOList;
@@ -66,6 +67,8 @@ public class RevisionAdjuster extends CDOFeatureDeltaVisitorImpl
public void visit(CDOSetFeatureDelta delta)
{
EStructuralFeature feature = delta.getFeature();
+ CDORevisionImpl.checkNoFeatureMap(feature);
+
Object value = delta.getValue();
if (value != null && feature instanceof EReference && !(value instanceof CDOElementProxy))
{
@@ -77,8 +80,9 @@ public class RevisionAdjuster extends CDOFeatureDeltaVisitorImpl
public void visit(CDOListFeatureDelta deltas)
{
EStructuralFeature feature = deltas.getFeature();
- InternalCDOList list = (InternalCDOList)revision.getValue(feature);
+ CDORevisionImpl.checkNoFeatureMap(feature);
+ InternalCDOList list = (InternalCDOList)revision.getValue(feature);
if (feature instanceof EReference)
{
int[] indices = ((CDOListFeatureDeltaImpl)deltas).reconstructAddedIndices().getElement2();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java
index d331743eee..84df6fb6ee 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java
@@ -4,7 +4,7 @@
* 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
**************************************************************************/
@@ -360,9 +360,9 @@ public interface CDOSessionProtocol extends PackageLoader
public Object adjustReference(Object id)
{
- if (id == null)
+ if (id == null || id == CDOID.NULL)
{
- return null;
+ return id;
}
if (idProvider != null && (id instanceof CDOID || id instanceof InternalEObject))

Back to the top