Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-10-18 07:59:25 -0400
committerEike Stepper2008-10-18 07:59:25 -0400
commit869d0b1c0d8df7e45b5c6c6cbe71fcc4a1a856c6 (patch)
tree418f87b32c2aa26ea39588c4a326db58ccd9ea44
parent02d23a532418c1f187fc2970caec46c7dc5aeaa1 (diff)
downloadcdo-869d0b1c0d8df7e45b5c6c6cbe71fcc4a1a856c6.tar.gz
cdo-869d0b1c0d8df7e45b5c6c6cbe71fcc4a1a856c6.tar.xz
cdo-869d0b1c0d8df7e45b5c6c6cbe71fcc4a1a856c6.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/internal/common/revision/cache/lru/LRURevisionCache.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/mem/MEMRevisionCache.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalClassMapping.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ResourceTest.java39
4 files changed, 34 insertions, 23 deletions
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 43f9a10e05..cac8de1432 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
@@ -16,7 +16,6 @@ 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;
import org.eclipse.emf.cdo.common.model.resource.CDONameFeature;
import org.eclipse.emf.cdo.common.model.resource.CDOResourceNodeClass;
import org.eclipse.emf.cdo.common.revision.CDORevision;
@@ -54,8 +53,6 @@ public class LRURevisionCache extends Lifecycle implements CDORevisionCache
private LRU revisedLRU;
- private transient CDOFolderFeature cdoFolderFeature;
-
private transient CDONameFeature cdoNameFeature;
public LRURevisionCache()
@@ -73,7 +70,6 @@ public class LRURevisionCache extends Lifecycle implements CDORevisionCache
if (packageManager != null)
{
CDOResourceNodeClass resourceNodeClass = packageManager.getCDOResourcePackage().getCDOResourceNodeClass();
- cdoFolderFeature = resourceNodeClass.getCDOFolderFeature();
cdoNameFeature = resourceNodeClass.getCDONameFeature();
}
}
@@ -273,7 +269,7 @@ public class LRURevisionCache extends Lifecycle implements CDORevisionCache
revision = getRevisionByTime(holder, timeStamp);
if (revision != null)
{
- CDOID revisionFolderID = (CDOID)revision.getValue(cdoFolderFeature);
+ CDOID revisionFolderID = (CDOID)revision.getContainerID();
if (CDOIDUtil.equals(revisionFolderID, folderID))
{
String revisionName = (String)revision.getValue(cdoNameFeature);
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 4a8fc9f26e..d8ccfa0ad4 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
@@ -17,7 +17,6 @@ import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
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;
import org.eclipse.emf.cdo.common.model.resource.CDONameFeature;
import org.eclipse.emf.cdo.common.model.resource.CDOResourceNodeClass;
import org.eclipse.emf.cdo.common.revision.CDORevision;
@@ -59,8 +58,6 @@ public class MEMRevisionCache extends ReferenceQueueWorker<InternalCDORevision>
private ReferenceType referenceType;
- private transient CDOFolderFeature cdoFolderFeature;
-
private transient CDONameFeature cdoNameFeature;
public MEMRevisionCache(ReferenceType referenceType)
@@ -84,7 +81,6 @@ public class MEMRevisionCache extends ReferenceQueueWorker<InternalCDORevision>
if (packageManager != null)
{
CDOResourceNodeClass resourceNodeClass = packageManager.getCDOResourcePackage().getCDOResourceNodeClass();
- cdoFolderFeature = resourceNodeClass.getCDOFolderFeature();
cdoNameFeature = resourceNodeClass.getCDONameFeature();
}
}
@@ -349,7 +345,7 @@ public class MEMRevisionCache extends ReferenceQueueWorker<InternalCDORevision>
InternalCDORevision revision = getRevisionByTime(timeStamp, true);
if (revision != null)
{
- CDOID revisionFolderID = (CDOID)revision.getValue(cdoFolderFeature);
+ CDOID revisionFolderID = (CDOID)revision.getContainerID();
if (CDOIDUtil.equals(revisionFolderID, folderID))
{
String revisionName = (String)revision.getValue(cdoNameFeature);
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalClassMapping.java
index 9837bd9ecf..ae39366469 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalClassMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalClassMapping.java
@@ -57,11 +57,9 @@ public class HorizontalClassMapping extends ClassMapping
{
IPackageManager packageManager = mappingStrategy.getStore().getRepository().getPackageManager();
CDOResourceNodeClass resourceNodeClass = packageManager.getCDOResourcePackage().getCDOResourceNodeClass();
-
- CDOFeature resourceFolderFeature = resourceNodeClass.getCDOFolderFeature();
- CDOID folderID = (CDOID)revision.getData().get(resourceFolderFeature, 0);
-
CDOFeature resourceNameFeature = resourceNodeClass.getCDONameFeature();
+
+ CDOID folderID = (CDOID)revision.getData().getContainerID();
String name = (String)revision.getData().get(resourceNameFeature, 0);
if (mappingStrategy.readResourceID(storeReader, folderID, name, revision.getCreated()) != null)
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ResourceTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ResourceTest.java
index cf72a8333b..f67303c36b 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ResourceTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ResourceTest.java
@@ -21,6 +21,7 @@ import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.eresource.CDOResourceFolder;
import org.eclipse.emf.cdo.eresource.CDOResourceNode;
+import org.eclipse.emf.cdo.internal.common.revision.CDORevisionResolverImpl;
import org.eclipse.emf.cdo.tests.model1.Order;
import org.eclipse.emf.cdo.tests.model1.Product1;
import org.eclipse.emf.cdo.tests.model1.VAT;
@@ -386,15 +387,35 @@ public class ResourceTest extends AbstractCDOTest
session.close();
}
- // ((CDORevisionResolverImpl)getRepository().getRevisionManager()).clearCache();
- //
- // CDOSession session = openSession();
- // CDOTransaction transaction = session.openTransaction();
- // CDOResource resource1 = transaction.getResource("/level1/level2-A/level3");
- // CDOResource resource2 = transaction.getResource("/level1/level2-B/level3");
- // assertEquals("/level1/level2-A/level3", resource1.getPath());
- // assertEquals("/level1/level2-B/level3", resource2.getPath());
- // session.close();
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource1 = transaction.getResource("/level1/level2-A/level3");
+ CDOResource resource2 = transaction.getResource("/level1/level2-B/level3");
+ assertEquals("/level1/level2-A/level3", resource1.getPath());
+ assertEquals("/level1/level2-B/level3", resource2.getPath());
+ session.close();
+ }
+
+ public void testLoadMultipleResources()
+ {
+ {
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ transaction.createResource("/level1/level2-A/level3");
+ transaction.createResource("/level1/level2-B/level3");
+ transaction.commit();
+ session.close();
+ }
+
+ ((CDORevisionResolverImpl)getRepository().getRevisionManager()).clearCache();
+
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource1 = transaction.getResource("/level1/level2-A/level3");
+ CDOResource resource2 = transaction.getResource("/level1/level2-B/level3");
+ assertEquals("/level1/level2-A/level3", resource1.getPath());
+ assertEquals("/level1/level2-B/level3", resource2.getPath());
+ session.close();
}
public void testDuplicatePath() throws Exception

Back to the top