summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-08-17 13:29:17 (EDT)
committerEike Stepper2007-08-17 13:29:17 (EDT)
commitf58e43265420cf5f8ce2686c87034c3021a916ef (patch)
tree2136a8335ecbd0ed3cd8a56241699d5faff26d02
parentdcf2ab9ab0c32f6b7e0dd41595f8a2413eaf30cb (diff)
downloadcdo-f58e43265420cf5f8ce2686c87034c3021a916ef.zip
cdo-f58e43265420cf5f8ce2686c87034c3021a916ef.tar.gz
cdo-f58e43265420cf5f8ce2686c87034c3021a916ef.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBClassInfo.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBFeatureInfo.java35
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBPackageInfo.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalMappingStrategy.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java2
5 files changed, 50 insertions, 8 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBClassInfo.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBClassInfo.java
index 518b7df..1302857 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBClassInfo.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBClassInfo.java
@@ -38,6 +38,14 @@ public final class DBClassInfo
public void setTable(IDBTable table)
{
- this.table = table;
+ if (this.table != table)
+ {
+ if (this.table != null)
+ {
+ throw new IllegalStateException("Table is already set");
+ }
+
+ this.table = table;
+ }
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBFeatureInfo.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBFeatureInfo.java
index 17ea744..221c91c 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBFeatureInfo.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBFeatureInfo.java
@@ -12,6 +12,9 @@ package org.eclipse.emf.cdo.server.internal.db;
import org.eclipse.net4j.db.IDBField;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* @author Eike Stepper
*/
@@ -19,7 +22,7 @@ public final class DBFeatureInfo
{
private int id;
- private IDBField field;
+ private Map<Object, IDBField> fields;
public DBFeatureInfo(int id)
{
@@ -31,13 +34,35 @@ public final class DBFeatureInfo
return id;
}
- public IDBField getField()
+ public IDBField getField(Object context)
+ {
+ return fields == null ? null : fields.get(context);
+ }
+
+ public void addField(Object context, IDBField field)
{
- return field;
+ if (fields == null)
+ {
+ fields = new HashMap();
+ }
+ else
+ {
+ if (fields.containsKey(context))
+ {
+ throw new IllegalStateException("Field " + field + " is already added for context " + context);
+ }
+ }
+
+ fields.put(context, field);
}
- public void setField(IDBField field)
+ public IDBField removeField(Object context)
{
- this.field = field;
+ if (fields == null)
+ {
+ return null;
+ }
+
+ return fields.remove(context);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBPackageInfo.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBPackageInfo.java
index 5568640..eec715f 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBPackageInfo.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBPackageInfo.java
@@ -38,6 +38,14 @@ public final class DBPackageInfo
public void setSchema(IDBSchema schema)
{
- this.schema = schema;
+ if (this.schema != schema)
+ {
+ if (this.schema != null)
+ {
+ throw new IllegalStateException("Schema " + schema + "is already set");
+ }
+
+ this.schema = schema;
+ }
}
}
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 451a5f8..1f03f0a 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
@@ -65,6 +65,7 @@ public class HorizontalMappingStrategy extends MappingStrategy
public void writeRevision(Connection connection, CDORevisionImpl revision)
{
+ revision.getCDOClass();
}
public CDORevision readRevision(Connection connection, CDOID id)
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 78c4aa3..9667b7f 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
@@ -140,7 +140,7 @@ public abstract class MappingStrategy implements IMappingStrategy
IDBField field = map(cdoClass, cdoFeature, affectedTables);
if (field != null)
{
- ((DBFeatureInfo)cdoFeature.getServerInfo()).setField(field);
+ ((DBFeatureInfo)cdoFeature.getServerInfo()).addField(cdoClass, field);
affectedTables.add(field.getTable());
if (TRACER.isEnabled())
{