Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 247226 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java (-1 / +2 lines)
Lines 901-908 Link Here
901
901
902
  /**
902
  /**
903
   * @ADDED
903
   * @ADDED
904
   * @since 3.0
904
   */
905
   */
905
  void setExisting(boolean existing)
906
  protected void setExisting(boolean existing)
906
  {
907
  {
907
    this.existing = existing;
908
    this.existing = existing;
908
  }
909
  }
(-)src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java (+5 lines)
Lines 306-311 Link Here
306
    return delegate.createResource(path);
306
    return delegate.createResource(path);
307
  }
307
  }
308
308
309
  public boolean isLegacyModeEnabled()
310
  {
311
    return delegate.isLegacyModeEnabled();
312
  }
313
309
  public Set<CDOObject> getConflicts()
314
  public Set<CDOObject> getConflicts()
310
  {
315
  {
311
    return delegate.getConflicts();
316
    return delegate.getConflicts();
(-)src/org/eclipse/emf/internal/cdo/CDOMetaWrapper.java (+9 lines)
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *    Eike Stepper - initial API and implementation
9
 *    Eike Stepper - initial API and implementation
10
 *    Martin Fluegge - bug 247226: Transparently support legacy models
10
 */
11
 */
11
package org.eclipse.emf.internal.cdo;
12
package org.eclipse.emf.internal.cdo;
12
13
Lines 111-116 Link Here
111
    throw new UnsupportedOperationException();
112
    throw new UnsupportedOperationException();
112
  }
113
  }
113
114
115
  /**
116
   * @since 3.0
117
   */
118
  public void cdoInternalPostRollback()
119
  {
120
    // Do nothing
121
  }
122
114
  public void cdoInternalPreCommit()
123
  public void cdoInternalPreCommit()
115
  {
124
  {
116
    throw new UnsupportedOperationException();
125
    throw new UnsupportedOperationException();
(-)src/org/eclipse/emf/internal/cdo/util/FSMUtil.java (-8 / +7 lines)
Lines 18-23 Link Here
18
import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
18
import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
19
import org.eclipse.emf.cdo.util.CDOUtil;
19
import org.eclipse.emf.cdo.util.CDOUtil;
20
import org.eclipse.emf.cdo.util.InvalidObjectException;
20
import org.eclipse.emf.cdo.util.InvalidObjectException;
21
import org.eclipse.emf.cdo.util.LegacyModeNotEnabledException;
21
import org.eclipse.emf.cdo.util.ObjectNotFoundException;
22
import org.eclipse.emf.cdo.util.ObjectNotFoundException;
22
import org.eclipse.emf.cdo.view.CDOView;
23
import org.eclipse.emf.cdo.view.CDOView;
23
24
Lines 36-42 Link Here
36
import org.eclipse.emf.ecore.EPackage;
37
import org.eclipse.emf.ecore.EPackage;
37
import org.eclipse.emf.ecore.EcorePackage;
38
import org.eclipse.emf.ecore.EcorePackage;
38
import org.eclipse.emf.ecore.InternalEObject;
39
import org.eclipse.emf.ecore.InternalEObject;
39
import org.eclipse.emf.ecore.impl.DynamicEObjectImpl;
40
import org.eclipse.emf.ecore.util.EcoreUtil;
40
import org.eclipse.emf.ecore.util.EcoreUtil;
41
import org.eclipse.emf.spi.cdo.InternalCDOObject;
41
import org.eclipse.emf.spi.cdo.InternalCDOObject;
42
import org.eclipse.emf.spi.cdo.InternalCDOView;
42
import org.eclipse.emf.spi.cdo.InternalCDOView;
Lines 139-144 Link Here
139
139
140
    if (object instanceof InternalEObject)
140
    if (object instanceof InternalEObject)
141
    {
141
    {
142
      if (!view.isLegacyModeEnabled())
143
      {
144
        throw new LegacyModeNotEnabledException();
145
      }
146
142
      return adaptLegacy((InternalEObject)object);
147
      return adaptLegacy((InternalEObject)object);
143
    }
148
    }
144
149
Lines 175-191 Link Here
175
   */
180
   */
176
  public static InternalCDOObject adaptLegacy(InternalEObject object)
181
  public static InternalCDOObject adaptLegacy(InternalEObject object)
177
  {
182
  {
178
    if (object.getClass() == DynamicEObjectImpl.class)
179
    {
180
      throw new IllegalArgumentException(Messages.getString("FSMUtil.4") + object); //$NON-NLS-1$
181
    }
182
183
    EList<Adapter> adapters = object.eAdapters();
183
    EList<Adapter> adapters = object.eAdapters();
184
    CDOLegacyAdapter adapter = getLegacyAdapter(adapters);
184
    CDOLegacyAdapter adapter = getLegacyAdapter(adapters);
185
    if (adapter == null)
185
    if (adapter == null)
186
    {
186
    {
187
      adapter = new CDOLegacyAdapter();
187
      adapter = new CDOLegacyAdapter(object);
188
      adapters.add(adapter);
189
    }
188
    }
190
189
191
    return adapter;
190
    return adapter;
(-)src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java (-4 / +19 lines)
Lines 72-79 Link Here
72
import org.eclipse.emf.internal.cdo.util.FSMUtil;
72
import org.eclipse.emf.internal.cdo.util.FSMUtil;
73
73
74
import org.eclipse.net4j.util.ImplementationError;
74
import org.eclipse.net4j.util.ImplementationError;
75
import org.eclipse.net4j.util.StringUtil;
76
import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump;
75
import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump;
76
import org.eclipse.net4j.util.StringUtil;
77
import org.eclipse.net4j.util.collection.CloseableIterator;
77
import org.eclipse.net4j.util.collection.CloseableIterator;
78
import org.eclipse.net4j.util.collection.FastList;
78
import org.eclipse.net4j.util.collection.FastList;
79
import org.eclipse.net4j.util.collection.HashBag;
79
import org.eclipse.net4j.util.collection.HashBag;
Lines 100-111 Link Here
100
import org.eclipse.emf.ecore.resource.ResourceSet;
100
import org.eclipse.emf.ecore.resource.ResourceSet;
101
import org.eclipse.emf.ecore.util.EcoreUtil;
101
import org.eclipse.emf.ecore.util.EcoreUtil;
102
import org.eclipse.emf.spi.cdo.CDOSessionProtocol;
102
import org.eclipse.emf.spi.cdo.CDOSessionProtocol;
103
import org.eclipse.emf.spi.cdo.CDOSessionProtocol.RefreshSessionResult;
103
import org.eclipse.emf.spi.cdo.InternalCDOObject;
104
import org.eclipse.emf.spi.cdo.InternalCDOObject;
104
import org.eclipse.emf.spi.cdo.InternalCDOSession;
105
import org.eclipse.emf.spi.cdo.InternalCDOSession;
105
import org.eclipse.emf.spi.cdo.InternalCDOTransaction;
106
import org.eclipse.emf.spi.cdo.InternalCDOTransaction;
106
import org.eclipse.emf.spi.cdo.InternalCDOView;
107
import org.eclipse.emf.spi.cdo.InternalCDOView;
107
import org.eclipse.emf.spi.cdo.InternalCDOViewSet;
108
import org.eclipse.emf.spi.cdo.InternalCDOViewSet;
108
import org.eclipse.emf.spi.cdo.CDOSessionProtocol.RefreshSessionResult;
109
109
110
import java.text.MessageFormat;
110
import java.text.MessageFormat;
111
import java.util.ArrayList;
111
import java.util.ArrayList;
Lines 115-122 Link Here
115
import java.util.HashSet;
115
import java.util.HashSet;
116
import java.util.List;
116
import java.util.List;
117
import java.util.Map;
117
import java.util.Map;
118
import java.util.Set;
119
import java.util.Map.Entry;
118
import java.util.Map.Entry;
119
import java.util.Set;
120
import java.util.concurrent.ConcurrentMap;
120
import java.util.concurrent.ConcurrentMap;
121
import java.util.concurrent.locks.ReentrantLock;
121
import java.util.concurrent.locks.ReentrantLock;
122
122
Lines 127-132 Link Here
127
{
127
{
128
  private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_VIEW, CDOViewImpl.class);
128
  private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_VIEW, CDOViewImpl.class);
129
129
130
  private final boolean legacyModeEnabled;
131
130
  private int viewID;
132
  private int viewID;
131
133
132
  private InternalCDOSession session;
134
  private InternalCDOSession session;
Lines 176-181 Link Here
176
  public CDOViewImpl(CDOBranch branch, long timeStamp)
178
  public CDOViewImpl(CDOBranch branch, long timeStamp)
177
  {
179
  {
178
    branchPoint = branch.getPoint(timeStamp);
180
    branchPoint = branch.getPoint(timeStamp);
181
    legacyModeEnabled = CDOUtil.isLegacyModeDefault();
179
    options = createOptions();
182
    options = createOptions();
180
  }
183
  }
181
184
Lines 205-210 Link Here
205
    return true;
208
    return true;
206
  }
209
  }
207
210
211
  public boolean isLegacyModeEnabled()
212
  {
213
    return legacyModeEnabled;
214
  }
215
208
  public ResourceSet getResourceSet()
216
  public ResourceSet getResourceSet()
209
  {
217
  {
210
    return viewSet.getResourceSet();
218
    return viewSet.getResourceSet();
Lines 1270-1276 Link Here
1270
1278
1271
    if (old != null)
1279
    if (old != null)
1272
    {
1280
    {
1273
      throw new IllegalStateException(MessageFormat.format(Messages.getString("CDOViewImpl.20"), object)); //$NON-NLS-1$
1281
      if (CDOUtil.isLegacyObject(object))
1282
      {
1283
        OM.LOG.warn("Legacy object has been registered multiple times: " + object);
1284
      }
1285
      else
1286
      {
1287
        throw new IllegalStateException(MessageFormat.format(Messages.getString("CDOViewImpl.20"), object)); //$NON-NLS-1$
1288
      }
1274
    }
1289
    }
1275
  }
1290
  }
1276
1291
(-)src/org/eclipse/emf/cdo/tests/BranchingTest.java (-1 / +1 lines)
Lines 691-697 Link Here
691
691
692
    CDOID id = CDOUtil.getCDOObject(product).cdoID();
692
    CDOID id = CDOUtil.getCDOObject(product).cdoID();
693
    CDOView view = session.openView();
693
    CDOView view = session.openView();
694
    product = (Product1)view.getObject(id);
694
    product = (Product1)CDOUtil.getEObject(view.getObject(id));
695
695
696
    view.setBranch(subBranch);
696
    view.setBranch(subBranch);
697
697

Return to bug 247226