diff options
65 files changed, 898 insertions, 610 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryInfo.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryInfo.java index 6a9f6d4e76..99f7a78256 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryInfo.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryInfo.java @@ -69,7 +69,9 @@ public interface CDOQueryInfo * <code>false</code> otherwise. * * @since 4.0 + * @deprecated As of 4.2 the legacy mode is always enabled. */ + @Deprecated public boolean isLegacyModeEnabled(); /** diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/CDOQueryInfoImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/CDOQueryInfoImpl.java index 243e515bb0..a3e1489214 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/CDOQueryInfoImpl.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/CDOQueryInfoImpl.java @@ -37,8 +37,6 @@ public class CDOQueryInfoImpl implements CDOQueryInfo protected int maxResults = UNLIMITED_RESULTS; - protected boolean legacyModeEnabled; - protected CDOChangeSetData changeSetData; public CDOQueryInfoImpl(String queryLanguage, String queryString, Object context) @@ -54,7 +52,6 @@ public class CDOQueryInfoImpl implements CDOQueryInfo queryString = in.readString(); context = in.readCDORevisionOrPrimitiveOrClassifier(); maxResults = in.readInt(); - legacyModeEnabled = in.readBoolean(); if (in.readBoolean()) { @@ -76,7 +73,6 @@ public class CDOQueryInfoImpl implements CDOQueryInfo out.writeString(queryString); out.writeCDORevisionOrPrimitiveOrClassifier(context); out.writeInt(maxResults); - out.writeBoolean(legacyModeEnabled); if (changeSetData != null) { @@ -138,14 +134,10 @@ public class CDOQueryInfoImpl implements CDOQueryInfo return this; } + @Deprecated public boolean isLegacyModeEnabled() { - return legacyModeEnabled; - } - - public void setLegacyModeEnabled(boolean legacyModeEnabled) - { - this.legacyModeEnabled = legacyModeEnabled; + return true; } public CDOChangeSetData getChangeSetData() diff --git a/plugins/org.eclipse.emf.cdo.compare/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.compare/META-INF/MANIFEST.MF index 889ba9c08f..684e6cd3b1 100644 --- a/plugins/org.eclipse.emf.cdo.compare/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.cdo.compare/META-INF/MANIFEST.MF @@ -13,7 +13,7 @@ Require-Bundle: org.eclipse.emf.cdo;bundle-version="[4.0.0,5.0.0)";visibility:=r Export-Package: org.eclipse.emf.cdo.compare;version="4.2.0", org.eclipse.emf.cdo.internal.compare.bundle;version="4.2.0";x-friends:="org.eclipse.emf.cdo.tests" Bundle-ActivationPolicy: lazy -Import-Package: com.google.common.base;version="[10.0.0,11.0.0)", - com.google.common.cache;version="[10.0.1,11.0.0)", - com.google.common.collect;version="[10.0.0,11.0.0)", - com.google.common.util.concurrent;version="[10.0.1,11.0.0)" +Import-Package: com.google.common.base;version="[11.0.0,15.0.0)", + com.google.common.cache;version="[11.0.0,15.0.0)", + com.google.common.collect;version="[11.0.0,15.0.0)", + com.google.common.util.concurrent;version="[11.0.0,15.0.0)" diff --git a/plugins/org.eclipse.emf.cdo.compare/src/org/eclipse/emf/cdo/compare/CDOCompare.java b/plugins/org.eclipse.emf.cdo.compare/src/org/eclipse/emf/cdo/compare/CDOCompare.java new file mode 100644 index 0000000000..614b0f9608 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.compare/src/org/eclipse/emf/cdo/compare/CDOCompare.java @@ -0,0 +1,224 @@ +/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.compare; + +import org.eclipse.emf.cdo.CDOObject; +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.id.CDOIDUtil; +import org.eclipse.emf.cdo.common.model.EMFUtil; +import org.eclipse.emf.cdo.util.CDOUtil; + +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.notify.impl.AdapterImpl; +import org.eclipse.emf.common.util.Monitor; +import org.eclipse.emf.compare.Comparison; +import org.eclipse.emf.compare.EMFCompare; +import org.eclipse.emf.compare.EMFCompare.Builder; +import org.eclipse.emf.compare.conflict.IConflictDetector; +import org.eclipse.emf.compare.diff.IDiffEngine; +import org.eclipse.emf.compare.equi.IEquiEngine; +import org.eclipse.emf.compare.match.DefaultComparisonFactory; +import org.eclipse.emf.compare.match.DefaultEqualityHelperFactory; +import org.eclipse.emf.compare.match.DefaultMatchEngine; +import org.eclipse.emf.compare.match.IComparisonFactory; +import org.eclipse.emf.compare.match.IEqualityHelperFactory; +import org.eclipse.emf.compare.match.IMatchEngine; +import org.eclipse.emf.compare.match.eobject.IEObjectMatcher; +import org.eclipse.emf.compare.match.eobject.IdentifierEObjectMatcher; +import org.eclipse.emf.compare.postprocessor.IPostProcessor; +import org.eclipse.emf.compare.req.IReqEngine; +import org.eclipse.emf.compare.scope.IComparisonScope; +import org.eclipse.emf.ecore.EObject; + +import com.google.common.base.Function; + +/** + * @author Eike Stepper + */ +public class CDOCompare +{ + public Comparison compare(IComparisonScope scope) + { + Function<EObject, String> idFunction = createIDFunction(); + IEObjectMatcher matcher = createMatcher(idFunction); + IEqualityHelperFactory equalityHelperFactory = createEqualityHelperFactory(); + IComparisonFactory comparisonFactory = createComparisonFactory(equalityHelperFactory); + EMFCompare comparator = createComparator(matcher, comparisonFactory); + + Comparison comparison = comparator.compare(scope); + comparison.eAdapters().add(new ComparisonScopeAdapter(scope)); + return comparison; + } + + protected CDOIDFunction createIDFunction() + { + return new CDOIDFunction(); + } + + protected IdentifierEObjectMatcher createMatcher(Function<EObject, String> idFunction) + { + return new IdentifierEObjectMatcher(idFunction); + } + + protected IEqualityHelperFactory createEqualityHelperFactory() + { + return new DefaultEqualityHelperFactory(); + } + + protected IComparisonFactory createComparisonFactory(IEqualityHelperFactory equalityHelperFactory) + { + return new DefaultComparisonFactory(equalityHelperFactory); + } + + protected EMFCompare createComparator(IEObjectMatcher matcher, IComparisonFactory comparisonFactory) + { + Builder builder = EMFCompare.builder(); + + IMatchEngine matchEngine = createMatchEngine(matcher, comparisonFactory); + if (matchEngine != null) + { + builder.setMatchEngine(matchEngine); + } + + IDiffEngine diffEngine = createDiffEngine(); + if (diffEngine != null) + { + builder.setDiffEngine(diffEngine); + } + + IReqEngine reqEngine = createRequirementEngine(); + if (reqEngine != null) + { + builder.setRequirementEngine(reqEngine); + } + + IEquiEngine equiEngine = createEquivalenceEngine(); + if (equiEngine != null) + { + builder.setEquivalenceEngine(equiEngine); + } + + IPostProcessor.Descriptor.Registry<?> registry = createPostProcessorRegistry(); + if (registry != null) + { + builder.setPostProcessorRegistry(registry); + } + + IConflictDetector conflictDetector = createConflictDetector(); + if (conflictDetector != null) + { + builder.setConflictDetector(conflictDetector); + } + + return builder.build(); + } + + protected CDOMatchEngine createMatchEngine(IEObjectMatcher matcher, IComparisonFactory comparisonFactory) + { + return new CDOMatchEngine(matcher, comparisonFactory); + } + + protected IDiffEngine createDiffEngine() + { + return null; + } + + protected IReqEngine createRequirementEngine() + { + return null; + } + + protected IEquiEngine createEquivalenceEngine() + { + return null; + } + + protected IPostProcessor.Descriptor.Registry<?> createPostProcessorRegistry() + { + return null; + } + + protected IConflictDetector createConflictDetector() + { + return null; + } + + public static IComparisonScope getScope(Comparison comparison) + { + ComparisonScopeAdapter adapter = EMFUtil.getAdapter(comparison, ComparisonScopeAdapter.class); + if (adapter == null) + { + return null; + } + + return adapter.getScope(); + } + + /** + * An {@link CDOIDFunction ID function} that considers the {@link CDOID}s of {@link CDOObject objects}. + * + * @author Eike Stepper + */ + public static class CDOIDFunction implements Function<EObject, String> + { + public String apply(EObject o) + { + CDOObject object = CDOUtil.getCDOObject(o); + CDOID id = object.cdoID(); + + StringBuilder builder = new StringBuilder(); + CDOIDUtil.write(builder, id); + return builder.toString(); + } + } + + /** + * @author Eike Stepper + */ + public static final class CDOMatchEngine extends DefaultMatchEngine + { + CDOMatchEngine(IEObjectMatcher matcher, IComparisonFactory comparisonFactory) + { + super(matcher, comparisonFactory); + } + + @Override + protected void match(Comparison comparison, IComparisonScope scope, final Notifier left, final Notifier right, + final Notifier origin, Monitor monitor) + { + match(comparison, scope, (EObject)left, (EObject)right, (EObject)origin, monitor); + } + } + + /** + * @author Eike Stepper + */ + private static final class ComparisonScopeAdapter extends AdapterImpl + { + private IComparisonScope scope; + + public ComparisonScopeAdapter(IComparisonScope scope) + { + this.scope = scope; + } + + public final IComparisonScope getScope() + { + return scope; + } + + @Override + public boolean isAdapterForType(Object type) + { + return type == ComparisonScopeAdapter.class; + } + } +} diff --git a/plugins/org.eclipse.emf.cdo.compare/src/org/eclipse/emf/cdo/compare/CDOCompareUtil.java b/plugins/org.eclipse.emf.cdo.compare/src/org/eclipse/emf/cdo/compare/CDOCompareUtil.java index 87ccff36f9..fea269b545 100644 --- a/plugins/org.eclipse.emf.cdo.compare/src/org/eclipse/emf/cdo/compare/CDOCompareUtil.java +++ b/plugins/org.eclipse.emf.cdo.compare/src/org/eclipse/emf/cdo/compare/CDOCompareUtil.java @@ -13,8 +13,8 @@ package org.eclipse.emf.cdo.compare; import org.eclipse.emf.cdo.CDOObject; import org.eclipse.emf.cdo.common.branch.CDOBranch; import org.eclipse.emf.cdo.common.branch.CDOBranchPoint; -import org.eclipse.emf.cdo.common.commit.CDOChangeSetData; import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.compare.CDOCompare.CDOIDFunction; import org.eclipse.emf.cdo.compare.CDOComparisonScope.AllContents; import org.eclipse.emf.cdo.compare.CDOComparisonScope.Minimal; import org.eclipse.emf.cdo.eresource.CDOResource; @@ -22,29 +22,14 @@ import org.eclipse.emf.cdo.eresource.CDOResourceFolder; import org.eclipse.emf.cdo.eresource.CDOResourceNode; import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil; import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.cdo.util.CDOUtil; import org.eclipse.emf.cdo.view.CDOView; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.util.Monitor; import org.eclipse.emf.compare.Comparison; -import org.eclipse.emf.compare.EMFCompare; import org.eclipse.emf.compare.Match; -import org.eclipse.emf.compare.match.DefaultComparisonFactory; -import org.eclipse.emf.compare.match.DefaultEqualityHelperFactory; -import org.eclipse.emf.compare.match.DefaultMatchEngine; -import org.eclipse.emf.compare.match.IComparisonFactory; -import org.eclipse.emf.compare.match.IMatchEngine; import org.eclipse.emf.compare.match.eobject.IEObjectMatcher; -import org.eclipse.emf.compare.match.eobject.IdentifierEObjectMatcher; import org.eclipse.emf.compare.scope.IComparisonScope; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.spi.cdo.InternalCDOSession; -import org.eclipse.emf.spi.cdo.InternalCDOSession.MergeData; -import com.google.common.base.Function; - -import java.util.HashSet; import java.util.Set; /** @@ -83,6 +68,11 @@ public final class CDOCompareUtil { } + public static Comparison compare(IComparisonScope scope) + { + return new CDOCompare().compare(scope); + } + /** * Takes an arbitrary {@link CDOObject object} (including {@link CDOResourceNode resource nodes}) and returns {@link Match matches} for <b>all</b> elements of its {@link EObject#eAllContents() content tree}. This scope has the advantage that the comparison can * be rooted at specific objects that are different from (below of) the root resource. The disadvantage is that all the transitive children of this specific object are @@ -90,19 +80,7 @@ public final class CDOCompareUtil */ public static Comparison compare(CDOObject left, CDOView rightView, CDOView[] originView) { - CDOView leftView = left.cdoView(); - if (leftView.getSession() != rightView.getSession()) - { - throw new IllegalArgumentException("Sessions are different"); - } - - CDOView view = openOriginView(leftView, rightView, originView); - - CDOObject right = CDOUtil.getCDOObject(rightView.getObject(left)); - CDOObject origin = view == null ? null : CDOUtil.getCDOObject(view.getObject(left)); - - IComparisonScope scope = new CDOComparisonScope.AllContents(left, right, origin); - return createComparison(scope); + return compare(CDOComparisonScope.AllContents.create(left, rightView, originView)); } /** @@ -113,84 +91,16 @@ public final class CDOCompareUtil */ public static Comparison compare(CDOView leftView, CDOView rightView, CDOView[] originView) { - InternalCDOSession session = (InternalCDOSession)leftView.getSession(); - if (rightView.getSession() != session) - { - throw new IllegalArgumentException("Sessions are different"); - } - - CDOView view = openOriginView(leftView, rightView, originView); - - Set<CDOID> ids; - if (view != null) - { - MergeData mergeData = session.getMergeData(leftView, rightView, view, false); - ids = mergeData.getIDs(); - } - else - { - CDOChangeSetData changeSetData = leftView.compareRevisions(rightView); - ids = new HashSet<CDOID>(changeSetData.getChangeKinds().keySet()); - } - - IComparisonScope scope = new CDOComparisonScope.Minimal(leftView, rightView, view, ids); - return createComparison(scope); + return compare(CDOComparisonScope.Minimal.create(leftView, rightView, originView)); } - private static CDOView openOriginView(CDOView leftView, CDOView rightView, CDOView[] originView) + public static Comparison compare(CDOView leftView, CDOView rightView, CDOView[] originView, Set<CDOID> ids) { - if (originView != null) - { - if (originView.length != 1) - { - throw new IllegalArgumentException("originView.length != 1"); - } - - if (originView[0] != null) - { - throw new IllegalArgumentException("originView[0] != null"); - } - - CDOBranchPoint ancestor = CDOBranchUtil.getAncestor(leftView, rightView); - if (!ancestor.equals(leftView) && !ancestor.equals(rightView)) - { - originView[0] = leftView.getSession().openView(ancestor); - return originView[0]; - } - } - - return null; - } - - private static Comparison createComparison(IComparisonScope scope) - { - Function<EObject, String> idFunction = new CDOIDFunction(); - IEObjectMatcher matcher = new IdentifierEObjectMatcher(idFunction); - - IComparisonFactory comparisonFactory = new DefaultComparisonFactory(new DefaultEqualityHelperFactory()); - IMatchEngine matchEngine = new CDOMatchEngine(matcher, comparisonFactory); - EMFCompare comparator = EMFCompare.builder().setMatchEngine(matchEngine).build(); - - Comparison comparison = comparator.compare(scope); - comparison.eAdapters().add(new ComparisonScopeAdapter(scope)); - return comparison; + return compare(CDOComparisonScope.Minimal.create(leftView, rightView, originView, ids)); } - /** - * @author Eike Stepper - */ - private static final class CDOMatchEngine extends DefaultMatchEngine + public static Comparison compareUncommittedChanges(CDOTransaction transaction) { - private CDOMatchEngine(IEObjectMatcher matcher, IComparisonFactory comparisonFactory) - { - super(matcher, comparisonFactory); - } - - @Override - protected void match(Comparison comparison, IComparisonScope scope, final Notifier left, final Notifier right, - final Notifier origin, Monitor monitor) - { - match(comparison, scope, (EObject)left, (EObject)right, (EObject)origin, monitor); - } + return compare(CDOComparisonScope.Minimal.create(transaction)); } } diff --git a/plugins/org.eclipse.emf.cdo.compare/src/org/eclipse/emf/cdo/compare/CDOComparisonScope.java b/plugins/org.eclipse.emf.cdo.compare/src/org/eclipse/emf/cdo/compare/CDOComparisonScope.java index 585f398193..e9b9b5f529 100644 --- a/plugins/org.eclipse.emf.cdo.compare/src/org/eclipse/emf/cdo/compare/CDOComparisonScope.java +++ b/plugins/org.eclipse.emf.cdo.compare/src/org/eclipse/emf/cdo/compare/CDOComparisonScope.java @@ -11,11 +11,16 @@ package org.eclipse.emf.cdo.compare; import org.eclipse.emf.cdo.CDOObject; +import org.eclipse.emf.cdo.CDOState; +import org.eclipse.emf.cdo.common.branch.CDOBranchPoint; +import org.eclipse.emf.cdo.common.commit.CDOChangeSetData; import org.eclipse.emf.cdo.common.id.CDOID; import org.eclipse.emf.cdo.common.id.CDOIDUtil; -import org.eclipse.emf.cdo.common.revision.CDORevision; +import org.eclipse.emf.cdo.common.revision.CDORevisionData; import org.eclipse.emf.cdo.eresource.CDOResource; import org.eclipse.emf.cdo.eresource.CDOResourceNode; +import org.eclipse.emf.cdo.session.CDOSession; +import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil; import org.eclipse.emf.cdo.transaction.CDOTransaction; import org.eclipse.emf.cdo.util.CDOUtil; import org.eclipse.emf.cdo.util.ObjectNotFoundException; @@ -29,6 +34,10 @@ import org.eclipse.emf.compare.scope.IComparisonScope; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.util.EcoreUtil.ProperContentIterator; +import org.eclipse.emf.spi.cdo.InternalCDOSession; +import org.eclipse.emf.spi.cdo.InternalCDOSession.MergeData; import com.google.common.base.Predicate; import com.google.common.collect.Iterators; @@ -44,6 +53,8 @@ import java.util.Set; */ public abstract class CDOComparisonScope extends AbstractComparisonScope { + private boolean resolveProxies = true; + public CDOComparisonScope(Notifier left, Notifier right, Notifier origin) { super(left, right, origin); @@ -59,6 +70,46 @@ public abstract class CDOComparisonScope extends AbstractComparisonScope return Iterators.emptyIterator(); } + public final boolean isResolveProxies() + { + return resolveProxies; + } + + public final void setResolveProxies(boolean resolveProxies) + { + this.resolveProxies = resolveProxies; + } + + private static CDOView openOriginView(CDOView leftView, CDOView rightView, CDOView[] originView) + { + if (leftView.getSession() != rightView.getSession()) + { + throw new IllegalArgumentException("Sessions are different"); + } + + if (originView != null) + { + if (originView.length != 1) + { + throw new IllegalArgumentException("originView.length != 1"); + } + + if (originView[0] != null) + { + throw new IllegalArgumentException("originView[0] != null"); + } + + CDOBranchPoint ancestor = CDOBranchUtil.getAncestor(leftView, rightView); + if (!ancestor.equals(leftView) && !ancestor.equals(rightView)) + { + originView[0] = leftView.getSession().openView(ancestor); + return originView[0]; + } + } + + return null; + } + /** * Takes an arbitrary {@link CDOObject object} (including {@link CDOResourceNode resource nodes}) * and returns {@link Match matches} for <b>all</b> elements of its {@link EObject#eAllContents() content tree}. This scope has the advantage that the comparison can @@ -80,7 +131,23 @@ public abstract class CDOComparisonScope extends AbstractComparisonScope public Iterator<? extends EObject> getChildren(EObject eObject) { - return eObject.eAllContents(); + return EcoreUtil.getAllProperContents(eObject, isResolveProxies()); + } + + /** + * Takes an arbitrary {@link CDOObject object} (including {@link CDOResourceNode resource nodes}) and returns {@link Match matches} for <b>all</b> elements of its {@link EObject#eAllContents() content tree}. This scope has the advantage that the comparison can + * be rooted at specific objects that are different from (below of) the root resource. The disadvantage is that all the transitive children of this specific object are + * matched, whether they differ or not. Major parts of huge repositories can be loaded to the client side easily, if no attention is paid. + */ + public static AllContents create(CDOObject left, CDOView rightView, CDOView[] originView) + { + CDOView leftView = left.cdoView(); + CDOView view = openOriginView(leftView, rightView, originView); + + CDOObject right = CDOUtil.getCDOObject(rightView.getObject(left)); + CDOObject origin = view == null ? null : CDOUtil.getCDOObject(view.getObject(left)); + + return new CDOComparisonScope.AllContents(left, right, origin); } } @@ -128,7 +195,14 @@ public abstract class CDOComparisonScope extends AbstractComparisonScope @Override public Iterator<EObject> getChildren(Object object) { - return Iterators.filter(((EObject)object).eContents().iterator(), Minimal.this); + if (object instanceof Resource) + { + Iterator<EObject> iterator = ((Resource)object).getContents().iterator(); + return Iterators.filter(iterator, Minimal.this); + } + + Iterator<EObject> iterator = new ProperContentIterator<EObject>((EObject)object, isResolveProxies()); + return Iterators.filter(iterator, Minimal.this); } }; } @@ -142,24 +216,38 @@ public abstract class CDOComparisonScope extends AbstractComparisonScope private void collectRequiredParentIDs(CDOObject object, Set<CDOID> requiredParentIDs) { + CDOState state = object.cdoState(); + if (state == CDOState.TRANSIENT) + { + return; + } + CDOView view = object.cdoView(); - CDORevision revision = object.cdoRevision(); + if (state == CDOState.PROXY) + { + CDOUtil.load(object, view); + } - CDOID containerID = (CDOID)revision.data().getContainerID(); - collectRequiredParentIDs(view, containerID, requiredParentIDs); + CDORevisionData revisionData = object.cdoRevision().data(); - CDOID resourceID = revision.data().getResourceID(); - collectRequiredParentIDs(view, resourceID, requiredParentIDs); + CDOID resourceID = revisionData.getResourceID(); + if (!CDOIDUtil.isNull(resourceID)) + { + collectRequiredParentIDs(view, resourceID, requiredParentIDs); + } + else + { + CDOID containerID = (CDOID)revisionData.getContainerID(); + collectRequiredParentIDs(view, containerID, requiredParentIDs); + } } private void collectRequiredParentIDs(CDOView view, CDOID id, Set<CDOID> requiredParentIDs) { if (!CDOIDUtil.isNull(id)) { - if (!ids.contains(id) && !requiredParentIDs.contains(id)) + if (!ids.contains(id) && requiredParentIDs.add(id)) { - requiredParentIDs.add(id); - collectRequiredParentID(view, id, requiredParentIDs); } } @@ -181,6 +269,45 @@ public abstract class CDOComparisonScope extends AbstractComparisonScope } } + public static IComparisonScope create(CDOView leftView, CDOView rightView, CDOView[] originView) + { + CDOView view = openOriginView(leftView, rightView, originView); + Set<CDOID> ids = getAffectedIDs(leftView, rightView, view); + return new CDOComparisonScope.Minimal(leftView, rightView, view, ids); + } + + public static IComparisonScope create(CDOView leftView, CDOView rightView, CDOView[] originView, Set<CDOID> ids) + { + CDOView view = openOriginView(leftView, rightView, originView); + return new CDOComparisonScope.Minimal(leftView, rightView, view, ids); + } + + public static IComparisonScope create(CDOTransaction transaction) + { + CDOSession session = transaction.getSession(); + CDOView lastView = session.openView(transaction.getLastUpdateTime()); + + Set<CDOID> ids = new HashSet<CDOID>(); + ids.addAll(transaction.getNewObjects().keySet()); + ids.addAll(transaction.getDirtyObjects().keySet()); + ids.addAll(transaction.getDetachedObjects().keySet()); + + return new CDOComparisonScope.Minimal(transaction, lastView, null, ids); + } + + private static Set<CDOID> getAffectedIDs(CDOView leftView, CDOView rightView, CDOView originView) + { + if (originView != null) + { + InternalCDOSession session = (InternalCDOSession)leftView.getSession(); + MergeData mergeData = session.getMergeData(leftView, rightView, originView, false); + return mergeData.getIDs(); + } + + CDOChangeSetData changeSetData = leftView.compareRevisions(rightView); + return new HashSet<CDOID>(changeSetData.getChangeKinds().keySet()); + } + private static CDOResource getRoot(CDOView view) { if (view == null) diff --git a/plugins/org.eclipse.emf.cdo.compare/src/org/eclipse/emf/cdo/compare/CDOIDFunction.java b/plugins/org.eclipse.emf.cdo.compare/src/org/eclipse/emf/cdo/compare/CDOIDFunction.java deleted file mode 100644 index cca2e5d4a9..0000000000 --- a/plugins/org.eclipse.emf.cdo.compare/src/org/eclipse/emf/cdo/compare/CDOIDFunction.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Eike Stepper - initial API and implementation - */ -package org.eclipse.emf.cdo.compare; - -import org.eclipse.emf.cdo.CDOObject; -import org.eclipse.emf.cdo.common.id.CDOID; -import org.eclipse.emf.cdo.common.id.CDOIDUtil; -import org.eclipse.emf.cdo.util.CDOUtil; - -import org.eclipse.emf.ecore.EObject; - -import com.google.common.base.Function; - -/** - * An {@link CDOIDFunction ID function} that considers the {@link CDOID}s of {@link CDOObject objects}. - * - * @author Eike Stepper - */ -public class CDOIDFunction implements Function<EObject, String> -{ - public String apply(EObject o) - { - CDOObject object = CDOUtil.getCDOObject(o); - CDOID id = object.cdoID(); - - StringBuilder builder = new StringBuilder(); - CDOIDUtil.write(builder, id); - return builder.toString(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.emf.cdo.compare/src/org/eclipse/emf/cdo/compare/ComparisonScopeAdapter.java b/plugins/org.eclipse.emf.cdo.compare/src/org/eclipse/emf/cdo/compare/ComparisonScopeAdapter.java deleted file mode 100644 index c8b1cdbf7f..0000000000 --- a/plugins/org.eclipse.emf.cdo.compare/src/org/eclipse/emf/cdo/compare/ComparisonScopeAdapter.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Eike Stepper - initial API and implementation - */ -package org.eclipse.emf.cdo.compare; - -import org.eclipse.emf.common.notify.impl.AdapterImpl; -import org.eclipse.emf.compare.scope.IComparisonScope; - -/** - * @author Eike Stepper - */ -public final class ComparisonScopeAdapter extends AdapterImpl -{ - private IComparisonScope scope; - - public ComparisonScopeAdapter(IComparisonScope scope) - { - this.scope = scope; - } - - public final IComparisonScope getScope() - { - return scope; - } - - @Override - public boolean isAdapterForType(Object type) - { - return type == ComparisonScopeAdapter.class; - } -} diff --git a/plugins/org.eclipse.emf.cdo.dawn.util/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.dawn.util/META-INF/MANIFEST.MF index d66a5a43c9..79afedf11a 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.util/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.cdo.dawn.util/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.emf.cdo.dawn.util;singleton:=true -Bundle-Version: 2.0.0.qualifier +Bundle-Version: 2.0.100.qualifier Bundle-Activator: org.eclipse.emf.cdo.dawn.internal.util.bundle.OM$Activator Require-Bundle: org.eclipse.ui;bundle-version="[3.4.0,4.0.0)", org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)", @@ -12,8 +12,8 @@ Require-Bundle: org.eclipse.ui;bundle-version="[3.4.0,4.0.0)", org.eclipse.emf.cdo.net4j;bundle-version="[4.0.0,5.0.0)" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Export-Package: org.eclipse.emf.cdo.dawn.internal.util.bundle;version="2.0.0", - org.eclipse.emf.cdo.dawn.util.connection;version="2.0.0", - org.eclipse.emf.cdo.dawn.util.exceptions;version="2.0.0" +Export-Package: org.eclipse.emf.cdo.dawn.internal.util.bundle;version="2.0.100", + org.eclipse.emf.cdo.dawn.util.connection;version="2.0.100", + org.eclipse.emf.cdo.dawn.util.exceptions;version="2.0.100" Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/plugins/org.eclipse.emf.cdo.dawn.util/src/org/eclipse/emf/cdo/dawn/util/connection/CDOConnectionUtil.java b/plugins/org.eclipse.emf.cdo.dawn.util/src/org/eclipse/emf/cdo/dawn/util/connection/CDOConnectionUtil.java index 573fa93590..f5b72fdd71 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.util/src/org/eclipse/emf/cdo/dawn/util/connection/CDOConnectionUtil.java +++ b/plugins/org.eclipse.emf.cdo.dawn.util/src/org/eclipse/emf/cdo/dawn/util/connection/CDOConnectionUtil.java @@ -96,11 +96,6 @@ public class CDOConnectionUtil */ public CDOSession openSession() { - if (!CDOUtil.isLegacyModeDefault()) - { - CDOUtil.setLegacyModeDefault(true); - } - currentSession = (CDOSession)IPluginContainer.INSTANCE.getElement("org.eclipse.emf.cdo.sessions", "cdo", protocol + "://" + host + "?repositoryName=" + repositoryName); diff --git a/plugins/org.eclipse.emf.cdo.releng/build.rmap b/plugins/org.eclipse.emf.cdo.releng/build.rmap index 7a74ff7f18..8af488a605 100644 --- a/plugins/org.eclipse.emf.cdo.releng/build.rmap +++ b/plugins/org.eclipse.emf.cdo.releng/build.rmap @@ -48,7 +48,7 @@ <!-- EMF --> <rm:provider componentTypes="eclipse.feature,osgi.bundle" readerType="p2" source="false" mutable="false"> - <rm:uri format="https://hudson.eclipse.org/hudson/job/emf-core-head/384/artifact/EMF.p2.repository"> + <rm:uri format="http://download.eclipse.org/modeling/emf/emf/updates/{0}"> <bc:propertyRef key="emf.version"/> </rm:uri> </rm:provider> diff --git a/plugins/org.eclipse.emf.cdo.releng/docs/multi-line-replace.txt b/plugins/org.eclipse.emf.cdo.releng/docs/multi-line-replace.txt new file mode 100644 index 0000000000..d71b13053f --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.releng/docs/multi-line-replace.txt @@ -0,0 +1,11 @@ +Multi-line Replace +================== + +for i in `find -name org.eclipse.pde.api.tools.prefs`; do sed -f sed-script $i > $i.new; mv -f $i.new $i; done + +sed-script +========== + +1,$s/^search$/search\ +addition/ + diff --git a/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/OCLQueryHandler.java b/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/OCLQueryHandler.java index 6363c144aa..f855507f7c 100644 --- a/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/OCLQueryHandler.java +++ b/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/OCLQueryHandler.java @@ -95,7 +95,7 @@ public class OCLQueryHandler implements IQueryHandler } ISession session = context.getView().getSession(); - CDOView view = CDOServerUtil.openView(session, context, info.isLegacyModeEnabled(), revisionProvider); + CDOView view = CDOServerUtil.openView(session, context, revisionProvider); CDOPackageRegistry packageRegistry = view.getSession().getPackageRegistry(); EcoreEnvironmentFactory envFactory = new EcoreEnvironmentFactory(packageRegistry); diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/LockingManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/LockingManager.java index b8dcdc30eb..1e76f8df04 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/LockingManager.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/LockingManager.java @@ -237,7 +237,7 @@ public class LockingManager extends RWOLockManager<Object, IView> implements Int private Set<? extends Object> createContentSet(Collection<? extends Object> objectsToLock, IView view) { CDOBranch branch = view.getBranch(); - CDOView cdoView = CDOServerUtil.openView(view.getSession(), branch.getHead(), true); + CDOView cdoView = CDOServerUtil.openView(view.getSession(), branch.getHead()); Set<Object> contents = new HashSet<Object>(); for (Object o : objectsToLock) diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java index 4f13590180..035cd907fc 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java @@ -98,10 +98,9 @@ public class ServerCDOView extends AbstractCDOView implements org.eclipse.emf.cd private CDORevisionProvider revisionProvider; - public ServerCDOView(InternalSession session, CDOBranchPoint branchPoint, boolean legacyModeEnabled, - CDORevisionProvider revisionProvider) + public ServerCDOView(InternalSession session, CDOBranchPoint branchPoint, CDORevisionProvider revisionProvider) { - super(branchPoint, legacyModeEnabled); + super(branchPoint); this.session = new ServerCDOSession(session); this.revisionProvider = revisionProvider; diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java index 157d1148a9..e2af2774d3 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java @@ -65,43 +65,121 @@ public final class CDOServerUtil { } + // /** + // * @since 4.2 + // */ + // public static CDOView openView(ISession session, CDOBranchPoint branchPoint, CDORevisionProvider revisionProvider) + // { + // return new ServerCDOView((InternalSession)session, branchPoint, revisionProvider); + // } + // + // /** + // * @since 4.2 + // */ + // public static CDOView openView(ISession session, CDOBranchPoint branchPoint) + // { + // CDORevisionManager revisionManager = session.getManager().getRepository().getRevisionManager(); + // CDORevisionProvider revisionProvider = new ManagedRevisionProvider(revisionManager, branchPoint); + // return new ServerCDOView((InternalSession)session, branchPoint, revisionProvider); + // } + // + // /** + // * @since 4.2 + // */ + // public static CDOView openView(IView view) + // { + // ISession session = view.getSession(); + // CDOBranchPoint branchPoint = CDOBranchUtil.copyBranchPoint(view); + // return openView(session, branchPoint, view); + // } + // + // /** + // * @since 4.2 + // */ + // public static CDOView openView(IStoreAccessor.CommitContext commitContext) + // { + // ISession session = commitContext.getTransaction().getSession(); + // CDOBranchPoint branchPoint = commitContext.getBranchPoint(); + // return openView(session, branchPoint, commitContext); + // } + + /** + * @since 4.2 + */ + public static CDOView openView(ISession session, CDOBranchPoint branchPoint, CDORevisionProvider revisionProvider) + { + return new ServerCDOView((InternalSession)session, branchPoint, revisionProvider); + } + + /** + * @since 4.2 + */ + public static CDOView openView(ISession session, CDOBranchPoint branchPoint) + { + CDORevisionManager revisionManager = session.getManager().getRepository().getRevisionManager(); + CDORevisionProvider revisionProvider = new ManagedRevisionProvider(revisionManager, branchPoint); + return openView(session, branchPoint, revisionProvider); + } + + /** + * @since 4.2 + */ + public static CDOView openView(IView view) + { + ISession session = view.getSession(); + CDOBranchPoint branchPoint = CDOBranchUtil.copyBranchPoint(view); + return openView(session, branchPoint, view); + } + + /** + * @since 4.2 + */ + public static CDOView openView(IStoreAccessor.CommitContext commitContext) + { + ISession session = commitContext.getTransaction().getSession(); + CDOBranchPoint branchPoint = commitContext.getBranchPoint(); + return openView(session, branchPoint, commitContext); + } + /** * @since 4.0 + * @deprecated As of 4.2 the legacy mode is always enabled, use {@link #openView(ISession, CDOBranchPoint, CDORevisionProvider)}. */ + @Deprecated public static CDOView openView(ISession session, CDOBranchPoint branchPoint, boolean legacyModeEnabled, CDORevisionProvider revisionProvider) { - return new ServerCDOView((InternalSession)session, branchPoint, legacyModeEnabled, revisionProvider); + return openView(session, branchPoint, revisionProvider); } /** * @since 4.0 + * @deprecated As of 4.2 the legacy mode is always enabled, use {@link #openView(ISession, CDOBranchPoint)}. */ + @Deprecated public static CDOView openView(ISession session, CDOBranchPoint branchPoint, boolean legacyModeEnabled) { - CDORevisionManager revisionManager = session.getManager().getRepository().getRevisionManager(); - CDORevisionProvider revisionProvider = new ManagedRevisionProvider(revisionManager, branchPoint); - return new ServerCDOView((InternalSession)session, branchPoint, legacyModeEnabled, revisionProvider); + return openView(session, branchPoint); } /** * @since 4.0 + * @deprecated As of 4.2 the legacy mode is always enabled, use {@link #openView(IView)}. */ + @Deprecated public static CDOView openView(IView view, boolean legacyModeEnabled) { - ISession session = view.getSession(); - CDOBranchPoint branchPoint = CDOBranchUtil.copyBranchPoint(view); - return openView(session, branchPoint, legacyModeEnabled, view); + return openView(view); } /** * @since 4.0 + * @deprecated As of 4.2 the legacy mode is always enabled, use {@link #openView(IStoreAccessor.CommitContext)}. */ + @Deprecated public static CDOView openView(IStoreAccessor.CommitContext commitContext, boolean legacyModeEnabled) { - ISession session = commitContext.getTransaction().getSession(); - CDOBranchPoint branchPoint = commitContext.getBranchPoint(); - return openView(session, branchPoint, legacyModeEnabled, commitContext); + return openView(commitContext); } /** diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/ObjectWriteAccessHandler.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/ObjectWriteAccessHandler.java index 2b7d77015b..342ddb04dc 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/ObjectWriteAccessHandler.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/ObjectWriteAccessHandler.java @@ -33,8 +33,6 @@ import org.eclipse.emf.ecore.EObject; */ public class ObjectWriteAccessHandler implements WriteAccessHandler { - private boolean legacyModeEnabled; - private IStoreAccessor.CommitContext commitContext; private CDOView view; @@ -47,14 +45,21 @@ public class ObjectWriteAccessHandler implements WriteAccessHandler { } + /** + * @deprecated As of 4.2 the legacy mode is always enabled. + */ + @Deprecated public ObjectWriteAccessHandler(boolean legacyModeEnabled) { - this.legacyModeEnabled = legacyModeEnabled; } + /** + * @deprecated As of 4.2 the legacy mode is always enabled. + */ + @Deprecated public final boolean isLegacyModeEnabled() { - return legacyModeEnabled; + return true; } protected final IStoreAccessor.CommitContext getCommitContext() @@ -71,7 +76,7 @@ public class ObjectWriteAccessHandler implements WriteAccessHandler { if (view == null) { - view = CDOServerUtil.openView(commitContext, legacyModeEnabled); + view = CDOServerUtil.openView(commitContext); } return view; diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/model/model1.genmodel b/plugins/org.eclipse.emf.cdo.tests.model1/model/model1.genmodel index 535f8fe82b..24eb5368c3 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model1/model/model1.genmodel +++ b/plugins/org.eclipse.emf.cdo.tests.model1/model/model1.genmodel @@ -4,8 +4,9 @@ editDirectory="" editorDirectory="" modelPluginID="org.eclipse.emf.cdo.tests.model1" modelName="Model1" updateClasspath="false" rootExtendsClass="org.eclipse.emf.internal.cdo.CDOObjectImpl" reflectiveDelegation="true" codeFormatting="true" testsDirectory="" importerID="org.eclipse.emf.importer.ecore" - featureDelegation="Reflective" complianceLevel="5.0" providerRootExtendsClass="org.eclipse.emf.cdo.edit.CDOItemProviderAdapter" - optimizedHasChildren="true" tableProviders="true" colorProviders="true" fontProviders="true"> + featureDelegation="Reflective" containmentProxies="true" complianceLevel="5.0" + providerRootExtendsClass="org.eclipse.emf.cdo.edit.CDOItemProviderAdapter" optimizedHasChildren="true" + tableProviders="true" colorProviders="true" fontProviders="true"> <foreignModel>model1.ecore</foreignModel> <modelPluginVariables>CDO=org.eclipse.emf.cdo</modelPluginVariables> <genPackages prefix="Model1" basePackage="org.eclipse.emf.cdo.tests" disposableProviderFactory="true" diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/model/model1.legacy.genmodel b/plugins/org.eclipse.emf.cdo.tests.model1/model/model1.legacy.genmodel index 113bd85ce3..3f70907b9e 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model1/model/model1.legacy.genmodel +++ b/plugins/org.eclipse.emf.cdo.tests.model1/model/model1.legacy.genmodel @@ -4,7 +4,7 @@ modelDirectory="/org.eclipse.emf.cdo.tests.model1/src" editDirectory="" editorDirectory="" modelPluginID="org.eclipse.emf.cdo.tests.model1" modelName="Model1" updateClasspath="false" codeFormatting="true" testsDirectory="" importerID="org.eclipse.emf.importer.ecore" - complianceLevel="5.0" runtimeVersion="2.6"> + containmentProxies="true" complianceLevel="5.0" runtimeVersion="2.6"> <foreignModel>model1.ecore</foreignModel> <modelPluginVariables>CDO=org.eclipse.emf.cdo</modelPluginVariables> <genPackages prefix="Model1" basePackage="org.eclipse.emf.cdo.tests" disposableProviderFactory="true" diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Category.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Category.java index 2d2ca0be35..af4388c21a 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Category.java +++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Category.java @@ -68,7 +68,7 @@ public interface Category extends EObject * <!-- end-user-doc --> * @return the value of the '<em>Categories</em>' containment reference list. * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getCategory_Categories() - * @model containment="true" + * @model containment="true" resolveProxies="true" * @generated */ EList<Category> getCategories(); @@ -84,7 +84,7 @@ public interface Category extends EObject * <!-- end-user-doc --> * @return the value of the '<em>Products</em>' containment reference list. * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getCategory_Products() - * @model containment="true" + * @model containment="true" resolveProxies="true" * @generated */ EList<Product1> getProducts(); diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Company.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Company.java index 98cacda872..fc44348c2a 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Company.java +++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Company.java @@ -43,7 +43,7 @@ public interface Company extends Address * <!-- end-user-doc --> * @return the value of the '<em>Categories</em>' containment reference list. * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getCompany_Categories() - * @model containment="true" + * @model containment="true" resolveProxies="true" * @generated */ EList<Category> getCategories(); @@ -59,7 +59,7 @@ public interface Company extends Address * <!-- end-user-doc --> * @return the value of the '<em>Suppliers</em>' containment reference list. * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getCompany_Suppliers() - * @model containment="true" + * @model containment="true" resolveProxies="true" * @generated */ EList<Supplier> getSuppliers(); @@ -75,7 +75,7 @@ public interface Company extends Address * <!-- end-user-doc --> * @return the value of the '<em>Purchase Orders</em>' containment reference list. * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getCompany_PurchaseOrders() - * @model containment="true" + * @model containment="true" resolveProxies="true" * @generated */ EList<PurchaseOrder> getPurchaseOrders(); @@ -91,7 +91,7 @@ public interface Company extends Address * <!-- end-user-doc --> * @return the value of the '<em>Customers</em>' containment reference list. * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getCompany_Customers() - * @model containment="true" + * @model containment="true" resolveProxies="true" * @generated */ EList<Customer> getCustomers(); @@ -107,7 +107,7 @@ public interface Company extends Address * <!-- end-user-doc --> * @return the value of the '<em>Sales Orders</em>' containment reference list. * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getCompany_SalesOrders() - * @model containment="true" + * @model containment="true" resolveProxies="true" * @generated */ EList<SalesOrder> getSalesOrders(); diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Order.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Order.java index 00119b1b39..e5d8d4745b 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Order.java +++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Order.java @@ -43,7 +43,7 @@ public interface Order extends EObject * @return the value of the '<em>Order Details</em>' containment reference list. * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getOrder_OrderDetails() * @see org.eclipse.emf.cdo.tests.model1.OrderDetail#getOrder - * @model opposite="order" containment="true" + * @model opposite="order" containment="true" resolveProxies="true" * @generated */ EList<OrderDetail> getOrderDetails(); diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/Model1PackageImpl.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/Model1PackageImpl.java index 25295128af..9a0a012235 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/Model1PackageImpl.java +++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/Model1PackageImpl.java @@ -710,19 +710,19 @@ public class Model1PackageImpl extends EPackageImpl implements Model1Package initEClass(companyEClass, Company.class, "Company", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getCompany_Categories(), this.getCategory(), null, "categories", null, 0, -1, Company.class, - !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getCompany_Suppliers(), this.getSupplier(), null, "suppliers", null, 0, -1, Company.class, - !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getCompany_Customers(), this.getCustomer(), null, "customers", null, 0, -1, Company.class, - !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getCompany_PurchaseOrders(), this.getPurchaseOrder(), null, "purchaseOrders", null, 0, -1, - Company.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, + Company.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getCompany_SalesOrders(), this.getSalesOrder(), null, "salesOrders", null, 0, -1, Company.class, - !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(supplierEClass, Supplier.class, "Supplier", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); @@ -737,18 +737,18 @@ public class Model1PackageImpl extends EPackageImpl implements Model1Package 0, -1, Customer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getCustomer_OrderByProduct(), this.getProductToOrder(), null, "orderByProduct", null, 0, -1, - Customer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, + Customer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(orderEClass, Order.class, "Order", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getOrder_OrderDetails(), this.getOrderDetail(), this.getOrderDetail_Order(), "orderDetails", null, - 0, -1, Order.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, + 0, -1, Order.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(orderDetailEClass, OrderDetail.class, "OrderDetail", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getOrderDetail_Order(), this.getOrder(), this.getOrder_OrderDetails(), "order", null, 1, 1, - OrderDetail.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, + OrderDetail.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getOrderDetail_Product(), this.getProduct1(), this.getProduct1_OrderDetails(), "product", null, 0, 1, OrderDetail.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, @@ -776,10 +776,10 @@ public class Model1PackageImpl extends EPackageImpl implements Model1Package initEAttribute(getCategory_Name(), ecorePackage.getEString(), "name", null, 0, 1, Category.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getCategory_Categories(), this.getCategory(), null, "categories", null, 0, -1, Category.class, - !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getCategory_Products(), this.getProduct1(), null, "products", null, 0, -1, Category.class, - !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(product1EClass, Product1.class, "Product1", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/legacy/impl/CategoryImpl.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/legacy/impl/CategoryImpl.java index 1d31f4bbae..6f675f59d6 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/legacy/impl/CategoryImpl.java +++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/legacy/impl/CategoryImpl.java @@ -134,7 +134,8 @@ public class CategoryImpl extends EObjectImpl implements Category { if (categories == null) { - categories = new EObjectContainmentEList<Category>(Category.class, this, Model1Package.CATEGORY__CATEGORIES); + categories = new EObjectContainmentEList.Resolving<Category>(Category.class, this, + Model1Package.CATEGORY__CATEGORIES); } return categories; } @@ -147,7 +148,7 @@ public class CategoryImpl extends EObjectImpl implements Category { if (products == null) { - products = new EObjectContainmentEList<Product1>(Product1.class, this, Model1Package.CATEGORY__PRODUCTS); + products = new EObjectContainmentEList.Resolving<Product1>(Product1.class, this, Model1Package.CATEGORY__PRODUCTS); } return products; } diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/legacy/impl/CompanyImpl.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/legacy/impl/CompanyImpl.java index fc565da799..38c7d94e7e 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/legacy/impl/CompanyImpl.java +++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/legacy/impl/CompanyImpl.java @@ -127,7 +127,8 @@ public class CompanyImpl extends AddressImpl implements Company { if (categories == null) { - categories = new EObjectContainmentEList<Category>(Category.class, this, Model1Package.COMPANY__CATEGORIES); + categories = new EObjectContainmentEList.Resolving<Category>(Category.class, this, + Model1Package.COMPANY__CATEGORIES); } return categories; } @@ -140,7 +141,8 @@ public class CompanyImpl extends AddressImpl implements Company { if (suppliers == null) { - suppliers = new EObjectContainmentEList<Supplier>(Supplier.class, this, Model1Package.COMPANY__SUPPLIERS); + suppliers = new EObjectContainmentEList.Resolving<Supplier>(Supplier.class, this, + Model1Package.COMPANY__SUPPLIERS); } return suppliers; } @@ -153,7 +155,8 @@ public class CompanyImpl extends AddressImpl implements Company { if (customers == null) { - customers = new EObjectContainmentEList<Customer>(Customer.class, this, Model1Package.COMPANY__CUSTOMERS); + customers = new EObjectContainmentEList.Resolving<Customer>(Customer.class, this, + Model1Package.COMPANY__CUSTOMERS); } return customers; } @@ -166,7 +169,7 @@ public class CompanyImpl extends AddressImpl implements Company { if (purchaseOrders == null) { - purchaseOrders = new EObjectContainmentEList<PurchaseOrder>(PurchaseOrder.class, this, + purchaseOrders = new EObjectContainmentEList.Resolving<PurchaseOrder>(PurchaseOrder.class, this, Model1Package.COMPANY__PURCHASE_ORDERS); } return purchaseOrders; @@ -180,7 +183,8 @@ public class CompanyImpl extends AddressImpl implements Company { if (salesOrders == null) { - salesOrders = new EObjectContainmentEList<SalesOrder>(SalesOrder.class, this, Model1Package.COMPANY__SALES_ORDERS); + salesOrders = new EObjectContainmentEList.Resolving<SalesOrder>(SalesOrder.class, this, + Model1Package.COMPANY__SALES_ORDERS); } return salesOrders; } diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/legacy/impl/Model1PackageImpl.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/legacy/impl/Model1PackageImpl.java index c2d39fc7dd..bc8e382e6f 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/legacy/impl/Model1PackageImpl.java +++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/legacy/impl/Model1PackageImpl.java @@ -720,19 +720,19 @@ public class Model1PackageImpl extends EPackageImpl implements Model1Package initEClass(companyEClass, Company.class, "Company", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getCompany_Categories(), this.getCategory(), null, "categories", null, 0, -1, Company.class, - !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getCompany_Suppliers(), this.getSupplier(), null, "suppliers", null, 0, -1, Company.class, - !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getCompany_Customers(), this.getCustomer(), null, "customers", null, 0, -1, Company.class, - !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getCompany_PurchaseOrders(), this.getPurchaseOrder(), null, "purchaseOrders", null, 0, -1, - Company.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, + Company.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getCompany_SalesOrders(), this.getSalesOrder(), null, "salesOrders", null, 0, -1, Company.class, - !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(supplierEClass, Supplier.class, "Supplier", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); @@ -747,18 +747,18 @@ public class Model1PackageImpl extends EPackageImpl implements Model1Package 0, -1, Customer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getCustomer_OrderByProduct(), this.getProductToOrder(), null, "orderByProduct", null, 0, -1, - Customer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, + Customer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(orderEClass, Order.class, "Order", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getOrder_OrderDetails(), this.getOrderDetail(), this.getOrderDetail_Order(), "orderDetails", null, - 0, -1, Order.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, + 0, -1, Order.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(orderDetailEClass, OrderDetail.class, "OrderDetail", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getOrderDetail_Order(), this.getOrder(), this.getOrder_OrderDetails(), "order", null, 1, 1, - OrderDetail.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, + OrderDetail.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getOrderDetail_Product(), this.getProduct1(), this.getProduct1_OrderDetails(), "product", null, 0, 1, OrderDetail.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, @@ -786,10 +786,10 @@ public class Model1PackageImpl extends EPackageImpl implements Model1Package initEAttribute(getCategory_Name(), ecorePackage.getEString(), "name", null, 0, 1, Category.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getCategory_Categories(), this.getCategory(), null, "categories", null, 0, -1, Category.class, - !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getCategory_Products(), this.getProduct1(), null, "products", null, 0, -1, Category.class, - !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(product1EClass, Product1.class, "Product1", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/legacy/impl/OrderAddressImpl.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/legacy/impl/OrderAddressImpl.java index 19df5bc739..37d2a0c86c 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/legacy/impl/OrderAddressImpl.java +++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/legacy/impl/OrderAddressImpl.java @@ -138,7 +138,7 @@ public class OrderAddressImpl extends AddressImpl implements OrderAddress { if (orderDetails == null) { - orderDetails = new EObjectContainmentWithInverseEList<OrderDetail>(OrderDetail.class, this, + orderDetails = new EObjectContainmentWithInverseEList.Resolving<OrderDetail>(OrderDetail.class, this, Model1Package.ORDER_ADDRESS__ORDER_DETAILS, Model1Package.ORDER_DETAIL__ORDER); } return orderDetails; @@ -156,6 +156,18 @@ public class OrderAddressImpl extends AddressImpl implements OrderAddress } /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Order basicGetOrder() + { + if (eContainerFeatureID() != Model1Package.ORDER_ADDRESS__ORDER) + return null; + return (Order)eInternalContainer(); + } + + /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @@ -376,7 +388,9 @@ public class OrderAddressImpl extends AddressImpl implements OrderAddress case Model1Package.ORDER_ADDRESS__ORDER_DETAILS: return getOrderDetails(); case Model1Package.ORDER_ADDRESS__ORDER: - return getOrder(); + if (resolve) + return getOrder(); + return basicGetOrder(); case Model1Package.ORDER_ADDRESS__PRODUCT: if (resolve) return getProduct(); @@ -459,7 +473,7 @@ public class OrderAddressImpl extends AddressImpl implements OrderAddress case Model1Package.ORDER_ADDRESS__ORDER_DETAILS: return orderDetails != null && !orderDetails.isEmpty(); case Model1Package.ORDER_ADDRESS__ORDER: - return getOrder() != null; + return basicGetOrder() != null; case Model1Package.ORDER_ADDRESS__PRODUCT: return product != null; case Model1Package.ORDER_ADDRESS__PRICE: diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/legacy/impl/OrderDetailImpl.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/legacy/impl/OrderDetailImpl.java index 3082cca7b7..2476c028a2 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/legacy/impl/OrderDetailImpl.java +++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/legacy/impl/OrderDetailImpl.java @@ -105,6 +105,18 @@ public class OrderDetailImpl extends EObjectImpl implements OrderDetail } /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Order basicGetOrder() + { + if (eContainerFeatureID() != Model1Package.ORDER_DETAIL__ORDER) + return null; + return (Order)eInternalContainer(); + } + + /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @@ -295,7 +307,9 @@ public class OrderDetailImpl extends EObjectImpl implements OrderDetail switch (featureID) { case Model1Package.ORDER_DETAIL__ORDER: - return getOrder(); + if (resolve) + return getOrder(); + return basicGetOrder(); case Model1Package.ORDER_DETAIL__PRODUCT: if (resolve) return getProduct(); @@ -360,7 +374,7 @@ public class OrderDetailImpl extends EObjectImpl implements OrderDetail switch (featureID) { case Model1Package.ORDER_DETAIL__ORDER: - return getOrder() != null; + return basicGetOrder() != null; case Model1Package.ORDER_DETAIL__PRODUCT: return product != null; case Model1Package.ORDER_DETAIL__PRICE: diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/legacy/impl/OrderImpl.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/legacy/impl/OrderImpl.java index 7da8a5efc2..3cbedba9c5 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/legacy/impl/OrderImpl.java +++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/legacy/impl/OrderImpl.java @@ -80,7 +80,7 @@ public abstract class OrderImpl extends EObjectImpl implements Order { if (orderDetails == null) { - orderDetails = new EObjectContainmentWithInverseEList<OrderDetail>(OrderDetail.class, this, + orderDetails = new EObjectContainmentWithInverseEList.Resolving<OrderDetail>(OrderDetail.class, this, Model1Package.ORDER__ORDER_DETAILS, Model1Package.ORDER_DETAIL__ORDER); } return orderDetails; diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java index 1b16ba8280..a5c715be7a 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java @@ -96,7 +96,6 @@ public abstract class AllConfigs extends ConfigTestSuite testClasses.add(DynamicXSDTest.class); testClasses.add(SetFeatureTest.class); testClasses.add(DynamicPackageTest.class); - testClasses.add(LegacyTest.class); testClasses.add(XRefTest.class); testClasses.add(StickyViewsTest.class); testClasses.add(LobTest.class); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ContainmentTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ContainmentTest.java index 74ef3aafbb..217949104c 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ContainmentTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ContainmentTest.java @@ -565,22 +565,43 @@ public class ContainmentTest extends AbstractCDOTest CDOTransaction transaction = session.openTransaction(); CDOResource resource = transaction.getOrCreateResource(getResourcePath("res1")); + // Model1Package.eINSTANCE.getClass(); + // Resource resource = new XMIResourceImpl(); + + EList<EObject> contents = resource.getContents(); + Company company = getModel1Factory().createCompany(); - resource.getContents().add(company); + contents.add(company); Category category = getModel1Factory().createCategory(); company.getCategories().add(category); Supplier supplier = getModel1Factory().createSupplier(); supplier.setName("supplier" + System.currentTimeMillis()); - resource.getContents().add(supplier); - company.getSuppliers().add(supplier); + contents.add(supplier); - // transaction.commit(); + EList<Supplier> suppliers = company.getSuppliers(); + suppliers.add(supplier); - resource.getContents().addAll(resource.getContents().get(0).eContents()); - resource.getContents().remove(0); + // // Test succeeds with this intermediary commit: + // transaction.commit(); + EList<EObject> companyContents = company.eContents(); + contents.addAll(companyContents); + contents.remove(company); + + // FileOutputStream stream = IOUtil.openOutputStream("/develop/test.xml"); + // + // try + // { + // resource.save(stream, null); + // } + // finally + // { + // IOUtil.close(stream); + // } + + int fails; transaction.commit(); } } diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/CrossReferenceTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/CrossReferenceTest.java index c9a9c4e80f..d163a7561e 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/CrossReferenceTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/CrossReferenceTest.java @@ -451,6 +451,8 @@ public class CrossReferenceTest extends AbstractCDOTest transaction.commit(); CDORevisionData data = CDOUtil.getCDOObject(salesOrder).cdoRevision().data(); CDOID id = (CDOID)data.get(getModel1Package().getSalesOrder_Customer(), 0); + + int fails; assertEquals(false, id.isExternal()); } @@ -491,7 +493,7 @@ public class CrossReferenceTest extends AbstractCDOTest /** * Bug 369253: bidirectional cross-reference between containing and contained object that - * is not a containment reference. + * is not a containment reference. */ public void testCrossCreferenceBetweenContainerAndContained() throws Exception { diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/EMFCompareTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/EMFCompareTest.java index c4c04779cf..6329c1f02e 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/EMFCompareTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/EMFCompareTest.java @@ -12,20 +12,49 @@ package org.eclipse.emf.cdo.tests; import org.eclipse.emf.cdo.CDOObject; import org.eclipse.emf.cdo.common.commit.CDOCommitInfo; +import org.eclipse.emf.cdo.common.revision.CDORevision; +import org.eclipse.emf.cdo.compare.CDOCompare; import org.eclipse.emf.cdo.compare.CDOCompareUtil; +import org.eclipse.emf.cdo.compare.CDOComparisonScope; import org.eclipse.emf.cdo.eresource.CDOResource; import org.eclipse.emf.cdo.session.CDOSession; import org.eclipse.emf.cdo.tests.config.IRepositoryConfig; import org.eclipse.emf.cdo.tests.config.impl.ConfigTest.Requires; +import org.eclipse.emf.cdo.tests.model1.Category; import org.eclipse.emf.cdo.tests.model1.Company; +import org.eclipse.emf.cdo.tests.model1.Product1; +import org.eclipse.emf.cdo.tests.model1.legacy.Model1Factory; import org.eclipse.emf.cdo.transaction.CDOTransaction; import org.eclipse.emf.cdo.util.CDOUtil; import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.common.util.URI; import org.eclipse.emf.compare.Comparison; import org.eclipse.emf.compare.Diff; +import org.eclipse.emf.compare.EMFCompare; import org.eclipse.emf.compare.Match; +import org.eclipse.emf.compare.diff.DefaultDiffEngine; +import org.eclipse.emf.compare.diff.DiffBuilder; +import org.eclipse.emf.compare.diff.FeatureFilter; +import org.eclipse.emf.compare.diff.IDiffEngine; +import org.eclipse.emf.compare.match.DefaultComparisonFactory; +import org.eclipse.emf.compare.match.DefaultEqualityHelperFactory; +import org.eclipse.emf.compare.match.DefaultMatchEngine; +import org.eclipse.emf.compare.match.IComparisonFactory; +import org.eclipse.emf.compare.match.IMatchEngine; +import org.eclipse.emf.compare.match.eobject.IEObjectMatcher; +import org.eclipse.emf.compare.scope.IComparisonScope; +import org.eclipse.emf.compare.utils.UseIdentifiers; +import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; + +import java.util.Collections; +import java.util.Set; /** * @author Eike Stepper @@ -105,6 +134,196 @@ public class EMFCompareTest extends AbstractCDOTest dump(comparison); } + public void testContainmentProxy() throws Exception + { + CDOSession session = openSession(); + CDOTransaction transaction = session.openTransaction(); + CDOResource resource1 = transaction.createResource(getResourcePath("/res1")); + CDOResource resource2 = transaction.createResource(getResourcePath("/res2")); + + Company company = getModel1Factory().createCompany(); + company.setName("Eclipse"); + resource1.getContents().add(company); + + Category categoryCrossContained = getModel1Factory().createCategory(); + categoryCrossContained.setName("Category"); + company.getCategories().add(categoryCrossContained); + resource2.getContents().add(categoryCrossContained); + + for (int i = 0; i < 10; ++i) + { + Product1 product = getModel1Factory().createProduct1(); + categoryCrossContained.getProducts().add(product); + } + + CDOCommitInfo commitInfo = transaction.commit(); + + Product1 product0 = categoryCrossContained.getProducts().get(0); + product0.setName("CHANGED"); + + transaction.commit(); + + Comparison comparison = CDOCompareUtil.compare(transaction, session.openView(commitInfo), null); + dump(comparison); + assertEquals(0, comparison.getMatch(categoryCrossContained).getDifferences().size()); + } + + public void testContainmentProxyEMF() throws Exception + { + ResourceSet resourceSetA = createResourceSet(); + Category categoryCrossContained = populate(resourceSetA); + + ResourceSet resourceSetB = createResourceSet(); + Product1 product0 = populate(resourceSetB).getProducts().get(0); + product0.setName("ProductB"); + + IComparisonScope scope = EMFCompare.createDefaultScope(resourceSetA, resourceSetB); + + // Configure EMF Compare + IEObjectMatcher matcher = DefaultMatchEngine.createDefaultEObjectMatcher(UseIdentifiers.NEVER); + IComparisonFactory comparisonFactory = new DefaultComparisonFactory(new DefaultEqualityHelperFactory()); + IMatchEngine matchEngine = new DefaultMatchEngine(matcher, comparisonFactory); + EMFCompare comparator = EMFCompare.builder().setMatchEngine(matchEngine).build(); + + // Compare the two models + Comparison comparison = comparator.compare(scope); + dump(comparison); + assertEquals(0, comparison.getMatch(categoryCrossContained).getDifferences().size()); + assertEquals(1, comparison.getMatch(product0).getDifferences().size()); + } + + public void testNoContainmentProxy() throws Exception + { + CDOSession session = openSession(); + CDOTransaction transaction = session.openTransaction(); + CDOResource resource1 = transaction.createResource(getResourcePath("/res1")); + + Company company = getModel1Factory().createCompany(); + company.setName("Company"); + resource1.getContents().add(company); + + Category category = getModel1Factory().createCategory(); + category.setName("Category"); + company.getCategories().add(category); + + for (int i = 0; i < 10; ++i) + { + Product1 product = getModel1Factory().createProduct1(); + category.getProducts().add(product); + } + + company.setName("Company2"); + + CDOCommitInfo commitInfo = transaction.commit(); + + category.getProducts().get(0).setName("EclipseProduct"); + transaction.commit(); + + Comparison comparison = CDOCompareUtil.compare(transaction, session.openView(commitInfo), null); + dump(comparison); + assertEquals(0, comparison.getMatch(category).getDifferences().size()); + } + + public void testChanges() throws Exception + { + CDOSession session = openSession(); + CDOTransaction transaction = session.openTransaction(); + CDOResource resource = transaction.createResource(getResourcePath("/res1")); + + Company company = getModel1Factory().createCompany(); + company.setName("Company"); + resource.getContents().add(company); + + Category category1 = getModel1Factory().createCategory(); + category1.setName("Category1"); + company.getCategories().add(category1); + + transaction.commit(); + + // Change category1 + category1.setName("CHANGED"); + + Category category2 = getModel1Factory().createCategory(); + category2.setName("Category2"); + + // Change company, add category2 + company.getCategories().add(category2); + + Comparison comparison = CDOCompareUtil.compareUncommittedChanges(transaction); + dump(comparison); + assertEquals(1, comparison.getMatch(category1).getDifferences().size()); + assertEquals(1, comparison.getMatch(company).getDifferences().size()); + } + + public void testChangesDelete() throws Exception + { + CDOSession session = openSession(); + CDOTransaction transaction = session.openTransaction(); + CDOResource resource = transaction.createResource(getResourcePath("/res1")); + + Company company = getModel1Factory().createCompany(); + company.setName("Company"); + resource.getContents().add(company); + + Category category = getModel1Factory().createCategory(); + category.setName("Category"); + company.getCategories().add(category); + + transaction.commit(); + + company.getCategories().clear(); + + Comparison comparison = CDOCompareUtil.compareUncommittedChanges(transaction); + dump(comparison); + assertEquals(1, comparison.getMatch(company).getDifferences().size()); + } + + public void testFeatureFilter() throws Exception + { + CDOSession session = openSession(); + CDOTransaction transaction = session.openTransaction(); + CDOResource resource = transaction.createResource(getResourcePath("/res1")); + + Company company = createCompany(); + company.setName("ESC"); + company.setCity("Berlin"); + resource.getContents().add(company); + CDOCommitInfo commit1 = transaction.commit(); + + company.setName("Eclipse"); + company.setCity("Ottawa"); + transaction.commit(); + + IComparisonScope scope = CDOComparisonScope.Minimal.create(transaction, session.openView(commit1), null); + Comparison comparison = new CDOCompare() + { + @Override + protected IDiffEngine createDiffEngine() + { + return new DefaultDiffEngine(new DiffBuilder()) + { + @Override + protected FeatureFilter createFeatureFilter() + { + return new FeatureFilter() + { + Set<? extends EStructuralFeature> ignored = Collections.singleton(getModel1Package().getAddress_City()); + + @Override + protected boolean isIgnoredAttribute(EAttribute attribute) + { + return ignored.contains(attribute); + } + }; + } + }; + } + }.compare(scope); + + dump(comparison); + assertEquals(1, comparison.getMatch(company).getDifferences().size()); + } + private Company createCompany() { Company company = getModel1Factory().createCompany(); @@ -116,6 +335,39 @@ public class EMFCompareTest extends AbstractCDOTest return company; } + private static ResourceSet createResourceSet() + { + ResourceSet resourceSet = new ResourceSetImpl(); + resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl()); + return resourceSet; + } + + private static Category populate(ResourceSet resourceSet) + { + Model1Factory factory = org.eclipse.emf.cdo.tests.model1.legacy.Model1Factory.eINSTANCE; + + Resource resourceA1 = resourceSet.createResource(URI.createURI("res1")); + Resource resourceA2 = resourceSet.createResource(URI.createURI("res2")); + + Company company = factory.createCompany(); + company.setName("Eclipse"); + resourceA1.getContents().add(company); + + Category categoryCrossContained = factory.createCategory(); + categoryCrossContained.setName("Category"); + company.getCategories().add(categoryCrossContained); + resourceA2.getContents().add(categoryCrossContained); + + for (int i = 0; i < 10; ++i) + { + Product1 product = factory.createProduct1(); + product.setName("Product" + i); + categoryCrossContained.getProducts().add(product); + } + + return categoryCrossContained; + } + private static void dump(Comparison comparison) { dump(comparison.getMatches(), ""); @@ -126,8 +378,8 @@ public class EMFCompareTest extends AbstractCDOTest for (Match match : matches) { System.out.println(indent + "Match:"); - System.out.println(indent + " Left: " + toString(match.getLeft())); - System.out.println(indent + " Right: " + toString(match.getRight())); + System.out.println(indent + " Left: " + toString(match == null ? null : match.getLeft())); + System.out.println(indent + " Right: " + toString(match == null ? null : match.getRight())); String origin = toString(match.getOrigin()); if (origin != null) { @@ -154,7 +406,11 @@ public class EMFCompareTest extends AbstractCDOTest CDOObject cdoObject = CDOUtil.getCDOObject(object); if (cdoObject != null) { - return cdoObject.cdoRevision().toString(); + CDORevision revision = cdoObject.cdoRevision(); + if (revision != null) + { + return revision.toString(); + } } return object.toString(); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LegacyTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LegacyTest.java deleted file mode 100644 index b803f01455..0000000000 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LegacyTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Eike Stepper - initial API and implementation - * Martin Fluegge - recreation of the test case - */ -package org.eclipse.emf.cdo.tests; - -import org.eclipse.emf.cdo.eresource.CDOResource; -import org.eclipse.emf.cdo.session.CDOSession; -import org.eclipse.emf.cdo.tests.model1.Customer; -import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.cdo.util.CDOUtil; -import org.eclipse.emf.cdo.util.LegacyModeNotEnabledException; - -/** - * @author Eike Stepper - */ -public class LegacyTest extends AbstractCDOTest -{ - public void testLegacyModeEnabled() throws Exception - { - Customer customer = getModel1Factory().createCustomer(); - customer.setName("Martin Fluegge"); - customer.setStreet("ABC Street 7"); - customer.setCity("Berlin"); - - CDOSession session = openSession(); - CDOUtil.setLegacyModeDefault(false); - CDOTransaction transaction = session.openTransaction(); - CDOResource resource = transaction.createResource(getResourcePath("/test1")); - - try - { - resource.getContents().add(customer); - transaction.commit(); - - if (isConfig(LEGACY)) - { - fail("LegacyModeNotEnabledException expected"); - } - } - catch (LegacyModeNotEnabledException ex) - { - if (!isConfig(LEGACY)) - { - fail("Native mode should not throw an exception here (" + ex.getMessage() + ")"); - } - } - } -} diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/PackageRegistryTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/PackageRegistryTest.java index 75b8ae1600..4fd9072ddc 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/PackageRegistryTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/PackageRegistryTest.java @@ -29,7 +29,6 @@ import org.eclipse.emf.cdo.tests.model3.Model3Package; import org.eclipse.emf.cdo.tests.model3.subpackage.Class2; import org.eclipse.emf.cdo.transaction.CDOTransaction; import org.eclipse.emf.cdo.util.CDOUtil; -import org.eclipse.emf.cdo.util.LegacyModeNotEnabledException; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.URI; @@ -333,51 +332,6 @@ public class PackageRegistryTest extends AbstractCDOTest } } - public void testGlobalDynamicPackageUnprepared() throws Exception - { - String nsURI = "http://dynamic"; - - try - { - EPackage p = EcoreFactory.eINSTANCE.createEPackage(); - p.setName("dynamic"); - p.setNsPrefix("dynamic"); - p.setNsURI(nsURI); - - EClass c = EcoreFactory.eINSTANCE.createEClass(); - c.setName("DClass"); - - p.getEClassifiers().add(c); - EPackage.Registry.INSTANCE.put(nsURI, p); - - CDOSession session = openSession(); - - // The default case is that legacy is disabled. For our test bed it is always enabled. - // To test the default case we must switch of legacy here. - CDOUtil.setLegacyModeDefault(false); - - CDOTransaction transaction = session.openTransaction(); - CDOResource res = transaction.createResource(getResourcePath("/res")); - - EFactory factory = p.getEFactoryInstance(); - EObject object = factory.create(c); - - res.getContents().add(object); - transaction.commit(); - session.close(); - - fail("LegacyModeNotEnabledException expected"); - } - catch (LegacyModeNotEnabledException expected) - { - // SUCCESS - } - finally - { - EPackage.Registry.INSTANCE.remove(nsURI); - } - } - @CleanRepositoriesBefore public void testDynamicPackageFactory() throws Exception { diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RepositoryTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RepositoryTest.java index 9d8ce2f568..2ecfebb919 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RepositoryTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RepositoryTest.java @@ -219,7 +219,7 @@ public class RepositoryTest extends AbstractCDOTest public void handleTransactionBeforeCommitting(ITransaction transaction, CommitContext commitContext, OMMonitor monitor) throws RuntimeException { - CDOView view = CDOServerUtil.openView(commitContext, isConfig(LEGACY)); + CDOView view = CDOServerUtil.openView(commitContext); for (CDORevision revision : commitContext.getNewObjects()) { EObject object = view.getObject(revision.getID()); @@ -274,7 +274,7 @@ public class RepositoryTest extends AbstractCDOTest resource.getContents().add(createCustomer("Eike")); transaction.commit(); // Ensure that model1 is committed to the repository - getRepository().addHandler(new ObjectWriteAccessHandler(isConfig(LEGACY)) + getRepository().addHandler(new ObjectWriteAccessHandler() { @Override protected void handleTransactionBeforeCommitting(OMMonitor monitor) throws RuntimeException diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/WorkspaceTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/WorkspaceTest.java index dc10c05ca6..4fd7968af3 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/WorkspaceTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/WorkspaceTest.java @@ -118,14 +118,12 @@ public class WorkspaceTest extends AbstractCDOTest JVMUtil.prepareContainer(getClientContainer()); localStore = createLocalStore(); - CDOUtil.setLegacyModeDefault(true); } @Override protected void doTearDown() throws Exception { disableConsole(); - CDOUtil.setLegacyModeDefault(false); for (CDOWorkspace workspace : workspaces) { IOUtil.closeSilent(workspace); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_327604_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_327604_Test.java index b89a8975bc..da68c03ce2 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_327604_Test.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_327604_Test.java @@ -31,7 +31,6 @@ import org.eclipse.emf.cdo.tests.model1.SalesOrder; import org.eclipse.emf.cdo.tests.model1.VAT; import org.eclipse.emf.cdo.tests.util.TestSessionConfiguration; import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.cdo.util.CDOUtil; import org.eclipse.emf.cdo.util.CommitException; import org.eclipse.emf.cdo.view.CDOView; import org.eclipse.emf.cdo.workspace.CDOWorkspace; @@ -118,15 +117,12 @@ public class Bugzilla_327604_Test extends AbstractCDOTest JVMUtil.prepareContainer(getClientContainer()); localStore = createLocalStore(); - - CDOUtil.setLegacyModeDefault(true); } @Override protected void doTearDown() throws Exception { disableConsole(); - CDOUtil.setLegacyModeDefault(false); for (CDOWorkspace workspace : workspaces) { IOUtil.closeSilent(workspace); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_355915_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_355915_Test.java index be5d25e207..0b977c55d2 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_355915_Test.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_355915_Test.java @@ -16,7 +16,6 @@ import org.eclipse.emf.cdo.tests.AbstractCDOTest; import org.eclipse.emf.cdo.tests.config.IModelConfig; import org.eclipse.emf.cdo.tests.model1.Customer; import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.cdo.util.CDOUtil; import org.eclipse.emf.cdo.util.CommitException; import org.eclipse.emf.cdo.view.CDOAdapterPolicy; @@ -49,8 +48,6 @@ public class Bugzilla_355915_Test extends AbstractCDOTest public void testInvalidationNotification() throws Exception { CDOSession session = openSession(); - CDOUtil.setLegacyModeDefault(true); - CDOTransaction transaction1 = session.openTransaction(); transaction1.options().setInvalidationNotificationEnabled(true); @@ -73,8 +70,6 @@ public class Bugzilla_355915_Test extends AbstractCDOTest public void run() { CDOSession session = openSession(); - CDOUtil.setLegacyModeDefault(true); - CDOTransaction transaction2 = session.openTransaction(); Resource resource2 = transaction2.getResource(getResourcePath(RESOURCE_PATH)); @@ -105,8 +100,6 @@ public class Bugzilla_355915_Test extends AbstractCDOTest public void testDeltaNotification() throws Exception { CDOSession session = openSession(); - CDOUtil.setLegacyModeDefault(true); - CDOTransaction transaction1 = session.openTransaction(); transaction1.options().addChangeSubscriptionPolicy(CDOAdapterPolicy.ALL); @@ -129,8 +122,6 @@ public class Bugzilla_355915_Test extends AbstractCDOTest public void run() { CDOSession session = openSession(); - CDOUtil.setLegacyModeDefault(true); - CDOTransaction transaction2 = session.openTransaction(); Resource resource2 = transaction2.getResource(getResourcePath(RESOURCE_PATH)); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_359992_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_359992_Test.java index 76f2edd0f5..36f6891b57 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_359992_Test.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_359992_Test.java @@ -22,7 +22,6 @@ import org.eclipse.emf.cdo.tests.model1.Customer; import org.eclipse.emf.cdo.tests.model1.SalesOrder; import org.eclipse.emf.cdo.tests.model1.legacy.Model1Factory; import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.cdo.util.CDOUtil; import org.eclipse.emf.cdo.util.CommitException; import org.eclipse.emf.cdo.view.CDOAdapterPolicy; @@ -37,7 +36,7 @@ import java.util.concurrent.TimeUnit; /** * Bug 359992. - * + * * @author Martin Fluegge */ public class Bugzilla_359992_Test extends AbstractCDOTest @@ -58,7 +57,6 @@ public class Bugzilla_359992_Test extends AbstractCDOTest public void testInvalidationNotification() throws Exception { CDOSession session = openSession(); - CDOUtil.setLegacyModeDefault(true); CDONet4jSession.Options options = (Options)session.options(); options.setCommitTimeout(10 * CommitTransactionRequest.DEFAULT_MONITOR_TIMEOUT_SECONDS); @@ -77,8 +75,6 @@ public class Bugzilla_359992_Test extends AbstractCDOTest session.close(); session = openSession(); - CDOUtil.setLegacyModeDefault(true); - transaction1 = session.openTransaction(); transaction1.options().setInvalidationNotificationEnabled(true); @@ -100,7 +96,6 @@ public class Bugzilla_359992_Test extends AbstractCDOTest public void testDeltaNotification() throws Exception { CDOSession session = openSession(); - CDOUtil.setLegacyModeDefault(true); CDONet4jSession.Options options = (Options)session.options(); options.setCommitTimeout(10 * CommitTransactionRequest.DEFAULT_MONITOR_TIMEOUT_SECONDS); @@ -119,8 +114,6 @@ public class Bugzilla_359992_Test extends AbstractCDOTest session.close(); session = openSession(); - CDOUtil.setLegacyModeDefault(true); - transaction1 = session.openTransaction(); transaction1.options().addChangeSubscriptionPolicy(CDOAdapterPolicy.ALL); @@ -154,7 +147,6 @@ public class Bugzilla_359992_Test extends AbstractCDOTest private void doClient2() throws CommitException { CDOSession session = openSession(); - CDOUtil.setLegacyModeDefault(true); CDONet4jSession.Options options = (Options)session.options(); options.setCommitTimeout(10 * CommitTransactionRequest.DEFAULT_MONITOR_TIMEOUT_SECONDS); CDOTransaction transaction2 = session.openTransaction(); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_362270_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_362270_Test.java index b497305b27..77bd8be720 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_362270_Test.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_362270_Test.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * Eike Stepper - initial API and implementation */ @@ -19,7 +19,6 @@ import org.eclipse.emf.cdo.tests.model1.Company; import org.eclipse.emf.cdo.tests.model1.PurchaseOrder; import org.eclipse.emf.cdo.tests.model1.Supplier; import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.cdo.util.CDOUtil; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.notify.Notification; @@ -50,7 +49,7 @@ import java.util.Map; /** * Test case for {@link CDODeltaNotification#getNewValue()} which must returns a local {@link EObject} contained in a * {@link XMIResource} because a {@link CDOObject} stored in a {@link CDOResource} references the local {@link EObject}. - * + * * @author Esteban Dugueperoux */ public class Bugzilla_362270_Test extends AbstractCDOTest @@ -74,7 +73,6 @@ public class Bugzilla_362270_Test extends AbstractCDOTest obeoCompany.getSuppliers().add(martinSupplier); CDOSession session = openSession(); - CDOUtil.setLegacyModeDefault(true); final CDOTransaction cdoTransaction = session.openTransaction(resourceSet); CDOResource cdoResource = cdoTransaction.createResource(getResourcePath("/test1")); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_376620_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_376620_Test.java index 4a26178e41..793b29dc99 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_376620_Test.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_376620_Test.java @@ -20,7 +20,6 @@ import org.eclipse.emf.cdo.tests.config.IModelConfig; import org.eclipse.emf.cdo.tests.model1.Supplier; import org.eclipse.emf.cdo.tests.model1.legacy.Model1Factory; import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.cdo.util.CDOUtil; import org.eclipse.emf.cdo.util.CommitException; import org.eclipse.emf.cdo.view.CDOAdapterPolicy; @@ -50,7 +49,6 @@ public class Bugzilla_376620_Test extends AbstractCDOTest public void testDeltaNotification() throws Exception { CDOSession session = openSession(); - CDOUtil.setLegacyModeDefault(true); CDONet4jSession.Options options = (Options)session.options(); options.setCommitTimeout(10 * CommitTransactionRequest.DEFAULT_MONITOR_TIMEOUT_SECONDS); @@ -69,8 +67,6 @@ public class Bugzilla_376620_Test extends AbstractCDOTest session.close(); session = openSession(); - CDOUtil.setLegacyModeDefault(true); - transaction1 = session.openTransaction(); transaction1.options().addChangeSubscriptionPolicy(CDOAdapterPolicy.ALL); @@ -99,7 +95,6 @@ public class Bugzilla_376620_Test extends AbstractCDOTest private void doClient2() throws CommitException { CDOSession session = openSession(); - CDOUtil.setLegacyModeDefault(true); CDONet4jSession.Options options = (Options)session.options(); options.setCommitTimeout(10 * CommitTransactionRequest.DEFAULT_MONITOR_TIMEOUT_SECONDS); CDOTransaction transaction2 = session.openTransaction(); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_392956_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_392956_Test.java index 267eb20e27..3afbd9f242 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_392956_Test.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_392956_Test.java @@ -16,7 +16,6 @@ import org.eclipse.emf.cdo.tests.model6.Holdable; import org.eclipse.emf.cdo.tests.model6.Holder; import org.eclipse.emf.cdo.tests.model6.Thing; import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.cdo.util.CDOUtil; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.resource.Resource; @@ -32,8 +31,6 @@ public class Bugzilla_392956_Test extends AbstractCDOTest Holder rootHolder = createModel(); CDOSession session = openSession(); - CDOUtil.setLegacyModeDefault(true); - CDOTransaction transaction = session.openTransaction(); Resource resource = transaction.getOrCreateResource(getResourcePath("model.model7")); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/SessionConfig.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/SessionConfig.java index 8922a07be9..e166b54e38 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/SessionConfig.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/SessionConfig.java @@ -23,7 +23,6 @@ import org.eclipse.emf.cdo.tests.config.IConfig; import org.eclipse.emf.cdo.tests.config.IRepositoryConfig; import org.eclipse.emf.cdo.tests.config.ISessionConfig; import org.eclipse.emf.cdo.tests.util.TestRevisionManager; -import org.eclipse.emf.cdo.util.CDOUtil; import org.eclipse.emf.cdo.view.CDOFetchRuleManager; import org.eclipse.emf.cdo.view.CDOViewProvider; import org.eclipse.emf.cdo.view.CDOViewProviderRegistry; @@ -207,8 +206,6 @@ public abstract class SessionConfig extends Config implements ISessionConfig IOUtil.delete(lobCache); } }); - - CDOUtil.setLegacyModeDefault(true); } private Set<String> captureGlobalPackageRegistry() diff --git a/plugins/org.eclipse.emf.cdo.ui.compare/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.ui.compare/META-INF/MANIFEST.MF index 21fc25a917..9ba2fe2e9b 100644 --- a/plugins/org.eclipse.emf.cdo.ui.compare/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.cdo.ui.compare/META-INF/MANIFEST.MF @@ -14,7 +14,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)", org.eclipse.emf.cdo.ui;bundle-version="[4.2.0,5.0.0)";visibility:=reexport, org.eclipse.emf.cdo.ui.shared;bundle-version="[4.0.0,5.0.0)", org.eclipse.emf.cdo.compare;bundle-version="[4.2.0,5.0.0)";visibility:=reexport, - org.eclipse.emf.compare.ide.ui;bundle-version="[2.0.0,3.0.0)", + org.eclipse.emf.compare.ide.ui;bundle-version="[3.0.0,4.0.0)", org.eclipse.emf.compare.edit;bundle-version="[3.0.0,4.0.0)" Export-Package: org.eclipse.emf.cdo.ui.compare;version="4.2.0", org.eclipse.emf.cdo.ui.internal.compare;version="4.2.0";x-internal:=true, diff --git a/plugins/org.eclipse.emf.cdo.ui.compare/src/org/eclipse/emf/cdo/ui/compare/CDOCompareEditorUtil.java b/plugins/org.eclipse.emf.cdo.ui.compare/src/org/eclipse/emf/cdo/ui/compare/CDOCompareEditorUtil.java index 307d07c568..03c2149dc1 100644 --- a/plugins/org.eclipse.emf.cdo.ui.compare/src/org/eclipse/emf/cdo/ui/compare/CDOCompareEditorUtil.java +++ b/plugins/org.eclipse.emf.cdo.ui.compare/src/org/eclipse/emf/cdo/ui/compare/CDOCompareEditorUtil.java @@ -10,9 +10,8 @@ */ package org.eclipse.emf.cdo.ui.compare; -import org.eclipse.emf.cdo.common.model.EMFUtil; +import org.eclipse.emf.cdo.compare.CDOCompare; import org.eclipse.emf.cdo.compare.CDOCompareUtil; -import org.eclipse.emf.cdo.compare.ComparisonScopeAdapter; import org.eclipse.emf.cdo.view.CDOView; import org.eclipse.emf.common.notify.AdapterFactory; @@ -38,7 +37,7 @@ public class CDOCompareEditorUtil { Comparison comparison = CDOCompareUtil.compare(leftView, rightView, originView); - IComparisonScope scope = EMFUtil.getAdapter(comparison, ComparisonScopeAdapter.class).getScope(); + IComparisonScope scope = CDOCompare.getScope(comparison); ICompareEditingDomain editingDomain = EMFCompareEditingDomain.create(scope.getLeft(), scope.getRight(), scope.getOrigin()); diff --git a/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF index cf173a405b..726a92585e 100644 --- a/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF @@ -29,7 +29,9 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.2.0"; org.eclipse.emf.cdo.ui.location, org.eclipse.emf.cdo.tests.ui, org.eclipse.emf.cdo.dawn.ui, - org.eclipse.emf.cdo.explorer", + org.eclipse.emf.cdo.explorer, + org.eclipse.emf.cdo.ui.team, + org.eclipse.emf.cdo.ui.compare", org.eclipse.emf.cdo.internal.ui.actions;version="4.2.0"; x-friends:="org.eclipse.emf.cdo.ui.defs, org.eclipse.emf.cdo.ui.ide, diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/LegacyModeRegistry.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/LegacyModeRegistry.java deleted file mode 100644 index 750c96ce31..0000000000 --- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/LegacyModeRegistry.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Victor Roldan Betancort - initial API and implementation - * Eike Stepper - maintenance - */ -package org.eclipse.emf.cdo.internal.ui; - -import org.eclipse.emf.cdo.session.CDOSession; - -import java.util.Collections; -import java.util.Map; -import java.util.WeakHashMap; - -/** - * Class to indicate if legacy is enabled or not for certain CDOSession - * - * @author Victor Roldan Betancort - */ -public class LegacyModeRegistry -{ - private static Map<CDOSession, Boolean> isLegacyEnabledForSession = Collections - .synchronizedMap(new WeakHashMap<CDOSession, Boolean>()); - - private LegacyModeRegistry() - { - - } - - public static void setLegacyEnabled(CDOSession session, boolean isLegacyEnabled) - { - isLegacyEnabledForSession.put(session, isLegacyEnabled); - } - - public static boolean isLegacyEnabled(CDOSession session) - { - Boolean status = isLegacyEnabledForSession.get(session); - return status != null ? status : false; - } -} diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenDurableViewAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenDurableViewAction.java index d95f8bb557..19b9e8d285 100644 --- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenDurableViewAction.java +++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenDurableViewAction.java @@ -57,7 +57,8 @@ public final class OpenDurableViewAction extends AbstractOpenViewAction { try { - CDOTransaction transaction = getSession().openTransaction(areaID); + CDOSession session = getSession(); + CDOTransaction transaction = session.openTransaction(areaID); new CDOTransactionCommentator(transaction); } catch (IllegalStateException ex) diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenSessionAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenSessionAction.java index ab47faa32b..dfb6bc15b9 100644 --- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenSessionAction.java +++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenSessionAction.java @@ -13,7 +13,6 @@ package org.eclipse.emf.cdo.internal.ui.actions; import org.eclipse.emf.cdo.common.model.CDOPackageRegistryPopulator; import org.eclipse.emf.cdo.common.util.NotAuthenticatedException; -import org.eclipse.emf.cdo.internal.ui.LegacyModeRegistry; import org.eclipse.emf.cdo.internal.ui.bundle.OM; import org.eclipse.emf.cdo.internal.ui.dialogs.OpenSessionDialog; import org.eclipse.emf.cdo.internal.ui.messages.Messages; @@ -84,11 +83,6 @@ public final class OpenSessionAction extends LongRunningAction { CDOPackageRegistryPopulator.populate(session.getPackageRegistry()); } - - if (sessionComposite.isLegacyMode()) - { - LegacyModeRegistry.setLegacyEnabled(session, true); - } } catch (RemoteException ex) { diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenTransactionAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenTransactionAction.java index c977d2070b..7af3fab902 100644 --- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenTransactionAction.java +++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenTransactionAction.java @@ -11,13 +11,11 @@ */ package org.eclipse.emf.cdo.internal.ui.actions; -import org.eclipse.emf.cdo.internal.ui.LegacyModeRegistry; import org.eclipse.emf.cdo.internal.ui.messages.Messages; import org.eclipse.emf.cdo.session.CDOSession; import org.eclipse.emf.cdo.transaction.CDOTransaction; import org.eclipse.emf.cdo.transaction.CDOTransactionCommentator; import org.eclipse.emf.cdo.ui.shared.SharedIcons; -import org.eclipse.emf.cdo.util.CDOUtil; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.ui.IWorkbenchPage; @@ -39,7 +37,6 @@ public final class OpenTransactionAction extends AbstractOpenViewAction @Override protected void doRun(IProgressMonitor progressMonitor) throws Exception { - CDOUtil.setLegacyModeDefault(LegacyModeRegistry.isLegacyEnabled(getSession())); CDOTransaction transaction = getSession().openTransaction(); new CDOTransactionCommentator(transaction); diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewAction.java index 7b7b9eaa01..25d4dd4b80 100644 --- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewAction.java +++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewAction.java @@ -35,6 +35,7 @@ public final class OpenViewAction extends AbstractOpenViewAction @Override protected void doRun(IProgressMonitor progressMonitor) throws Exception { - getSession().openView(); + CDOSession session = getSession(); + session.openView(); } } diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ToggleLegacyModeDefaultAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ToggleLegacyModeDefaultAction.java deleted file mode 100644 index 453463abfc..0000000000 --- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ToggleLegacyModeDefaultAction.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Victor Roldan Betancort - initial API and implementation - * Eike Stepper - maintenance - */ -package org.eclipse.emf.cdo.internal.ui.actions; - -import org.eclipse.emf.cdo.internal.ui.LegacyModeRegistry; -import org.eclipse.emf.cdo.session.CDOSession; - -import org.eclipse.net4j.util.ui.actions.SafeAction; - -/** - * @author Victor Roldan Betancort - */ -public class ToggleLegacyModeDefaultAction extends SafeAction -{ - private static final String TITLE = "Legacy Mode"; - - private static final String TOOL_TIP = "Toggles the default for legacy mode"; - - private CDOSession session; - - public ToggleLegacyModeDefaultAction(CDOSession session) - { - super(TITLE, AS_CHECK_BOX); - setToolTipText(TOOL_TIP); - this.session = session; - setChecked(LegacyModeRegistry.isLegacyEnabled(session)); - } - - @Override - protected void safeRun() throws Exception - { - LegacyModeRegistry.setLegacyEnabled(session, !LegacyModeRegistry.isLegacyEnabled(session)); - } -} diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java index 8bea1cff74..2028c4358b 100644 --- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java +++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java @@ -42,7 +42,6 @@ import org.eclipse.emf.cdo.internal.ui.actions.RegisterSinglePackageAction; import org.eclipse.emf.cdo.internal.ui.actions.ReloadViewAction; import org.eclipse.emf.cdo.internal.ui.actions.RollbackTransactionAction; import org.eclipse.emf.cdo.internal.ui.actions.SwitchTargetAction; -import org.eclipse.emf.cdo.internal.ui.actions.ToggleLegacyModeDefaultAction; import org.eclipse.emf.cdo.internal.ui.messages.Messages; import org.eclipse.emf.cdo.session.CDORepositoryInfo; import org.eclipse.emf.cdo.session.CDOSession; @@ -500,8 +499,6 @@ public class CDOItemProvider extends ContainerItemProvider<IContainer<Object>> } manager.add(new Separator()); - manager.add(new ToggleLegacyModeDefaultAction(session)); - manager.add(new Separator()); manager.add(new CloseSessionAction(page, session)); } diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/SessionComposite.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/SessionComposite.java index 7cd582dade..51b458065b 100644 --- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/SessionComposite.java +++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/SessionComposite.java @@ -58,16 +58,12 @@ public class SessionComposite extends Composite private PreferenceButton automaticButton; - private PreferenceButton legacyButton; - private String connectorDescription; private String repositoryName; private boolean automaticRegistry; - private boolean legacyMode; - public SessionComposite(Composite parent, int style) { super(parent, style); @@ -116,18 +112,6 @@ public class SessionComposite extends Composite } }); - new Label(this, SWT.NONE); - legacyButton = new PreferenceButton(this, SWT.CHECK, Messages.getString("SessionComposite.4"), //$NON-NLS-1$ - OM.PREF_LEGACY_MODE_DEFAULT); - legacyButton.getButton().addSelectionListener(new SelectionAdapter() - { - @Override - public void widgetSelected(SelectionEvent e) - { - legacyMode = legacyButton.getSelection(); - } - }); - connectorText.setFocus(); connectorText.getCombo().addFocusListener(new FocusListener() { @@ -151,7 +135,6 @@ public class SessionComposite extends Composite connectorDescription = connectorText.getText(); repositoryName = repositoryText.getText(); automaticRegistry = automaticButton.getSelection(); - legacyMode = legacyButton.getSelection(); } public IHistory<String> getConnectorHistory() @@ -184,27 +167,11 @@ public class SessionComposite extends Composite return automaticButton; } - /** - * @since 4.2 - */ - public PreferenceButton getLegacyButton() - { - return legacyButton; - } - public boolean isAutomaticRegistry() { return automaticRegistry; } - /** - * @since 4.2 - */ - public boolean isLegacyMode() - { - return legacyMode; - } - public String getSessionDescription() { StringBuilder builder = new StringBuilder(); @@ -239,7 +206,6 @@ public class SessionComposite extends Composite connectorText.getHistory().add(connectorDescription); repositoryText.getHistory().add(repositoryName); automaticButton.getPreference().setValue(automaticRegistry); - legacyButton.getPreference().setValue(legacyMode); } @Override @@ -249,7 +215,6 @@ public class SessionComposite extends Composite connectorText.addListener(eventType, listener); repositoryText.addListener(eventType, listener); automaticButton.addListener(eventType, listener); - legacyButton.addListener(eventType, listener); } @Override @@ -259,6 +224,5 @@ public class SessionComposite extends Composite connectorText.removeListener(eventType, listener); repositoryText.removeListener(eventType, listener); automaticButton.removeListener(eventType, listener); - legacyButton.removeListener(eventType, listener); } } diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java index 5dcbb28eea..c149d3c39a 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java @@ -354,6 +354,7 @@ public class CDOPushTransaction extends Notifier implements CDOTransaction return delegate.createResource(path); } + @Deprecated public boolean isLegacyModeEnabled() { return delegate.isLegacyModeEnabled(); diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java index 4a19fa434e..37dab09079 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java @@ -83,15 +83,6 @@ import java.util.Map; */ public final class CDOUtil { - private static final ThreadLocal<Boolean> legacyModeDefault = new InheritableThreadLocal<Boolean>() - { - @Override - protected Boolean initialValue() - { - return false; - } - }; - static { CDOPackageRegistryImpl.SYSTEM_ELEMENTS[0] = EcorePackage.eINSTANCE; @@ -586,18 +577,21 @@ public final class CDOUtil /** * @since 3.0 + * @deprecated As of 4.2 the legacy mode is always enabled. */ + @Deprecated public static boolean isLegacyModeDefault() { - return legacyModeDefault.get(); + return true; } /** * @since 3.0 + * @deprecated As of 4.2 the legacy mode is always enabled. */ + @Deprecated public static void setLegacyModeDefault(boolean on) { - legacyModeDefault.set(on); } /** diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/LegacyModeNotEnabledException.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/LegacyModeNotEnabledException.java index 9330f9892e..ec404ebf96 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/LegacyModeNotEnabledException.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/LegacyModeNotEnabledException.java @@ -19,9 +19,11 @@ import org.eclipse.emf.cdo.view.CDOView; * * @author Eike Stepper * @since 3.0 + * @deprecated As of 4.2 the legacy mode is always enabled. * @noextend This interface is not intended to be extended by clients. * @noinstantiate This class is not intended to be instantiated by clients. */ +@Deprecated public class LegacyModeNotEnabledException extends IllegalStateException { private static final long serialVersionUID = 1L; diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java index 4b67bc44b4..2bd3de3bc6 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java @@ -163,7 +163,9 @@ public interface CDOView extends CDOCommonView, CDOUpdatable, CDOCommitHistory.P /** * @see CDOUtil#setLegacyModeDefault(boolean) * @since 3.0 + * @deprecated As of 4.2 the legacy mode is always enabled. */ + @Deprecated public boolean isLegacyModeEnabled(); /** 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 497fbfb2b7..3407d3b58f 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 @@ -712,7 +712,7 @@ public class CDOObjectImpl extends MinimalEStoreEObjectImpl implements InternalC } /** - * Code took from {@link BasicEObjectImpl#eBasicSetContainer} and modify it to detect when object are moved in the + * Code taken from {@link BasicEObjectImpl#eBasicSetContainer} and modified to detect whether the object is moved in the * same context. (E.g.: An object is moved from resA to resB. resA and resB belongs to the same CDORepositoryInfo. * Without this special handling, a detach and newObject will be generated for the object moved) * diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryImpl.java index b0db46d0c0..45c1045464 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryImpl.java @@ -41,7 +41,6 @@ public class CDOQueryImpl extends CDOQueryInfoImpl implements CDOQuery { super(queryLanguage, queryString, context); this.view = view; - setLegacyModeEnabled(view.isLegacyModeEnabled()); } public InternalCDOView getView() @@ -177,7 +176,6 @@ public class CDOQueryImpl extends CDOQueryInfoImpl implements CDOQuery { CDOQueryInfoImpl queryInfo = new CDOQueryInfoImpl(getQueryLanguage(), getQueryString(), getContext()); queryInfo.setMaxResults(getMaxResults()); - queryInfo.setLegacyModeEnabled(isLegacyModeEnabled()); queryInfo.setChangeSetData(getChangeSetData()); for (Entry<String, Object> entry : getParameters().entrySet()) diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java index cbf964a97f..5ac10bb9f9 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java @@ -99,7 +99,6 @@ import org.eclipse.emf.cdo.transaction.CDOUserSavepoint; import org.eclipse.emf.cdo.util.CDOURIUtil; import org.eclipse.emf.cdo.util.CDOUtil; import org.eclipse.emf.cdo.util.CommitException; -import org.eclipse.emf.cdo.util.LegacyModeNotEnabledException; import org.eclipse.emf.cdo.util.ObjectNotFoundException; import org.eclipse.emf.cdo.view.CDOView; @@ -3004,14 +3003,8 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa { if (!objects.isEmpty()) { - boolean noLegacy = !isLegacyModeEnabled(); for (CDOObject object : objects.values()) { - if (noLegacy && object instanceof CDOObjectWrapper) - { - throw new LegacyModeNotEnabledException(object.toString()); - } - collectLobs((InternalCDORevision)object.cdoRevision(), lobs); ((InternalCDOObject)object).cdoInternalPreCommit(); } diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java index 30dea36fdc..25c6e5bee3 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java @@ -122,8 +122,6 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb private final ViewAndState[] viewAndStates = ViewAndState.create(this); - private final boolean legacyModeEnabled; - private CDOBranchPoint branchPoint; private final CDOURIHandler uriHandler = new CDOURIHandler(this); @@ -154,15 +152,13 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb @ExcludeFromDump private transient InternalCDOObject lastLookupObject; - public AbstractCDOView(CDOBranchPoint branchPoint, boolean legacyModeEnabled) + public AbstractCDOView(CDOBranchPoint branchPoint) { - this(legacyModeEnabled); basicSetBranchPoint(branchPoint); } - public AbstractCDOView(boolean legacyModeEnabled) + public AbstractCDOView() { - this.legacyModeEnabled = legacyModeEnabled; } public boolean isReadOnly() @@ -170,9 +166,10 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb return true; } + @Deprecated public boolean isLegacyModeEnabled() { - return legacyModeEnabled; + return true; } protected synchronized final Map<CDOID, InternalCDOObject> getModifiableObjects() diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java index 512920262e..dab8f49d48 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java @@ -144,13 +144,12 @@ public class CDOViewImpl extends AbstractCDOView */ public CDOViewImpl(CDOBranch branch, long timeStamp) { - super(branch.getPoint(timeStamp), CDOUtil.isLegacyModeDefault()); + super(branch.getPoint(timeStamp)); options = createOptions(); } public CDOViewImpl(String durableLockingID) { - super(CDOUtil.isLegacyModeDefault()); this.durableLockingID = durableLockingID; options = createOptions(); } diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/FSMUtil.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/FSMUtil.java index b6d869a8db..9c2f5a0fb8 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/FSMUtil.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/FSMUtil.java @@ -13,7 +13,6 @@ package org.eclipse.emf.spi.cdo; import org.eclipse.emf.cdo.CDOObject; import org.eclipse.emf.cdo.CDOState; -import org.eclipse.emf.cdo.util.LegacyModeNotEnabledException; import org.eclipse.emf.cdo.view.CDOView; import org.eclipse.emf.internal.cdo.CDOObjectImpl; @@ -98,11 +97,6 @@ public final class FSMUtil if (object instanceof InternalEObject) { - if (!view.isLegacyModeEnabled()) - { - throw new LegacyModeNotEnabledException(object.toString()); - } - return adaptLegacy((InternalEObject)object); } |