Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2013-03-05 02:08:19 -0500
committerEike Stepper2013-03-07 08:44:23 -0500
commit81a23a1e6238318f5fc18c97c0ef64b3ed51b3df (patch)
tree3a9090db0ff7c9c008f1b79a6bf85e90e5b8f3a0
parenta500d7231be01e2d63dd0c56f22594a2ae853057 (diff)
downloadcdo-81a23a1e6238318f5fc18c97c0ef64b3ed51b3df.tar.gz
cdo-81a23a1e6238318f5fc18c97c0ef64b3ed51b3df.tar.xz
cdo-81a23a1e6238318f5fc18c97c0ef64b3ed51b3df.zip
[401763] Make CDO Server more robust against data dictionary changes
https://bugs.eclipse.org/bugs/show_bug.cgi?id=401763
-rw-r--r--plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/AbstractDBTest.java3
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBField.java5
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBFieldDelta.java9
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBIndexDelta.java8
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBIndexFieldDelta.java9
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBPropertyDelta.java9
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBSchemaDelta.java10
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBTableDelta.java10
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBNamedElement.java2
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBSchema.java2
10 files changed, 62 insertions, 5 deletions
diff --git a/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/AbstractDBTest.java b/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/AbstractDBTest.java
index 2274341522..8e3820cbb3 100644
--- a/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/AbstractDBTest.java
+++ b/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/AbstractDBTest.java
@@ -20,6 +20,7 @@ import org.eclipse.net4j.db.ddl.IDBField;
import org.eclipse.net4j.db.ddl.IDBIndex;
import org.eclipse.net4j.db.ddl.IDBSchema;
import org.eclipse.net4j.db.ddl.IDBTable;
+import org.eclipse.net4j.db.ddl.delta.IDBSchemaDelta;
import org.eclipse.net4j.util.tests.AbstractOMTest;
import javax.sql.DataSource;
@@ -230,7 +231,7 @@ public abstract class AbstractDBTest extends AbstractOMTest
IDBIndex index22 = table2.addIndex("index2", IDBIndex.Type.UNIQUE, field21, field22);
IDBIndex index23 = table2.addIndex("index3", IDBIndex.Type.NON_UNIQUE, field22);
- // IDBSchemaDelta schemaDelta = schemaTransaction.getSchemaDelta();
+ IDBSchemaDelta schemaDelta = schemaTransaction.getSchemaDelta();
schemaTransaction.commit();
assertEquals(true, database.getSchema().isLocked());
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBField.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBField.java
index a7ed7897fb..2ceca70b62 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBField.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBField.java
@@ -22,6 +22,8 @@ public class DBField extends DBSchemaElement implements IDBField
{
public static final int DEFAULT_DECIMAL_PRECISION = 5;
+ public static final int DEFAULT_PRECISION = 0;
+
public static final int DEFAULT_SCALE = 0;
public static final int DEFAULT_CHAR_LENGTH = 1;
@@ -97,6 +99,9 @@ public class DBField extends DBSchemaElement implements IDBField
case DECIMAL:
case NUMERIC:
return DEFAULT_DECIMAL_PRECISION;
+
+ default:
+ return DEFAULT_PRECISION;
}
}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBFieldDelta.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBFieldDelta.java
index 1cc23df9b9..36c613e2b5 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBFieldDelta.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBFieldDelta.java
@@ -19,6 +19,8 @@ import org.eclipse.net4j.internal.db.ddl.DBField;
import org.eclipse.net4j.internal.db.ddl.DBTable;
import org.eclipse.net4j.util.ObjectUtil;
+import java.text.MessageFormat;
+
/**
* @author Eike Stepper
*/
@@ -101,4 +103,11 @@ public final class DBFieldDelta extends DBTableElementDelta implements IDBFieldD
return table.getField(getName());
}
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("DBFieldDelta[name={0}, kind={1}, propertyDeltas={2}]", getName(), getChangeKind(),
+ getPropertyDeltas().values());
+ }
}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBIndexDelta.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBIndexDelta.java
index f88310f09e..44a285edba 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBIndexDelta.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBIndexDelta.java
@@ -22,6 +22,7 @@ import org.eclipse.net4j.internal.db.ddl.DBIndexField;
import org.eclipse.net4j.internal.db.ddl.DBTable;
import org.eclipse.net4j.util.ObjectUtil;
+import java.text.MessageFormat;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
@@ -147,4 +148,11 @@ public final class DBIndexDelta extends DBTableElementDelta implements IDBIndexD
return table.getIndex(getName());
}
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("DBIndexDelta[name={0}, kind={1}, propertyDeltas={2}, indexFieldDeltas={3}]",
+ getName(), getChangeKind(), getPropertyDeltas().values(), indexFieldDeltas.values());
+ }
}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBIndexFieldDelta.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBIndexFieldDelta.java
index 19f262fae9..aef40665ae 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBIndexFieldDelta.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBIndexFieldDelta.java
@@ -18,6 +18,8 @@ import org.eclipse.net4j.internal.db.ddl.DBIndex;
import org.eclipse.net4j.internal.db.ddl.DBIndexField;
import org.eclipse.net4j.util.ObjectUtil;
+import java.text.MessageFormat;
+
/**
* @author Eike Stepper
*/
@@ -76,4 +78,11 @@ public final class DBIndexFieldDelta extends DBDelta implements IDBIndexFieldDel
return index.getIndexField(getName());
}
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("DBIndexFieldDelta[name={0}, kind={1}, propertyDeltas={2}]", getName(),
+ getChangeKind(), getPropertyDeltas().values());
+ }
}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBPropertyDelta.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBPropertyDelta.java
index 73f441a762..08f961a8e8 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBPropertyDelta.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBPropertyDelta.java
@@ -14,6 +14,8 @@ import org.eclipse.net4j.db.ddl.delta.IDBDelta.ChangeKind;
import org.eclipse.net4j.db.ddl.delta.IDBPropertyDelta;
import org.eclipse.net4j.spi.db.DBNamedElement;
+import java.text.MessageFormat;
+
/**
* @author Eike Stepper
*/
@@ -61,4 +63,11 @@ public final class DBPropertyDelta<T> extends DBNamedElement implements IDBPrope
{
return oldValue;
}
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("DBPropertyDelta[name={0}, kind={1}, type={2}, value={3}, oldValue={4}]", getName(),
+ getChangeKind(), getType(), getValue(), getOldValue());
+ }
}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBSchemaDelta.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBSchemaDelta.java
index 2cc754ef9d..93defc4a6b 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBSchemaDelta.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBSchemaDelta.java
@@ -18,6 +18,7 @@ import org.eclipse.net4j.db.ddl.delta.IDBTableDelta;
import org.eclipse.net4j.internal.db.ddl.DBTable;
import org.eclipse.net4j.spi.db.DBSchema;
+import java.text.MessageFormat;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
@@ -90,7 +91,7 @@ public final class DBSchemaDelta extends DBDelta implements IDBSchemaDelta
public void accept(IDBDeltaVisitor visitor)
{
visitor.visit(this);
- for (DBDelta tableDelta : getElements())
+ for (DBTableDelta tableDelta : getElements())
{
tableDelta.accept(visitor);
}
@@ -106,4 +107,11 @@ public final class DBSchemaDelta extends DBDelta implements IDBSchemaDelta
IDBDeltaVisitor visitor = new IDBDeltaVisitor.Applier(schema);
accept(visitor);
}
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("DBSchemaDelta[name={0}, kind={1}, tableDeltas={2}]", getName(), getChangeKind(),
+ tableDeltas.values());
+ }
}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBTableDelta.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBTableDelta.java
index 6f274c4dcd..b63375fdfa 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBTableDelta.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/delta/DBTableDelta.java
@@ -21,6 +21,7 @@ import org.eclipse.net4j.internal.db.ddl.DBField;
import org.eclipse.net4j.internal.db.ddl.DBIndex;
import org.eclipse.net4j.internal.db.ddl.DBTable;
+import java.text.MessageFormat;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
@@ -147,7 +148,7 @@ public final class DBTableDelta extends DBDelta implements IDBTableDelta
fieldDelta.accept(visitor);
}
- for (IDBIndexDelta indexDelta : getIndexDeltas().values())
+ for (IDBIndexDelta indexDelta : indexDeltas.values())
{
indexDelta.accept(visitor);
}
@@ -157,4 +158,11 @@ public final class DBTableDelta extends DBDelta implements IDBTableDelta
{
return (DBTable)schema.getTable(getName());
}
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("DBTableDelta[name={0}, kind={1}, fieldDeltas={2}, indexDeltas={3}]", getName(),
+ getChangeKind(), fieldDeltas.values(), indexDeltas.values());
+ }
}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBNamedElement.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBNamedElement.java
index 244d0633aa..1fd49c81a4 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBNamedElement.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBNamedElement.java
@@ -70,7 +70,7 @@ public abstract class DBNamedElement extends DBElement implements IDBNamedElemen
}
@Override
- public final String toString()
+ public String toString()
{
return name;
}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBSchema.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBSchema.java
index baeb0e1911..e4e666b670 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBSchema.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBSchema.java
@@ -119,7 +119,7 @@ public class DBSchema extends DBSchemaElement implements IDBSchema
for (IDBIndex sourceIndex : sourceTable.getIndices())
{
- DBIndex index = table.addIndex(sourceIndex.getType());
+ DBIndex index = table.addIndex(sourceIndex.getName(), sourceIndex.getType());
for (IDBField sourceField : sourceIndex.getFields())
{
DBField field = table.getField(sourceField.getPosition());

Back to the top