summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-07-23 06:59:51 (EDT)
committerEike Stepper2007-07-23 06:59:51 (EDT)
commit99c52f879ac0614ac18d8fbbe4aafe24e78274a8 (patch)
tree8282e6e5f842a5bcd3f703769c58492e22a1e581
parent32575f773251b7cc01aa23f18c1faca82c2c3a03 (diff)
downloadcdo-99c52f879ac0614ac18d8fbbe4aafe24e78274a8.zip
cdo-99c52f879ac0614ac18d8fbbe4aafe24e78274a8.tar.gz
cdo-99c52f879ac0614ac18d8fbbe4aafe24e78274a8.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java16
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOAdapterImpl.java42
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java20
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java14
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/FSMUtil.java1
6 files changed, 45 insertions, 52 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java
index 48a69fc..1b3fbf8 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java
@@ -60,14 +60,14 @@ public class CommitTransactionIndication extends CDOServerIndication
@Override
protected void indicating(ExtendedDataInputStream in) throws IOException
{
- // try
- // {
- // Thread.sleep(100000000000L);
- // }
- // catch (InterruptedException ex)
- // {
- // throw new IOException(ex.getMessage());
- // }
+ try
+ {
+ Thread.sleep(100000000000L);
+ }
+ catch (InterruptedException ex)
+ {
+ throw new IOException(ex.getMessage());
+ }
newPackages = readNewPackages(in);
newResources = readNewResources(in);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOAdapterImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOAdapterImpl.java
index 2d1319b..73f69eb 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOAdapterImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOAdapterImpl.java
@@ -18,7 +18,6 @@ import org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl;
import org.eclipse.emf.cdo.internal.protocol.model.CDOFeatureImpl;
import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
import org.eclipse.emf.cdo.protocol.CDOID;
-import org.eclipse.emf.cdo.protocol.model.CDOClass;
import org.eclipse.emf.cdo.protocol.model.CDOType;
import org.eclipse.emf.cdo.protocol.revision.CDORevision;
import org.eclipse.emf.cdo.protocol.util.ImplementationError;
@@ -30,7 +29,6 @@ import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.common.util.URI;
@@ -48,10 +46,12 @@ import org.eclipse.emf.ecore.impl.EStructuralFeatureImpl;
import org.eclipse.emf.ecore.impl.ETypedElementImpl;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.emf.internal.cdo.bundle.OM;
import org.eclipse.emf.internal.cdo.util.GenUtil;
import java.lang.reflect.Field;
+import java.util.Iterator;
import java.util.List;
/**
@@ -129,22 +129,22 @@ public class CDOAdapterImpl extends AdapterImpl implements InternalCDOObject
return state;
}
- public CDORevision cdoRevision()
+ public CDORevisionImpl cdoRevision()
{
return revision;
}
- public CDOResource cdoResource()
+ public CDOResourceImpl cdoResource()
{
return resource;
}
- public CDOClass cdoClass()
+ public CDOClassImpl cdoClass()
{
return CDOObjectImpl.getCDOClass(this);
}
- public CDOView cdoView()
+ public CDOViewImpl cdoView()
{
return CDOObjectImpl.getCDOView(this);
}
@@ -232,20 +232,14 @@ public class CDOAdapterImpl extends AdapterImpl implements InternalCDOObject
private void transferTargetToRevision()
{
InternalEObject target = getTarget();
- CDOViewImpl view = (CDOViewImpl)cdoView();
+ CDOViewImpl view = cdoView();
CDOClassImpl cdoClass = revision.getCDOClass();
- System.out.println("TRANSFER " + cdoClass.getName() + ": " + target);
CDOFeatureImpl[] features = cdoClass.getAllFeatures();
for (int i = 0; i < features.length; i++)
{
CDOFeatureImpl feature = features[i];
- System.out.println("FEATURE " + feature);
- if (feature.getName().equals("eClassifier") && feature.getContainingClass().getName().equals("EGenericType"))
- {
- System.out.println("EGenericType.eClassifier");
- }
Object targetValue = getTargetValue(target, feature, view);
if (feature.isMany())
@@ -253,17 +247,16 @@ public class CDOAdapterImpl extends AdapterImpl implements InternalCDOObject
List revisionList = revision.getList(feature);
revisionList.clear();
- if (targetValue instanceof BasicEList)
+ if (targetValue != null)
{
- BasicEList targetList = (BasicEList)targetValue;
- if (targetList != null)
+ if (targetValue instanceof InternalEList)
{
- Object[] data = targetList.data();
- if (data != null)
+ InternalEList targetList = (InternalEList)targetValue;
+ if (targetList != null)
{
- for (int j = 0; j < targetList.size(); j++)
+ for (Iterator it = targetList.basicIterator(); it.hasNext();)
{
- Object targetElement = data[j];
+ Object targetElement = it.next();
if (targetElement != null && feature.isReference())
{
targetElement = view.convertObjectToID(targetElement);
@@ -273,15 +266,10 @@ public class CDOAdapterImpl extends AdapterImpl implements InternalCDOObject
}
}
}
- }
- else
- {
- if (targetValue != null && feature.isReference())
+ else
{
- targetValue = view.convertObjectToID(targetValue);
+ throw new ClassCastException(targetValue.getClass().getName());
}
-
- revisionList.add(targetValue);
}
}
else
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
index 1d1810c..c500ce1 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
@@ -34,7 +34,6 @@ import org.eclipse.net4j.util.event.EventUtil;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.lifecycle.ILifecycle;
-import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.InternalEObject;
@@ -261,15 +260,12 @@ public class CDOSessionImpl extends Lifecycle implements CDOSession
{
long lowerBound = nextTemporaryID;
registerMetaInstance((InternalEObject)ePackage);
- for (TreeIterator<EObject> it = ePackage.eAllContents(); it.hasNext();)
- {
- InternalEObject metaInstance = (InternalEObject)it.next();
- registerMetaInstance(metaInstance);
- }
-
return CDOIDRangeImpl.create(lowerBound, nextTemporaryID + 2);
}
+ /**
+ * TODO synchronize on nextTemporaryID
+ */
private void registerMetaInstance(InternalEObject metaInstance)
{
CDOID id = CDOIDImpl.create(nextTemporaryID);
@@ -282,6 +278,16 @@ public class CDOSessionImpl extends Lifecycle implements CDOSession
metaInstanceToIDMap.put(metaInstance, id);
--nextTemporaryID;
--nextTemporaryID;
+
+ // for (EReference reference : metaInstance.eClass().getEAllReferences())
+ // {
+ // metaInstance.eGet(reference);
+ // }
+
+ for (EObject content : metaInstance.eContents())
+ {
+ registerMetaInstance((InternalEObject)content);
+ }
}
public void notifyInvalidation(long timeStamp, Set<CDOID> dirtyOIDs, CDOViewImpl excludedView)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java
index 36e744c..a964eb3 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java
@@ -13,8 +13,6 @@ import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.fsm.FiniteStateMachine;
import org.eclipse.net4j.util.fsm.ITransition;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.internal.cdo.bundle.OM;
import org.eclipse.emf.internal.cdo.protocol.CommitTransactionResult;
import org.eclipse.emf.internal.cdo.protocol.ResourceIDRequest;
@@ -203,7 +201,7 @@ public final class CDOStateMachine extends FiniteStateMachine<CDOState, CDOEvent
transaction.registerNew(object);
// Attach content tree
- for (Iterator it = FSMUtil.iterator(object.eContents(), data.view); it.hasNext();)
+ for (Iterator it = FSMUtil.iterator(object.eContents(), transaction); it.hasNext();)
{
InternalCDOObject content = (InternalCDOObject)it.next();
INSTANCE.process(content, CDOEvent.ATTACH, data);
@@ -219,17 +217,15 @@ public final class CDOStateMachine extends FiniteStateMachine<CDOState, CDOEvent
{
public void execute(InternalCDOObject object, CDOState state, CDOEvent event, Object data)
{
+ CDOTransactionImpl transaction = (CDOTransactionImpl)object.cdoView();
object.cdoInternalFinalizeRevision();
object.cdoInternalSetState(CDOState.NEW);
// Finalize content tree
- EList<EObject> contents = object.eContents();
- for (EObject content : contents)
+ for (Iterator it = FSMUtil.iterator(object.eContents(), transaction); it.hasNext();)
{
- if (content instanceof InternalCDOObject)
- {
- INSTANCE.process((InternalCDOObject)content, CDOEvent.FINALIZE_ATTACH, null);
- }
+ InternalCDOObject content = (InternalCDOObject)it.next();
+ INSTANCE.process(content, CDOEvent.FINALIZE_ATTACH, data);
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
index 06b6cab..a5eb561 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
@@ -282,7 +282,9 @@ public class CDOViewImpl extends org.eclipse.net4j.internal.util.event.Notifier
return id;
}
- throw new ImplementationError("Not a CDOID: " + shouldBeCDOID.getClass().getName());
+ // XXX
+ convertObjectToID(idOrObject);
+ throw new ImplementationError("Unable to provideCDOID: " + idOrObject.getClass().getName());
}
public Object convertObjectToID(Object potentialObject)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/FSMUtil.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/FSMUtil.java
index 724760a..a1c5be8 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/FSMUtil.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/FSMUtil.java
@@ -54,6 +54,7 @@ public final class FSMUtil
if (object instanceof EModelElement || object instanceof EGenericType)
{
InternalEObject eObject = (InternalEObject)object;
+ eObject = (InternalEObject)EcoreUtil.resolve(eObject, view.getResourceSet());
CDOID id = view.getSession().lookupMetaInstanceID(eObject);
if (id != null)
{