Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 116162 Details for
Bug 251544
Instance of list are not the same for the following transition transient/new persisted/transient resulting strange behavior (NPE)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch v4 - ready to be committed
patch.txt (text/plain), 57.09 KB, created by
Eike Stepper
on 2008-10-27 03:16:30 EDT
(
hide
)
Description:
Patch v4 - ready to be committed
Filename:
MIME Type:
Creator:
Eike Stepper
Created:
2008-10-27 03:16:30 EDT
Size:
57.09 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.emf.cdo >Index: src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.cdo/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java,v >retrieving revision 1.45 >diff -u -r1.45 CDOResourceImpl.java >--- src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java 20 Oct 2008 22:47:22 -0000 1.45 >+++ src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java 27 Oct 2008 07:15:11 -0000 >@@ -48,12 +48,10 @@ > import org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl; > import org.eclipse.emf.ecore.resource.impl.ResourceImpl; > import org.eclipse.emf.ecore.util.InternalEList; >-import org.eclipse.emf.ecore.util.NotifyingInternalEListImpl; > > import java.io.IOException; > import java.io.InputStream; > import java.io.OutputStream; >-import java.util.Collection; > import java.util.Iterator; > import java.util.Map; > >@@ -257,19 +255,6 @@ > @SuppressWarnings("unchecked") > public EList<EObject> getContents() > { >- if (FSMUtil.isTransient(this)) >- { >- EList<EObject> transientContents = (EList<EObject>)eSettings[EresourcePackage.CDO_RESOURCE__CONTENTS]; >- if (transientContents == null) >- { >- transientContents = new TransientContents<EObject>(); >- eSettings[EresourcePackage.CDO_RESOURCE__CONTENTS] = transientContents; >- // throw new ImplementationError(); >- } >- >- return transientContents; >- } >- > return (EList<EObject>)eGet(EresourcePackage.Literals.CDO_RESOURCE__CONTENTS, true); > } > >@@ -846,7 +831,7 @@ > { > if (eStructuralFeature == EresourcePackage.eINSTANCE.getCDOResource_Contents()) > { >- return new PersistentContents(eStructuralFeature); >+ return new ContentsCDOList(eStructuralFeature); > } > > return super.createList(eStructuralFeature); >@@ -857,19 +842,15 @@ > * > * @ADDED > * @author Eike Stepper >+ * @since 2.0 > */ >- protected class PersistentContents extends CDOStoreEList<Object> >+ protected class ContentsCDOList extends BasicEStoreEList<Object> > { > private static final long serialVersionUID = 1L; > >- @SuppressWarnings("deprecation") >- public PersistentContents(EStructuralFeature eStructuralFeature) >+ public ContentsCDOList(EStructuralFeature eStructuralFeature) > { >- super(eStructuralFeature); >- if (!cdoView().hasUniqueResourceContents()) >- { >- kind &= ~IS_UNIQUE; >- } >+ super(CDOResourceImpl.this, eStructuralFeature); > } > > /** >@@ -880,8 +861,12 @@ > @Override > public boolean contains(Object object) > { >- return size() <= 4 ? super.contains(object) : object instanceof InternalEObject >- && ((InternalEObject)object).eDirectResource() == CDOResourceImpl.this; >+ if (size() <= 4) >+ { >+ return super.contains(object); >+ } >+ >+ return object instanceof InternalEObject && ((InternalEObject)object).eDirectResource() == CDOResourceImpl.this; > } > > /** >@@ -890,13 +875,22 @@ > @Override > public NotificationChain inverseAdd(Object object, NotificationChain notifications) > { >- CDOTransactionImpl transaction = cdoView().toTransaction(); >- InternalCDOObject cdoObject = FSMUtil.adapt(object, transaction); >- notifications = cdoObject.eSetResource(CDOResourceImpl.this, notifications); >- // Attach here instead of i CDOObjectImpl.eSetResource because EMF does it also here >- if (FSMUtil.isTransient(cdoObject)) >+ if (FSMUtil.isTransient(CDOResourceImpl.this)) > { >- attached(cdoObject, transaction); >+ InternalEObject eObject = (InternalEObject)object; >+ notifications = eObject.eSetResource(CDOResourceImpl.this, notifications); >+ } >+ else >+ { >+ CDOTransactionImpl transaction = cdoView().toTransaction(); >+ InternalCDOObject cdoObject = FSMUtil.adapt(object, transaction); >+ notifications = cdoObject.eSetResource(CDOResourceImpl.this, notifications); >+ >+ // Attach here instead of in CDOObjectImpl.eSetResource because EMF does it also here >+ if (FSMUtil.isTransient(cdoObject)) >+ { >+ attached(cdoObject, transaction); >+ } > } > > return notifications; >@@ -908,170 +902,72 @@ > @Override > public NotificationChain inverseRemove(Object object, NotificationChain notifications) > { >- InternalEObject eObject = (InternalEObject)object; >- detached(eObject); >- return eObject.eSetResource(null, notifications); >- } >- } >- >- /** >- * TODO Change superclass to NotifyingInternalEListImpl when EMF 2.3 is out of maintenance >- * <p> >- * TODO Reuse {@link ResourceImpl.ContentsEList}!!! --> Bugzilla! >- * >- * @ADDED >- * @author Eike Stepper >- */ >- protected class TransientContents<E extends Object & EObject> extends NotifyingInternalEListImpl<E> >- { >- private static final long serialVersionUID = 1L; >- >- public TransientContents() >- { >- } >- >- public TransientContents(Collection<? extends E> collection) >- { >- super(collection); >- } >+ if (FSMUtil.isTransient(CDOResourceImpl.this)) >+ { >+ InternalEObject eObject = (InternalEObject)object; >+ notifications = eObject.eSetResource(null, notifications); >+ } >+ else >+ { >+ InternalEObject eObject = (InternalEObject)object; >+ detached(eObject); >+ notifications = eObject.eSetResource(null, notifications); >+ } > >- public TransientContents(int initialCapacity) >- { >- super(initialCapacity); >+ return notifications; > } > > /** >- * Optimization taken from ResourceImpl.EContentList.contains >- * > * @since 2.0 > */ >- @Override >- public boolean contains(Object object) >- { >- return size <= 4 ? super.contains(object) : object instanceof InternalEObject >- && ((InternalEObject)object).eDirectResource() == CDOResourceImpl.this; >- } >- >- @Override >- public Object getNotifier() >- { >- return CDOResourceImpl.this; >- } >- >- @Override >- public int getFeatureID() >+ protected void loaded() > { >- return EresourcePackage.CDO_RESOURCE__CONTENTS; >+ if (!isLoaded()) >+ { >+ Notification notification = setLoaded(true); >+ if (notification != null) >+ { >+ eNotify(notification); >+ } >+ } > } > >- @Override >- protected boolean isNotificationRequired() >+ /** >+ * @since 2.0 >+ */ >+ protected void modified() > { >- return eNotificationRequired(); >+ if (isTrackingModification()) >+ { >+ setModified(true); >+ } > } > >+ /** >+ * @since 2.0 >+ */ > @Override > protected boolean useEquals() > { > return false; > } > >- @Override >- protected boolean hasInverse() >- { >- return true; >- } >- >- @Override >- protected boolean isUnique() >- { >- return true; >- } >- > /** > * @since 2.0 > */ >- /* >- * IMPORTANT: Compile errors in this method might indicate an old version of EMF. Legacy support is only enabled for >- * EMF with fixed bug #247130. These compile errors do not affect native models! >- */ >- public InternalEList<E> readWriteFiringList() >- { >- return this; >- } >- >- @Override >- public NotificationChain inverseAdd(E object, NotificationChain notifications) >- { >- InternalEObject eObject = (InternalEObject)object; >- notifications = eObject.eSetResource(CDOResourceImpl.this, notifications); >- // CDOResourceImpl.this.attached(eObject); >- return notifications; >- } >- >- @Override >- public NotificationChain inverseRemove(E object, NotificationChain notifications) >- { >- InternalEObject eObject = (InternalEObject)object; >- // CDOResourceImpl.this.detached(eObject); >- return eObject.eSetResource(null, notifications); >- } >- >- @Override >- protected void didAdd(int index, E object) >- { >- super.didAdd(index, object); >- modified(); >- } >- > @Override >- protected void didRemove(int index, E object) >- { >- super.didRemove(index, object); >- modified(); >- } >- >- @Override >- protected void didSet(int index, E newObject, E oldObject) >- { >- super.didSet(index, newObject, oldObject); >- modified(); >- } >- >- @Override >- protected void didClear(int oldSize, Object[] oldData) >+ protected boolean hasInverse() > { >- if (oldSize == 0) >- { >- loaded(); >- } >- else >- { >- super.didClear(oldSize, oldData); >- } >+ return true; > } > > /** > * @since 2.0 > */ >- protected void loaded() >- { >- if (!isLoaded()) >- { >- Notification notification = setLoaded(true); >- if (notification != null) >- { >- eNotify(notification); >- } >- } >- } >- >- protected void modified() >+ @Override >+ protected boolean isUnique() > { >- if (isTrackingModification()) >- { >- setModified(true); >- } >+ return true; > } > } > } // CDOResourceImpl >Index: src/org/eclipse/emf/cdo/CDOView.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.cdo/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOView.java,v >retrieving revision 1.56 >diff -u -r1.56 CDOView.java >--- src/org/eclipse/emf/cdo/CDOView.java 19 Oct 2008 08:16:19 -0000 1.56 >+++ src/org/eclipse/emf/cdo/CDOView.java 27 Oct 2008 07:15:11 -0000 >@@ -165,32 +165,6 @@ > public boolean hasConflict(); > > /** >- * @see #setUniqueResourceContents(boolean) >- * @deprecated This performance tweak is not necessary with EMF 2.5 anymore and is likely to be removed when CDO >- * reaches 2.0. In the meantime it can be safely used. >- */ >- @Deprecated >- public boolean hasUniqueResourceContents(); >- >- /** >- * Specifies whether the contents list of resources will be unique or not. >- * <p> >- * This property is transient in that it does not stick with resources outside of the scope of this view. Especially >- * it will not be persisted with resources in the repository. Each new view will start with <code>true</code> as a >- * default value. Changing to <code>false</code> will subsequently apply to all resources being loaded or created. >- * <p> >- * Notice that the resource contents is a containment list and as such <b>must be</b> unique. Setting this property to >- * <code>false</code> is only recommended for performance optimization when uniqueness is granted by other means. >- * Violating the uniqueness constraint will result in unpredictable behaviour and possible corruption of the >- * repository! >- * >- * @deprecated This performance tweak is not necessary with EMF 2.5 anymore and is likely to be removed when CDO >- * reaches 2.0. In the meantime it can be safely used. >- */ >- @Deprecated >- public void setUniqueResourceContents(boolean uniqueResourceContents); >- >- /** > * Returns <code>true</code> if the {@link CDOObject objects} in this view will notify their > * {@link org.eclipse.emf.common.notify.Adapter adapters} about the fact that they are <em>invalidated</em> (due to > * remote changes), <code>false</code> otherwise. >Index: src/org/eclipse/emf/internal/cdo/CDOViewImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.cdo/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java,v >retrieving revision 1.157 >diff -u -r1.157 CDOViewImpl.java >--- src/org/eclipse/emf/internal/cdo/CDOViewImpl.java 26 Oct 2008 20:18:29 -0000 1.157 >+++ src/org/eclipse/emf/internal/cdo/CDOViewImpl.java 27 Oct 2008 07:15:12 -0000 >@@ -100,8 +100,6 @@ > > private CDOURIHandler uriHandler = new CDOURIHandler(this); > >- private boolean uniqueResourceContents = true; >- > private boolean invalidationNotificationEnabled; > > private CDORevisionPrefetchingPolicy revisionPrefetchingPolicy; >@@ -225,18 +223,6 @@ > return false; > } > >- @Deprecated >- public boolean hasUniqueResourceContents() >- { >- return uniqueResourceContents; >- } >- >- @Deprecated >- public void setUniqueResourceContents(boolean uniqueResourceContents) >- { >- this.uniqueResourceContents = uniqueResourceContents; >- } >- > /** > * @since 2.0 > */ >Index: src/org/eclipse/emf/internal/cdo/CDOXATransactionCommitContext.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.cdo/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOXATransactionCommitContext.java,v >retrieving revision 1.2 >diff -u -r1.2 CDOXATransactionCommitContext.java >--- src/org/eclipse/emf/internal/cdo/CDOXATransactionCommitContext.java 7 Oct 2008 14:39:27 -0000 1.2 >+++ src/org/eclipse/emf/internal/cdo/CDOXATransactionCommitContext.java 27 Oct 2008 07:15:12 -0000 >@@ -30,7 +30,6 @@ > import java.util.HashMap; > import java.util.List; > import java.util.Map; >-import java.util.Set; > import java.util.concurrent.Callable; > > /** >@@ -112,7 +111,7 @@ > return delegateCommitContext.getNewResources(); > } > >- public Set<CDOID> getDetachedObjects() >+ public Map<CDOID, CDOObject> getDetachedObjects() > { > return delegateCommitContext.getDetachedObjects(); > } >Index: src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.cdo/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java,v >retrieving revision 1.81 >diff -u -r1.81 CDOTransactionImpl.java >--- src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java 19 Oct 2008 01:28:53 -0000 1.81 >+++ src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java 27 Oct 2008 07:15:12 -0000 >@@ -399,11 +399,6 @@ > return null; > } > >- private boolean isDetached(CDOID id) >- { >- return lastSavepoint.getSharedDetachedObjects().contains(id); >- } >- > /** > * @since 2.0 > */ >@@ -416,7 +411,7 @@ > return null; > } > >- if (isDetached(id)) >+ if (id.isTemporary() && isDetached(id)) > { > FSMUtil.validate(id, null); > } >@@ -424,6 +419,11 @@ > return super.getObject(id, loadOnDemand); > } > >+ private boolean isDetached(CDOID id) >+ { >+ return lastSavepoint.getSharedDetachedObjects().contains(id); >+ } >+ > /** > * @since 2.0 > */ >@@ -505,7 +505,7 @@ > } > } > >- // Rollback every persisted objects >+ // Rollback all persisted objects > Map<CDOID, CDOObject> detachedObjects = itrSavepoint.getDetachedObjects(); > if (!detachedObjects.isEmpty()) > { >@@ -519,18 +519,16 @@ > { > InternalCDOObject internalDirtyObject = (InternalCDOObject)entryDirty.getValue(); > cleanObject(internalDirtyObject, getRevision(entryDirty.getKey(), true)); >- registerObject(internalDirtyObject); > } > } > } > > for (Entry<CDOID, CDOObject> entryDirtyObject : itrSavepoint.getDirtyObjects().entrySet()) > { >- // Rollback every persisted objects >+ // Rollback all persisted objects > if (!entryDirtyObject.getKey().isTemporary()) > { > InternalCDOObject internalDirtyObject = (InternalCDOObject)entryDirtyObject.getValue(); >- // cleanObject(internalDirtyObject, getRevision(entryDirtyObject.getKey(), true)); > CDOStateMachine.INSTANCE.rollback(internalDirtyObject); > } > } >@@ -585,10 +583,6 @@ > for (Entry<CDOID, CDOObject> entryNewObject : newObjMaps.entrySet()) > { > InternalCDOObject object = (InternalCDOObject)entryNewObject.getValue(); >- if (!isObjectRegistered(entryNewObject.getKey())) >- { >- registerObject(object); >- } > > // Go back to the previous state > cleanObject(object, (InternalCDORevision)object.cdoRevision()); >@@ -648,8 +642,6 @@ > } > > // deregister object >- deregisterObject(object); >- > if (object.cdoState() == CDOState.NEW) > { > Map<CDOID, ? extends CDOObject> map = object instanceof CDOResource ? getLastSavepoint().getNewResources() >@@ -658,6 +650,8 @@ > // Determine if we added object > if (map.containsKey(object.cdoID())) > { >+ // deregister object >+ deregisterObject(object); > map.remove(object.cdoID()); > } > else >@@ -1017,7 +1011,7 @@ > > private Map<CDOID, CDORevisionDelta> revisionDeltas; > >- private Set<CDOID> detachedObjects; >+ private Map<CDOID, CDOObject> detachedObjects; > > private List<CDOPackage> newPackages; > >@@ -1027,7 +1021,7 @@ > newResources = transaction.getNewResources(); > newObjects = transaction.getNewObjects(); > dirtyObjects = transaction.getDirtyObjects(); >- detachedObjects = transaction.getDetachedObjects().keySet(); >+ detachedObjects = transaction.getDetachedObjects(); > revisionDeltas = transaction.getRevisionDeltas(); > newPackages = transaction.analyzeNewPackages(); > } >@@ -1052,7 +1046,7 @@ > return newResources; > } > >- public Set<CDOID> getDetachedObjects() >+ public Map<CDOID, CDOObject> getDetachedObjects() > { > return detachedObjects; > } >@@ -1109,9 +1103,12 @@ > postCommit(getNewResources(), result); > postCommit(getNewObjects(), result); > postCommit(getDirtyObjects(), result); >+ for (Entry<CDOID, CDOObject> entry : getDetachedObjects().entrySet()) >+ { >+ removeObject(entry.getKey()); >+ } > > CDOSessionImpl session = getTransaction().getSession(); >- > for (CDOPackage newPackage : newPackages) > { > ((InternalCDOPackage)newPackage).setPersistent(true); >@@ -1120,7 +1117,7 @@ > ChangeSubscriptionManager changeSubscriptionManager = getTransaction().getChangeSubscriptionManager(); > changeSubscriptionManager.handleNewObjects(getNewObjects().values()); > changeSubscriptionManager.handleNewObjects(getNewResources().values()); >- changeSubscriptionManager.handleDetachedObjects(getDetachedObjects()); >+ changeSubscriptionManager.handleDetachedObjects(getDetachedObjects().keySet()); > > long timeStamp = result.getTimeStamp(); > >@@ -1135,7 +1132,7 @@ > > if (!dirtyIDs.isEmpty() || !getDetachedObjects().isEmpty()) > { >- Set<CDOID> detachedIDs = new HashSet<CDOID>(getDetachedObjects()); >+ Set<CDOID> detachedIDs = new HashSet<CDOID>(getDetachedObjects().keySet()); > Collection<CDORevisionDelta> deltasCopy = new ArrayList<CDORevisionDelta>(deltas); > session.handleCommitNotification(timeStamp, dirtyIDs, detachedIDs, deltasCopy, getTransaction()); > } >Index: src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.cdo/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java,v >retrieving revision 1.76 >diff -u -r1.76 CDOObjectImpl.java >--- src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java 19 Oct 2008 01:28:52 -0000 1.76 >+++ src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java 27 Oct 2008 07:15:11 -0000 >@@ -34,6 +34,7 @@ > import org.eclipse.emf.common.notify.Adapter; > import org.eclipse.emf.common.notify.Notification; > import org.eclipse.emf.common.notify.NotificationChain; >+import org.eclipse.emf.common.util.BasicEList; > import org.eclipse.emf.common.util.BasicEMap; > import org.eclipse.emf.common.util.ECollections; > import org.eclipse.emf.common.util.EList; >@@ -49,7 +50,6 @@ > import org.eclipse.emf.ecore.impl.EStoreEObjectImpl; > import org.eclipse.emf.ecore.resource.Resource; > import org.eclipse.emf.ecore.resource.Resource.Internal; >-import org.eclipse.emf.ecore.util.DelegatingEcoreEList; > import org.eclipse.emf.ecore.util.DelegatingFeatureMap; > import org.eclipse.emf.ecore.util.EcoreEList; > import org.eclipse.emf.ecore.util.EcoreEMap; >@@ -77,10 +77,19 @@ > > private InternalCDORevision revision; > >+ /** >+ * CDO used this list instead of eSettings for transient objects. EMF used eSettings as cache. CDO deactivated the >+ * cache but EMF still used eSettings to store list wrappers. CDO needs another place to store the real list with the >+ * actual data (transient mode) and accessible through EStore. This allows CDO to always use the same instance of the >+ * list wrapper. >+ */ >+ private transient Object cdoSettings[]; >+ > public CDOObjectImpl() > { > state = CDOState.TRANSIENT; > eContainer = null; >+ cdoSettings = null; > } > > public CDOID cdoID() >@@ -98,6 +107,28 @@ > return revision; > } > >+ /** >+ * @since 2.0 >+ */ >+ protected Object[] cdoSettings() >+ { >+ if (cdoSettings == null) >+ { >+ int size = eClass().getFeatureCount() - eStaticFeatureCount(); >+ cdoSettings = size == 0 ? ENO_SETTINGS : new Object[size]; >+ } >+ >+ return cdoSettings; >+ } >+ >+ /** >+ * @since 2.0 >+ */ >+ protected Object[] cdoBasicSettings() >+ { >+ return cdoSettings; >+ } >+ > public CDOClass cdoClass() > { > return getCDOClass(this); >@@ -201,13 +232,15 @@ > > public void cdoInternalPostLoad() > { >+ // Reset EMAP objects > if (eSettings != null) > { >- // Make sure transient feature are kept but persisted value are not cached. >+ // Make sure transient features are kept but persisted values are not cached. > EClass eClass = eClass(); > for (int i = 0; i < eClass.getFeatureCount(); i++) > { > EStructuralFeature eFeature = cdoInternalDynamicFeature(i); >+ > // We need to keep the existing list if possible. > if (!eFeature.isTransient() && eSettings[i] instanceof InternalCDOLoadable) > { >@@ -230,20 +263,7 @@ > */ > public void cdoInternalCleanup() > { >- if (eSettings != null) >- { >- // Make sure transient feature are kept but persisted value are not cached. >- EClass eClass = eClass(); >- for (int i = 0; i < eClass.getFeatureCount(); i++) >- { >- EStructuralFeature eFeature = cdoInternalDynamicFeature(i); >- // We need to keep the existing list if possible. >- if (!eFeature.isTransient()) >- { >- eSettings[i] = null; >- } >- } >- } >+ // Do nothing > } > > public void cdoInternalPostAttach() >@@ -256,6 +276,7 @@ > CDOViewImpl view = cdoView(); > revision.setContainerID(eContainer == null ? CDOID.NULL : cdoView().convertObjectToID(eContainer, true)); > revision.setContainingFeatureID(eContainerFeatureID); >+ > Resource directResource = eDirectResource(); > if (directResource instanceof CDOResource) > { >@@ -263,8 +284,6 @@ > revision.setResourceID(cdoResource.cdoID()); > } > >- eSettings(); >- > EClass eClass = eClass(); > for (int i = 0; i < eClass.getFeatureCount(); i++) > { >@@ -274,6 +293,8 @@ > populateRevisionFeature(view, revision, eFeature, eSettings, i); > } > } >+ >+ cdoSettings = null; > } > > @SuppressWarnings("unchecked") >@@ -287,7 +308,7 @@ > TRACER.format("Populating feature {0}", cdoFeature); > } > >- Object setting = eSettings[i]; >+ Object setting = cdoBasicSettings() != null ? cdoSettings()[i] : null; > if (setting == null) > { > setting = eFeature.getDefaultValue(); >@@ -330,13 +351,12 @@ > > revision.set(cdoFeature, 0, setting); > } >- >- if (eSettings != null) >- { >- eSettings[i] = null; >- } > } > >+ /** >+ * It is really important for accessing the data to go through {@link #cdoStore()}. {@link #eStore()} will redirect >+ * you to the transient data. >+ */ > public void cdoInternalPostDetach() > { > if (TRACER.isEnabled()) >@@ -346,15 +366,17 @@ > > CDOViewImpl view = cdoView(); > super.eSetDirectResource(cdoDirectResource()); >- eContainer = eStore().getContainer(this); >- eContainerFeatureID = getStore().getContainingFeatureID(this); >+ >+ CDOStore store = cdoStore(); >+ eContainer = store.getContainer(this); >+ eContainerFeatureID = store.getContainingFeatureID(this); > if (eContainer != null && eContainmentFeature().isResolveProxies()) > { > adjustOppositeReference(eContainer, eContainmentFeature()); > } > > // Ensure that the internal eSettings array is initialized; >- eSettings(); >+ resetSettings(); > > EClass eClass = eClass(); > for (int i = 0; i < eClass.getFeatureCount(); i++) >@@ -367,7 +389,12 @@ > } > } > >- @SuppressWarnings("unchecked") >+ private void resetSettings() >+ { >+ cdoSettings = null; >+ cdoSettings(); >+ } >+ > private void depopulateRevisionFeature(CDOViewImpl view, InternalCDORevision revision, EStructuralFeature eFeature, > Object[] eSettings, int i) > { >@@ -379,17 +406,18 @@ > EStructuralFeature.Internal internalFeature = (EStructuralFeature.Internal)eFeature; > EReference oppositeReference = cdoID().isTemporary() ? null : internalFeature.getEOpposite(); > >+ CDOStore cdoStore = cdoStore(); >+ EStore eStore = eStore(); > if (eFeature.isMany()) > { >- eSettings[i] = null; >- InternalEList<Object> setting = (InternalEList<Object>)eGet(eFeature, true); >- int size = eStore().size(this, eFeature); >+ >+ int size = cdoStore.size(this, eFeature); > for (int index = 0; index < size; index++) > { > // Do not trigger events > // Do not trigger inverse updates >- Object object = eStore().get(this, eFeature, index); >- setting.basicAdd(object, null); >+ Object object = cdoStore.get(this, eFeature, index); >+ eStore.add(this, eFeature, index, object); > if (oppositeReference != null) > { > adjustOppositeReference((InternalEObject)object, oppositeReference); >@@ -398,10 +426,11 @@ > } > else > { >- eSettings[i] = eStore().get(this, eFeature, 0); >+ Object object = cdoStore.get(this, eFeature, EStore.NO_INDEX); >+ eStore.set(this, eFeature, EStore.NO_INDEX, object); > if (oppositeReference != null) > { >- adjustOppositeReference((InternalEObject)eSettings[i], oppositeReference); >+ adjustOppositeReference((InternalEObject)object, oppositeReference); > } > } > } >@@ -534,7 +563,7 @@ > public EStoreEcoreEMap() > { > super((EClass)eType, eType.getInstanceClass(), null); >- delegateEList = new CDOStoreEList<BasicEMap.Entry<Object, Object>>(eStructuralFeature) >+ delegateEList = new BasicEStoreEList<BasicEMap.Entry<Object, Object>>(CDOObjectImpl.this, eStructuralFeature) > { > private static final long serialVersionUID = 1L; > >@@ -576,7 +605,10 @@ > > private void checkListForReading() > { >- CDOStateMachine.INSTANCE.read(CDOObjectImpl.this); >+ if (!FSMUtil.isTransient(CDOObjectImpl.this)) >+ { >+ CDOStateMachine.INSTANCE.read(CDOObjectImpl.this); >+ } > } > > /** >@@ -641,7 +673,7 @@ > return new EStoreEcoreEMap(); > } > >- return new CDOStoreEList<Object>(eStructuralFeature); >+ return super.createList(eStructuralFeature); > } > > @Override >@@ -659,7 +691,7 @@ > } > else if (resource instanceof CDOResourceImpl || resource == null) > { >- getStore().setContainer(this, (CDOResourceImpl)resource, eInternalContainer(), eContainerFeatureID()); >+ cdoStore().setContainer(this, (CDOResourceImpl)resource, eInternalContainer(), eContainerFeatureID()); > } > else > { >@@ -678,83 +710,30 @@ > return super.eDirectResource(); > } > >- return (Resource.Internal)getStore().getResource(this); >+ return (Resource.Internal)cdoStore().getResource(this); > } > > /** >- * Don't cache non-transient features in this CDOObject's {@link #eSettings()}. >+ * @since 2.0 > */ > @Override >- protected boolean eIsCaching() >- { >- return false; >- } >- >- @Override >- public Object dynamicGet(int dynamicFeatureID) >- { >- if (FSMUtil.isTransient(this)) >- { >- if (eSettings == null) >- { >- return null; >- } >- >- return eSettings[dynamicFeatureID]; >- } >- >- // Delegate to CDOStore >- return super.dynamicGet(dynamicFeatureID); >- } >- >- @Override >- public boolean eIsSet(EStructuralFeature feature) >+ public InternalEObject.EStore eStore() > { > if (FSMUtil.isTransient(this)) > { >- // TODO What about defaultValues != null? >- if (eSettings == null) >- { >- return false; >- } >- >- return eSettings[eDynamicFeatureID(feature)] != null; >+ return CDOStoreSettingsImpl.INSTANCE; > } > >- // Delegate to CDOStore >- return super.eIsSet(feature); >- } >- >- @Override >- public void dynamicSet(int dynamicFeatureID, Object value) >- { >- if (FSMUtil.isTransient(this)) >- { >- eSettings(); // Important to create eSettings array if necessary >- eSettings[dynamicFeatureID] = value; >- } >- else >- { >- // Delegate to CDOStore >- super.dynamicSet(dynamicFeatureID, value); >- } >+ return cdoStore(); > } > >+ /** >+ * Don't cache non-transient features in this CDOObject's {@link #eSettings()}. >+ */ > @Override >- public void dynamicUnset(int dynamicFeatureID) >+ protected boolean eIsCaching() > { >- if (FSMUtil.isTransient(this)) >- { >- if (eSettings != null) >- { >- eSettings[dynamicFeatureID] = null; >- } >- } >- else >- { >- // Delegate to CDOStore >- super.dynamicUnset(dynamicFeatureID); >- } >+ return false; > } > > @Override >@@ -768,7 +747,7 @@ > else > { > // Delegate to CDOStore >- container = getStore().getContainer(this); >+ container = cdoStore().getContainer(this); > } > > if (container instanceof CDOResource) >@@ -788,7 +767,7 @@ > } > > // Delegate to CDOStore >- return getStore().getContainingFeatureID(this); >+ return cdoStore().getContainingFeatureID(this); > } > > /** >@@ -960,7 +939,7 @@ > } > else > { >- getStore().setContainer(this, cdoDirectResource(), newEContainer, newContainerFeatureID); >+ cdoStore().setContainer(this, cdoDirectResource(), newEContainer, newContainerFeatureID); > } > } > >@@ -991,216 +970,186 @@ > return ModelUtil.getCDOClass(cdoObject.eClass(), packageManager); > } > >- private CDOStore getStore() >+ private CDOStore cdoStore() > { >- return (CDOStore)eStore(); >+ return cdoView().getStore(); > } > > /** >- * TODO Remove this when EMF has fixed http://bugs.eclipse.org/197487 >- * > * @author Eike Stepper >+ * @since 2.0 > */ >- public class CDOStoreEList<E> extends DelegatingEcoreEList.Dynamic<E> >+ public static class CDOStoreSettingsImpl implements InternalEObject.EStore > { >- private static final long serialVersionUID = 1L; >+ public static CDOStoreSettingsImpl INSTANCE = new CDOStoreSettingsImpl(); > >- public CDOStoreEList(EStructuralFeature eStructuralFeature) >+ private CDOStoreSettingsImpl() > { >- super(CDOObjectImpl.this, eStructuralFeature); > } > >- @Override >- protected List<E> delegateList() >+ protected Object getValue(InternalEObject eObject, int dynamicFeatureID) > { >- throw new UnsupportedOperationException(); >+ return ((CDOObjectImpl)eObject).cdoSettings()[dynamicFeatureID]; >+ > } > >- @Override >- public EStructuralFeature getEStructuralFeature() >+ protected EList<Object> getValueAsList(InternalEObject eObject, int dynamicFeatureID) > { >- return eStructuralFeature; >+ @SuppressWarnings("unchecked") >+ EList<Object> result = (EList<Object>)getValue(eObject, dynamicFeatureID); >+ if (result == null) >+ { >+ result = new BasicEList<Object>(); >+ ((CDOObjectImpl)eObject).cdoSettings()[dynamicFeatureID] = result; >+ } >+ >+ return result; > } > >- @Override >- protected void delegateAdd(int index, Object object) >+ protected Object setValue(InternalEObject eObject, int dynamicFeatureID, Object newValue) > { >- getStore().add(owner, eStructuralFeature, index, object); >+ Object eSettings[] = ((CDOObjectImpl)eObject).cdoSettings(); >+ >+ try >+ { >+ return eSettings[dynamicFeatureID]; >+ } >+ finally >+ { >+ eSettings[dynamicFeatureID] = newValue; >+ } > } > >- @Override >- protected void delegateAdd(Object object) >+ protected int eDynamicFeatureID(InternalEObject eObject, EStructuralFeature feature) > { >- delegateAdd(delegateSize(), object); >+ return ((CDOObjectImpl)eObject).eDynamicFeatureID(feature); > } > >- @Override >- protected List<E> delegateBasicList() >+ public Object get(InternalEObject eObject, EStructuralFeature feature, int index) > { >- int size = delegateSize(); >- if (size == 0) >+ int dynamicFeatureID = eDynamicFeatureID(eObject, feature); >+ if (feature.isMany()) > { >- return ECollections.emptyEList(); >+ return getValueAsList(eObject, dynamicFeatureID).get(index); > } > >- Object[] data = getStore().toArray(owner, eStructuralFeature); >- return new EcoreEList.UnmodifiableEList<E>(owner, eStructuralFeature, data.length, data); >+ return getValue(eObject, dynamicFeatureID); > } > >- @Override >- protected void delegateClear() >+ public Object set(InternalEObject eObject, EStructuralFeature feature, int index, Object value) > { >- getStore().clear(owner, eStructuralFeature); >+ int dynamicFeatureID = eDynamicFeatureID(eObject, feature); >+ if (feature.isMany()) >+ { >+ return getValueAsList(eObject, dynamicFeatureID).set(index, value); >+ } >+ >+ return setValue(eObject, dynamicFeatureID, value); > } > >- @Override >- protected boolean delegateContains(Object object) >+ public void add(InternalEObject eObject, EStructuralFeature feature, int index, Object value) > { >- return getStore().contains(owner, eStructuralFeature, object); >+ int dynamicFeatureID = eDynamicFeatureID(eObject, feature); >+ getValueAsList(eObject, dynamicFeatureID).add(index, value); > } > >- @Override >- protected boolean delegateContainsAll(Collection<?> collection) >+ public Object remove(InternalEObject eObject, EStructuralFeature feature, int index) > { >- for (Object o : collection) >- { >- if (!delegateContains(o)) >- { >- return false; >- } >- } >- return true; >+ int dynamicFeatureID = eDynamicFeatureID(eObject, feature); >+ return getValueAsList(eObject, dynamicFeatureID).remove(index); > } > >- @SuppressWarnings("unchecked") >- @Override >- protected E delegateGet(int index) >+ public Object move(InternalEObject eObject, EStructuralFeature feature, int targetIndex, int sourceIndex) > { >- return (E)getStore().get(owner, eStructuralFeature, index); >+ int dynamicFeatureID = eDynamicFeatureID(eObject, feature); >+ return getValueAsList(eObject, dynamicFeatureID).move(targetIndex, sourceIndex); > } > >- @Override >- protected int delegateHashCode() >+ public void clear(InternalEObject eObject, EStructuralFeature feature) > { >- return getStore().hashCode(owner, eStructuralFeature); >+ int dynamicFeatureID = eDynamicFeatureID(eObject, feature); >+ if (feature.isMany()) >+ { >+ getValueAsList(eObject, dynamicFeatureID).clear(); >+ } >+ >+ setValue(eObject, dynamicFeatureID, null); > } > >- @Override >- protected int delegateIndexOf(Object object) >+ public int size(InternalEObject eObject, EStructuralFeature feature) > { >- return getStore().indexOf(owner, eStructuralFeature, object); >+ int dynamicFeatureID = eDynamicFeatureID(eObject, feature); >+ return getValueAsList(eObject, dynamicFeatureID).size(); > } > >- @Override >- protected boolean delegateIsEmpty() >+ public int indexOf(InternalEObject eObject, EStructuralFeature feature, Object value) > { >- return getStore().isEmpty(owner, eStructuralFeature); >+ int dynamicFeatureID = eDynamicFeatureID(eObject, feature); >+ return getValueAsList(eObject, dynamicFeatureID).indexOf(value); > } > >- @Override >- protected Iterator<E> delegateIterator() >+ public int lastIndexOf(InternalEObject eObject, EStructuralFeature feature, Object value) > { >- return iterator(); >+ int dynamicFeatureID = eDynamicFeatureID(eObject, feature); >+ return getValueAsList(eObject, dynamicFeatureID).lastIndexOf(value); > } > >- @Override >- protected int delegateLastIndexOf(Object object) >+ public Object[] toArray(InternalEObject eObject, EStructuralFeature feature) > { >- return getStore().lastIndexOf(owner, eStructuralFeature, object); >+ int dynamicFeatureID = eDynamicFeatureID(eObject, feature); >+ return getValueAsList(eObject, dynamicFeatureID).toArray(); > } > >- @Override >- protected ListIterator<E> delegateListIterator() >+ public <T> T[] toArray(InternalEObject eObject, EStructuralFeature feature, T[] array) > { >- return listIterator(); >+ int dynamicFeatureID = eDynamicFeatureID(eObject, feature); >+ return getValueAsList(eObject, dynamicFeatureID).toArray(array); > } > >- @SuppressWarnings("unchecked") >- @Override >- protected E delegateRemove(int index) >+ public boolean isEmpty(InternalEObject eObject, EStructuralFeature feature) > { >- return (E)getStore().remove(owner, eStructuralFeature, index); >+ int dynamicFeatureID = eDynamicFeatureID(eObject, feature); >+ return getValueAsList(eObject, dynamicFeatureID).isEmpty(); > } > >- @SuppressWarnings("unchecked") >- @Override >- protected E delegateSet(int index, E object) >+ public boolean contains(InternalEObject eObject, EStructuralFeature feature, Object value) > { >- return (E)getStore().set(owner, eStructuralFeature, index, object); >+ int dynamicFeatureID = eDynamicFeatureID(eObject, feature); >+ return getValueAsList(eObject, dynamicFeatureID).contains(value); > } > >- @Override >- protected int delegateSize() >+ public int hashCode(InternalEObject eObject, EStructuralFeature feature) > { >- return getStore().size(owner, eStructuralFeature); >+ int dynamicFeatureID = eDynamicFeatureID(eObject, feature); >+ return getValueAsList(eObject, dynamicFeatureID).hashCode(); > } > >- @Override >- protected Object[] delegateToArray() >+ public InternalEObject getContainer(InternalEObject eObject) > { >- return getStore().toArray(owner, eStructuralFeature); >+ return null; > } > >- @Override >- protected <T> T[] delegateToArray(T[] array) >+ public EStructuralFeature getContainingFeature(InternalEObject eObject) > { >- return getStore().toArray(owner, eStructuralFeature, array); >+ // This should never be called. >+ throw new UnsupportedOperationException(); > } > >- @SuppressWarnings("unchecked") >- @Override >- protected E delegateMove(int targetIndex, int sourceIndex) >+ public EObject create(EClass eClass) > { >- return (E)getStore().move(owner, eStructuralFeature, targetIndex, sourceIndex); >+ return new EStoreEObjectImpl(eClass, this); > } > >- @Override >- protected boolean delegateEquals(Object object) >+ public boolean isSet(InternalEObject eObject, EStructuralFeature feature) > { >- if (object == this) >- { >- return true; >- } >- >- if (!(object instanceof List)) >- { >- return false; >- } >- >- List<?> list = (List<?>)object; >- if (list.size() != delegateSize()) >- { >- return false; >- } >- >- for (ListIterator<?> i = list.listIterator(); i.hasNext();) >- { >- Object element = i.next(); >- if (element == null ? get(i.previousIndex()) != null : !element.equals(get(i.previousIndex()))) >- { >- return false; >- } >- } >- >- return true; >+ int dynamicFeatureID = eDynamicFeatureID(eObject, feature); >+ return getValue(eObject, dynamicFeatureID) != null; > } > >- @Override >- protected String delegateToString() >+ public void unset(InternalEObject eObject, EStructuralFeature feature) > { >- StringBuffer stringBuffer = new StringBuffer(); >- stringBuffer.append("["); >- for (int i = 0, size = size(); i < size;) >- { >- Object value = delegateGet(i); >- stringBuffer.append(String.valueOf(value)); >- if (++i < size) >- { >- stringBuffer.append(", "); >- } >- } >- stringBuffer.append("]"); >- return stringBuffer.toString(); >+ int dynamicFeatureID = eDynamicFeatureID(eObject, feature); >+ setValue(eObject, dynamicFeatureID, null); > } > } > >@@ -1233,7 +1182,7 @@ > @Override > protected void delegateAdd(int index, Entry object) > { >- getStore().add(owner, eStructuralFeature, index, object); >+ eStore().add(owner, eStructuralFeature, index, object); > } > > @Override >@@ -1251,20 +1200,20 @@ > return ECollections.emptyEList(); > } > >- Object[] data = getStore().toArray(owner, eStructuralFeature); >+ Object[] data = cdoStore().toArray(owner, eStructuralFeature); > return new EcoreEList.UnmodifiableEList<FeatureMap.Entry>(owner, eStructuralFeature, data.length, data); > } > > @Override > protected void delegateClear() > { >- getStore().clear(owner, eStructuralFeature); >+ eStore().clear(owner, eStructuralFeature); > } > > @Override > protected boolean delegateContains(Object object) > { >- return getStore().contains(owner, eStructuralFeature, object); >+ return eStore().contains(owner, eStructuralFeature, object); > } > > @Override >@@ -1277,31 +1226,32 @@ > return false; > } > } >+ > return true; > } > > @Override > protected Entry delegateGet(int index) > { >- return (Entry)getStore().get(owner, eStructuralFeature, index); >+ return (Entry)eStore().get(owner, eStructuralFeature, index); > } > > @Override > protected int delegateHashCode() > { >- return getStore().hashCode(owner, eStructuralFeature); >+ return eStore().hashCode(owner, eStructuralFeature); > } > > @Override > protected int delegateIndexOf(Object object) > { >- return getStore().indexOf(owner, eStructuralFeature, object); >+ return eStore().indexOf(owner, eStructuralFeature, object); > } > > @Override > protected boolean delegateIsEmpty() > { >- return getStore().isEmpty(owner, eStructuralFeature); >+ return eStore().isEmpty(owner, eStructuralFeature); > } > > @Override >@@ -1313,7 +1263,7 @@ > @Override > protected int delegateLastIndexOf(Object object) > { >- return getStore().lastIndexOf(owner, eStructuralFeature, object); >+ return eStore().lastIndexOf(owner, eStructuralFeature, object); > } > > @Override >@@ -1325,37 +1275,37 @@ > @Override > protected Entry delegateRemove(int index) > { >- return (Entry)getStore().remove(owner, eStructuralFeature, index); >+ return (Entry)eStore().remove(owner, eStructuralFeature, index); > } > > @Override > protected Entry delegateSet(int index, Entry object) > { >- return (Entry)getStore().set(owner, eStructuralFeature, index, object); >+ return (Entry)eStore().set(owner, eStructuralFeature, index, object); > } > > @Override > protected int delegateSize() > { >- return getStore().size(owner, eStructuralFeature); >+ return eStore().size(owner, eStructuralFeature); > } > > @Override > protected Object[] delegateToArray() > { >- return getStore().toArray(owner, eStructuralFeature); >+ return eStore().toArray(owner, eStructuralFeature); > } > > @Override > protected <T> T[] delegateToArray(T[] array) > { >- return getStore().toArray(owner, eStructuralFeature, array); >+ return eStore().toArray(owner, eStructuralFeature, array); > } > > @Override > protected Entry delegateMove(int targetIndex, int sourceIndex) > { >- return (Entry)getStore().move(owner, eStructuralFeature, targetIndex, sourceIndex); >+ return (Entry)eStore().move(owner, eStructuralFeature, targetIndex, sourceIndex); > } > > @Override >@@ -1372,6 +1322,7 @@ > stringBuffer.append(", "); > } > } >+ > stringBuffer.append("]"); > return stringBuffer.toString(); > } >Index: src/org/eclipse/emf/internal/cdo/CDOCommitContext.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.cdo/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOCommitContext.java,v >retrieving revision 1.1 >diff -u -r1.1 CDOCommitContext.java >--- src/org/eclipse/emf/internal/cdo/CDOCommitContext.java 11 Sep 2008 06:38:26 -0000 1.1 >+++ src/org/eclipse/emf/internal/cdo/CDOCommitContext.java 27 Oct 2008 07:15:11 -0000 >@@ -21,7 +21,6 @@ > > import java.util.List; > import java.util.Map; >-import java.util.Set; > > /** > * Provides a context for a commit operation. >@@ -45,7 +44,7 @@ > > public Map<CDOID, CDOObject> getDirtyObjects(); > >- public Set<CDOID> getDetachedObjects(); >+ public Map<CDOID, CDOObject> getDetachedObjects(); > > public Map<CDOID, CDORevisionDelta> getRevisionDeltas(); > } >Index: src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionRequest.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.cdo/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionRequest.java,v >retrieving revision 1.47 >diff -u -r1.47 CommitTransactionRequest.java >--- src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionRequest.java 14 Oct 2008 20:10:39 -0000 1.47 >+++ src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionRequest.java 27 Oct 2008 07:15:12 -0000 >@@ -103,7 +103,7 @@ > Collection<CDOResource> newResources = commitContext.getNewResources().values(); > Collection<CDOObject> newObjects = commitContext.getNewObjects().values(); > Collection<CDORevisionDelta> revisionDeltas = commitContext.getRevisionDeltas().values(); >- Collection<CDOID> detachedObjects = commitContext.getDetachedObjects(); >+ Collection<CDOID> detachedObjects = commitContext.getDetachedObjects().keySet(); > > out.writeInt(newPackages.size()); > out.writeInt(newResources.size() + newObjects.size()); >#P org.eclipse.emf.cdo.tests >Index: src/org/eclipse/emf/cdo/tests/AllTestsAllConfigs.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.cdo/tests/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsAllConfigs.java,v >retrieving revision 1.13 >diff -u -r1.13 AllTestsAllConfigs.java >--- src/org/eclipse/emf/cdo/tests/AllTestsAllConfigs.java 26 Oct 2008 20:18:27 -0000 1.13 >+++ src/org/eclipse/emf/cdo/tests/AllTestsAllConfigs.java 27 Oct 2008 07:15:14 -0000 >@@ -16,6 +16,7 @@ > import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_246442_Test; > import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_246456_Test; > import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_246622_Test; >+import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_248052_Test; > import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_248124_Test; > import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_248915_Test; > import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_250036_Test; >@@ -23,6 +24,7 @@ > import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_250910_Test; > import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_251087_Test; > import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_251263_Test; >+import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_251544_Test; > import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_251752_Test; > import org.eclipse.emf.cdo.tests.config.ConfigTest; > import org.eclipse.emf.cdo.tests.config.ConfigTestSuite; >@@ -85,14 +87,16 @@ > testClasses.add(Bugzilla_246442_Test.class); > testClasses.add(Bugzilla_246456_Test.class); > testClasses.add(Bugzilla_246622_Test.class); >+ testClasses.add(Bugzilla_248052_Test.class); > testClasses.add(Bugzilla_248124_Test.class); > testClasses.add(Bugzilla_248915_Test.class); > testClasses.add(Bugzilla_250036_Test.class); > testClasses.add(Bugzilla_250757_Test.class); >+ testClasses.add(Bugzilla_250910_Test.class); > testClasses.add(Bugzilla_251087_Test.class); > testClasses.add(Bugzilla_251263_Test.class); >+ testClasses.add(Bugzilla_251544_Test.class); > testClasses.add(Bugzilla_251752_Test.class); >- testClasses.add(Bugzilla_250910_Test.class); > > // TODO testClasses.add(NonCDOResourceTest.class); > // TODO testClasses.add(GeneratedEcoreTest.class); >Index: src/org/eclipse/emf/cdo/tests/DetachTest.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.cdo/tests/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/DetachTest.java,v >retrieving revision 1.8 >diff -u -r1.8 DetachTest.java >--- src/org/eclipse/emf/cdo/tests/DetachTest.java 19 Oct 2008 01:29:00 -0000 1.8 >+++ src/org/eclipse/emf/cdo/tests/DetachTest.java 27 Oct 2008 07:15:14 -0000 >@@ -57,6 +57,8 @@ > assertNull(transaction.getResourceSet().getEObject(uriC1, false)); > > transaction.commit(); >+ assertNull(transaction.getResourceSet().getEObject(uriC1, false)); >+ session.close(); > } > > public void testCleanObjectDeletion() throws Exception >@@ -76,18 +78,9 @@ > > resource.getContents().remove(c1); > assertTransient(c1); >+ assertSame(c1, transaction.getObject(id)); >+ assertSame(c1, transaction.getResourceSet().getEObject(uriC1, false)); > >- try >- { >- transaction.getObject(id); >- fail("ObjectNotFoundException expected"); >- } >- catch (ObjectNotFoundException expected) >- { >- // SUCCESS >- } >- >- assertNull(transaction.getResourceSet().getEObject(uriC1, false)); > transaction.commit(); > assertTransient(c1); > >@@ -102,6 +95,7 @@ > } > > assertNull(transaction.getResourceSet().getEObject(uriC1, false)); >+ session.close(); > } > > public void testSavePointNewObjectDeletion() throws Exception >@@ -149,16 +143,32 @@ > > CDOSavepoint savepoint2 = transaction.setSavepoint(); > c1.setName("SIMON2"); >- assertNull(transaction.getResourceSet().getEObject(uriC1, false)); >+ if (isPersisted) >+ { >+ assertNotNull(transaction.getResourceSet().getEObject(uriC1, false)); >+ } >+ else >+ { >+ assertNull(transaction.getResourceSet().getEObject(uriC1, false)); >+ } > > savepoint2.rollback(); > assertEquals("SIMON2", c1.getName()); > assertTransient(c1); >- assertNull(transaction.getResourceSet().getEObject(uriC1, false)); >+ >+ if (isPersisted) >+ { >+ assertNotNull(transaction.getResourceSet().getEObject(uriC1, false)); >+ } >+ else >+ { >+ assertNull(transaction.getResourceSet().getEObject(uriC1, false)); >+ } > > savepoint.rollback(); > assertEquals("SIMON", c1.getName()); > assertEquals(c1, transaction.getResourceSet().getEObject(uriC1, false)); >+ > if (isPersisted) > { > assertDirty(c1, transaction); >Index: src/org/eclipse/emf/cdo/tests/TransactionTest.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.cdo/tests/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionTest.java,v >retrieving revision 1.3 >diff -u -r1.3 TransactionTest.java >--- src/org/eclipse/emf/cdo/tests/TransactionTest.java 28 Sep 2008 10:46:26 -0000 1.3 >+++ src/org/eclipse/emf/cdo/tests/TransactionTest.java 27 Oct 2008 07:15:14 -0000 >@@ -63,7 +63,6 @@ > } > } > >- @SuppressWarnings("deprecation") > public void testCreateManyTransactions() throws Exception > { > msg("Opening session"); >@@ -79,8 +78,8 @@ > msg("Transaction " + i + " (" + lastDuration + ")"); > lastDuration = System.currentTimeMillis(); > transaction = session.openTransaction(); >- transaction.setUniqueResourceContents(false); > resource = transaction.getResource("/test2"); >+ > Category category = getModel1Factory().createCategory(); > resource.getContents().add(category); > transaction.commit(); >Index: src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_246456_Test.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.cdo/tests/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_246456_Test.java,v >retrieving revision 1.3 >diff -u -r1.3 Bugzilla_246456_Test.java >--- src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_246456_Test.java 22 Sep 2008 09:20:06 -0000 1.3 >+++ src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_246456_Test.java 27 Oct 2008 07:15:14 -0000 >@@ -24,7 +24,6 @@ > */ > public class Bugzilla_246456_Test extends AbstractCDOTest > { >- @SuppressWarnings("deprecation") > public void testBugzilla_246456() throws Exception > { > msg("Opening session"); >@@ -36,7 +35,6 @@ > .setCapacityRevised(10); > ((LRURevisionCache)((TwoLevelRevisionCache)transaction.getSession().getRevisionManager().getCache()).getLevel1()) > .setCapacityCurrent(10); >- transaction.setUniqueResourceContents(false); > > msg("Creating resource"); > CDOResource resource = transaction.createResource("/test1"); >Index: src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_251544_Test.java >=================================================================== >RCS file: src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_251544_Test.java >diff -N src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_251544_Test.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_251544_Test.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,68 @@ >+package org.eclipse.emf.cdo.tests.bugzilla; >+ >+import org.eclipse.emf.cdo.CDOSession; >+import org.eclipse.emf.cdo.CDOTransaction; >+import org.eclipse.emf.cdo.eresource.CDOResource; >+import org.eclipse.emf.cdo.tests.AbstractCDOTest; >+import org.eclipse.emf.cdo.tests.model1.Order; >+import org.eclipse.emf.cdo.tests.model1.OrderDetail; >+import org.eclipse.emf.cdo.tests.model1.Product1; >+ >+import org.eclipse.emf.common.util.EList; >+import org.eclipse.emf.ecore.EObject; >+ >+/** >+ * Resources fetched using CDOViewImpl.getResource(CDOID) not added to ResourceSet >+ * <p> >+ * See https://bugs.eclipse.org/251544 >+ * >+ * @author Simon McDuff >+ */ >+public class Bugzilla_251544_Test extends AbstractCDOTest >+{ >+ public void testFromPersistedToTransient() throws Exception >+ { >+ CDOSession session = openModel1Session(); >+ CDOTransaction transaction = session.openTransaction(); >+ CDOResource resource = transaction.createResource("/my/resource"); >+ >+ Order order1 = getModel1Factory().createOrder(); >+ OrderDetail orderDetail = getModel1Factory().createOrderDetail(); >+ Product1 product = getModel1Factory().createProduct1(); >+ EList<EObject> contentList = resource.getContents(); >+ resource.getContents().add(order1); >+ order1.getOrderDetails().add(orderDetail); >+ orderDetail.setProduct(product); >+ >+ EList<OrderDetail> list = order1.getOrderDetails(); >+ // >+ resource.getContents().remove(0); // remove object by index >+ list.remove(orderDetail); >+ transaction.commit(); >+ >+ resource.delete(null); >+ >+ assertSame(contentList, resource.getContents()); >+ } >+ >+ public void testFromTransientToPersisted() throws Exception >+ { >+ CDOSession session = openModel1Session(); >+ CDOTransaction transaction = session.openTransaction(); >+ CDOResource resource = transaction.createResource("/my/resource"); >+ >+ Order order1 = getModel1Factory().createOrder(); >+ OrderDetail orderDetail = getModel1Factory().createOrderDetail(); >+ EList<OrderDetail> orderDetails = order1.getOrderDetails(); >+ order1.getOrderDetails().add(orderDetail); >+ >+ msg("Persist the graph"); >+ resource.getContents().add(order1); >+ assertSame(orderDetails, order1.getOrderDetails()); >+ resource.getContents().remove(0); // remove object by index >+ assertSame(orderDetails, order1.getOrderDetails()); >+ assertEquals(true, orderDetails.remove(orderDetail)); >+ transaction.commit(); >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 251544
:
115764
|
115825
|
115828
| 116162