summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-08-25 04:31:37 (EDT)
committerEike Stepper2007-08-25 04:31:37 (EDT)
commit3f092a0374378e09f54a35fe21abf5d4e8721ea2 (patch)
treed226d6b435f9a9f602183867b6db0b63c4f00ef3
parent29258ad6ac66851417729c38f13da26754d328f7 (diff)
downloadcdo-3f092a0374378e09f54a35fe21abf5d4e8721ea2.zip
cdo-3f092a0374378e09f54a35fe21abf5d4e8721ea2.tar.gz
cdo-3f092a0374378e09f54a35fe21abf5d4e8721ea2.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalMappingStrategy.java34
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java35
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalMappingStrategy.java9
3 files changed, 64 insertions, 14 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalMappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalMappingStrategy.java
index f926664..44863b1 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalMappingStrategy.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalMappingStrategy.java
@@ -13,11 +13,13 @@ package org.eclipse.emf.cdo.server.internal.db;
import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.protocol.model.CDOClass;
import org.eclipse.emf.cdo.protocol.model.CDOClassRef;
+import org.eclipse.emf.cdo.protocol.model.CDOPackage;
+import org.eclipse.emf.cdo.server.IPackageManager;
import org.eclipse.emf.cdo.server.db.IDBStoreAccessor;
import org.eclipse.emf.cdo.server.db.IMapping;
-import java.sql.ResultSet;
-import java.util.Iterator;
+import java.util.ArrayList;
+import java.util.List;
/**
* @author Eike Stepper
@@ -38,18 +40,6 @@ public class HorizontalMappingStrategy extends MappingStrategy
return false;
}
- public Iterator<CDOID> readObjectIDs(IDBStoreAccessor storeAccessor, boolean withTypes)
- {
- return new ObjectIDIterator(this, storeAccessor, withTypes)
- {
- @Override
- protected ResultSet getNextResultSet()
- {
- return null;
- }
- };
- }
-
public CDOClassRef readObjectType(IDBStoreAccessor storeAccessor, CDOID id)
{
return null;
@@ -65,4 +55,20 @@ public class HorizontalMappingStrategy extends MappingStrategy
return new HorizontalMapping(this, cdoClass);
}
+
+ @Override
+ protected List<CDOClass> getObjectIDClasses()
+ {
+ List<CDOClass> result = new ArrayList();
+ IPackageManager packageManager = getStore().getRepository().getPackageManager();
+ for (CDOPackage cdoPackage : packageManager.getPackages())
+ {
+ for (CDOClass cdoClass : cdoPackage.getClasses())
+ {
+ result.add(cdoClass);
+ }
+ }
+
+ return result;
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java
index 569e148..167b21e 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java
@@ -10,6 +10,7 @@
**************************************************************************/
package org.eclipse.emf.cdo.server.internal.db;
+import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.protocol.model.CDOClass;
import org.eclipse.emf.cdo.protocol.model.CDOClassRef;
import org.eclipse.emf.cdo.server.db.IDBStore;
@@ -19,7 +20,10 @@ import org.eclipse.emf.cdo.server.db.IMappingStrategy;
import org.eclipse.net4j.db.IDBTable;
+import java.sql.ResultSet;
import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
import java.util.Map;
/**
@@ -125,6 +129,35 @@ public abstract class MappingStrategy implements IMappingStrategy
return mapping;
}
+ public Iterator<CDOID> readObjectIDs(IDBStoreAccessor storeAccessor, boolean withTypes)
+ {
+ List<CDOClass> classes = getObjectIDClasses();
+ final Iterator<CDOClass> classIt = classes.iterator();
+ return new ObjectIDIterator(this, storeAccessor, withTypes)
+ {
+ @Override
+ protected ResultSet getNextResultSet()
+ {
+ while (classIt.hasNext())
+ {
+ CDOClass cdoClass = classIt.next();
+ ValueMapping mapping = (ValueMapping)ClassServerInfo.getMapping(cdoClass);
+ if (mapping != null)
+ {
+ IDBTable table = mapping.getTable();
+ if (table != null)
+ {
+
+ return null;
+ }
+ }
+ }
+
+ return null;
+ }
+ };
+ }
+
public CDOClassRef getClassRef(IDBStoreAccessor storeAccessor, int classID)
{
CDOClassRef classRef = classRefs.get(classID);
@@ -144,4 +177,6 @@ public abstract class MappingStrategy implements IMappingStrategy
}
protected abstract IMapping createMapping(CDOClass cdoClass);
+
+ protected abstract List<CDOClass> getObjectIDClasses();
} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalMappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalMappingStrategy.java
index 870db73..ae35fb1 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalMappingStrategy.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalMappingStrategy.java
@@ -16,7 +16,9 @@ import org.eclipse.emf.cdo.protocol.model.CDOClassRef;
import org.eclipse.emf.cdo.server.db.IDBStoreAccessor;
import org.eclipse.emf.cdo.server.db.IMapping;
+import java.util.Collections;
import java.util.Iterator;
+import java.util.List;
/**
* @author Eike Stepper
@@ -40,6 +42,7 @@ public class VerticalMappingStrategy extends MappingStrategy
return true;
}
+ @Override
public Iterator<CDOID> readObjectIDs(IDBStoreAccessor storeAccessor, boolean withTypes)
{
return null;
@@ -65,4 +68,10 @@ public class VerticalMappingStrategy extends MappingStrategy
{
return new VerticalMapping(this, cdoClass);
}
+
+ @Override
+ protected List<CDOClass> getObjectIDClasses()
+ {
+ return Collections.singletonList(rootMapping.getCDOClass());
+ }
}