summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-08-17 04:05:53 (EDT)
committerEike Stepper2007-08-17 04:05:53 (EDT)
commit99ac3d9bc1cc5df34829f0e533eabe4de5ff3fb6 (patch)
treebfcc75cc40cff9cb4e10616643451ccf2dd20227
parent32683980457cb6f968899da134718d2f65e5e1c3 (diff)
downloadcdo-99ac3d9bc1cc5df34829f0e533eabe4de5ff3fb6.zip
cdo-99ac3d9bc1cc5df34829f0e533eabe4de5ff3fb6.tar.gz
cdo-99ac3d9bc1cc5df34829f0e533eabe4de5ff3fb6.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java33
1 files changed, 25 insertions, 8 deletions
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 0347f33..c8adebc 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
@@ -24,7 +24,9 @@ import org.eclipse.net4j.db.IDBTable;
import org.eclipse.net4j.internal.db.DBSchema;
import org.eclipse.net4j.util.ImplementationError;
+import java.util.ArrayList;
import java.util.HashSet;
+import java.util.List;
import java.util.Properties;
import java.util.Set;
@@ -76,32 +78,47 @@ public abstract class MappingStrategy implements IMappingStrategy
public Set<IDBTable> map(CDOPackageImpl[] cdoPackages)
{
+ // Lazily create the schema
if (schema == null)
{
schema = createSchema();
}
+ // Prepare data structures
Set<IDBTable> affectedTables = new HashSet();
+ List<CDOClass> cdoClasses = new ArrayList();
+
+ // Map all packages before classes are mapped
for (CDOPackageImpl cdoPackage : cdoPackages)
{
((DBPackageInfo)cdoPackage.getServerInfo()).setSchema(schema);
+ }
+
+ // Map all classes before features are mapped
+ for (CDOPackageImpl cdoPackage : cdoPackages)
+ {
for (CDOClass cdoClass : cdoPackage.getClasses())
{
+ cdoClasses.add(cdoClass);
IDBTable table = map(schema, cdoClass, affectedTables);
if (table != null)
{
((DBClassInfo)cdoClass.getServerInfo()).setTable(table);
affectedTables.add(table);
}
+ }
+ }
- for (CDOFeature cdoFeature : cdoClass.getAllFeatures())
+ // Map all features
+ for (CDOClass cdoClass : cdoClasses)
+ {
+ for (CDOFeature cdoFeature : cdoClass.getAllFeatures())
+ {
+ IDBField field = map(schema, cdoClass, cdoFeature, affectedTables);
+ if (field != null)
{
- IDBField field = map(schema, cdoClass, cdoFeature, affectedTables);
- if (table != null)
- {
- ((DBFeatureInfo)cdoFeature.getServerInfo()).setField(field);
- affectedTables.add(field.getTable());
- }
+ ((DBFeatureInfo)cdoFeature.getServerInfo()).setField(field);
+ affectedTables.add(field.getTable());
}
}
}
@@ -188,6 +205,6 @@ public abstract class MappingStrategy implements IMappingStrategy
return DBType.LONGVARCHAR;
}
- throw new ImplementationError("Unrecognized type: " + type);
+ throw new ImplementationError("Unrecognized CDOType: " + type);
}
} \ No newline at end of file