summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Winkler2010-01-16 08:46:28 (EST)
committerStefan Winkler2010-01-16 08:46:28 (EST)
commitcf5edf5c4fb853cbe5c5910c9452327a49a211bd (patch)
tree07243d793349044ed72b8e94733d77f954b76a14
parent58253b19a340fffcfb3c3221b97144ab52fd22ed (diff)
downloadcdo-cf5edf5c4fb853cbe5c5910c9452327a49a211bd.zip
cdo-cf5edf5c4fb853cbe5c5910c9452327a49a211bd.tar.gz
cdo-cf5edf5c4fb853cbe5c5910c9452327a49a211bd.tar.bz2
[270716] Provide support for branching
https://bugs.eclipse.org/bugs/show_bug.cgi?id=270716
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/plugin.xml4
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingClassMapping.java15
4 files changed, 33 insertions, 9 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/plugin.xml b/plugins/org.eclipse.emf.cdo.server.db/plugin.xml
index 076fa93..c91c8f3 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.server.db/plugin.xml
@@ -33,5 +33,9 @@
class="org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditMappingStrategy"
type="horizontalNonAudit">
</mappingStrategy>
+ <mappingStrategy
+ class="org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalBranchingMappingStrategy"
+ type="horizontalBranching">
+ </mappingStrategy>
</extension>
</plugin>
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java
index d43f04c..06cc45a 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java
@@ -91,6 +91,9 @@ public abstract class AbstractHorizontalClassMapping implements IClassMapping
IDBField idField = table.addField(CDODBSchema.ATTRIBUTES_ID, DBType.BIGINT, true);
IDBField versionField = table.addField(CDODBSchema.ATTRIBUTES_VERSION, DBType.INTEGER, true);
+
+ addBranchingField(table);
+
table.addField(CDODBSchema.ATTRIBUTES_CLASS, DBType.BIGINT, true);
table.addField(CDODBSchema.ATTRIBUTES_CREATED, DBType.BIGINT, true);
IDBField revisedField = table.addField(CDODBSchema.ATTRIBUTES_REVISED, DBType.BIGINT, true);
@@ -102,6 +105,10 @@ public abstract class AbstractHorizontalClassMapping implements IClassMapping
table.addIndex(IDBIndex.Type.NON_UNIQUE, idField, revisedField);
}
+ protected void addBranchingField(IDBTable table)
+ {
+ }
+
private void initFeatures()
{
EStructuralFeature[] features = CDOModelUtil.getAllPersistentFeatures(eClass);
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java
index b7efc61..0f8d7c8 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java
@@ -269,10 +269,10 @@ public abstract class AbstractListTableMapping implements IListMapping
setKeyFields(pstmt, revision);
- // if (TRACER.isEnabled())
- // {
- // TRACER.trace(pstmt.toString());
- // }
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(pstmt.toString());
+ }
if (listChunk != CDORevision.UNCHUNKED)
{
@@ -339,10 +339,10 @@ public abstract class AbstractListTableMapping implements IListMapping
setKeyFields(pstmt, revision);
- // if (TRACER.isEnabled())
- // {
- // TRACER.trace(pstmt.toString());
- // }
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(pstmt.toString());
+ }
resultSet = pstmt.executeQuery();
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingClassMapping.java
index dc19a52..91ddc9b 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingClassMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingClassMapping.java
@@ -31,6 +31,10 @@ import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.net4j.db.DBException;
+import org.eclipse.net4j.db.DBType;
+import org.eclipse.net4j.db.ddl.IDBField;
+import org.eclipse.net4j.db.ddl.IDBTable;
+import org.eclipse.net4j.db.ddl.IDBIndex.Type;
import org.eclipse.net4j.util.ImplementationError;
import org.eclipse.net4j.util.om.monitor.OMMonitor;
import org.eclipse.net4j.util.om.monitor.OMMonitor.Async;
@@ -72,6 +76,13 @@ public class HorizontalBranchingClassMapping extends AbstractHorizontalClassMapp
initSqlStrings();
}
+ @Override
+ protected void addBranchingField(IDBTable table)
+ {
+ IDBField branch = table.addField(CDODBSchema.ATTRIBUTES_BRANCH, DBType.INTEGER, true);
+ table.addIndex(Type.NON_UNIQUE, branch);
+ }
+
private void initSqlStrings()
{
Map<EStructuralFeature, String> unsettableFields = getUnsettableFields();
@@ -178,7 +189,7 @@ public class HorizontalBranchingClassMapping extends AbstractHorizontalClassMapp
}
}
- builder.append(") VALUES (?, ?, ?, ?, ?, ?, ?, ?"); //$NON-NLS-1$
+ builder.append(") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?"); //$NON-NLS-1$
for (int i = 0; i < getValueMappings().size(); i++)
{
@@ -204,6 +215,8 @@ public class HorizontalBranchingClassMapping extends AbstractHorizontalClassMapp
builder.append(" = ? WHERE "); //$NON-NLS-1$
builder.append(CDODBSchema.ATTRIBUTES_ID);
builder.append(" = ? AND "); //$NON-NLS-1$
+ builder.append(CDODBSchema.ATTRIBUTES_BRANCH);
+ builder.append(" = ? AND "); //$NON-NLS-1$
builder.append(CDODBSchema.ATTRIBUTES_REVISED);
builder.append(" = 0"); //$NON-NLS-1$
sqlReviseAttributes = builder.toString();