Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-10-15 15:49:58 -0400
committerEike Stepper2008-10-15 15:49:58 -0400
commit3ef4cd444ef6ffd5be15fe9f3ea8289a1981845b (patch)
treef9ebad162b8df9378aa446b0d85963c9158a70be
parent558ae6302818570ba5e4841512df1b5e60f79800 (diff)
downloadcdo-3ef4cd444ef6ffd5be15fe9f3ea8289a1981845b.tar.gz
cdo-3ef4cd444ef6ffd5be15fe9f3ea8289a1981845b.tar.xz
cdo-3ef4cd444ef6ffd5be15fe9f3ea8289a1981845b.zip
[249847] Store resources in a hierarchical structure
https://bugs.eclipse.org/bugs/show_bug.cgi?id=249847
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java19
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionCache.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/mem/MEMRevisionCache.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStore.java8
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java33
5 files changed, 29 insertions, 36 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java
index 5e43875407..32bb5cc429 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java
@@ -27,6 +27,7 @@ import org.eclipse.emf.cdo.spi.common.CDOIDLibraryDescriptorImpl;
import org.eclipse.emf.cdo.spi.common.CDOIDLongImpl;
import org.eclipse.net4j.util.ImplementationError;
+import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.io.ExtendedDataInput;
import org.eclipse.net4j.util.om.trace.ContextTracer;
@@ -230,4 +231,22 @@ public final class CDOIDUtil
{
return new CDOIDAndVersionImpl(id, version);
}
+
+ /**
+ * @since 2.0
+ */
+ public static boolean equals(CDOID id1, CDOID id2)
+ {
+ if (id1 == null)
+ {
+ id1 = CDOID.NULL;
+ }
+
+ if (id2 == null)
+ {
+ id2 = CDOID.NULL;
+ }
+
+ return ObjectUtil.equals(id1, id2);
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionCache.java
index 0a602a66fb..43f9a10e05 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionCache.java
@@ -13,6 +13,7 @@
package org.eclipse.emf.cdo.internal.common.revision.cache.lru;
import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.model.CDOClass;
import org.eclipse.emf.cdo.common.model.CDOPackageManager;
import org.eclipse.emf.cdo.common.model.resource.CDOFolderFeature;
@@ -273,7 +274,7 @@ public class LRURevisionCache extends Lifecycle implements CDORevisionCache
if (revision != null)
{
CDOID revisionFolderID = (CDOID)revision.getValue(cdoFolderFeature);
- if (ObjectUtil.equals(revisionFolderID, folderID))
+ if (CDOIDUtil.equals(revisionFolderID, folderID))
{
String revisionName = (String)revision.getValue(cdoNameFeature);
if (ObjectUtil.equals(revisionName, name))
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/mem/MEMRevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/mem/MEMRevisionCache.java
index dbe32a18e3..4a8fc9f26e 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/mem/MEMRevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/mem/MEMRevisionCache.java
@@ -350,7 +350,7 @@ public class MEMRevisionCache extends ReferenceQueueWorker<InternalCDORevision>
if (revision != null)
{
CDOID revisionFolderID = (CDOID)revision.getValue(cdoFolderFeature);
- if (ObjectUtil.equals(revisionFolderID, folderID))
+ if (CDOIDUtil.equals(revisionFolderID, folderID))
{
String revisionName = (String)revision.getValue(cdoNameFeature);
if (ObjectUtil.equals(revisionName, name))
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStore.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStore.java
index 7905de7f55..8d6685f4f5 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStore.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStore.java
@@ -13,6 +13,7 @@
package org.eclipse.emf.cdo.internal.server;
import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.cdo.common.model.resource.CDOResourceNodeClass;
import org.eclipse.emf.cdo.common.revision.CDORevision;
@@ -175,10 +176,10 @@ public class MEMStore extends LongIDStore implements IMEMStore
if (revision.isResource())
{
- // CDOID revisionFolder = (CDOID)revision.getData().get(getResourceFolderFeature(), 0);
CDOID revisionFolder = (CDOID)revision.getData().getContainerID();
String revisionName = (String)revision.getData().get(getResourceNameFeature(), 0);
- if (getResourceID(revisionFolder, revisionName, revision.getCreated()) != null)
+ CDOID resourceID = getResourceID(revisionFolder, revisionName, revision.getCreated());
+ if (resourceID != null)
{
throw new IllegalStateException("Duplicate resource: " + revisionName + " (folderID=" + revisionFolder + ")");
}
@@ -268,7 +269,8 @@ public class MEMStore extends LongIDStore implements IMEMStore
if (revision != null)
{
CDOID revisionFolder = (CDOID)revision.getData().getContainerID();
- if (ObjectUtil.equals(revisionFolder, folderID))
+ // TODO Don't use ObjectUtil.equals for CDOIDs
+ if (CDOIDUtil.equals(revisionFolder, folderID))
{
String revisionName = (String)revision.getData().get(getResourceNameFeature(), 0);
boolean match = exactMatch || name == null ? ObjectUtil.equals(revisionName, name) : revisionName
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
index 8508f9db7c..d2e0344bca 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
@@ -48,6 +48,7 @@ import org.eclipse.emf.internal.cdo.util.IPackageClosure;
import org.eclipse.emf.internal.cdo.util.ModelUtil;
import org.eclipse.net4j.util.ImplementationError;
+import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.event.Notifier;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.transaction.TransactionException;
@@ -366,36 +367,6 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
return id;
}
- // /**
- // * @since 2.0
- // */
- // @Override
- // protected CDOResourceNode getRootResourceNode(String name)
- // {
- // if (dirty)
- // {
- // CDOResourceNode node = getRootResourceNode(name, getDirtyObjects().values());
- // if (node != null)
- // {
- // return node;
- // }
- //
- // node = getRootResourceNode(name, getNewObjects().values());
- // if (node != null)
- // {
- // return node;
- // }
- //
- // node = getRootResourceNode(name, getNewResources().values());
- // if (node != null)
- // {
- // return node;
- // }
- // }
- //
- // return super.getRootResourceNode(name);
- // }
-
private CDOResourceNode getRootResourceNode(String name, Collection<? extends CDOObject> objects)
{
for (CDOObject object : objects)
@@ -403,7 +374,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
if (object instanceof CDOResourceNode)
{
CDOResourceNode node = (CDOResourceNode)object;
- if (node.getFolder() == null && name.equals(node.getName()))
+ if (node.getFolder() == null && ObjectUtil.equals(name, node.getName()))
{
return node;
}

Back to the top