diff options
author | Eike Stepper | 2008-06-02 00:21:43 -0400 |
---|---|---|
committer | Eike Stepper | 2008-06-02 00:21:43 -0400 |
commit | 7dde9f25e6985370aff5c6368c81a30d1a2a700f (patch) | |
tree | b213ae1819d1dc0eae632afbe054a1dd402bf0cd | |
parent | 697aa7bbc5de256eeddcef0d9f1554fecd7210ad (diff) | |
download | cdo-7dde9f25e6985370aff5c6368c81a30d1a2a700f.zip cdo-7dde9f25e6985370aff5c6368c81a30d1a2a700f.tar.gz cdo-7dde9f25e6985370aff5c6368c81a30d1a2a700f.tar.xz |
[234839] Performance problem when adding to a resource.content
https://bugs.eclipse.org/bugs/show_bug.cgi?id=234839
15 files changed, 245 insertions, 118 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/AllTests.java b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/AllTests.java index 2532da4..f05e6e1 100644 --- a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/AllTests.java +++ b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/AllTests.java @@ -18,7 +18,7 @@ import org.eclipse.emf.cdo.tests.InitialTest; import org.eclipse.emf.cdo.tests.InvalidationTest; import org.eclipse.emf.cdo.tests.MangoTest; import org.eclipse.emf.cdo.tests.NoLegacyTest; -import org.eclipse.emf.cdo.tests.ResourceTest; +import org.eclipse.emf.cdo.tests.NonCDOResourceTest; import org.eclipse.emf.cdo.tests.RevisionDeltaTest; import org.eclipse.emf.cdo.tests.RevisionHolderTest; import org.eclipse.emf.cdo.tests.RollbackTest; @@ -50,7 +50,7 @@ public class AllTests suite.addTestSuite(MangoTest.class); suite.addTestSuite(EnumTest.class); suite.addTestSuite(NoLegacyTest.class); - suite.addTestSuite(ResourceTest.class); + suite.addTestSuite(NonCDOResourceTest.class); suite.addTestSuite(InvalidationTest.class); suite.addTestSuite(InitialTest.class); suite.addTestSuite(ViewTest.class); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java index 76551ab..97a9dc6 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java @@ -28,7 +28,7 @@ public class AllTests suite.addTestSuite(EnumTest.class); suite.addTestSuite(StateMachineTest.class); suite.addTestSuite(ViewTest.class); - suite.addTestSuite(ResourceTest.class); + suite.addTestSuite(NonCDOResourceTest.class); suite.addTestSuite(ContainmentTest.class); suite.addTestSuite(InvalidationTest.class); suite.addTestSuite(RollbackTest.class); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ResourceTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/NonCDOResourceTest.java index f63638a..c950082 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ResourceTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/NonCDOResourceTest.java @@ -25,7 +25,7 @@ import junit.framework.TestCase; * @author Simon McDuff * @author Eike Stepper */ -public class ResourceTest extends TestCase +public class NonCDOResourceTest extends TestCase { public void testNonCDOResource() throws Exception { diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ViewTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ViewTest.java index 54b8d64..dfad32f 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ViewTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ViewTest.java @@ -15,7 +15,15 @@ import org.eclipse.emf.cdo.CDOTransaction; import org.eclipse.emf.cdo.CDOView; import org.eclipse.emf.cdo.eresource.CDOResource; import org.eclipse.emf.cdo.protocol.id.CDOID; +import org.eclipse.emf.cdo.protocol.model.resource.CDOContentsFeature; +import org.eclipse.emf.cdo.protocol.model.resource.CDOResourcePackage; +import org.eclipse.emf.cdo.protocol.revision.CDOReferenceProxy; +import org.eclipse.emf.cdo.protocol.revision.CDORevisionData; +import org.eclipse.emf.cdo.tests.model1.Company; +import org.eclipse.emf.cdo.tests.model1.Model1Factory; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; @@ -60,6 +68,94 @@ public class ViewTest extends AbstractCDOTest session.close(); } + public void testUniqueResourceContents() throws Exception + { + { + CDOSession session = openModel1Session(); + CDOTransaction transaction = session.openTransaction(); + CDOResource resource = transaction.createResource("/test1"); + EList<EObject> contents = resource.getContents(); + for (int i = 0; i < 100; i++) + { + Company company = Model1Factory.eINSTANCE.createCompany(); + company.setName("Company " + i); + contents.add(company); + } + + transaction.commit(); + session.close(); + } + + CDOSession session = openModel1Session(); + session.setReferenceChunkSize(2); + + CDOTransaction transaction = session.openTransaction(); + transaction.setUniqueResourceContents(true); + + CDOResource resource = transaction.getResource("/test1"); + EList<EObject> contents = resource.getContents(); + for (int i = 100; i < 110; i++) + { + Company company = Model1Factory.eINSTANCE.createCompany(); + company.setName("Company " + i); + contents.add(company); + } + + CDORevisionData revision = resource.cdoRevision().getData(); + CDOResourcePackage resourcePackage = session.getPackageManager().getCDOResourcePackage(); + CDOContentsFeature contentsFeature = resourcePackage.getCDOResourceClass().getCDOContentsFeature(); + assertEquals(false, revision.get(contentsFeature, 0) instanceof CDOReferenceProxy); + assertEquals(false, revision.get(contentsFeature, 1) instanceof CDOReferenceProxy); + assertEquals(false, revision.get(contentsFeature, 2) instanceof CDOReferenceProxy); + assertEquals(false, revision.get(contentsFeature, 99) instanceof CDOReferenceProxy); + assertEquals(false, revision.get(contentsFeature, 100) instanceof CDOReferenceProxy); + session.close(); + } + + public void testNonUniqueResourceContents() throws Exception + { + { + CDOSession session = openModel1Session(); + CDOTransaction transaction = session.openTransaction(); + CDOResource resource = transaction.createResource("/test1"); + EList<EObject> contents = resource.getContents(); + for (int i = 0; i < 100; i++) + { + Company company = Model1Factory.eINSTANCE.createCompany(); + company.setName("Company " + i); + contents.add(company); + } + + transaction.commit(); + session.close(); + } + + CDOSession session = openModel1Session(); + session.setReferenceChunkSize(2); + + CDOTransaction transaction = session.openTransaction(); + transaction.setUniqueResourceContents(false); + + CDOResource resource = transaction.getResource("/test1"); + EList<EObject> contents = resource.getContents(); + for (int i = 100; i < 110; i++) + { + Company company = Model1Factory.eINSTANCE.createCompany(); + company.setName("Company " + i); + contents.add(company); + } + + CDORevisionData revision = resource.cdoRevision().getData(); + CDOResourcePackage resourcePackage = session.getPackageManager().getCDOResourcePackage(); + CDOContentsFeature contentsFeature = resourcePackage.getCDOResourceClass().getCDOContentsFeature(); + assertEquals(false, revision.get(contentsFeature, 0) instanceof CDOReferenceProxy); + assertEquals(false, revision.get(contentsFeature, 1) instanceof CDOReferenceProxy); + assertEquals(true, revision.get(contentsFeature, 2) instanceof CDOReferenceProxy); + assertEquals(true, revision.get(contentsFeature, 99) instanceof CDOReferenceProxy); + assertEquals(false, revision.get(contentsFeature, 100) instanceof CDOReferenceProxy); + session.close(); + } + public void testExternalResourceSet() throws Exception { { diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransactionHandler.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransactionHandler.java index 701f895..bfacb39 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransactionHandler.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransactionHandler.java @@ -21,8 +21,8 @@ import org.eclipse.emf.cdo.protocol.revision.delta.CDOFeatureDelta; public interface CDOTransactionHandler { /** - * Called by a <code>CDOTransaction</code> <b>before</b> an object is added. The implementor of this method is - * allowed to throw an unchecked exception that will propagate up to the operation that is about to add the object. + * Called by a <code>CDOTransaction</code> <b>before</b> an object is added. The implementor of this method is allowed + * to throw an unchecked exception that will propagate up to the operation that is about to add the object. */ public void addingObject(CDOTransaction transaction, CDOObject object); 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 e81c106..de18e55 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 @@ -39,9 +39,13 @@ public interface CDOView extends CDOProtocolView, INotifier public boolean hasConflict(); - public boolean isEnableInvalidationNotifications(); + public boolean hasUniqueResourceContents(); - public void setEnableInvalidationNotifications(boolean on); + public void setUniqueResourceContents(boolean uniqueResourceContents); + + public boolean isInvalidationNotificationsEnabled(); + + public void setInvalidationNotificationsEnabled(boolean invalidationNotificationsEnabled); public int getLoadRevisionCollectionChunkSize(); diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResource.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResource.java index a637e01..9c73db5 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResource.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResource.java @@ -16,8 +16,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.ResourceSet; /** - * <!-- begin-user-doc --> A representation of the model object '<em><b>CDO Resource</b></em>'. <!-- end-user-doc - * --> + * <!-- begin-user-doc --> A representation of the model object '<em><b>CDO Resource</b></em>'. <!-- end-user-doc --> * <p> * The following features are supported: * <ul> @@ -29,6 +28,7 @@ import org.eclipse.emf.ecore.resource.ResourceSet; * <li>{@link org.eclipse.emf.cdo.eresource.CDOResource#isTrackingModification <em>Tracking Modification</em>}</li> * <li>{@link org.eclipse.emf.cdo.eresource.CDOResource#getErrors <em>Errors</em>}</li> * <li>{@link org.eclipse.emf.cdo.eresource.CDOResource#getWarnings <em>Warnings</em>}</li> + * <li>{@link org.eclipse.emf.cdo.eresource.CDOResource#getTimeStamp <em>Time Stamp</em>}</li> * <li>{@link org.eclipse.emf.cdo.eresource.CDOResource#getPath <em>Path</em>}</li> * </ul> * </p> @@ -43,8 +43,8 @@ public interface CDOResource extends EresourceObject /** * Returns the value of the '<em><b>Resource Set</b></em>' attribute. <!-- begin-user-doc --> * <p> - * If the meaning of the '<em>Resource Set</em>' attribute isn't clear, there really should be more of a - * description here... + * If the meaning of the '<em>Resource Set</em>' attribute isn't clear, there really should be more of a description + * here... * </p> * <!-- end-user-doc --> * @@ -70,8 +70,7 @@ public interface CDOResource extends EresourceObject /** * Returns the value of the '<em><b>URI</b></em>' attribute. <!-- begin-user-doc --> * <p> - * If the meaning of the '<em>URI</em>' attribute isn't clear, there really should be more of a description - * here... + * If the meaning of the '<em>URI</em>' attribute isn't clear, there really should be more of a description here... * </p> * <!-- end-user-doc --> * @@ -98,8 +97,8 @@ public interface CDOResource extends EresourceObject * Returns the value of the '<em><b>Contents</b></em>' containment reference list. The list contents are of type * {@link org.eclipse.emf.ecore.EObject}. <!-- begin-user-doc --> * <p> - * If the meaning of the '<em>Contents</em>' containment reference list isn't clear, there really should be more - * of a description here... + * If the meaning of the '<em>Contents</em>' containment reference list isn't clear, there really should be more of a + * description here... * </p> * <!-- end-user-doc --> * @@ -140,8 +139,7 @@ public interface CDOResource extends EresourceObject /** * Returns the value of the '<em><b>Loaded</b></em>' attribute. <!-- begin-user-doc --> * <p> - * If the meaning of the '<em>Loaded</em>' attribute isn't clear, there really should be more of a description - * here... + * If the meaning of the '<em>Loaded</em>' attribute isn't clear, there really should be more of a description here... * </p> * <!-- end-user-doc --> * @@ -154,8 +152,8 @@ public interface CDOResource extends EresourceObject boolean isLoaded(); /** - * Sets the value of the '{@link org.eclipse.emf.cdo.eresource.CDOResource#isLoaded <em>Loaded</em>}' attribute. - * <!-- begin-user-doc --> <!-- end-user-doc --> + * Sets the value of the '{@link org.eclipse.emf.cdo.eresource.CDOResource#isLoaded <em>Loaded</em>}' attribute. <!-- + * begin-user-doc --> <!-- end-user-doc --> * * @param value * the new value of the '<em>Loaded</em>' attribute. @@ -181,8 +179,8 @@ public interface CDOResource extends EresourceObject boolean isTrackingModification(); /** - * Sets the value of the '{@link org.eclipse.emf.cdo.eresource.CDOResource#isTrackingModification <em>Tracking Modification</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> + * Sets the value of the '{@link org.eclipse.emf.cdo.eresource.CDOResource#isTrackingModification + * <em>Tracking Modification</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> * * @param value * the new value of the '<em>Tracking Modification</em>' attribute. @@ -195,8 +193,8 @@ public interface CDOResource extends EresourceObject * Returns the value of the '<em><b>Errors</b></em>' attribute list. The list contents are of type * {@link org.eclipse.emf.ecore.resource.Resource.Diagnostic}. <!-- begin-user-doc --> * <p> - * If the meaning of the '<em>Errors</em>' attribute list isn't clear, there really should be more of a - * description here... + * If the meaning of the '<em>Errors</em>' attribute list isn't clear, there really should be more of a description + * here... * </p> * <!-- end-user-doc --> * @@ -211,8 +209,8 @@ public interface CDOResource extends EresourceObject * Returns the value of the '<em><b>Warnings</b></em>' attribute list. The list contents are of type * {@link org.eclipse.emf.ecore.resource.Resource.Diagnostic}. <!-- begin-user-doc --> * <p> - * If the meaning of the '<em>Warnings</em>' attribute list isn't clear, there really should be more of a - * description here... + * If the meaning of the '<em>Warnings</em>' attribute list isn't clear, there really should be more of a description + * here... * </p> * <!-- end-user-doc --> * @@ -253,8 +251,7 @@ public interface CDOResource extends EresourceObject /** * Returns the value of the '<em><b>Path</b></em>' attribute. <!-- begin-user-doc --> * <p> - * If the meaning of the '<em>Path</em>' attribute isn't clear, there really should be more of a description - * here... + * If the meaning of the '<em>Path</em>' attribute isn't clear, there really should be more of a description here... * </p> * <!-- end-user-doc --> * diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourcePackage.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourcePackage.java index 8d5487e..5863888 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourcePackage.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourcePackage.java @@ -112,8 +112,8 @@ public interface EresourcePackage extends EPackage int CDO_RESOURCE__LOADED = 4; /** - * The feature id for the '<em><b>Tracking Modification</b></em>' attribute. <!-- begin-user-doc --> <!-- - * end-user-doc --> + * The feature id for the '<em><b>Tracking Modification</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc + * --> * * @generated * @ordered @@ -129,8 +129,7 @@ public interface EresourcePackage extends EPackage int CDO_RESOURCE__ERRORS = 6; /** - * The feature id for the '<em><b>Warnings</b></em>' attribute list. <!-- begin-user-doc --> <!-- end-user-doc - * --> + * The feature id for the '<em><b>Warnings</b></em>' attribute list. <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated * @ordered @@ -154,8 +153,8 @@ public interface EresourcePackage extends EPackage int CDO_RESOURCE__PATH = 9; /** - * The number of structural features of the '<em>CDO Resource</em>' class. <!-- begin-user-doc --> <!-- - * end-user-doc --> + * The number of structural features of the '<em>CDO Resource</em>' class. <!-- begin-user-doc --> <!-- end-user-doc + * --> * * @generated * @ordered @@ -200,8 +199,8 @@ public interface EresourcePackage extends EPackage EClass getCDOResource(); /** - * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResource#getResourceSet <em>Resource Set</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> + * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResource#getResourceSet + * <em>Resource Set</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> * * @return the meta object for the attribute '<em>Resource Set</em>'. * @see org.eclipse.emf.cdo.eresource.CDOResource#getResourceSet() @@ -222,8 +221,9 @@ public interface EresourcePackage extends EPackage EAttribute getCDOResource_URI(); /** - * Returns the meta object for the containment reference list '{@link org.eclipse.emf.cdo.eresource.CDOResource#getContents <em>Contents</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> + * Returns the meta object for the containment reference list ' + * {@link org.eclipse.emf.cdo.eresource.CDOResource#getContents <em>Contents</em>}'. <!-- begin-user-doc --> <!-- + * end-user-doc --> * * @return the meta object for the containment reference list '<em>Contents</em>'. * @see org.eclipse.emf.cdo.eresource.CDOResource#getContents() @@ -233,8 +233,8 @@ public interface EresourcePackage extends EPackage EReference getCDOResource_Contents(); /** - * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResource#isModified <em>Modified</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> + * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResource#isModified + * <em>Modified</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> * * @return the meta object for the attribute '<em>Modified</em>'. * @see org.eclipse.emf.cdo.eresource.CDOResource#isModified() @@ -244,8 +244,8 @@ public interface EresourcePackage extends EPackage EAttribute getCDOResource_Modified(); /** - * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResource#isLoaded <em>Loaded</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> + * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResource#isLoaded + * <em>Loaded</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> * * @return the meta object for the attribute '<em>Loaded</em>'. * @see org.eclipse.emf.cdo.eresource.CDOResource#isLoaded() @@ -255,8 +255,8 @@ public interface EresourcePackage extends EPackage EAttribute getCDOResource_Loaded(); /** - * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResource#isTrackingModification <em>Tracking Modification</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> + * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResource#isTrackingModification + * <em>Tracking Modification</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> * * @return the meta object for the attribute '<em>Tracking Modification</em>'. * @see org.eclipse.emf.cdo.eresource.CDOResource#isTrackingModification() @@ -266,8 +266,8 @@ public interface EresourcePackage extends EPackage EAttribute getCDOResource_TrackingModification(); /** - * Returns the meta object for the attribute list '{@link org.eclipse.emf.cdo.eresource.CDOResource#getErrors <em>Errors</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> + * Returns the meta object for the attribute list '{@link org.eclipse.emf.cdo.eresource.CDOResource#getErrors + * <em>Errors</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> * * @return the meta object for the attribute list '<em>Errors</em>'. * @see org.eclipse.emf.cdo.eresource.CDOResource#getErrors() @@ -277,8 +277,8 @@ public interface EresourcePackage extends EPackage EAttribute getCDOResource_Errors(); /** - * Returns the meta object for the attribute list '{@link org.eclipse.emf.cdo.eresource.CDOResource#getWarnings <em>Warnings</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> + * Returns the meta object for the attribute list '{@link org.eclipse.emf.cdo.eresource.CDOResource#getWarnings + * <em>Warnings</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> * * @return the meta object for the attribute list '<em>Warnings</em>'. * @see org.eclipse.emf.cdo.eresource.CDOResource#getWarnings() @@ -288,8 +288,8 @@ public interface EresourcePackage extends EPackage EAttribute getCDOResource_Warnings(); /** - * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResource#getTimeStamp <em>Time Stamp</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> + * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResource#getTimeStamp + * <em>Time Stamp</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> * * @return the meta object for the attribute '<em>Time Stamp</em>'. * @see org.eclipse.emf.cdo.eresource.CDOResource#getTimeStamp() @@ -299,8 +299,8 @@ public interface EresourcePackage extends EPackage EAttribute getCDOResource_TimeStamp(); /** - * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResource#getPath <em>Path</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> + * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResource#getPath <em>Path</em>} + * '. <!-- begin-user-doc --> <!-- end-user-doc --> * * @return the meta object for the attribute '<em>Path</em>'. * @see org.eclipse.emf.cdo.eresource.CDOResource#getPath() @@ -332,8 +332,8 @@ public interface EresourcePackage extends EPackage EDataType getURI(); /** - * Returns the meta object for data type '{@link org.eclipse.emf.ecore.resource.Resource.Diagnostic <em>Diagnostic</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> + * Returns the meta object for data type '{@link org.eclipse.emf.ecore.resource.Resource.Diagnostic + * <em>Diagnostic</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> * * @return the meta object for data type '<em>Diagnostic</em>'. * @see org.eclipse.emf.ecore.resource.Resource.Diagnostic @@ -365,8 +365,8 @@ public interface EresourcePackage extends EPackage interface Literals { /** - * The meta object literal for the '{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl <em>CDO Resource</em>}' - * class. <!-- begin-user-doc --> <!-- end-user-doc --> + * The meta object literal for the '{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl <em>CDO Resource</em>} + * ' class. <!-- begin-user-doc --> <!-- end-user-doc --> * * @see org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl * @see org.eclipse.emf.cdo.eresource.impl.EresourcePackageImpl#getCDOResource() @@ -375,8 +375,8 @@ public interface EresourcePackage extends EPackage EClass CDO_RESOURCE = eINSTANCE.getCDOResource(); /** - * The meta object literal for the '<em><b>Resource Set</b></em>' attribute feature. <!-- begin-user-doc --> - * <!-- end-user-doc --> + * The meta object literal for the '<em><b>Resource Set</b></em>' attribute feature. <!-- begin-user-doc --> <!-- + * end-user-doc --> * * @generated */ @@ -415,24 +415,24 @@ public interface EresourcePackage extends EPackage EAttribute CDO_RESOURCE__LOADED = eINSTANCE.getCDOResource_Loaded(); /** - * The meta object literal for the '<em><b>Tracking Modification</b></em>' attribute feature. <!-- - * begin-user-doc --> <!-- end-user-doc --> + * The meta object literal for the '<em><b>Tracking Modification</b></em>' attribute feature. <!-- begin-user-doc + * --> <!-- end-user-doc --> * * @generated */ EAttribute CDO_RESOURCE__TRACKING_MODIFICATION = eINSTANCE.getCDOResource_TrackingModification(); /** - * The meta object literal for the '<em><b>Errors</b></em>' attribute list feature. <!-- begin-user-doc --> - * <!-- end-user-doc --> + * The meta object literal for the '<em><b>Errors</b></em>' attribute list feature. <!-- begin-user-doc --> <!-- + * end-user-doc --> * * @generated */ EAttribute CDO_RESOURCE__ERRORS = eINSTANCE.getCDOResource_Errors(); /** - * The meta object literal for the '<em><b>Warnings</b></em>' attribute list feature. <!-- begin-user-doc --> - * <!-- end-user-doc --> + * The meta object literal for the '<em><b>Warnings</b></em>' attribute list feature. <!-- begin-user-doc --> <!-- + * end-user-doc --> * * @generated */ @@ -455,8 +455,7 @@ public interface EresourcePackage extends EPackage EAttribute CDO_RESOURCE__PATH = eINSTANCE.getCDOResource_Path(); /** - * The meta object literal for the '<em>Resource Set</em>' data type. <!-- begin-user-doc --> <!-- end-user-doc - * --> + * The meta object literal for the '<em>Resource Set</em>' data type. <!-- begin-user-doc --> <!-- end-user-doc --> * * @see org.eclipse.emf.ecore.resource.ResourceSet * @see org.eclipse.emf.cdo.eresource.impl.EresourcePackageImpl#getResourceSet() @@ -474,8 +473,7 @@ public interface EresourcePackage extends EPackage EDataType URI = eINSTANCE.getURI(); /** - * The meta object literal for the '<em>Diagnostic</em>' data type. <!-- begin-user-doc --> <!-- end-user-doc - * --> + * The meta object literal for the '<em>Diagnostic</em>' data type. <!-- begin-user-doc --> <!-- end-user-doc --> * * @see org.eclipse.emf.ecore.resource.Resource.Diagnostic * @see org.eclipse.emf.cdo.eresource.impl.EresourcePackageImpl#getDiagnostic() diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java index 3d410c0..5ef75df 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java @@ -37,6 +37,7 @@ import org.eclipse.emf.common.util.TreeIterator; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; @@ -53,8 +54,7 @@ import java.util.ListIterator; import java.util.Map; /** - * <!-- begin-user-doc --> An implementation of the model object '<em><b>CDO Resource</b></em>'. <!-- end-user-doc - * --> + * <!-- begin-user-doc --> An implementation of the model object '<em><b>CDO Resource</b></em>'. <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> @@ -66,6 +66,7 @@ import java.util.Map; * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#isTrackingModification <em>Tracking Modification</em>}</li> * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#getErrors <em>Errors</em>}</li> * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#getWarnings <em>Warnings</em>}</li> + * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#getTimeStamp <em>Time Stamp</em>}</li> * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#getPath <em>Path</em>}</li> * </ul> * </p> @@ -522,6 +523,23 @@ public class CDOResourceImpl extends CDOObjectImpl implements CDOResource this.existing = existing; } + /** + * @ADDED + */ + @Override + protected EList<?> createList(EStructuralFeature eStructuralFeature) + { + if (eStructuralFeature == EresourcePackage.eINSTANCE.getCDOResource_Contents()) + { + return new PersistentContents(eStructuralFeature); + } + + return super.createList(eStructuralFeature); + } + + /** + * @ADDED + */ private InternalCDOObject getLegacyWrapper(EObject object) throws ImplementationError { InternalCDOObject legacy = FSMUtil.adapt(object, view); @@ -542,6 +560,24 @@ public class CDOResourceImpl extends CDOObjectImpl implements CDOResource } /** + * @ADDED + * @author Eike Stepper + */ + protected class PersistentContents extends CDOStoreEList<Object> + { + private static final long serialVersionUID = 1L; + + public PersistentContents(EStructuralFeature eStructuralFeature) + { + super(eStructuralFeature); + if (!cdoView().hasUniqueResourceContents()) + { + kind &= ~IS_UNIQUE; + } + } + } + + /** * TODO Change superclass to NotifyingInternalEListImpl when EMF 2.3 is out of maintenance * * @ADDED diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java index 1d2a89a..026f3b2 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java @@ -60,8 +60,8 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka private EDataType diagnosticEDataType = null; /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package package URI value. + * Creates an instance of the model <b>Package</b>, registered with {@link org.eclipse.emf.ecore.EPackage.Registry + * EPackage.Registry} by the package package URI value. * <p> * Note: the correct way to create the package is via the static factory method {@link #init init()}, which also * performs initialization of the package, or returns the registered package, if one already exists. <!-- diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceAdapterFactory.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceAdapterFactory.java index 65ee0e6..84265bd 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceAdapterFactory.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceAdapterFactory.java @@ -104,9 +104,9 @@ public class EresourceAdapterFactory extends AdapterFactoryImpl } /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.eresource.CDOResource <em>CDO Resource</em>}'. - * <!-- begin-user-doc --> This default implementation returns null so that we can easily ignore cases; it's useful to - * ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc --> + * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.eresource.CDOResource + * <em>CDO Resource</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can easily + * ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc --> * * @return the new adapter. * @see org.eclipse.emf.cdo.eresource.CDOResource diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceSwitch.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceSwitch.java index 2a0ac94..bd97da8 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceSwitch.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceSwitch.java @@ -50,8 +50,8 @@ public class EresourceSwitch<T> } /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that - * result. <!-- begin-user-doc --> <!-- end-user-doc --> + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> <!-- end-user-doc --> * * @return the first non-null result returned by a <code>caseXXX</code> call. * @generated @@ -62,8 +62,8 @@ public class EresourceSwitch<T> } /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that - * result. <!-- begin-user-doc --> <!-- end-user-doc --> + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> <!-- end-user-doc --> * * @return the first non-null result returned by a <code>caseXXX</code> call. * @generated @@ -82,8 +82,8 @@ public class EresourceSwitch<T> } /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that - * result. <!-- begin-user-doc --> <!-- end-user-doc --> + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> <!-- end-user-doc --> * * @return the first non-null result returned by a <code>caseXXX</code> call. * @generated @@ -105,8 +105,8 @@ public class EresourceSwitch<T> } /** - * Returns the result of interpreting the object as an instance of '<em>CDO Resource</em>'. <!-- begin-user-doc - * --> This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc --> + * Returns the result of interpreting the object as an instance of '<em>CDO Resource</em>'. <!-- begin-user-doc --> + * This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc --> * * @param object * the target of the switch. @@ -120,8 +120,8 @@ public class EresourceSwitch<T> } /** - * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. <!-- begin-user-doc --> - * This implementation returns null; returning a non-null result will terminate the switch, but this is the last case + * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. <!-- begin-user-doc --> This + * implementation returns null; returning a non-null result will terminate the switch, but this is the last case * anyway. <!-- end-user-doc --> * * @param object diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOPackageType.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOPackageType.java index f02a6fd..51aad57 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOPackageType.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOPackageType.java @@ -20,21 +20,21 @@ import org.eclipse.emf.internal.cdo.CDOStateMachine; public enum CDOPackageType { /** - * The type of <code>EPackages</code> that have been dedicatedly generated for CDO. Instances of - * <code>EClasses</code> of these packages are represented by {@link CDOObjectImpl} to the {@link CDOStateMachine}. + * The type of <code>EPackages</code> that have been dedicatedly generated for CDO. Instances of <code>EClasses</code> + * of these packages are represented by {@link CDOObjectImpl} to the {@link CDOStateMachine}. */ NATIVE, /** - * The type of <code>EPackages</code> that have been normally generated for EMF. Instances of <code>EClasses</code> - * of these packages are represented by {@link CDOAdapterImpl} to the {@link CDOStateMachine}. + * The type of <code>EPackages</code> that have been normally generated for EMF. Instances of <code>EClasses</code> of + * these packages are represented by {@link CDOAdapterImpl} to the {@link CDOStateMachine}. */ LEGACY, /** - * The type of <code>EPackages</code> that have been normally generated for EMF and later converted to CDO. - * Instances of <code>EClasses</code> of these packages are represented by - * {@link org.eclipse.emf.internal.cdo.CDOCallbackImpl} to the {@link CDOStateMachine}. + * The type of <code>EPackages</code> that have been normally generated for EMF and later converted to CDO. Instances + * of <code>EClasses</code> of these packages are represented by {@link org.eclipse.emf.internal.cdo.CDOCallbackImpl} + * to the {@link CDOStateMachine}. */ CONVERTED } 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 4202387..9d96184 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 @@ -432,22 +432,6 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec throw new ImplementationError(); } - // @Override - // public Internal eDirectResource() - // { - // if (revision != null && resource instanceof InternalCDOObject) - // { - // CDOID containerID = revision.getContainerID(); - // CDOID resourceID = ((InternalCDOObject)resource).cdoID(); - // if (containerID.equals(resourceID)) - // { - // return resource; - // } - // } - // - // return null; - // } - @Override protected void eSetDirectResource(Internal resource) { diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java index 2b4081b..61b130e 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java @@ -80,7 +80,9 @@ public class CDOViewImpl extends org.eclipse.net4j.internal.util.event.Notifier private ResourceSet resourceSet; - private boolean enableInvalidationNotifications; + private boolean uniqueResourceContents = true; + + private boolean invalidationNotificationsEnabled; private int loadRevisionCollectionChunkSize; @@ -98,7 +100,7 @@ public class CDOViewImpl extends org.eclipse.net4j.internal.util.event.Notifier { viewID = id; this.session = session; - enableInvalidationNotifications = OM.PREF_ENABLE_INVALIDATION_NOTIFICATIONS.getValue(); + invalidationNotificationsEnabled = OM.PREF_ENABLE_INVALIDATION_NOTIFICATIONS.getValue(); loadRevisionCollectionChunkSize = OM.PREF_LOAD_REVISION_COLLECTION_CHUNK_SIZE.getValue(); objects = createObjectsMap(); } @@ -143,14 +145,24 @@ public class CDOViewImpl extends org.eclipse.net4j.internal.util.event.Notifier return false; } - public boolean isEnableInvalidationNotifications() + public boolean hasUniqueResourceContents() + { + return uniqueResourceContents; + } + + public void setUniqueResourceContents(boolean uniqueResourceContents) + { + this.uniqueResourceContents = uniqueResourceContents; + } + + public boolean isInvalidationNotificationsEnabled() { - return enableInvalidationNotifications; + return invalidationNotificationsEnabled; } - public void setEnableInvalidationNotifications(boolean on) + public void setInvalidationNotificationsEnabled(boolean invalidationNotificationsEnabled) { - enableInvalidationNotifications = on; + this.invalidationNotificationsEnabled = invalidationNotificationsEnabled; } public int getLoadRevisionCollectionChunkSize() @@ -562,9 +574,9 @@ public class CDOViewImpl extends org.eclipse.net4j.internal.util.event.Notifier /** * Turns registered objects into proxies and synchronously delivers invalidation events to registered event listeners. * <p> - * <b>Implementation note:</b> This implementation guarantees that exceptions from listener code don't propagate up - * to the caller of this method. Runtime exceptions from the implementation of the {@link CDOStateMachine} are - * propagated to the caller of this method but this should not happen in the absence of implementation errors. + * <b>Implementation note:</b> This implementation guarantees that exceptions from listener code don't propagate up to + * the caller of this method. Runtime exceptions from the implementation of the {@link CDOStateMachine} are propagated + * to the caller of this method but this should not happen in the absence of implementation errors. * * @param timeStamp * The time stamp of the server transaction if this event was sent as a result of a successfully committed @@ -575,7 +587,7 @@ public class CDOViewImpl extends org.eclipse.net4j.internal.util.event.Notifier */ public void notifyInvalidation(long timeStamp, Set<CDOID> dirtyOIDs) { - List<InternalCDOObject> dirtyObjects = enableInvalidationNotifications ? new ArrayList<InternalCDOObject>() : null; + List<InternalCDOObject> dirtyObjects = invalidationNotificationsEnabled ? new ArrayList<InternalCDOObject>() : null; for (CDOID dirtyOID : dirtyOIDs) { InternalCDOObject dirtyObject; |