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/internal/cdo/CDOLegacyAdapter.java (-88 / +113 lines)
Lines 10-15 Link Here
10
 */
10
 */
11
package org.eclipse.emf.internal.cdo;
11
package org.eclipse.emf.internal.cdo;
12
12
13
import org.eclipse.emf.internal.cdo.bundle.OM;
14
15
import org.eclipse.net4j.util.om.trace.ContextTracer;
16
13
import org.eclipse.emf.common.notify.Adapter;
17
import org.eclipse.emf.common.notify.Adapter;
14
import org.eclipse.emf.common.notify.Notification;
18
import org.eclipse.emf.common.notify.Notification;
15
import org.eclipse.emf.common.notify.Notifier;
19
import org.eclipse.emf.common.notify.Notifier;
Lines 24-115 Link Here
24
 */
28
 */
25
public class CDOLegacyAdapter extends CDOLegacyWrapper implements Adapter.Internal
29
public class CDOLegacyAdapter extends CDOLegacyWrapper implements Adapter.Internal
26
{
30
{
27
  public CDOLegacyAdapter()
31
28
  {
32
	private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_OBJECT, CDOLegacyAdapter.class);
29
    super(null);
33
30
  }
34
	public CDOLegacyAdapter()
31
35
	{
32
  public void setTarget(Notifier newTarget)
36
		super(null);
33
  {
37
34
    instance = (InternalEObject)newTarget;
38
	}
35
  }
39
36
40
	public void setTarget(Notifier newTarget)
37
  public void unsetTarget(Notifier oldTarget)
41
	{
38
  {
42
39
    if (instance == oldTarget)
43
		instance = (InternalEObject) newTarget;
40
    {
44
41
      instance = null;
45
	}
42
    }
46
43
  }
47
	public void unsetTarget(Notifier oldTarget)
44
48
	{
45
  public Notifier getTarget()
49
		if (instance == oldTarget)
46
  {
50
		{
47
    return instance;
51
			instance = null;
48
  }
52
		}
49
53
	}
50
  public boolean isAdapterForType(Object type)
54
51
  {
55
	public Notifier getTarget()
52
    return type == CDOLegacyAdapter.class;
56
	{
53
  }
57
		return instance;
54
58
	}
55
  public void notifyChanged(Notification msg)
59
56
  {
60
	public boolean isAdapterForType(Object type)
57
    CDOStore store = view.getStore();
61
	{
58
    EStructuralFeature feature = (EStructuralFeature)msg.getFeature();
62
		return type == CDOLegacyAdapter.class;
59
    switch (msg.getEventType())
63
	}
60
    {
64
61
    case Notification.SET:
65
	public void notifyChanged(Notification msg)
62
      store.set(instance, feature, msg.getPosition(), msg.getNewValue());
66
	{
63
      break;
67
64
68
		CDOStore store = view.getStore();
65
    case Notification.UNSET:
69
		EStructuralFeature feature = (EStructuralFeature) msg.getFeature();
66
      store.unset(instance, feature);
70
67
      break;
71
		//TODO Martin: Seems that it is quite uncool to set a transient feature to the view. Leads to an error because the the wrong featureID will be found in the revision. Discuss this with Eike.
68
72
		if (feature.isTransient())
69
    case Notification.MOVE:
73
		{
70
      // TODO Is that correct?
74
			return;
71
      store.move(instance, feature, msg.getPosition(), (Integer)msg.getOldValue());
75
		}
72
      break;
76
73
77
		switch (msg.getEventType())
74
    case Notification.ADD:
78
		{
75
      store.add(instance, feature, msg.getPosition(), msg.getNewValue());
79
		case Notification.SET:
76
      break;
80
			store.set(instance, feature, msg.getPosition(), msg.getNewValue());
77
81
			break;
78
    case Notification.ADD_MANY:
82
79
    {
83
		case Notification.UNSET:
80
      int pos = msg.getPosition();
84
			store.unset(instance, feature);
81
      @SuppressWarnings("unchecked")
85
			break;
82
      List<Object> list = (List<Object>)msg.getNewValue();
86
83
      for (Object object : list)
87
		case Notification.MOVE:
84
      {
88
			// TODO Is that correct?
85
        // TODO Is that correct?
89
			store.move(instance, feature, msg.getPosition(), (Integer) msg.getOldValue());
86
        store.add(instance, feature, pos++, object);
90
			break;
87
      }
91
88
    }
92
		case Notification.ADD:
89
93
			store.add(instance, feature, msg.getPosition(), msg.getNewValue());
90
      break;
94
			break;
91
95
92
    case Notification.REMOVE:
96
		case Notification.ADD_MANY:
93
      store.remove(instance, feature, msg.getPosition());
97
		{
94
      break;
98
95
99
			int pos = msg.getPosition();
96
    case Notification.REMOVE_MANY:
100
			@SuppressWarnings("unchecked")
97
    {
101
			List<Object> list = (List<Object>) msg.getNewValue();
98
      int pos = msg.getPosition();
102
			for (Object object : list)
99
      @SuppressWarnings("unchecked")
103
			{
100
      List<Object> list = (List<Object>)msg.getOldValue();
104
				// TODO Is that correct?
101
      for (int i = 0; i < list.size(); i++)
105
				store.add(instance, feature, pos++, object);
102
      {
106
103
        store.remove(instance, feature, pos);
107
			}
104
      }
108
		}
105
    }
109
106
110
			break;
107
      break;
111
108
    }
112
		case Notification.REMOVE:
109
  }
113
			store.remove(instance, feature, msg.getPosition());
110
114
			break;
111
  @Override
115
112
  public void cdoInternalPostInvalidate()
116
		case Notification.REMOVE_MANY:
113
  {
117
		{
114
  }
118
			int pos = msg.getPosition();
119
			@SuppressWarnings("unchecked")
120
			List<Object> list = (List<Object>) msg.getOldValue();
121
			for (int i = 0; i < list.size(); i++)
122
			{
123
				store.remove(instance, feature, pos);
124
			}
125
		}
126
127
			break;
128
		}
129
	}
130
131
	//	@Override
132
	//	public void cdoInternalPostInvalidate()
133
	//	{
134
	//		System.out.println("*********************  Calling cdoInternalPostInvalidate() ");
135
	//		InternalCDORevision revision = cdoView().getRevision(cdoID(), true);
136
	//		cdoInternalSetRevision(revision);
137
	//		revisionToInstance();
138
	//		cdoInternalSetState(CDOState.CLEAN);
139
	//	}
115
}
140
}
(-)src/org/eclipse/emf/internal/cdo/CDOLegacyWrapper.java (-530 / +955 lines)
Lines 15-20 Link Here
15
import org.eclipse.emf.cdo.common.id.CDOID;
15
import org.eclipse.emf.cdo.common.id.CDOID;
16
import org.eclipse.emf.cdo.common.model.CDOModelUtil;
16
import org.eclipse.emf.cdo.common.model.CDOModelUtil;
17
import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
17
import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
18
import org.eclipse.emf.cdo.common.model.CDOType;
18
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
19
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
19
import org.eclipse.emf.cdo.common.revision.CDORevision;
20
import org.eclipse.emf.cdo.common.revision.CDORevision;
20
import org.eclipse.emf.cdo.eresource.CDOResource;
21
import org.eclipse.emf.cdo.eresource.CDOResource;
Lines 28-36 Link Here
28
import org.eclipse.net4j.util.om.trace.ContextTracer;
29
import org.eclipse.net4j.util.om.trace.ContextTracer;
29
30
30
import org.eclipse.emf.common.notify.Adapter;
31
import org.eclipse.emf.common.notify.Adapter;
31
import org.eclipse.emf.common.notify.Notification;
32
import org.eclipse.emf.common.notify.impl.NotifyingListImpl;
32
import org.eclipse.emf.common.notify.impl.NotifyingListImpl;
33
import org.eclipse.emf.common.util.URI;
33
import org.eclipse.emf.common.util.URI;
34
import org.eclipse.emf.ecore.EAttribute;
34
import org.eclipse.emf.ecore.EClass;
35
import org.eclipse.emf.ecore.EClass;
35
import org.eclipse.emf.ecore.EClassifier;
36
import org.eclipse.emf.ecore.EClassifier;
36
import org.eclipse.emf.ecore.EObject;
37
import org.eclipse.emf.ecore.EObject;
Lines 46-51 Link Here
46
import java.lang.reflect.InvocationHandler;
47
import java.lang.reflect.InvocationHandler;
47
import java.lang.reflect.Method;
48
import java.lang.reflect.Method;
48
import java.lang.reflect.Proxy;
49
import java.lang.reflect.Proxy;
50
import java.util.HashMap;
51
import java.util.Map;
49
52
50
/**
53
/**
51
 * @author Eike Stepper
54
 * @author Eike Stepper
Lines 53-588 Link Here
53
 */
56
 */
54
public abstract class CDOLegacyWrapper extends CDOObjectWrapper
57
public abstract class CDOLegacyWrapper extends CDOObjectWrapper
55
{
58
{
56
  private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_OBJECT, CDOLegacyWrapper.class);
59
	//private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_OBJECT, CDOLegacyWrapper.class);
57
60
58
  protected CDOState state;
61
	//TODO Martin: with OM.DEBUG_VIEW I managed activating traces. Should ask Eike how the tracing works in general.
62
	private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_VIEW, CDOLegacyWrapper.class);
59
63
60
  protected InternalCDORevision revision;
64
	protected CDOState state;
61
65
62
  public CDOLegacyWrapper(InternalEObject instance)
66
	protected InternalCDORevision revision;
63
  {
67
64
    this.instance = instance;
68
	/**
65
    state = CDOState.TRANSIENT;
69
	 * @since 3.0
66
  }
70
	 * @description It could happen the while <i>revisionToInstance()</i> is
67
71
	 *              executed externally the <i>internalPostLoad()</i> method will
68
  public CDOState cdoState()
72
	 *              be called. This happens for example if
69
  {
73
	 *              <i>internalPostInvalidate()</i> is called. The leads to
70
    return state;
74
	 *              another <i>revisionToInstance()</i> call while the first call
71
  }
75
	 *              has not finished. This is certainly not so cool. That's why
72
76
	 *              <b>underConstruction</b> will flag that
73
  public InternalCDORevision cdoRevision()
77
	 *              <i>revisionToInstance()</i> is still running and avoid the
74
  {
78
	 *              second call.
75
    return revision;
79
	 */
76
  }
80
	private boolean underConstruction = false;
77
81
78
  public void cdoReload()
82
	/**
79
  {
83
	 * This local ThreadMap stores all pre-registered objects. This avoids a
80
    CDOStateMachine.INSTANCE.reload(this);
84
	 * neverending loop when setting the container for the object
81
  }
85
	 */
82
86
	private static ThreadLocal<Map<CDOID, EObject>> localThread = new InheritableThreadLocal<Map<CDOID, EObject>>()
83
  public CDOState cdoInternalSetState(CDOState state)
87
	{
84
  {
88
		@Override
85
    if (this.state != state)
89
		protected synchronized Map<CDOID, EObject> initialValue()
86
    {
90
		{
87
      if (TRACER.isEnabled())
91
			return new HashMap<CDOID, EObject>();
88
      {
92
		}
89
        TRACER.format("Setting state {0} for {1}", state, this); //$NON-NLS-1$
93
	};
90
      }
94
91
95
	//TODO Martin: threadCount could be removed if clearing the ThreadMap is not necessary 
92
      CDOState oldState = this.state;
96
	private static Integer threadCount = 0;
93
      this.state = state;
97
94
      adjustEProxy();
98
	public CDOLegacyWrapper(InternalEObject instance)
95
      if (view != null)
99
	{
96
      {
100
		this.instance = instance;
97
        view.handleObjectStateChanged(this, oldState, state);
101
		state = CDOState.TRANSIENT;
98
      }
102
99
103
	}
100
      return oldState;
104
101
    }
105
	public CDOState cdoState()
102
106
	{
103
    return null;
107
		return state;
104
  }
108
	}
105
109
106
  public void cdoInternalSetRevision(CDORevision revision)
110
	public InternalCDORevision cdoRevision()
107
  {
111
	{
108
    if (TRACER.isEnabled())
112
		return revision;
109
    {
113
	}
110
      TRACER.format("Setting revision: {0}", revision); //$NON-NLS-1$
114
111
    }
115
	public void cdoReload()
112
116
	{
113
    this.revision = (InternalCDORevision)revision;
117
		CDOStateMachine.INSTANCE.reload(this);
114
  }
118
	}
115
119
116
  public void cdoInternalPostAttach()
120
	public CDOState cdoInternalSetState(CDOState state)
117
  {
121
	{
118
    instanceToRevision();
122
		if (this.state != state)
119
123
		{
120
    // TODO Avoid if no adapters in list (eBasicAdapters?)
124
			if (TRACER.isEnabled())
121
    // TODO LEGACY Clarify how to intercept adapter addition in the legacy instance
125
			{
122
    for (Adapter adapter : eAdapters())
126
				TRACER.format("Setting state {0} for {1}", state, this); //$NON-NLS-1$
123
    {
127
			}
124
      view.subscribe(this, adapter);
128
125
    }
129
			CDOState oldState = this.state;
126
  }
130
			this.state = state;
127
131
			adjustEProxy();
128
  public void cdoInternalPostDetach(boolean remote)
132
			if (view != null)
129
  {
133
			{
130
    // Do nothing
134
				view.handleObjectStateChanged(this, oldState, state);
131
  }
135
			}
132
136
133
  public void cdoInternalPreCommit()
137
			return oldState;
134
  {
138
		}
135
    // instanceToRevision();
139
136
    // if (cdoState() == CDOState.DIRTY) // NEW is handled in PrepareTransition
140
		return null;
137
    // {
141
	}
138
    // CDORevisionManagerImpl revisionManager = (CDORevisionManagerImpl)cdoView().getSession().getRevisionManager();
142
139
    // InternalCDORevision originRevision = revisionManager.getRevisionByVersion(revision.getID(),
143
	public void cdoInternalSetRevision(CDORevision revision)
140
    // CDORevision.UNCHUNKED, revision.getVersion() - 1, false);
144
	{
141
    // CDORevisionDelta delta = revision.compare(originRevision);
145
142
    //
146
		trace("Setting revision: " + revision + "");
143
    // // TODO LEGACY Consider to gather the deltas on the fly with noremal EMF change notifications
147
		this.revision = (InternalCDORevision) revision;
144
    // cdoView().toTransaction().registerRevisionDelta(delta);
148
	}
145
    // }
149
146
  }
150
	public void cdoInternalPostAttach()
147
151
	{
148
  public void cdoInternalPreLoad()
152
		instanceToRevision();
149
  {
153
150
  }
154
		// TODO Avoid if no adapters in list (eBasicAdapters?)
151
155
		// TODO LEGACY Clarify how to intercept adapter addition in the legacy instance
152
  public void cdoInternalPostLoad()
156
		for (Adapter adapter : eAdapters())
153
  {
157
		{
154
    // TODO Consider not remembering the revisin after copying it to the instance (spare 1/2 of the space)
158
			view.subscribe(this, adapter);
155
    revisionToInstance();
159
		}
156
  }
160
	}
157
161
158
  public void cdoInternalPostInvalidate()
162
	public void cdoInternalPostDetach(boolean remote)
159
  {
163
	{
160
  }
164
161
165
	}
162
  public void cdoInternalCleanup()
166
163
  {
167
	public void cdoInternalPreCommit()
164
  }
168
	{
165
169
		// instanceToRevision();
166
  @Override
170
		// if (cdoState() == CDOState.DIRTY) // NEW is handled in PrepareTransition
167
  public boolean equals(Object obj)
171
		// {
168
  {
172
		// CDORevisionManagerImpl revisionManager = (CDORevisionManagerImpl)cdoView().getSession().getRevisionManager();
169
    return obj == this || obj == instance;
173
		// InternalCDORevision originRevision = revisionManager.getRevisionByVersion(revision.getID(),
170
  }
174
		// CDORevision.UNCHUNKED, revision.getVersion() - 1, false);
171
175
		// CDORevisionDelta delta = revision.compare(originRevision);
172
  @Override
176
		//
173
  public int hashCode()
177
		// // TODO LEGACY Consider to gather the deltas on the fly with noremal EMF change notifications
174
  {
178
		// cdoView().toTransaction().registerRevisionDelta(delta);
175
    if (instance != null)
179
		// }
176
    {
180
	}
177
      return instance.hashCode();
181
178
    }
182
	public void cdoInternalPreLoad()
179
183
	{
180
    return super.hashCode();
184
181
  }
185
	}
182
186
183
  @Override
187
	public void cdoInternalPostLoad()
184
  public String toString()
188
	{
185
  {
189
186
    return "CDOLegacyWrapper[" + id + "]"; //$NON-NLS-1$ //$NON-NLS-2$
190
		// TODO Consider not remembering the revisin after copying it to the instance (spare 1/2 of the space)
187
  }
191
		revisionToInstance();
188
192
189
  protected void instanceToRevision()
193
	}
190
  {
194
191
    if (TRACER.isEnabled())
195
	public void cdoInternalPostInvalidate()
192
    {
196
	{
193
      TRACER.format("Transfering instance to revision: {0} --> {1}", instance, revision); //$NON-NLS-1$
197
194
    }
198
		InternalCDORevision revision = cdoView().getRevision(cdoID(), true);
195
199
		cdoInternalSetRevision(revision);
196
    // Handle containment
200
		revisionToInstance();
197
    instanceToRevisionContainment();
201
		cdoInternalSetState(CDOState.CLEAN);
198
202
199
    // Handle values
203
	}
200
    CDOPackageRegistry packageRegistry = cdoView().getSession().getPackageRegistry();
204
201
    EClass eClass = revision.getEClass();
205
	public void cdoInternalCleanup()
202
    for (EStructuralFeature feature : CDOModelUtil.getAllPersistentFeatures(eClass))
206
	{
203
    {
207
204
      instanceToRevisionFeature(feature, packageRegistry);
208
	}
205
    }
209
206
  }
210
	@Override
207
211
	public boolean equals(Object obj)
208
  protected void instanceToRevisionContainment()
212
	{
209
  {
213
		return obj == this || obj == instance;
210
    CDOResource resource = (CDOResource)getInstanceResource(instance);
214
	}
211
    revision.setResourceID(resource == null ? CDOID.NULL : resource.cdoID());
215
212
216
	@Override
213
    InternalEObject eContainer = getInstanceContainer(instance);
217
	public int hashCode()
214
    if (eContainer == null)
218
	{
215
    {
219
		if (instance != null)
216
      revision.setContainerID(CDOID.NULL);
220
		{
217
      revision.setContainingFeatureID(0);
221
			return instance.hashCode();
218
    }
222
		}
219
    else
223
220
    {
224
		return super.hashCode();
221
      CDOObject cdoContainer = FSMUtil.adapt(eContainer, view);
225
	}
222
      revision.setContainerID(cdoContainer.cdoID());
226
223
      revision.setContainingFeatureID(getInstanceContainerFeatureID(instance));
227
	@Override
224
    }
228
	public String toString()
225
  }
229
	{
226
230
		return "CDOLegacyWrapper[" + id + "]";
227
  protected void instanceToRevisionFeature(EStructuralFeature feature, CDOPackageRegistry packageRegistry)
231
	}
228
  {
232
229
    Object instanceValue = getInstanceValue(instance, feature, packageRegistry);
233
	protected void instanceToRevision()
230
    CDOObjectImpl.instanceToRevisionFeature(view, this, feature, instanceValue);
234
	{
231
  }
235
		if (TRACER.isEnabled())
232
236
		{
233
  /**
237
			TRACER.format("Transfering instance to revision: {0} --> {1}", instance, revision);
234
   * TODO Simon: Fix this whole mess ;-)
238
		}
235
   */
239
236
  protected void revisionToInstance()
240
		// Handle containment
237
  {
241
		instanceToRevisionContainment();
238
    if (TRACER.isEnabled())
242
239
    {
243
		// Handle values
240
      TRACER.format("Transfering revision to instance: {0} --> {1}", revision, instance); //$NON-NLS-1$
244
		CDOPackageRegistry packageRegistry = cdoView().getSession().getPackageRegistry();
241
    }
245
		EClass eClass = revision.getEClass();
242
246
		for (EStructuralFeature feature : CDOModelUtil.getAllPersistentFeatures(eClass))
243
    boolean deliver = instance.eDeliver();
247
		{
244
    if (deliver)
248
			instanceToRevisionFeature(feature, packageRegistry);
245
    {
249
		}
246
      instance.eSetDeliver(false);
250
	}
247
    }
251
248
252
	protected void instanceToRevisionContainment()
249
    try
253
	{
250
    {
254
		CDOResource resource = (CDOResource) getInstanceResource(instance);
251
      // Handle containment
255
		revision.setResourceID(resource == null ? CDOID.NULL : resource.cdoID());
252
      revisionToInstanceContainment();
256
253
257
		InternalEObject eContainer = getInstanceContainer(instance);
254
      // Handle values
258
		if (eContainer == null)
255
      CDOPackageRegistry packageRegistry = cdoView().getSession().getPackageRegistry();
259
		{
256
      EClass eClass = revision.getEClass();
260
			revision.setContainerID(CDOID.NULL);
257
      for (EStructuralFeature feature : CDOModelUtil.getAllPersistentFeatures(eClass))
261
			revision.setContainingFeatureID(0);
258
      {
262
		}
259
        revisionToInstanceFeature(feature, packageRegistry);
263
		else
260
      }
264
		{
261
    }
265
			CDOObject cdoContainer = FSMUtil.adapt(eContainer, view);
262
    finally
266
			revision.setContainerID(cdoContainer.cdoID());
263
    {
267
			revision.setContainingFeatureID(getInstanceContainerFeatureID(instance));
264
      if (deliver)
268
		}
265
      {
269
	}
266
        instance.eSetDeliver(true);
270
267
      }
271
	protected void instanceToRevisionFeature(EStructuralFeature feature, CDOPackageRegistry packageRegistry)
268
    }
272
	{
269
  }
273
270
274
		Object instanceValue = getInstanceValue(instance, feature, packageRegistry);
271
  protected void revisionToInstanceContainment()
275
		CDOObjectImpl.instanceToRevisionFeature(view, this, feature, instanceValue);
272
  {
276
	}
273
    CDOID resourceID = revision.getResourceID();
277
274
    InternalEObject resource = getEObjectFromPotentialID(view, null, resourceID);
278
	/**
275
    setInstanceResource((Resource.Internal)resource);
279
	 * TODO Simon: Fix this whole mess ;-)
276
280
	 */
277
    Object containerID = revision.getContainerID();
281
	protected void revisionToInstance()
278
    InternalEObject container = getEObjectFromPotentialID(view, null, containerID);
282
	{
279
    setInstanceContainer(container, revision.getContainingFeatureID());
283
280
  }
284
		if (isUnderConstruction()) //return if revisionToInstance was called befor to avoid doubled calls
281
285
		{
282
  protected void revisionToInstanceFeature(EStructuralFeature feature, CDOPackageRegistry packageRegistry)
286
			return;
283
  {
287
		}
284
    // Attempt 4
288
		setUnderConstruction(true);
285
    Object value = revision.getValue(feature);
289
286
    view.getStore().set(instance, feature, Notification.NO_INDEX, value);
290
		if (TRACER.isEnabled())
287
  }
291
		{
288
292
			TRACER.format("Transfering revision to instance: {0} --> {1}", revision, instance);
289
  protected Resource.Internal getInstanceResource(InternalEObject instance)
293
		}
290
  {
294
		boolean deliver = instance.eDeliver();
291
    return instance.eDirectResource();
295
		if (deliver)
292
  }
296
		{
293
297
			instance.eSetDeliver(false);
294
  protected InternalEObject getInstanceContainer(InternalEObject instance)
298
		}
295
  {
299
296
    return instance.eInternalContainer();
300
		try
297
  }
301
		{
298
302
			// Handle containment
299
  protected int getInstanceContainerFeatureID(InternalEObject instance)
303
300
  {
304
			preRegisterObject(this);
301
    return instance.eContainerFeatureID();
305
			incrementThreadCount();
302
  }
306
303
307
			trace("Thread " + localThread + " MAP: (" + instance + ") {" + getPreRegisteredObjects() + "}");
304
  protected Object getInstanceValue(InternalEObject instance, EStructuralFeature feature,
308
			revisionToInstanceContainment();
305
      CDOPackageRegistry packageRegistry)
309
306
  {
310
			// Handle values
307
    return instance.eGet(feature);
311
			//CDOPackageRegistry packageRegistry = cdoView().getSession().getPackageRegistry();
308
  }
312
			EClass eClass = revision.getEClass();
309
313
			for (EStructuralFeature feature : CDOModelUtil.getAllPersistentFeatures(eClass))
310
  protected void setInstanceResource(Resource.Internal resource)
314
			{
311
  {
315
				revisionToInstanceFeature(feature);
312
    Method method = ReflectUtil.getMethod(instance.getClass(), "eSetDirectResource", Resource.Internal.class); //$NON-NLS-1$
316
			}
313
    ReflectUtil.invokeMethod(method, instance, resource);
317
		}
314
  }
318
		catch (Exception e)
315
319
		{
316
  protected void setInstanceContainer(InternalEObject container, int containerFeatureID)
320
			e.printStackTrace();
317
  {
321
		}
318
    Method method = ReflectUtil.getMethod(instance.getClass(), "eBasicSetContainer", InternalEObject.class, int.class); //$NON-NLS-1$
322
		finally
319
    ReflectUtil.invokeMethod(method, instance, container, containerFeatureID);
323
		{
320
  }
324
			if (deliver)
321
325
			{
322
  protected void setInstanceValue(InternalEObject instance, EStructuralFeature feature, Object value)
326
				instance.eSetDeliver(true);
323
  {
327
			}
324
    instance.eSet(feature, value);
328
			decrementThreadCount();
325
  }
329
			if (getPreRegisteredObjects() != null)
326
330
			{
327
  /**
331
				if (getThreadCount() == 0)
328
   * @param feature
332
				{
329
   *          in case that a proxy has to be created the feature that will determine the interface type of the proxy and
333
330
   *          that will be used later to resolve the proxy. <code>null</code> indicates that proxy creation will be
334
					//localThread.remove(); // TODO Martin: check why new objects will be created if this list is cleared
331
   *          avoided!
335
332
   */
336
				}
333
  protected InternalEObject getEObjectFromPotentialID(InternalCDOView view, EStructuralFeature feature,
337
			}
334
      Object potentialID)
338
			setUnderConstruction(false);
335
  {
339
		}
336
    if (potentialID instanceof CDOID)
340
337
    {
341
	}
338
      CDOID id = (CDOID)potentialID;
342
339
      if (id.isNull())
343
	private void decrementThreadCount()
340
      {
344
	{
341
        return null;
345
		threadCount--;
342
      }
346
	}
343
347
344
      boolean loadOnDemand = feature == null;
348
	private void incrementThreadCount()
345
      potentialID = view.getObject(id, loadOnDemand);
349
	{
346
      if (potentialID == null && !loadOnDemand)
350
		threadCount++;
347
      {
351
	}
348
        return createProxy(view, feature, id);
352
349
      }
353
	private Integer getThreadCount()
350
    }
354
	{
351
355
		return threadCount;
352
    if (potentialID instanceof InternalCDOObject)
356
	}
353
    {
357
354
      return ((InternalCDOObject)potentialID).cdoInternalInstance();
358
	/**
355
    }
359
	 * adds an object to the pre-registered objects list which hold all created
356
360
	 * objects even if they are not registered in the view
357
    return (InternalEObject)potentialID;
361
	 */
358
  }
362
	private void preRegisterObject(CDOLegacyWrapper wrapper)
359
363
	{
360
  /**
364
		getPreRegisteredObjects().put(wrapper.cdoID(), wrapper);
361
   * Creates and returns a <em>proxy</em> object. The usage of a proxy object is strongly limited. The only guarantee
365
	}
362
   * that can be made is that the following methods are callable and will behave in the expected way:
366
363
   * <ul>
367
	/**
364
   * <li>{@link CDOObject#cdoID()} will return the {@link CDOID} of the target object
368
	 * 
365
   * <li>{@link CDOObject#cdoState()} will return {@link CDOState#PROXY PROXY}
369
	 * 
366
   * <li>{@link InternalEObject#eIsProxy()} will return <code>true</code>
370
	 */
367
   * <li>{@link InternalEObject#eProxyURI()} will return the EMF proxy URI of the target object
371
	protected void revisionToInstanceContainment()
368
   * </ul>
372
	{
369
   * Calling any other method on the proxy object will result in an {@link UnsupportedOperationException} being thrown
373
370
   * at runtime. Note also that the proxy object might even not be cast to the concrete type of the target object. The
374
		CDOID resourceID = revision.getResourceID();
371
   * proxy can only guaranteed to be of <em>any</em> concrete subtype of the declared type of the given feature.
375
		InternalEObject resource = getEObjectFromPotentialID(view, null, resourceID);
372
   * <p>
376
		setInstanceResource((Resource.Internal) resource);
373
   * TODO {@link InternalEObject#eResolveProxy(InternalEObject)
377
374
   */
378
		Object containerID = revision.getContainerID();
375
  protected InternalEObject createProxy(InternalCDOView view, EStructuralFeature feature, CDOID id)
379
		InternalEObject container;
376
  {
380
377
    EClassifier eType = feature.getEType();
381
		container = getEObjectFromPotentialID(view, null, containerID);
378
    Class<?> instanceClass = eType.getInstanceClass();
382
379
383
		setInstanceContainer(container, revision.getContainingFeatureID());
380
    Class<?>[] interfaces = { instanceClass, InternalEObject.class, LegacyProxy.class };
384
381
    ClassLoader classLoader = CDOLegacyWrapper.class.getClassLoader();
385
	}
382
    LegacyProxyInvocationHandler handler = new LegacyProxyInvocationHandler(this, id);
386
383
    return (InternalEObject)Proxy.newProxyInstance(classLoader, interfaces, handler);
387
	private Map<CDOID, EObject> getPreRegisteredObjects()
384
  }
388
	{
385
389
		return localThread.get();
386
  /**
390
	}
387
   * TODO Ed: Fix whole mess ;-)
391
388
   */
392
	/**
389
  protected void clearEList(InternalEList<Object> list)
393
	 * @since 3.0
390
  {
394
	 */
391
    while (!list.isEmpty())
395
	protected void revisionToInstanceFeature(EStructuralFeature feature)
392
    {
396
	{
393
      Object toBeRemoved = list.basicGet(0);
397
394
      list.basicRemove(toBeRemoved, null);
398
		if (feature.isMany())
395
    }
399
		{
396
  }
400
			int size = view.getStore().size(instance, feature);
397
401
398
  /**
402
			if (!state.equals(CDOState.CONFLICT)) //do not do anything with the list if state is conflict
399
   * TODO Consider using only EMF concepts for resolving proxies!
403
			{
400
   */
404
				InternalEList list = (InternalEList) instance.eGet(feature);
401
  protected void resolveAllProxies()
405
				EStructuralFeature.Internal internalFeature = (EStructuralFeature.Internal) feature;
402
  {
406
				//EReference oppositeReference = cdoID().isTemporary() ? null : internalFeature.getEOpposite();
403
    // if (!allProxiesResolved)
407
404
    {
408
				clearList(feature, list);
405
      CDOPackageRegistry packageRegistry = cdoView().getSession().getPackageRegistry();
409
406
      EClass eClass = revision.getEClass();
410
				for (int index = 0; index < size; index++)
407
      for (EStructuralFeature feature : CDOModelUtil.getAllPersistentFeatures(eClass))
411
				{
408
      {
412
409
        if (feature instanceof EReference)
413
					Object object = getValueFromFeature(feature, index);
410
        {
414
					try
411
          resolveProxies(feature, packageRegistry);
415
					{
412
        }
416
						trace("Adding " + object + " to feature " + feature + "in instance " + instance);
413
      }
417
						instance.eInverseAdd((InternalEObject) object, feature.getFeatureID(), object.getClass(), null);
414
418
415
      // allProxiesResolved = true;
419
					}
416
    }
420
					//catch (ArrayIndexOutOfBoundsException e) //TODO: Martin fallback if eInverseAdd is not implemented (felegated to eDynmic... and resulted in an execption). maybe basicadd is enough 
417
  }
421
					catch (Exception e)
418
422
					{
419
  /*
423
						trace("Error: " + e.getMessage());
420
   * IMPORTANT: Compile errors in this method might indicate an old version of EMF. Legacy support is only enabled for
424
421
   * EMF with fixed bug #247130. These compile errors do not affect native models!
425
						list.basicAdd(object, null);//this seems to be wrong
422
   */
426
423
  @SuppressWarnings("unchecked")
427
					}
424
  protected void resolveProxies(EStructuralFeature feature, CDOPackageRegistry packageRegistry)
428
				}
425
  {
429
			}
426
    Object value = getInstanceValue(instance, feature, packageRegistry);
430
427
    if (value != null)
431
		}
428
    {
432
		else
429
      if (feature.isMany())
433
		{
430
      {
434
			Object object = getValueFromFeature(feature, 0);
431
        InternalEList<Object> list = (InternalEList<Object>)value;
435
			if (feature instanceof EAttribute)
432
        int size = list.size();
436
			{
433
        for (int i = 0; i < size; i++)
437
434
        {
438
				trace("Setting attribute value " + object + " to feature " + feature + " in instance " + instance);
435
          Object element = list.get(i);
439
				eSet(feature, object);
436
          if (element instanceof LegacyProxy)
440
			}
437
          {
441
			else
438
            CDOID id = ((LegacyProxy)element).getID();
442
			{
439
            InternalCDOObject resolved = (InternalCDOObject)view.getObject(id);
443
440
            InternalEObject instance = resolved.cdoInternalInstance();
444
				if (instance != null)
441
445
				{
442
            // TODO LEGACY
446
					if (object != null)
443
            // // TODO Is InternalEList.basicSet() needed???
447
					{
444
            // if (list instanceof org.eclipse.emf.ecore.util.DelegatingInternalEList)
448
						try
445
            // {
449
						{
446
            // list = ((org.eclipse.emf.ecore.util.DelegatingInternalEList)list).getDelegateInternalEList();
450
							trace("Adding object " + object + " to feature " + feature + " in instance " + instance);
447
            // }
451
							instance.eInverseAdd((InternalEObject) object, feature.getFeatureID(), ((EObject) object).getClass(), null);
448
452
							trace("Added object " + object + " to feature " + feature + " in instance " + instance);
449
            if (list instanceof NotifyingListImpl)
453
						}
450
            {
454
						catch (Exception e)
451
              ((NotifyingListImpl)list).basicSet(i, instance, null);
455
						{
452
            }
456
							//e.printStackTrace();
453
            else
457
							//TODO Martin: Should handle this exception more carefully
454
            {
458
							trace("Error: " + e.getMessage() + " trying to use eSet");
455
              list.set(i, instance);
459
456
            }
460
							instance.eSet(feature.getFeatureID(), object);
457
          }
461
458
        }
462
						}
459
      }
463
460
      else
464
						//TODO Martin: check if adjusting the opposite is needed here
461
      {
465
						//						EStructuralFeature.Internal internalFeature = (EStructuralFeature.Internal) feature;
462
        if (value instanceof LegacyProxy)
466
						//						EReference oppositeReference = cdoID().isTemporary() ? null : internalFeature.getEOpposite();
463
        {
467
						//						if (oppositeReference != null && object != null)
464
          CDOID id = ((LegacyProxy)value).getID();
468
						//						{
465
          InternalCDOObject resolved = (InternalCDOObject)view.getObject(id);
469
						//							adjustOppositeReference(instance, (InternalEObject) object, oppositeReference);
466
          InternalEObject instance = resolved.cdoInternalInstance();
470
						//						}
467
          setInstanceValue(instance, feature, instance);
471
					}
468
        }
472
					else
469
      }
473
					{
470
    }
474
						try
471
  }
475
						{
472
476
							trace("Setting feature " + feature + " to null in instance " + instance);
473
  protected void adjustEProxy()
477
							instance.eInverseAdd((InternalEObject) object, feature.getFeatureID(), null, null);
474
  {
478
						}
475
    // Setting eProxyURI is necessary to prevent content adapters from
479
						catch (Exception e)
476
    // loading the whole content tree.
480
						{
477
    // TODO Does not have the desired effect ;-( see CDOEditor.createModel()
481
							//e.printStackTrace();
478
    if (state == CDOState.PROXY)
482
							//TODO Martin: Should handle this exception more carefully
479
    {
483
							instance.eSet(feature.getFeatureID(), null);
480
      if (!instance.eIsProxy())
484
							trace(e.getMessage());
481
      {
485
						}
482
        URI uri = URI.createURI(CDOProtocolConstants.PROTOCOL_NAME + ":proxy#" + id); //$NON-NLS-1$
486
					}
483
        if (TRACER.isEnabled())
487
				}
484
        {
488
			}
485
          TRACER.format("Setting proxyURI {0} for {1}", uri, instance); //$NON-NLS-1$
489
		}
486
        }
490
	}
487
491
488
        instance.eSetProxyURI(uri);
492
	private void clearList(EStructuralFeature feature, InternalEList list)
489
      }
493
	{
490
    }
494
491
    else
495
		//attempt 2
492
    {
496
		int size = list.size();
493
      if (instance.eIsProxy())
497
		for (int i = 0; i < size; i++)
494
      {
498
		{
495
        if (TRACER.isEnabled())
499
			InternalEObject obj = (InternalEObject) list.get(0);
496
        {
500
			instance.eInverseRemove(obj, feature.getFeatureID(), obj.getClass(), null);
497
          TRACER.format("Unsetting proxyURI for {0}", instance); //$NON-NLS-1$
501
498
        }
502
		}
499
503
	}
500
        instance.eSetProxyURI(null);
504
501
      }
505
	/**
502
    }
506
	 * This method retrieves the value from the feature at the given index. It
503
  }
507
	 * retrieves the value either from the views's store or the internal
504
508
	 * pre-registration Map.
505
  protected static int getEFlagMask(Class<?> instanceClass, String flagName)
509
	 * 
506
  {
510
	 * @param feature the feature to retireive the value from
507
    Field field = ReflectUtil.getField(instanceClass, flagName);
511
	 * @param index the given index of the object in the feature
508
    if (!field.isAccessible())
512
	 * @return the value from the feature at the given index
509
    {
513
	 */
510
      field.setAccessible(true);
514
	private Object getValueFromFeature(EStructuralFeature feature, int index)
511
    }
515
	{
512
516
513
    try
517
		Object object = null;
514
    {
518
515
      return (Integer)field.get(null);
519
		object = revision.get(feature, index);
516
    }
520
517
    catch (IllegalAccessException ex)
521
		if (object == null)
518
    {
522
		{
519
      throw new ImplementationError(ex);
523
			return null; //TODO Martin: chekc if this is correct
520
    }
524
		}
521
  }
525
522
526
		CDOType type = CDOModelUtil.getType(feature.getEType());
523
  public static boolean isLegacyProxy(Object object)
527
		if (type != null)
524
  {
528
		{
525
    return object instanceof LegacyProxy;
529
			object = type.convertToEMF(feature.getEType(), object);
526
  }
530
			if (object instanceof CDOID)
527
531
			{
528
  /**
532
				if (getPreRegisteredObjects().get(object) != null)
529
   * @author Eike Stepper
533
				{
530
   */
534
					object = ((CDOLegacyWrapper) getPreRegisteredObjects().get(object)).instance;//getEObjectFromPotentialID(view, feature, object);
531
  private static interface LegacyProxy
535
				}
532
  {
536
				else
533
    public CDOID getID();
537
				//if Object not preregistered get the object from the view which creates it or returns a still registered object
534
  }
538
				{
535
539
536
  /**
540
					object = view.getStore().get(instance, feature, index);
537
   * @author Eike Stepper
541
					if (object != null)
538
   */
542
					{
539
  private static final class LegacyProxyInvocationHandler implements InvocationHandler, LegacyProxy
543
						CDOLegacyWrapper wrapper = FSMUtil.getLegacyAdapter(((EObject) object).eAdapters());
540
  {
544
						if (wrapper == null)
541
    private static final Method getIDMethod = ReflectUtil.getMethod(LegacyProxy.class, "getID"); //$NON-NLS-1$
545
						{
542
546
							wrapper = (CDOLegacyWrapper) FSMUtil.adaptLegacy((InternalEObject) object);
543
    private static final Method eIsProxyMethod = ReflectUtil.getMethod(EObject.class, "eIsProxy"); //$NON-NLS-1$
547
						}
544
548
						preRegisterObject(wrapper);
545
    private static final Method eProxyURIMethod = ReflectUtil.getMethod(InternalEObject.class, "eProxyURI"); //$NON-NLS-1$
549
						//	getPreRegisteredObjects().put(wrapper.cdoID(), wrapper);
546
550
					}
547
    private CDOLegacyWrapper wrapper;
551
548
552
				}
549
    private CDOID id;
553
			}
550
554
		}
551
    public LegacyProxyInvocationHandler(CDOLegacyWrapper wrapper, CDOID id)
555
552
    {
556
		return object;
553
      this.wrapper = wrapper;
557
	}
554
      this.id = id;
558
555
    }
559
	private void adjustOppositeReference(InternalEObject instance, InternalEObject object, EReference oppositeReference)
556
560
	{
557
    public CDOID getID()
561
558
    {
562
		trace("Setting opposite: " + object + " in Feature " + oppositeReference + " in instance " + instance + "");
559
      return id;
563
		boolean deliver = object.eDeliver(); //disable notifications
560
    }
564
		if (deliver)
561
565
		{
562
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
566
			object.eSetDeliver(false);
563
    {
567
		}
564
      if (method.equals(getIDMethod))
568
		try
565
      {
569
		{
566
        return id;
570
			if (oppositeReference.isMany())
567
      }
571
			{
568
572
569
      if (method.equals(eIsProxyMethod))
573
				//TODO Martin: ist this correct? Should I adjust opposite here?
570
      {
574
				//((InternalEList<Object>) object.eGet(oppositeReference)).basicAdd(instance, null);
571
        return true;
575
			}
572
      }
576
			else
573
577
			{
574
      if (method.equals(eProxyURIMethod))
578
575
      {
579
				//TODO Martin: this only increases performance if getter is cheaper than setter. Should discuss this.
576
        // Use the resource of the container because it's guaranteed to be in the same CDOView as the resource
580
				if (object.eGet(oppositeReference) != instance)
577
        // of the target!
581
				{
578
        Resource resource = wrapper.eResource();
582
579
583
					object.eInverseAdd(instance, oppositeReference.getFeatureID(), ((EObject) instance).getClass(), null);
580
        // TODO Consider using a "fake" Resource implementation. See Resource.getEObject(...)
584
				}
581
        return resource.getURI().appendFragment(id.toURIFragment());
585
			}
582
      }
586
		}
583
587
		finally
584
      // A client must have invoked the proxy while being told not to do so!
588
		{
585
      throw new UnsupportedOperationException(method.getName());
589
			if (deliver)
586
    }
590
			{
587
  }
591
				object.eSetDeliver(true);
592
			}
593
		}
594
595
	}
596
597
	//TODO Martin: remove this uncommented block if sure that it is not needed anymore
598
	//	private void convertAndSetList(EStructuralFeature feature, int size)
599
	//	{
600
	//	
601
	//		EStructuralFeature.Internal internalFeature = (EStructuralFeature.Internal) feature;
602
	//		EReference oppositeReference = cdoID().isTemporary() ? null : internalFeature.getEOpposite();
603
	//
604
	//		
605
	//			List<Object> tmp = new ArrayList<Object>();
606
	//			for (int index = 0; index < size; index++)
607
	//			{
608
	//				//Object object = view.getStore().get(instance, feature, index);
609
	//				Object object = getValueFromFeature(feature, index);
610
	//				tmp.add(object);
611
	//				
612
	//
613
	//				//			if (oppositeReference != null)
614
	//				//			{
615
	//				//				adjustOppositeReference(instance, (InternalEObject) object, oppositeReference);
616
	//				//			}
617
	//			}
618
	//			InternalEList list = (InternalEList) instance.eGet(feature);
619
	//			internalSynchronizeLists(tmp, list, feature.getFeatureID(), oppositeReference);
620
	//		
621
	//	}
622
	//
623
	//	private void internalSynchronizeLists(List<Object> tmp, InternalEList list, int featureId, EReference oppositeReference)
624
	//	{
625
	//		//remove
626
	//		for (Object obj : list)
627
	//		{
628
	//
629
	//			if (!tmp.contains(obj))//remove if removed from list
630
	//			{
631
	//
632
	//				list.basicRemove(obj, null);
633
	//				adjustOppositeReference(instance, (InternalEObject) obj, oppositeReference);
634
	//
635
	//				//((BasicEObjectImpl) instance).eInverseRemove((InternalEObject) obj, featureId, null);
636
	//				//((InternalEObject) obj).eBasicRemoveFromContainer(null);
637
	//				//				NotificationChain eInverseRemove = ((InternalEObject) obj).eInverseRemove(instance, featureId, instance.getClass(), null);
638
	//				//				NotificationChain basicRemove = list.basicRemove(obj, eInverseRemove);
639
	//				//				basicRemove.dispatch();
640
	//				//((InternalEObject) obj).eInternalContainer()
641
	//
642
	//				//((InternalEObject) obj).eContainer().notify();
643
	//				//				Method method = ReflectUtil.getMethod(obj.getClass(), "eBasicRemoveFromContainer", InternalEObject.class, int.class); //$NON-NLS-1$
644
	//				//				ReflectUtil.invokeMethod(method, obj);
645
	//				
646
	//
647
	//			}
648
	//		}
649
	//
650
	//		for (Object obj : tmp)
651
	//		{
652
	//			if (!list.basicContains(obj))//remove if removed from list
653
	//			{
654
	//				
655
	//				list.basicAdd(obj, null);
656
	//				if (oppositeReference != null)
657
	//				{
658
	//					adjustOppositeReference(instance, (InternalEObject) obj, oppositeReference);
659
	//				}
660
	//
661
	//				//instance.eInverseAdd((InternalEObject) obj, featureId, ((EObject) obj).getClass(), null);
662
	//				//((EObjectImpl) instance).eInverseAdd((InternalEObject) obj, featureId, null);
663
	//				//((InternalEObject) obj).eBasicSetContainer(instance, ((InternalEObject) obj).eContainerFeatureID(), null);
664
	//
665
	//				//list.add(obj);
666
	//			}
667
	//		}
668
	//	}
669
670
	protected Resource.Internal getInstanceResource(InternalEObject instance)
671
	{
672
		return instance.eDirectResource();
673
	}
674
675
	protected InternalEObject getInstanceContainer(InternalEObject instance)
676
	{
677
		return instance.eInternalContainer();
678
	}
679
680
	protected int getInstanceContainerFeatureID(InternalEObject instance)
681
	{
682
		return instance.eContainerFeatureID();
683
	}
684
685
	protected Object getInstanceValue(InternalEObject instance, EStructuralFeature feature, CDOPackageRegistry packageRegistry)
686
	{
687
		return instance.eGet(feature);
688
	}
689
690
	protected void setInstanceResource(Resource.Internal resource)
691
	{
692
		Method method = ReflectUtil.getMethod(instance.getClass(), "eSetDirectResource", Resource.Internal.class); //$NON-NLS-1$
693
		ReflectUtil.invokeMethod(method, instance, resource);
694
	}
695
696
	protected void setInstanceContainer(InternalEObject container, int containerFeatureID)
697
	{
698
		Method method = ReflectUtil.getMethod(instance.getClass(), "eBasicSetContainer", InternalEObject.class, int.class); //$NON-NLS-1$
699
		ReflectUtil.invokeMethod(method, instance, container, containerFeatureID);
700
	}
701
702
	protected void setInstanceValue(InternalEObject instance, EStructuralFeature feature, Object value)
703
	{
704
		instance.eSet(feature, value);
705
	}
706
707
	/**
708
	 * @param feature in case that a proxy has to be created the feature that will
709
	 *          determine the interface type of the proxy and that will be used
710
	 *          later to resolve the proxy. <code>null</code> indicates that proxy
711
	 *          creation will be avoided!
712
	 */
713
	protected InternalEObject getEObjectFromPotentialID(InternalCDOView view, EStructuralFeature feature, Object potentialID)
714
	{
715
716
		if (getPreRegisteredObjects().get(potentialID) != null)
717
		{
718
719
			potentialID = ((CDOLegacyWrapper) getPreRegisteredObjects().get(potentialID)).instance;
720
721
			trace("getting Object (" + potentialID + ") from localThread instead of the view");
722
723
		}
724
		else
725
		{
726
727
			if (potentialID instanceof CDOID)
728
			{
729
				CDOID id = (CDOID) potentialID;
730
				if (id.isNull())
731
				{
732
					return null;
733
				}
734
735
				boolean loadOnDemand = feature == null;
736
				potentialID = view.getObject(id, loadOnDemand);
737
				if (potentialID == null && !loadOnDemand)
738
				{
739
					return createProxy(view, feature, id);
740
				}
741
			}
742
743
			if (potentialID instanceof InternalCDOObject)
744
			{
745
				return ((InternalCDOObject) potentialID).cdoInternalInstance();
746
			}
747
748
		}
749
		return (InternalEObject) potentialID;
750
	}
751
752
	/**
753
	 * Creates and returns a <em>proxy</em> object. The usage of a proxy object is
754
	 * strongly limited. The only guarantee that can be made is that the following
755
	 * methods are callable and will behave in the expected way:
756
	 * <ul>
757
	 * <li>{@link CDOObject#cdoID()} will return the {@link CDOID} of the target
758
	 * object
759
	 * <li>{@link CDOObject#cdoState()} will return {@link CDOState#PROXY PROXY}
760
	 * <li>{@link InternalEObject#eIsProxy()} will return <code>true</code>
761
	 * <li>{@link InternalEObject#eProxyURI()} will return the EMF proxy URI of
762
	 * the target object
763
	 * </ul>
764
	 * Calling any other method on the proxy object will result in an
765
	 * {@link UnsupportedOperationException} being thrown at runtime. Note also
766
	 * that the proxy object might even not be cast to the concrete type of the
767
	 * target object. The proxy can only guaranteed to be of <em>any</em> concrete
768
	 * subtype of the declared type of the given feature.
769
	 * <p>
770
	 * TODO {@link InternalEObject#eResolveProxy(InternalEObject)
771
	 */
772
	protected InternalEObject createProxy(InternalCDOView view, EStructuralFeature feature, CDOID id)
773
	{
774
		EClassifier eType = feature.getEType();
775
		Class<?> instanceClass = eType.getInstanceClass();
776
777
		Class<?>[] interfaces =
778
		{ instanceClass, InternalEObject.class, LegacyProxy.class };
779
		ClassLoader classLoader = CDOLegacyWrapper.class.getClassLoader();
780
		LegacyProxyInvocationHandler handler = new LegacyProxyInvocationHandler(this, id);
781
		return (InternalEObject) Proxy.newProxyInstance(classLoader, interfaces, handler);
782
	}
783
784
	/**
785
	 * TODO Ed: Fix whole mess ;-)
786
	 */
787
	protected void clearEList(InternalEList<Object> list)
788
	{
789
		while (!list.isEmpty())
790
		{
791
			Object toBeRemoved = list.basicGet(0);
792
			list.basicRemove(toBeRemoved, null);
793
		}
794
	}
795
796
	/**
797
	 * TODO Consider using only EMF concepts for resolving proxies!
798
	 */
799
	protected void resolveAllProxies()
800
	{
801
		// if (!allProxiesResolved)
802
		{
803
			CDOPackageRegistry packageRegistry = cdoView().getSession().getPackageRegistry();
804
			EClass eClass = revision.getEClass();
805
			for (EStructuralFeature feature : CDOModelUtil.getAllPersistentFeatures(eClass))
806
			{
807
				if (feature instanceof EReference)
808
				{
809
					resolveProxies(feature, packageRegistry);
810
				}
811
			}
812
813
			// allProxiesResolved = true;
814
		}
815
	}
816
817
	/*
818
	 * IMPORTANT: Compile errors in this method might indicate an old version of
819
	 * EMF. Legacy support is only enabled for EMF with fixed bug #247130. These
820
	 * compile errors do not affect native models!
821
	 */
822
	@SuppressWarnings("unchecked")
823
	protected void resolveProxies(EStructuralFeature feature, CDOPackageRegistry packageRegistry)
824
	{
825
		Object value = getInstanceValue(instance, feature, packageRegistry);
826
		if (value != null)
827
		{
828
			if (feature.isMany())
829
			{
830
				InternalEList<Object> list = (InternalEList<Object>) value;
831
				int size = list.size();
832
				for (int i = 0; i < size; i++)
833
				{
834
					Object element = list.get(i);
835
					if (element instanceof LegacyProxy)
836
					{
837
						CDOID id = ((LegacyProxy) element).getID();
838
						InternalCDOObject resolved = (InternalCDOObject) view.getObject(id);
839
						InternalEObject instance = resolved.cdoInternalInstance();
840
841
						// TODO LEGACY
842
						// // TODO Is InternalEList.basicSet() needed???
843
						// if (list instanceof org.eclipse.emf.ecore.util.DelegatingInternalEList)
844
						// {
845
						// list = ((org.eclipse.emf.ecore.util.DelegatingInternalEList)list).getDelegateInternalEList();
846
						// }
847
848
						if (list instanceof NotifyingListImpl)
849
						{
850
							((NotifyingListImpl) list).basicSet(i, instance, null);
851
						}
852
						else
853
						{
854
							list.set(i, instance);
855
						}
856
					}
857
				}
858
			}
859
			else
860
			{
861
				if (value instanceof LegacyProxy)
862
				{
863
					CDOID id = ((LegacyProxy) value).getID();
864
					InternalCDOObject resolved = (InternalCDOObject) view.getObject(id);
865
					InternalEObject instance = resolved.cdoInternalInstance();
866
					setInstanceValue(instance, feature, instance);
867
				}
868
			}
869
		}
870
	}
871
872
	protected void adjustEProxy()
873
	{
874
		// Setting eProxyURI is necessary to prevent content adapters from
875
		// loading the whole content tree.
876
		// TODO Does not have the desired effect ;-( see CDOEditor.createModel()
877
		if (state == CDOState.PROXY)
878
		{
879
			if (!instance.eIsProxy())
880
			{
881
				URI uri = URI.createURI(CDOProtocolConstants.PROTOCOL_NAME + ":proxy#" + id); //$NON-NLS-1$
882
				if (TRACER.isEnabled())
883
				{
884
					TRACER.format("Setting proxyURI {0} for {1}", uri, instance);
885
				}
886
887
				instance.eSetProxyURI(uri);
888
			}
889
		}
890
		else
891
		{
892
			if (instance.eIsProxy())
893
			{
894
				if (TRACER.isEnabled())
895
				{
896
					TRACER.format("Unsetting proxyURI for {0}", instance);
897
				}
898
899
				instance.eSetProxyURI(null);
900
			}
901
		}
902
	}
903
904
	protected static int getEFlagMask(Class<?> instanceClass, String flagName)
905
	{
906
		Field field = ReflectUtil.getField(instanceClass, flagName);
907
		if (!field.isAccessible())
908
		{
909
			field.setAccessible(true);
910
		}
911
912
		try
913
		{
914
			return (Integer) field.get(null);
915
		}
916
		catch (IllegalAccessException ex)
917
		{
918
			throw new ImplementationError(ex);
919
		}
920
	}
921
922
	public static boolean isLegacyProxy(Object object)
923
	{
924
		return object instanceof LegacyProxy;
925
	}
926
927
	/**
928
	 * @author Eike Stepper
929
	 */
930
	private static interface LegacyProxy
931
	{
932
		public CDOID getID();
933
	}
934
935
	/**
936
	 * @author Eike Stepper
937
	 */
938
	private static final class LegacyProxyInvocationHandler implements InvocationHandler, LegacyProxy
939
	{
940
		private static final Method getIDMethod = ReflectUtil.getMethod(LegacyProxy.class, "getID");
941
942
		private static final Method eIsProxyMethod = ReflectUtil.getMethod(EObject.class, "eIsProxy");
943
944
		private static final Method eProxyURIMethod = ReflectUtil.getMethod(InternalEObject.class, "eProxyURI");
945
946
		private CDOLegacyWrapper wrapper;
947
948
		private CDOID id;
949
950
		public LegacyProxyInvocationHandler(CDOLegacyWrapper wrapper, CDOID id)
951
		{
952
			this.wrapper = wrapper;
953
			this.id = id;
954
		}
955
956
		public CDOID getID()
957
		{
958
			return id;
959
		}
960
961
		public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
962
		{
963
			if (method.equals(getIDMethod))
964
			{
965
				return id;
966
			}
967
968
			if (method.equals(eIsProxyMethod))
969
			{
970
				return true;
971
			}
972
973
			if (method.equals(eProxyURIMethod))
974
			{
975
				// Use the resource of the container because it's guaranteed to be in the same CDOView as the resource
976
				// of the target!
977
				Resource resource = wrapper.eResource();
978
979
				// TODO Consider using a "fake" Resource implementation. See Resource.getEObject(...)
980
				return resource.getURI().appendFragment(id.toURIFragment());
981
			}
982
983
			// A client must have invoked the proxy while being told not to do so!
984
			throw new UnsupportedOperationException(method.getName());
985
		}
986
	}
987
988
	private void trace(String trace)
989
	{
990
991
		if (TRACER.isEnabled())
992
		{
993
			TRACER.format(trace);
994
		}
995
		//System.out.println(trace);
996
	}
997
998
	/**
999
	 * @since 3.0
1000
	 */
1001
	public synchronized void setUnderConstruction(boolean underConstruction)
1002
	{
1003
		this.underConstruction = underConstruction;
1004
	}
1005
1006
	/**
1007
	 * @since 3.0
1008
	 */
1009
	public boolean isUnderConstruction()
1010
	{
1011
		return underConstruction;
1012
	}
588
}
1013
}
(-)src/org/eclipse/emf/internal/cdo/CDOObjectWrapper.java (-341 / +338 lines)
Lines 42-390 Link Here
42
 */
42
 */
43
public abstract class CDOObjectWrapper implements InternalCDOObject
43
public abstract class CDOObjectWrapper implements InternalCDOObject
44
{
44
{
45
  private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_OBJECT, CDOObjectWrapper.class);
45
	private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_OBJECT, CDOObjectWrapper.class);
46
46
47
  protected CDOID id;
47
	protected CDOID id;
48
48
49
  protected InternalCDOView view;
49
	protected InternalCDOView view;
50
50
51
  protected InternalEObject instance;
51
	protected InternalEObject instance;
52
52
53
  public CDOObjectWrapper()
53
	public CDOObjectWrapper()
54
  {
54
	{
55
  }
55
	}
56
56
57
  public CDOID cdoID()
57
	public CDOID cdoID()
58
  {
58
	{
59
    return id;
59
		return id;
60
  }
60
	}
61
61
62
  public InternalCDOView cdoView()
62
	public InternalCDOView cdoView()
63
  {
63
	{
64
    return view;
64
		return view;
65
  }
65
	}
66
66
67
  public CDOResourceImpl cdoResource()
67
	public CDOResourceImpl cdoResource()
68
  {
68
	{
69
    Resource resource = eResource();
69
		Resource resource = eResource();
70
    if (resource instanceof CDOResourceImpl)
70
		if (resource instanceof CDOResourceImpl)
71
    {
71
		{
72
      return (CDOResourceImpl)resource;
72
			return (CDOResourceImpl) resource;
73
    }
73
		}
74
74
75
    return null;
75
		return null;
76
  }
76
	}
77
77
78
  /**
78
	/**
79
   * @since 2.0
79
	 * @since 2.0
80
   */
80
	 */
81
  public CDOResourceImpl cdoDirectResource()
81
	public CDOResourceImpl cdoDirectResource()
82
  {
82
	{
83
    Resource.Internal resource = eDirectResource();
83
		Resource.Internal resource = eDirectResource();
84
    if (resource instanceof CDOResourceImpl)
84
		if (resource instanceof CDOResourceImpl)
85
    {
85
		{
86
      return (CDOResourceImpl)resource;
86
			return (CDOResourceImpl) resource;
87
    }
87
		}
88
88
89
    return null;
89
		return null;
90
  }
90
	}
91
91
92
  public void cdoInternalSetID(CDOID id)
92
	public void cdoInternalSetID(CDOID id)
93
  {
93
	{
94
    if (id == null)
94
		if (id == null)
95
    {
95
		{
96
      throw new IllegalArgumentException("id == null"); //$NON-NLS-1$
96
			//throw new IllegalArgumentException("id == null"); //$NON-NLS-1$
97
    }
97
		}
98
98
99
    if (TRACER.isEnabled())
99
		if (TRACER.isEnabled())
100
    {
100
		{
101
      TRACER.format("Setting ID: {0} for {1}", id, instance); //$NON-NLS-1$
101
			TRACER.format("Setting ID: {0} for {1}", id, instance); //$NON-NLS-1$
102
    }
102
		}
103
103
104
    this.id = id;
104
		this.id = id;
105
  }
105
	}
106
106
107
  public void cdoInternalSetView(CDOView view)
107
	public void cdoInternalSetView(CDOView view)
108
  {
108
	{
109
    if (TRACER.isEnabled())
109
		if (TRACER.isEnabled())
110
    {
110
		{
111
      TRACER.format("Setting view: {0} for {1}", view, instance); //$NON-NLS-1$
111
			TRACER.format("Setting view: {0} for {1}", view, instance); //$NON-NLS-1$
112
    }
112
		}
113
113
114
    this.view = (InternalCDOView)view;
114
		this.view = (InternalCDOView) view;
115
  }
115
	}
116
116
117
  public InternalEObject cdoInternalInstance()
117
	public InternalEObject cdoInternalInstance()
118
  {
118
	{
119
    return instance;
119
		return instance;
120
  }
120
	}
121
121
122
  /**
122
	/**
123
   * @since 2.0
123
	 * @since 2.0
124
   */
124
	 */
125
  public boolean cdoConflict()
125
	public boolean cdoConflict()
126
  {
126
	{
127
    return FSMUtil.isConflict(this);
127
		return FSMUtil.isConflict(this);
128
  }
128
	}
129
129
130
  /**
130
	/**
131
   * @since 2.0
131
	 * @since 2.0
132
   */
132
	 */
133
  public boolean cdoInvalid()
133
	public boolean cdoInvalid()
134
  {
134
	{
135
    return FSMUtil.isInvalid(this);
135
		return FSMUtil.isInvalid(this);
136
  }
136
	}
137
137
138
  /**
138
	/**
139
   * @since 3.0
139
	 * @since 3.0
140
   */
140
	 */
141
  public void cdoPrefetch(int depth)
141
	public void cdoPrefetch(int depth)
142
  {
142
	{
143
    view.prefetchRevisions(id, depth);
143
		view.prefetchRevisions(id, depth);
144
  }
144
	}
145
145
146
  public EStructuralFeature cdoInternalDynamicFeature(int dynamicFeatureID)
146
	public EStructuralFeature cdoInternalDynamicFeature(int dynamicFeatureID)
147
  {
147
	{
148
    // TODO Implement method CDOWrapperImpl.cdoInternalDynamicFeature()
148
		// TODO Implement method CDOWrapperImpl.cdoInternalDynamicFeature()
149
    throw new UnsupportedOperationException("Not yet implemented"); //$NON-NLS-1$
149
		throw new UnsupportedOperationException("Not yet implemented"); //$NON-NLS-1$
150
  }
150
	}
151
151
152
  /**
152
	/**
153
   * @since 2.0
153
	 * @since 2.0
154
   */
154
	 */
155
  public CDOLock cdoReadLock()
155
	public CDOLock cdoReadLock()
156
  {
156
	{
157
    throw new UnsupportedOperationException();
157
		throw new UnsupportedOperationException();
158
  }
158
	}
159
159
160
  /**
160
	/**
161
   * @since 2.0
161
	 * @since 2.0
162
   */
162
	 */
163
  public CDOLock cdoWriteLock()
163
	public CDOLock cdoWriteLock()
164
  {
164
	{
165
    throw new UnsupportedOperationException();
165
		throw new UnsupportedOperationException();
166
  }
166
	}
167
167
168
  public EList<Adapter> eAdapters()
168
	public EList<Adapter> eAdapters()
169
  {
169
	{
170
    return instance.eAdapters();
170
		return instance.eAdapters();
171
  }
171
	}
172
172
173
  public TreeIterator<EObject> eAllContents()
173
	public TreeIterator<EObject> eAllContents()
174
  {
174
	{
175
    return instance.eAllContents();
175
		return instance.eAllContents();
176
  }
176
	}
177
177
178
  public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
178
	public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
179
  {
179
	{
180
    return instance.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
180
		return instance.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
181
  }
181
	}
182
182
183
  public NotificationChain eBasicRemoveFromContainer(NotificationChain notifications)
183
	public NotificationChain eBasicRemoveFromContainer(NotificationChain notifications)
184
  {
184
	{
185
    return instance.eBasicRemoveFromContainer(notifications);
185
		return instance.eBasicRemoveFromContainer(notifications);
186
  }
186
	}
187
187
188
  public NotificationChain eBasicSetContainer(InternalEObject newContainer, int newContainerFeatureID,
188
	public NotificationChain eBasicSetContainer(InternalEObject newContainer, int newContainerFeatureID, NotificationChain notifications)
189
      NotificationChain notifications)
189
	{
190
  {
190
		return instance.eBasicSetContainer(newContainer, newContainerFeatureID, notifications);
191
    return instance.eBasicSetContainer(newContainer, newContainerFeatureID, notifications);
191
	}
192
  }
192
193
193
	public EClass eClass()
194
  public EClass eClass()
194
	{
195
  {
195
		return instance.eClass();
196
    return instance.eClass();
196
	}
197
  }
197
198
198
	public EObject eContainer()
199
  public EObject eContainer()
199
	{
200
  {
200
		return instance.eContainer();
201
    return instance.eContainer();
201
	}
202
  }
202
203
203
	public int eContainerFeatureID()
204
  public int eContainerFeatureID()
204
	{
205
  {
205
		return instance.eContainerFeatureID();
206
    return instance.eContainerFeatureID();
206
	}
207
  }
207
208
208
	public EStructuralFeature eContainingFeature()
209
  public EStructuralFeature eContainingFeature()
209
	{
210
  {
210
		return instance.eContainingFeature();
211
    return instance.eContainingFeature();
211
	}
212
  }
212
213
213
	public EReference eContainmentFeature()
214
  public EReference eContainmentFeature()
214
	{
215
  {
215
		return instance.eContainmentFeature();
216
    return instance.eContainmentFeature();
216
	}
217
  }
217
218
218
	public EList<EObject> eContents()
219
  public EList<EObject> eContents()
219
	{
220
  {
220
		return instance.eContents();
221
    return instance.eContents();
221
	}
222
  }
222
223
223
	public EList<EObject> eCrossReferences()
224
  public EList<EObject> eCrossReferences()
224
	{
225
  {
225
		return instance.eCrossReferences();
226
    return instance.eCrossReferences();
226
	}
227
  }
227
228
228
	public boolean eDeliver()
229
  public boolean eDeliver()
229
	{
230
  {
230
		return instance.eDeliver();
231
    return instance.eDeliver();
231
	}
232
  }
232
233
233
	public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass)
234
  public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass)
234
	{
235
  {
235
		return instance.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
236
    return instance.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
236
	}
237
  }
237
238
238
	public Resource.Internal eDirectResource()
239
  public Resource.Internal eDirectResource()
239
	{
240
  {
240
		return instance.eDirectResource();
241
    return instance.eDirectResource();
241
	}
242
  }
242
243
243
	public Object eGet(EStructuralFeature feature, boolean resolve, boolean coreType)
244
  public Object eGet(EStructuralFeature feature, boolean resolve, boolean coreType)
244
	{
245
  {
245
		return instance.eGet(feature, resolve, coreType);
246
    return instance.eGet(feature, resolve, coreType);
246
	}
247
  }
247
248
248
	public Object eGet(EStructuralFeature feature, boolean resolve)
249
  public Object eGet(EStructuralFeature feature, boolean resolve)
249
	{
250
  {
250
		return instance.eGet(feature, resolve);
251
    return instance.eGet(feature, resolve);
251
	}
252
  }
252
253
253
	public Object eGet(EStructuralFeature feature)
254
  public Object eGet(EStructuralFeature feature)
254
	{
255
  {
255
		return instance.eGet(feature);
256
    return instance.eGet(feature);
256
	}
257
  }
257
258
258
	public Object eGet(int featureID, boolean resolve, boolean coreType)
259
  public Object eGet(int featureID, boolean resolve, boolean coreType)
259
	{
260
  {
260
		return instance.eGet(featureID, resolve, coreType);
261
    return instance.eGet(featureID, resolve, coreType);
261
	}
262
  }
262
263
263
	public InternalEObject eInternalContainer()
264
  public InternalEObject eInternalContainer()
264
	{
265
  {
265
		return instance.eInternalContainer();
266
    return instance.eInternalContainer();
266
	}
267
  }
267
268
268
	public Resource.Internal eInternalResource()
269
  public Resource.Internal eInternalResource()
269
	{
270
  {
270
		return instance.eInternalResource();
271
    return instance.eInternalResource();
271
	}
272
  }
272
273
273
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class<?> baseClass, NotificationChain notifications)
274
  public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class<?> baseClass,
274
	{
275
      NotificationChain notifications)
275
		return instance.eInverseAdd(otherEnd, featureID, baseClass, notifications);
276
  {
276
	}
277
    return instance.eInverseAdd(otherEnd, featureID, baseClass, notifications);
277
278
  }
278
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class<?> baseClass, NotificationChain notifications)
279
279
	{
280
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class<?> baseClass,
280
		return instance.eInverseRemove(otherEnd, featureID, baseClass, notifications);
281
      NotificationChain notifications)
281
	}
282
  {
282
283
    return instance.eInverseRemove(otherEnd, featureID, baseClass, notifications);
283
	public boolean eIsProxy()
284
  }
284
	{
285
285
		return instance.eIsProxy();
286
  public boolean eIsProxy()
286
	}
287
  {
287
288
    return instance.eIsProxy();
288
	public boolean eIsSet(EStructuralFeature feature)
289
  }
289
	{
290
290
		return instance.eIsSet(feature);
291
  public boolean eIsSet(EStructuralFeature feature)
291
	}
292
  {
292
293
    return instance.eIsSet(feature);
293
	public boolean eIsSet(int featureID)
294
  }
294
	{
295
295
		return instance.eIsSet(featureID);
296
  public boolean eIsSet(int featureID)
296
	}
297
  {
297
298
    return instance.eIsSet(featureID);
298
	public boolean eNotificationRequired()
299
  }
299
	{
300
300
		return instance.eNotificationRequired();
301
  public boolean eNotificationRequired()
301
	}
302
  {
302
303
    return instance.eNotificationRequired();
303
	public void eNotify(Notification notification)
304
  }
304
	{
305
305
		instance.eNotify(notification);
306
  public void eNotify(Notification notification)
306
	}
307
  {
307
308
    instance.eNotify(notification);
308
	public EObject eObjectForURIFragmentSegment(String uriFragmentSegment)
309
  }
309
	{
310
310
		return instance.eObjectForURIFragmentSegment(uriFragmentSegment);
311
  public EObject eObjectForURIFragmentSegment(String uriFragmentSegment)
311
	}
312
  {
312
313
    return instance.eObjectForURIFragmentSegment(uriFragmentSegment);
313
	public URI eProxyURI()
314
  }
314
	{
315
315
		return instance.eProxyURI();
316
  public URI eProxyURI()
316
	}
317
  {
317
318
    return instance.eProxyURI();
318
	public EObject eResolveProxy(InternalEObject proxy)
319
  }
319
	{
320
320
		return instance.eResolveProxy(proxy);
321
  public EObject eResolveProxy(InternalEObject proxy)
321
	}
322
  {
322
323
    return instance.eResolveProxy(proxy);
323
	public Resource eResource()
324
  }
324
	{
325
325
		return instance.eResource();
326
  public Resource eResource()
326
	}
327
  {
327
328
    return instance.eResource();
328
	public void eSet(EStructuralFeature feature, Object newValue)
329
  }
329
	{
330
330
		instance.eSet(feature, newValue);
331
  public void eSet(EStructuralFeature feature, Object newValue)
331
	}
332
  {
332
333
    instance.eSet(feature, newValue);
333
	public void eSet(int featureID, Object newValue)
334
  }
334
	{
335
335
		instance.eSet(featureID, newValue);
336
  public void eSet(int featureID, Object newValue)
336
	}
337
  {
337
338
    instance.eSet(featureID, newValue);
338
	public void eSetClass(EClass class1)
339
  }
339
	{
340
340
		instance.eSetClass(class1);
341
  public void eSetClass(EClass class1)
341
	}
342
  {
342
343
    instance.eSetClass(class1);
343
	public void eSetDeliver(boolean deliver)
344
  }
344
	{
345
345
		instance.eSetDeliver(deliver);
346
  public void eSetDeliver(boolean deliver)
346
	}
347
  {
347
348
    instance.eSetDeliver(deliver);
348
	public void eSetProxyURI(URI uri)
349
  }
349
	{
350
350
		instance.eSetProxyURI(uri);
351
  public void eSetProxyURI(URI uri)
351
	}
352
  {
352
353
    instance.eSetProxyURI(uri);
353
	public NotificationChain eSetResource(Resource.Internal resource, NotificationChain notifications)
354
  }
354
	{
355
355
		return instance.eSetResource(resource, notifications);
356
  public NotificationChain eSetResource(Resource.Internal resource, NotificationChain notifications)
356
	}
357
  {
357
358
    return instance.eSetResource(resource, notifications);
358
	public void eSetStore(EStore store)
359
  }
359
	{
360
360
		instance.eSetStore(store);
361
  public void eSetStore(EStore store)
361
	}
362
  {
362
363
    instance.eSetStore(store);
363
	public Setting eSetting(EStructuralFeature feature)
364
  }
364
	{
365
365
		return instance.eSetting(feature);
366
  public Setting eSetting(EStructuralFeature feature)
366
	}
367
  {
367
368
    return instance.eSetting(feature);
368
	public EStore eStore()
369
  }
369
	{
370
370
		return instance.eStore();
371
  public EStore eStore()
371
	}
372
  {
372
373
    return instance.eStore();
373
	public void eUnset(EStructuralFeature feature)
374
  }
374
	{
375
375
		instance.eUnset(feature);
376
  public void eUnset(EStructuralFeature feature)
376
	}
377
  {
377
378
    instance.eUnset(feature);
378
	public void eUnset(int featureID)
379
  }
379
	{
380
380
		instance.eUnset(featureID);
381
  public void eUnset(int featureID)
381
	}
382
  {
382
383
    instance.eUnset(featureID);
383
	public String eURIFragmentSegment(EStructuralFeature feature, EObject object)
384
  }
384
	{
385
385
		return instance.eURIFragmentSegment(feature, object);
386
  public String eURIFragmentSegment(EStructuralFeature feature, EObject object)
386
	}
387
  {
388
    return instance.eURIFragmentSegment(feature, object);
389
  }
390
}
387
}

Return to bug 247226