summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaspar De Groot2010-04-12 06:14:16 (EDT)
committerCaspar De Groot2010-04-12 06:14:16 (EDT)
commitd1842a940a0a5bccd257dd3ca7aa16d687e8d5ac (patch)
tree0087f29c8498a198d9ceee1a5ea316785bd9495b
parent405621fdd1c641161c8895bb62b3ef917fed6d7b (diff)
downloadcdo-d1842a940a0a5bccd257dd3ca7aa16d687e8d5ac.zip
cdo-d1842a940a0a5bccd257dd3ca7aa16d687e8d5ac.tar.gz
cdo-d1842a940a0a5bccd257dd3ca7aa16d687e8d5ac.tar.bz2
[303466] CDO not robust when using dynamic packages
https://bugs.eclipse.org/bugs/show_bug.cgi?id=303466
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java39
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDODataInput.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageUnitImpl.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/protocol/CDODataInputImpl.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageUnit.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadPackagesRequest.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RefreshSessionRequest.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MetaDataManager.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernatePackageHandler.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java14
11 files changed, 66 insertions, 46 deletions
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 d1aaabf..6b5f696 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
@@ -30,6 +30,7 @@ import org.eclipse.emf.ecore.EEnumLiteral;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.FeatureMapUtil;
@@ -383,13 +384,14 @@ public final class CDOModelUtil
}
/**
- * @since 2.0
+ * @since 3.0
*/
- public static EPackage readPackage(ExtendedDataInput in, EPackage.Registry packageRegistry) throws IOException
+ public static EPackage readPackage(ExtendedDataInput in, ResourceSet resourceSet, boolean lookForResource)
+ throws IOException
{
String uri = in.readString();
boolean zipped = in.readBoolean();
byte[] bytes = in.readByteArray();
- return EMFUtil.createEPackage(uri, bytes, zipped, packageRegistry);
+ return EMFUtil.createEPackage(uri, bytes, zipped, resourceSet, lookForResource);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java
index 038d351..23b6063 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java
@@ -42,8 +42,8 @@ import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.Map.Entry;
+import java.util.Set;
/**
* @author Eike Stepper
@@ -242,7 +242,8 @@ public final class EMFUtil
Resource resource = ePackage.eResource();
if (resource == null)
{
- resource = createEcoreResource(ePackage.getNsURI(), packageRegistry);
+ ResourceSet resourceSet = EMFUtil.newEcoreResourceSet(packageRegistry);
+ resource = resourceSet.createResource(URI.createURI(ePackage.getNsURI()));
resource.getContents().add(ePackage);
}
@@ -256,12 +257,30 @@ public final class EMFUtil
}
}
- public static EPackage createEPackage(String uri, byte[] bytes, boolean zipped, EPackage.Registry packageRegistry)
+ /**
+ * @since 3.0
+ */
+ public static EPackage createEPackage(String uri, byte[] bytes, boolean zipped, ResourceSet resourceSet,
+ boolean lookForResource)
{
try
{
+ Resource resource = null;
+ if (lookForResource)
+ {
+ resource = resourceSet.getResource(URI.createURI(uri), false);
+ if (resource != null)
+ {
+ resource.unload();
+ }
+ }
+
+ if (resource == null)
+ {
+ resource = resourceSet.createResource(URI.createURI(uri));
+ }
+
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
- Resource resource = createEcoreResource(uri, packageRegistry);
resource.load(bais, createResourceOptions(zipped));
EList<EObject> contents = resource.getContents();
@@ -273,18 +292,6 @@ public final class EMFUtil
}
}
- private static Resource createEcoreResource(String uri, EPackage.Registry packageRegistry)
- {
- ResourceSet resourceSet = new ResourceSetImpl();
- resourceSet.setPackageRegistry(packageRegistry);
-
- Resource.Factory resourceFactory = new EcoreResourceFactoryImpl();
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", resourceFactory); //$NON-NLS-1$
- resourceSet.getResourceFactoryRegistry().getProtocolToFactoryMap().put("*", resourceFactory); //$NON-NLS-1$
-
- return resourceSet.createResource(URI.createURI(uri));
- }
-
private static Map<String, Object> createResourceOptions(boolean zipped)
{
Map<String, Object> options = new HashMap<String, Object>();
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDODataInput.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDODataInput.java
index cc70116..c44ca1d 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDODataInput.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDODataInput.java
@@ -23,7 +23,6 @@ import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
import org.eclipse.emf.cdo.common.model.CDOClassifierRef;
import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
-import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
import org.eclipse.emf.cdo.common.model.CDOType;
import org.eclipse.emf.cdo.common.revision.CDOList;
@@ -38,6 +37,7 @@ import org.eclipse.net4j.util.io.ExtendedDataInput;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.ResourceSet;
import java.io.IOException;
@@ -49,9 +49,9 @@ public interface CDODataInput extends ExtendedDataInput
{
// /////////////////////////////////////////////////////////////////////////////////////////////////
- public CDOPackageUnit readCDOPackageUnit(CDOPackageRegistry packageRegistry) throws IOException;
+ public CDOPackageUnit readCDOPackageUnit(ResourceSet resourceSet) throws IOException;
- public CDOPackageUnit[] readCDOPackageUnits(CDOPackageRegistry packageRegistry) throws IOException;
+ public CDOPackageUnit[] readCDOPackageUnits(ResourceSet resourceSet) throws IOException;
public CDOPackageUnit.Type readCDOPackageUnitType() throws IOException;
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageUnitImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageUnitImpl.java
index 48bf633..1637aea 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageUnitImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageUnitImpl.java
@@ -27,6 +27,7 @@ import org.eclipse.net4j.util.CheckUtil;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.util.EcoreUtil;
import java.io.IOException;
@@ -275,14 +276,15 @@ public class CDOPackageUnitImpl implements InternalCDOPackageUnit
}
}
- public void read(CDODataInput in, InternalCDOPackageRegistry packageRegistry) throws IOException
+ public void read(CDODataInput in, ResourceSet resourceSet) throws IOException
{
EPackage ePackage = null;
boolean withPackages = in.readBoolean();
if (withPackages)
{
- CheckUtil.checkArg(packageRegistry, "packageRegistry");
- ePackage = CDOModelUtil.readPackage(in, packageRegistry);
+ CheckUtil.checkArg(resourceSet, "resourceSet"); //$NON-NLS-1$
+ CheckUtil.checkNull(resourceSet.getPackageRegistry(), "ResourceSet's packageRegistry == null");
+ ePackage = CDOModelUtil.readPackage(in, resourceSet, true);
setState(State.LOADED);
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/protocol/CDODataInputImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/protocol/CDODataInputImpl.java
index 047234a..7650589 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/protocol/CDODataInputImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/protocol/CDODataInputImpl.java
@@ -20,11 +20,11 @@ import org.eclipse.emf.cdo.common.commit.CDOCommitData;
import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
import org.eclipse.emf.cdo.common.commit.CDOCommitInfoManager;
import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOID.Type;
import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
-import org.eclipse.emf.cdo.common.id.CDOID.Type;
import org.eclipse.emf.cdo.common.model.CDOClassifierRef;
import org.eclipse.emf.cdo.common.model.CDOModelUtil;
import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
@@ -78,6 +78,8 @@ import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.FeatureMapUtil;
import java.io.IOException;
@@ -97,14 +99,14 @@ public abstract class CDODataInputImpl extends ExtendedDataInput.Delegating impl
super(delegate);
}
- public CDOPackageUnit readCDOPackageUnit(CDOPackageRegistry packageRegistry) throws IOException
+ public CDOPackageUnit readCDOPackageUnit(ResourceSet resourceSet) throws IOException
{
InternalCDOPackageUnit packageUnit = (InternalCDOPackageUnit)CDOModelUtil.createPackageUnit();
- packageUnit.read(this, (InternalCDOPackageRegistry)packageRegistry);
+ packageUnit.read(this, resourceSet);
return packageUnit;
}
- public CDOPackageUnit[] readCDOPackageUnits(CDOPackageRegistry packageRegistry) throws IOException
+ public CDOPackageUnit[] readCDOPackageUnits(ResourceSet resourceSet) throws IOException
{
int size = readInt();
if (TRACER.isEnabled())
@@ -115,7 +117,7 @@ public abstract class CDODataInputImpl extends ExtendedDataInput.Delegating impl
CDOPackageUnit[] packageUnits = new CDOPackageUnit[size];
for (int i = 0; i < size; i++)
{
- packageUnits[i] = readCDOPackageUnit(packageRegistry);
+ packageUnits[i] = readCDOPackageUnit(resourceSet);
}
return packageUnits;
@@ -216,12 +218,14 @@ public abstract class CDODataInputImpl extends ExtendedDataInput.Delegating impl
public CDOCommitData readCDOCommitData() throws IOException
{
InternalCDOPackageRegistry packageRegistry = (InternalCDOPackageRegistry)getPackageRegistry();
+ ResourceSet resourceSet = new ResourceSetImpl();
+ resourceSet.setPackageRegistry(packageRegistry);
int size = readInt();
List<CDOPackageUnit> newPackageUnits = new ArrayList<CDOPackageUnit>(size);
for (int i = 0; i < size; i++)
{
- CDOPackageUnit data = readCDOPackageUnit(packageRegistry);
+ CDOPackageUnit data = readCDOPackageUnit(resourceSet);
newPackageUnits.add(data);
packageRegistry.putPackageUnit((InternalCDOPackageUnit)data);
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageUnit.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageUnit.java
index 9526a1b..367113e 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageUnit.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageUnit.java
@@ -15,6 +15,7 @@ import org.eclipse.emf.cdo.common.protocol.CDODataInput;
import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.ResourceSet;
import java.io.IOException;
@@ -52,7 +53,7 @@ public interface InternalCDOPackageUnit extends CDOPackageUnit
/**
* @since 3.0
*/
- public void read(CDODataInput in, InternalCDOPackageRegistry packageRegistry) throws IOException;
+ public void read(CDODataInput in, ResourceSet resourceSet) throws IOException;
public void init(EPackage ePackage);
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadPackagesRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadPackagesRequest.java
index 28026ab..6ebd8ce 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadPackagesRequest.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadPackagesRequest.java
@@ -21,6 +21,7 @@ import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.ResourceSet;
import java.io.IOException;
@@ -54,7 +55,8 @@ public class LoadPackagesRequest extends CDOClientRequest<EPackage[]>
@Override
protected EPackage[] confirming(CDODataInput in) throws IOException
{
- EPackage ePackage = CDOModelUtil.readPackage(in, packageUnit.getPackageRegistry());
+ ResourceSet resourceSet = EMFUtil.newEcoreResourceSet(packageUnit.getPackageRegistry());
+ EPackage ePackage = CDOModelUtil.readPackage(in, resourceSet, false);
return EMFUtil.getAllPackages(ePackage);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RefreshSessionRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RefreshSessionRequest.java
index 14b5a79..c19bea1 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RefreshSessionRequest.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RefreshSessionRequest.java
@@ -14,12 +14,14 @@ package org.eclipse.emf.cdo.internal.net4j.protocol;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
+import org.eclipse.emf.cdo.common.model.EMFUtil;
import org.eclipse.emf.cdo.common.protocol.CDODataInput;
import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
+import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.spi.cdo.CDOSessionProtocol.RefreshSessionResult;
import java.io.IOException;
@@ -87,6 +89,7 @@ public class RefreshSessionRequest extends CDOClientRequest<RefreshSessionResult
lastUpdateTime = in.readLong();
RefreshSessionResult result = new RefreshSessionResult(lastUpdateTime);
+ ResourceSet resourceSet = EMFUtil.newEcoreResourceSet();
for (;;)
{
byte type = in.readByte();
@@ -94,7 +97,7 @@ public class RefreshSessionRequest extends CDOClientRequest<RefreshSessionResult
{
case CDOProtocolConstants.REFRESH_PACKAGE_UNIT:
{
- CDOPackageUnit packageUnit = in.readCDOPackageUnit(null);
+ CDOPackageUnit packageUnit = in.readCDOPackageUnit(resourceSet);
result.addPackageUnit(packageUnit);
break;
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MetaDataManager.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MetaDataManager.java
index c63ed9f..fe791fc 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MetaDataManager.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MetaDataManager.java
@@ -39,6 +39,7 @@ import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -191,7 +192,8 @@ public class MetaDataManager extends Lifecycle implements IMetaDataManager
private EPackage createEPackage(InternalCDOPackageUnit packageUnit, byte[] bytes)
{
- return EMFUtil.createEPackage(packageUnit.getID(), bytes, ZIP_PACKAGE_BYTES, getPackageRegistry());
+ ResourceSet resourceSet = EMFUtil.newEcoreResourceSet(getPackageRegistry());
+ return EMFUtil.createEPackage(packageUnit.getID(), bytes, ZIP_PACKAGE_BYTES, resourceSet, false);
}
private byte[] getEPackageBytes(InternalCDOPackageUnit packageUnit)
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernatePackageHandler.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernatePackageHandler.java
index 0f76be9..38b8a8f 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernatePackageHandler.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernatePackageHandler.java
@@ -25,6 +25,7 @@ import org.eclipse.net4j.util.lifecycle.Lifecycle;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.ResourceSet;
import org.hibernate.Criteria;
import org.hibernate.Session;
@@ -226,8 +227,8 @@ public class HibernatePackageHandler extends Lifecycle
throw new IllegalArgumentException("EPackages with root uri " + nsUri + " not found"); //$NON-NLS-1$ //$NON-NLS-2$
}
- final EPackage rootEPackage = EMFUtil
- .createEPackage(nsUri, ePackageBlob, ZIP_PACKAGE_BYTES, getPackageRegistry());
+ ResourceSet resourceSet = EMFUtil.newEcoreResourceSet(getPackageRegistry());
+ final EPackage rootEPackage = EMFUtil.createEPackage(nsUri, ePackageBlob, ZIP_PACKAGE_BYTES, resourceSet, false);
epacks = EMFUtil.getAllPackages(rootEPackage);
ePackagesByRootUri.put(nsUri, epacks);
}
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java
index 760ca5f..8ddcbfd 100644
--- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java
@@ -19,6 +19,7 @@ import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
import org.eclipse.emf.cdo.common.id.CDOIDProvider;
import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
+import org.eclipse.emf.cdo.common.model.EMFUtil;
import org.eclipse.emf.cdo.common.protocol.CDODataInput;
import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
@@ -49,7 +50,7 @@ import org.eclipse.net4j.util.om.monitor.OMMonitor;
import org.eclipse.net4j.util.om.monitor.ProgressDistributor;
import org.eclipse.net4j.util.om.trace.ContextTracer;
-import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.util.EcoreUtil;
import java.io.IOException;
@@ -200,21 +201,16 @@ public class CommitTransactionIndication extends IndicationWithMonitoring
}
InternalCDOPackageRegistry packageRegistry = commitContext.getPackageRegistry();
+ ResourceSet resourceSet = EMFUtil.newEcoreResourceSet(packageRegistry);
for (int i = 0; i < newPackageUnits.length; i++)
{
- newPackageUnits[i] = (InternalCDOPackageUnit)in.readCDOPackageUnit(packageRegistry);
+ newPackageUnits[i] = (InternalCDOPackageUnit)in.readCDOPackageUnit(resourceSet);
packageRegistry.putPackageUnit(newPackageUnits[i]); // Must happen before readCDORevision!!!
monitor.worked();
}
// When all packages are deserialized and registered, resolve them
- for (InternalCDOPackageUnit packageUnit : newPackageUnits)
- {
- for (EPackage ePackage : packageUnit.getEPackages(true))
- {
- EcoreUtil.resolveAll(ePackage);
- }
- }
+ EcoreUtil.resolveAll(resourceSet);
// New objects
if (TRACER.isEnabled())