summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-01-04 13:46:13 (EST)
committerEike Stepper2008-01-04 13:46:13 (EST)
commit31e9df55d1e76b6f15bd8fb4a78b06312cedcd1e (patch)
treea4ac87fcaf387dcb37d19c8e52d588976505605d
parente508a91d0216fb16f2a0d454fe71d647ce941755 (diff)
downloadcdo-31e9df55d1e76b6f15bd8fb4a78b06312cedcd1e.zip
cdo-31e9df55d1e76b6f15bd8fb4a78b06312cedcd1e.tar.gz
cdo-31e9df55d1e76b6f15bd8fb4a78b06312cedcd1e.tar.bz2
[214374] Sending deltas doesn't adjust CDOIDs
https://bugs.eclipse.org/bugs/show_bug.cgi?id=214374
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BugzillasTest.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSession.java3
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSessionPackageManager.java38
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOView.java4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java8
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionPackageManagerImpl.java (renamed from plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionPackageManager.java)42
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionRequest.java4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ModelUtil.java14
11 files changed, 100 insertions, 26 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BugzillasTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BugzillasTest.java
index 0117331..2161cdb 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BugzillasTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BugzillasTest.java
@@ -21,8 +21,6 @@ import org.eclipse.emf.cdo.tests.model1.Model1Factory;
import org.eclipse.emf.cdo.tests.model1.Model1Package;
import org.eclipse.emf.cdo.tests.model1.SalesOrder;
-import org.eclipse.emf.internal.cdo.CDOTransactionImpl;
-
import junit.framework.Assert;
/**
@@ -50,11 +48,10 @@ public class BugzillasTest extends AbstractCDOTest
transaction.commit();
transaction.close();
- CDOTransactionImpl transaction2 = (CDOTransactionImpl)session.openTransaction();
+ CDOTransaction transaction2 = session.openTransaction();
SalesOrder salesOrder2 = (SalesOrder)transaction2.getObject(salesOrder.cdoID(), true);
CDORevision salesRevision = salesOrder2.cdoRevision();
- CDOFeature customerFeature = salesRevision.getCDOClass().lookupFeature(
- Model1Package.eINSTANCE.getSalesOrder_Customer().getFeatureID());
+ CDOFeature customerFeature = session.getPackageManager().convert(Model1Package.eINSTANCE.getSalesOrder_Customer());
Object value = salesRevision.getData().get(customerFeature, 0);
Assert.assertEquals(true, value instanceof CDOID);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSession.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSession.java
index 4091a79..8e18aba 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSession.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSession.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.emf.cdo;
-import org.eclipse.emf.cdo.protocol.model.CDOPackageManager;
import org.eclipse.emf.cdo.util.CDOPackageRegistry;
import org.eclipse.net4j.channel.IChannel;
@@ -49,7 +48,7 @@ public interface CDOSession extends IContainer<CDOView>
public CDOPackageRegistry getPackageRegistry();
- public CDOPackageManager getPackageManager();
+ public CDOSessionPackageManager getPackageManager();
public CDORevisionManager getRevisionManager();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSessionPackageManager.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSessionPackageManager.java
new file mode 100644
index 0000000..3f2032b
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSessionPackageManager.java
@@ -0,0 +1,38 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * 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;
+
+import org.eclipse.emf.cdo.protocol.model.CDOClass;
+import org.eclipse.emf.cdo.protocol.model.CDOFeature;
+import org.eclipse.emf.cdo.protocol.model.CDOPackage;
+import org.eclipse.emf.cdo.protocol.model.CDOPackageManager;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOSessionPackageManager extends CDOPackageManager
+{
+ public CDOPackage convert(EPackage ePackage);
+
+ public CDOClass convert(EClass eClass);
+
+ public CDOFeature convert(EStructuralFeature eFeature);
+
+ public EPackage convert(CDOPackage cdoPackage);
+
+ public EClass convert(CDOClass cdoClass);
+
+ public EStructuralFeature convert(CDOFeature cdoFeature);
+}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOView.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOView.java
index e5f77e4..5e57ae6 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOView.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOView.java
@@ -50,6 +50,8 @@ public interface CDOView extends INotifier
public void setLoadRevisionCollectionChunkSize(int loadRevisionCollectionChunkSize);
+ public CDORevision getRevision(CDOID id);
+
/**
* @see ResourceSet#getResource(URI, boolean)
*/
@@ -57,7 +59,7 @@ public interface CDOView extends INotifier
public CDOObject getObject(CDOID id);
- public CDORevision getRevision(CDOID id);
+ public CDOObject getObject(CDOID id, boolean loadOnDemand);
public boolean isObjectRegistered(CDOID id);
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 e5b1158..a281b89 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
@@ -476,7 +476,7 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
static CDOClassImpl getCDOClass(InternalCDOObject cdoObject)
{
CDOViewImpl view = (CDOViewImpl)cdoObject.cdoView();
- CDOSessionPackageManager packageManager = view.getSession().getPackageManager();
+ CDOSessionPackageManagerImpl packageManager = view.getSession().getPackageManager();
return ModelUtil.getCDOClass(cdoObject.eClass(), packageManager);
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
index 23d62fe..2e4fca9 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
@@ -107,7 +107,7 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession
private CDOPackageRegistryImpl packageRegistry;
- private CDOSessionPackageManager packageManager;
+ private CDOSessionPackageManagerImpl packageManager;
private CDORevisionManagerImpl revisionManager;
@@ -233,7 +233,7 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession
return packageRegistry;
}
- public CDOSessionPackageManager getPackageManager()
+ public CDOSessionPackageManagerImpl getPackageManager()
{
return packageManager;
}
@@ -526,9 +526,9 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession
return new CDOPackageRegistryImpl(this, delegate);
}
- protected CDOSessionPackageManager createPackageManager()
+ protected CDOSessionPackageManagerImpl createPackageManager()
{
- return new CDOSessionPackageManager(this);
+ return new CDOSessionPackageManagerImpl(this);
}
protected CDORevisionManagerImpl createRevisionManager()
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionPackageManager.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionPackageManagerImpl.java
index aff814e..ef50e7b 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionPackageManager.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionPackageManagerImpl.java
@@ -10,9 +10,15 @@
**************************************************************************/
package org.eclipse.emf.internal.cdo;
+import org.eclipse.emf.cdo.CDOSessionPackageManager;
+import org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl;
+import org.eclipse.emf.cdo.internal.protocol.model.CDOFeatureImpl;
import org.eclipse.emf.cdo.internal.protocol.model.CDOPackageImpl;
import org.eclipse.emf.cdo.internal.protocol.model.CDOPackageManagerImpl;
import org.eclipse.emf.cdo.protocol.CDOIDRange;
+import org.eclipse.emf.cdo.protocol.model.CDOClass;
+import org.eclipse.emf.cdo.protocol.model.CDOFeature;
+import org.eclipse.emf.cdo.protocol.model.CDOPackage;
import org.eclipse.emf.cdo.protocol.model.CDOPackageInfo;
import org.eclipse.emf.cdo.protocol.util.TransportException;
import org.eclipse.emf.cdo.util.EMFUtil;
@@ -23,18 +29,20 @@ import org.eclipse.emf.internal.cdo.util.ModelUtil;
import org.eclipse.net4j.signal.failover.IFailOverStrategy;
+import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EStructuralFeature;
import java.util.Collection;
/**
* @author Eike Stepper
*/
-public class CDOSessionPackageManager extends CDOPackageManagerImpl
+public class CDOSessionPackageManagerImpl extends CDOPackageManagerImpl implements CDOSessionPackageManager
{
private CDOSessionImpl session;
- public CDOSessionPackageManager(CDOSessionImpl session)
+ public CDOSessionPackageManagerImpl(CDOSessionImpl session)
{
this.session = session;
ModelUtil.addModelInfos(this);
@@ -45,6 +53,36 @@ public class CDOSessionPackageManager extends CDOPackageManagerImpl
return session;
}
+ public CDOPackage convert(EPackage ePackage)
+ {
+ return ModelUtil.getCDOPackage(ePackage, this);
+ }
+
+ public CDOClass convert(EClass eClass)
+ {
+ return ModelUtil.getCDOClass(eClass, this);
+ }
+
+ public CDOFeature convert(EStructuralFeature eFeature)
+ {
+ return ModelUtil.getCDOFeature(eFeature, this);
+ }
+
+ public EPackage convert(CDOPackage cdoPackage)
+ {
+ return ModelUtil.getEPackage((CDOPackageImpl)cdoPackage, session.getPackageRegistry());
+ }
+
+ public EClass convert(CDOClass cdoClass)
+ {
+ return ModelUtil.getEClass((CDOClassImpl)cdoClass, session.getPackageRegistry());
+ }
+
+ public EStructuralFeature convert(CDOFeature cdoFeature)
+ {
+ return ModelUtil.getEFeature((CDOFeatureImpl)cdoFeature, session.getPackageRegistry());
+ }
+
public void addPackageProxies(Collection<CDOPackageInfo> packageInfos)
{
for (CDOPackageInfo info : packageInfos)
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 737a14c..29e0407 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
@@ -502,7 +502,7 @@ public final class CDOStore implements EStore
throw new IllegalStateException("view == null");
}
- CDOSessionPackageManager packageManager = view.getSession().getPackageManager();
+ CDOSessionPackageManagerImpl packageManager = view.getSession().getPackageManager();
return ModelUtil.getCDOFeature(eFeature, packageManager);
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
index 0ee665a..74cf323 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
@@ -398,7 +398,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements CDOTransaction
}
// Determine which of the used packages are new
- CDOSessionPackageManager packageManager = session.getPackageManager();
+ CDOSessionPackageManagerImpl packageManager = session.getPackageManager();
List<CDOPackage> newPackages = new ArrayList<CDOPackage>();
for (EPackage usedPackage : usedPackages)
{
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionRequest.java
index 3cb981a..7baacd3 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionRequest.java
@@ -20,7 +20,7 @@ import org.eclipse.emf.cdo.protocol.revision.CDODuplicateRevisionException;
import org.eclipse.emf.internal.cdo.CDORevisionManagerImpl;
import org.eclipse.emf.internal.cdo.CDOSessionImpl;
-import org.eclipse.emf.internal.cdo.CDOSessionPackageManager;
+import org.eclipse.emf.internal.cdo.CDOSessionPackageManagerImpl;
import org.eclipse.emf.internal.cdo.bundle.OM;
import org.eclipse.net4j.channel.IChannel;
@@ -116,7 +116,7 @@ public class LoadRevisionRequest extends CDOClientRequest<List<CDORevisionImpl>>
{
CDOSessionImpl session = getSession();
CDORevisionManagerImpl revisionManager = session.getRevisionManager();
- CDOSessionPackageManager packageManager = session.getPackageManager();
+ CDOSessionPackageManagerImpl packageManager = session.getPackageManager();
ArrayList<CDORevisionImpl> revisions = new ArrayList<CDORevisionImpl>(ids.size());
if (PROTOCOL.isEnabled())
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ModelUtil.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ModelUtil.java
index e968454..160cd8c 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ModelUtil.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ModelUtil.java
@@ -26,7 +26,7 @@ import org.eclipse.emf.cdo.util.EMFUtil;
import org.eclipse.emf.internal.cdo.CDOFactoryImpl;
import org.eclipse.emf.internal.cdo.CDOPackageRegistryImpl;
-import org.eclipse.emf.internal.cdo.CDOSessionPackageManager;
+import org.eclipse.emf.internal.cdo.CDOSessionPackageManagerImpl;
import org.eclipse.emf.internal.cdo.bundle.OM;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
@@ -106,7 +106,7 @@ public final class ModelUtil
}
}
- public static CDOPackageImpl getCDOPackage(EPackage ePackage, CDOSessionPackageManager packageManager)
+ public static CDOPackageImpl getCDOPackage(EPackage ePackage, CDOSessionPackageManagerImpl packageManager)
{
String packageURI = ePackage.getNsURI();
CDOPackageImpl cdoPackage = packageManager.lookupPackage(packageURI);
@@ -119,13 +119,13 @@ public final class ModelUtil
return cdoPackage;
}
- public static CDOClassImpl getCDOClass(EClass eClass, CDOSessionPackageManager packageManager)
+ public static CDOClassImpl getCDOClass(EClass eClass, CDOSessionPackageManagerImpl packageManager)
{
CDOPackageImpl cdoPackage = getCDOPackage(eClass.getEPackage(), packageManager);
return cdoPackage.lookupClass(eClass.getClassifierID());
}
- public static CDOFeatureImpl getCDOFeature(EStructuralFeature eFeature, CDOSessionPackageManager packageManager)
+ public static CDOFeatureImpl getCDOFeature(EStructuralFeature eFeature, CDOSessionPackageManagerImpl packageManager)
{
CDOClassImpl cdoClass = getCDOClass(eFeature.getEContainingClass(), packageManager);
return cdoClass.lookupFeature(eFeature.getFeatureID());
@@ -135,7 +135,7 @@ public final class ModelUtil
* @see EMFUtil#getPersistentFeatures(org.eclipse.emf.common.util.EList)
* @see http://www.eclipse.org/newsportal/article.php?id=26780&group=eclipse.tools.emf#26780
*/
- private static CDOPackageImpl createCDOPackage(EPackage ePackage, CDOSessionPackageManager packageManager)
+ private static CDOPackageImpl createCDOPackage(EPackage ePackage, CDOSessionPackageManagerImpl packageManager)
{
String packageURI = ePackage.getNsURI();
String name = ePackage.getName();
@@ -309,7 +309,7 @@ public final class ModelUtil
return null;
}
- public static void addModelInfos(CDOSessionPackageManager packageManager)
+ public static void addModelInfos(CDOSessionPackageManagerImpl packageManager)
{
// Ecore
CDOCorePackageImpl corePackage = packageManager.getCDOCorePackage();
@@ -326,7 +326,7 @@ public final class ModelUtil
}
@Deprecated
- public static void removeModelInfos(CDOSessionPackageManager packageManager)
+ public static void removeModelInfos(CDOSessionPackageManagerImpl packageManager)
{
// Ecore
CDOCorePackageImpl corePackage = packageManager.getCDOCorePackage();