summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-07-24 06:50:54 (EDT)
committerEike Stepper2007-07-24 06:50:54 (EDT)
commitfd61b3b8c6074263087f94d806bad6b7320660a8 (patch)
treef66ed9bd7a42c216c1f365aa2dd4d9a3309fa495
parent722c6f62a414b2ff3f16c974038b81bab5f24e11 (diff)
downloadcdo-fd61b3b8c6074263087f94d806bad6b7320660a8.zip
cdo-fd61b3b8c6074263087f94d806bad6b7320660a8.tar.gz
cdo-fd61b3b8c6074263087f94d806bad6b7320660a8.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOAdapterImpl.java23
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOPackageRegistryImpl.java4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java3
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java45
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/FSMUtil.java2
6 files changed, 62 insertions, 19 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java
index aba0ac9..3836355 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java
@@ -365,7 +365,7 @@ public class CDOResourceImpl extends CDOObjectImpl implements CDOResource
*/
public void attached(EObject object)
{
- throw new UnsupportedOperationException();
+ // Do nothing
}
/**
@@ -373,7 +373,7 @@ public class CDOResourceImpl extends CDOObjectImpl implements CDOResource
*/
public void detached(EObject object)
{
- throw new UnsupportedOperationException();
+ // Do nothing
}
/**
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 0483c8f..054b45a 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
@@ -65,6 +65,8 @@ public class CDOAdapterImpl extends AdapterImpl implements InternalCDOObject
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_OBJECT, CDOAdapterImpl.class);
+ private CDOViewImpl view;
+
private CDOID id;
private CDOState state;
@@ -163,7 +165,12 @@ public class CDOAdapterImpl extends AdapterImpl implements InternalCDOObject
public CDOViewImpl cdoView()
{
- return CDOObjectImpl.getCDOView(this);
+ if (view == null)
+ {
+ view = CDOObjectImpl.getCDOView(this);
+ }
+
+ return view;
}
public void cdoInternalSetID(CDOID id)
@@ -222,7 +229,7 @@ public class CDOAdapterImpl extends AdapterImpl implements InternalCDOObject
public void cdoInternalSetView(CDOView view)
{
- // Do nothing since target will never be a CDOResource
+ this.view = (CDOViewImpl)view;
}
public void cdoInternalSetResource(CDOResource resource)
@@ -351,6 +358,11 @@ public class CDOAdapterImpl extends AdapterImpl implements InternalCDOObject
{
InternalEObject target = getTarget();
CDOViewImpl view = cdoView();
+ if (view == null)
+ {
+ cdoView();
+ throw new ImplementationError("view == null");
+ }
// Handle containment
CDOID containerID = revision.getContainerID();
@@ -404,7 +416,7 @@ public class CDOAdapterImpl extends AdapterImpl implements InternalCDOObject
value = view.convertIDToObject(value);
}
- setTargetValue(getTarget(), feature, value);
+ setTargetValue(target, feature, value);
}
}
}
@@ -566,6 +578,11 @@ public class CDOAdapterImpl extends AdapterImpl implements InternalCDOObject
{
throw new ImplementationError(ex);
}
+ catch (RuntimeException ex)
+ {
+ ex.printStackTrace();
+ throw ex;
+ }
}
private static int getEFlagMask(Class<?> targetClass, String flagName)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOPackageRegistryImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOPackageRegistryImpl.java
index 3d35786..24111cb 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOPackageRegistryImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOPackageRegistryImpl.java
@@ -113,7 +113,9 @@ public class CDOPackageRegistryImpl extends EPackageRegistryImpl implements CDOP
public EPackage getEPackage()
{
- return ModelUtil.createEPackage(cdoPackage, CDOPackageRegistryImpl.this);
+ EPackage ePackage = ModelUtil.createEPackage(cdoPackage, CDOPackageRegistryImpl.this);
+ session.registerEPackage(ePackage);
+ return ePackage;
}
@Override
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 39b7e14..48cea1a 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
@@ -616,7 +616,8 @@ public class CDOSessionImpl extends Lifecycle implements CDOSession
return adapter.getTarget();
}
- return null;
+ // throw new ImplementationError("Can't resolve " + uriFragment);
+ return object;
}
public TreeIterator<EObject> getAllContents()
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 15b5733..3e6ae0d 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
@@ -223,21 +223,46 @@ public class CDOViewImpl extends org.eclipse.net4j.internal.util.event.Notifier
lastLookupObject = objects.get(id);
if (lastLookupObject == null)
{
- lastLookupObject = createObjectForRevision(id);
+ if (id.isMeta())
+ {
+ lastLookupObject = createObjectForMeta(id);
+ }
+ else
+ {
+ lastLookupObject = createObjectForRevision(id);
+ }
+
registerObject(lastLookupObject);
}
return lastLookupObject;
}
+ /**
+ * @return Never <code>null</code>
+ */
+ private InternalCDOObject createObjectForMeta(CDOID id)
+ {
+ InternalEObject metaInstance = session.lookupMetaInstance(id);
+ if (metaInstance == null)
+ {
+ throw new ImplementationError("No metaInstance for " + id);
+ }
+
+ return new CDOMetaImpl(this, metaInstance, id);
+ }
+
+ /**
+ * @return Never <code>null</code>
+ */
private InternalCDOObject createObjectForRevision(CDOID id)
{
+ CDORevisionImpl revision = lookupRevision(id);
if (TRACER.isEnabled())
{
- TRACER.format("Creating object: ID={0}", id);
+ TRACER.trace("Creating object for revision: " + revision);
}
- CDORevisionImpl revision = lookupRevision(id);
InternalCDOObject object = newInstance(revision.getCDOClass());
if (object instanceof CDOResourceImpl)
{
@@ -246,8 +271,11 @@ public class CDOViewImpl extends org.eclipse.net4j.internal.util.event.Notifier
else
{
CDOID resourceID = revision.getResourceID();
- CDOResourceImpl resource = getResource(resourceID);
- object.cdoInternalSetResource(resource);
+ if (!resourceID.isNull())
+ {
+ CDOResourceImpl resource = getResource(resourceID);
+ object.cdoInternalSetResource(resource);
+ }
}
object.cdoInternalSetView(this);
@@ -324,12 +352,7 @@ public class CDOViewImpl extends org.eclipse.net4j.internal.util.event.Notifier
throw new ImplementationError("ID not registered: " + id);
}
- if (result instanceof CDOAdapterImpl)
- {
- return ((CDOAdapterImpl)result).getTarget();
- }
-
- return result;
+ return result.cdoInternalInstance();
}
return potentialID;
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 2751d62..7df7f47 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
@@ -56,7 +56,7 @@ public final class FSMUtil
InternalEObject eObject = (InternalEObject)object;
if (eObject.eIsProxy())
{
- eObject = (InternalEObject)EcoreUtil.resolve(eObject, view.getResourceSet());
+ EcoreUtil.resolve(eObject, view.getResourceSet());
}
CDOID id = view.getSession().lookupMetaInstanceID(eObject);