summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-01-06 14:09:55 (EST)
committerEike Stepper2008-01-06 14:09:55 (EST)
commitd166a816f13c894bb98050f3670b242301a9de2e (patch)
treea6eaa3a0dd3ab6e481fe3036a991cbf05f9f4117
parentc083fd0be1b273d6088d981db8ccd6cd33d36894 (diff)
downloadcdo-d166a816f13c894bb98050f3670b242301a9de2e.zip
cdo-d166a816f13c894bb98050f3670b242301a9de2e.tar.gz
cdo-d166a816f13c894bb98050f3670b242301a9de2e.tar.bz2
[214437] Provide efficient type lookup service in storage framework
https://bugs.eclipse.org/bugs/show_bug.cgi?id=214437
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IClassMapping.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IObjectTypeCache.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IReferenceMapping.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassMapping.java26
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalClassMapping.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalMappingStrategy.java96
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java95
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/NoClassMapping.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectTypeCache.java (renamed from plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IObjectTypeLookup.java)22
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ReferenceMapping.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalClassMapping.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalMappingStrategy.java8
13 files changed, 205 insertions, 92 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IClassMapping.java
index fc706c4..2798201 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IClassMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IClassMapping.java
@@ -40,7 +40,7 @@ public interface IClassMapping
public IReferenceMapping getReferenceMapping(CDOFeature feature);
- public void writeRevision(IDBStoreAccessor storeAccessor, CDORevisionImpl revision);
+ public void writeRevision(IDBStoreWriter storeWriter, CDORevisionImpl revision);
public void readRevision(IDBStoreReader storeReader, CDORevisionImpl revision, int referenceChunk);
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IObjectTypeCache.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IObjectTypeCache.java
index 6166f5a..4eff0b8 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IObjectTypeCache.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IObjectTypeCache.java
@@ -13,10 +13,14 @@ package org.eclipse.emf.cdo.server.db;
import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.protocol.model.CDOClassRef;
+import java.sql.Connection;
+
/**
* @author Eike Stepper
*/
-public interface IObjectTypeCache extends IObjectTypeLookup
+public interface IObjectTypeCache
{
- public void putObjectType(IDBStoreWriter storeWriter, CDOID id, CDOClassRef type);
+ public CDOClassRef getObjectType(Connection connection, CDOID id);
+
+ public void putObjectType(Connection connection, CDOID id, CDOClassRef type);
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IReferenceMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IReferenceMapping.java
index bc26fcd..9014893 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IReferenceMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IReferenceMapping.java
@@ -24,7 +24,7 @@ public interface IReferenceMapping extends IFeatureMapping
{
public IDBTable getTable();
- public void writeReference(IDBStoreAccessor storeAccessor, CDORevisionImpl revision);
+ public void writeReference(IDBStoreWriter storeWriter, CDORevisionImpl revision);
public void readReference(IDBStoreReader storeReader, CDORevisionImpl revision, int referenceChunk);
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassMapping.java
index ed4fb41..b6dbfc5 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassMapping.java
@@ -19,8 +19,8 @@ import org.eclipse.emf.cdo.protocol.model.resource.CDOResourceClass;
import org.eclipse.emf.cdo.server.db.IAttributeMapping;
import org.eclipse.emf.cdo.server.db.IClassMapping;
import org.eclipse.emf.cdo.server.db.IDBStore;
-import org.eclipse.emf.cdo.server.db.IDBStoreAccessor;
import org.eclipse.emf.cdo.server.db.IDBStoreReader;
+import org.eclipse.emf.cdo.server.db.IDBStoreWriter;
import org.eclipse.emf.cdo.server.db.IReferenceMapping;
import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
@@ -160,7 +160,7 @@ public abstract class ClassMapping implements IClassMapping
}
}
- protected int sqlUpdate(IDBStoreAccessor storeAccessor, String sql) throws DBException
+ protected int sqlUpdate(IDBStoreWriter storeWriter, String sql) throws DBException
{
if (TRACER.isEnabled())
{
@@ -169,7 +169,7 @@ public abstract class ClassMapping implements IClassMapping
try
{
- Statement statement = storeAccessor.getStatement();
+ Statement statement = storeWriter.getStatement();
return statement.executeUpdate(sql);
}
catch (SQLException ex)
@@ -436,25 +436,25 @@ public abstract class ClassMapping implements IClassMapping
protected abstract boolean hasFullRevisionInfo();
- public void writeRevision(IDBStoreAccessor storeAccessor, CDORevisionImpl revision)
+ public void writeRevision(IDBStoreWriter storeWriter, CDORevisionImpl revision)
{
if (revision.getVersion() >= 2 && hasFullRevisionInfo())
{
- writeRevisedRow(storeAccessor, revision);
+ writeRevisedRow(storeWriter, revision);
}
if (attributeMappings != null)
{
- writeAttributes(storeAccessor, revision);
+ writeAttributes(storeWriter, revision);
}
if (referenceMappings != null)
{
- writeReferences(storeAccessor, revision);
+ writeReferences(storeWriter, revision);
}
}
- protected void writeRevisedRow(IDBStoreAccessor storeAccessor, CDORevisionImpl revision)
+ protected void writeRevisedRow(IDBStoreWriter storeWriter, CDORevisionImpl revision)
{
StringBuilder builder = new StringBuilder();
builder.append("UPDATE ");
@@ -471,10 +471,10 @@ public abstract class ClassMapping implements IClassMapping
builder.append(CDODBSchema.ATTRIBUTES_VERSION);
builder.append("=");
builder.append(revision.getVersion() - 1);
- sqlUpdate(storeAccessor, builder.toString());
+ sqlUpdate(storeWriter, builder.toString());
}
- protected void writeAttributes(IDBStoreAccessor storeAccessor, CDORevisionImpl revision)
+ protected void writeAttributes(IDBStoreWriter storeWriter, CDORevisionImpl revision)
{
StringBuilder builder = new StringBuilder();
builder.append("INSERT INTO ");
@@ -489,14 +489,14 @@ public abstract class ClassMapping implements IClassMapping
}
builder.append(")");
- sqlUpdate(storeAccessor, builder.toString());
+ sqlUpdate(storeWriter, builder.toString());
}
- protected void writeReferences(IDBStoreAccessor storeAccessor, CDORevisionImpl revision)
+ protected void writeReferences(IDBStoreWriter storeWriter, CDORevisionImpl revision)
{
for (IReferenceMapping referenceMapping : referenceMappings)
{
- referenceMapping.writeReference(storeAccessor, revision);
+ referenceMapping.writeReference(storeWriter, revision);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
index a3dc368..cd0df15 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
@@ -30,6 +30,7 @@ import org.eclipse.net4j.db.IDBSchema;
import org.eclipse.net4j.db.IDBTable;
import org.eclipse.net4j.internal.db.DBSchema;
import org.eclipse.net4j.util.ImplementationError;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import java.sql.Connection;
import java.text.MessageFormat;
@@ -184,6 +185,7 @@ public class DBStore extends Store implements IDBStore
System.currentTimeMillis(), 0, 0, 0);
MappingStrategy mappingStrategy = (MappingStrategy)getMappingStrategy();
+
IClassMapping resourceClassMapping = mappingStrategy.getResourceClassMapping();
Set<IDBTable> tables = resourceClassMapping.getAffectedTables();
if (dbAdapter.createTables(tables, connection).size() != tables.size())
@@ -234,6 +236,7 @@ public class DBStore extends Store implements IDBStore
nextPackageID = DBUtil.selectMaximumInt(connection, CDODBSchema.PACKAGES_ID) + 1;
nextClassID = DBUtil.selectMaximumInt(connection, CDODBSchema.CLASSES_ID) + 1;
nextFeatureID = DBUtil.selectMaximumInt(connection, CDODBSchema.FEATURES_ID) + 1;
+ LifecycleUtil.activate(mappingStrategy);
}
protected void deactivateStore(Repository repository, Connection connection)
@@ -260,6 +263,8 @@ public class DBStore extends Store implements IDBStore
{
throw new DBException("No row updated in table " + CDODBSchema.REPOSITORY);
}
+
+ LifecycleUtil.deactivate(mappingStrategy);
}
public void repairAfterCrash()
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalClassMapping.java
index b12afb4..f90c96e 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalClassMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalClassMapping.java
@@ -10,7 +10,11 @@
**************************************************************************/
package org.eclipse.emf.cdo.server.internal.db;
+import org.eclipse.emf.cdo.internal.protocol.model.CDOClassRefImpl;
+import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
+import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.protocol.model.CDOClass;
+import org.eclipse.emf.cdo.server.db.IDBStoreWriter;
/**
* @author Eike Stepper
@@ -29,6 +33,18 @@ public class HorizontalClassMapping extends ClassMapping
}
@Override
+ public void writeRevision(IDBStoreWriter storeWriter, CDORevisionImpl revision)
+ {
+ super.writeRevision(storeWriter, revision);
+ if (revision.getVersion() == 1)
+ {
+ CDOID id = revision.getID();
+ CDOClassRefImpl type = revision.getCDOClass().createClassRef();
+ getMappingStrategy().getObjectTypeCache().putObjectType(storeWriter.getConnection(), id, type);
+ }
+ }
+
+ @Override
protected boolean hasFullRevisionInfo()
{
return true;
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 6c84241..142021c 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
@@ -10,11 +10,25 @@
**************************************************************************/
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.IClassMapping;
+import org.eclipse.emf.cdo.server.db.IDBStore;
+import org.eclipse.emf.cdo.server.db.IDBStoreReader;
+import org.eclipse.emf.cdo.server.db.IObjectTypeCache;
+import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
+import org.eclipse.net4j.db.DBException;
+import org.eclipse.net4j.db.DBUtil;
+import org.eclipse.net4j.db.IDBTable;
+import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
@@ -23,6 +37,10 @@ import java.util.List;
*/
public class HorizontalMappingStrategy extends MappingStrategy
{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, HorizontalMappingStrategy.class);
+
+ private IObjectTypeCache objectTypeCache;
+
public HorizontalMappingStrategy()
{
}
@@ -32,6 +50,63 @@ public class HorizontalMappingStrategy extends MappingStrategy
return "horizontal";
}
+ public IObjectTypeCache getObjectTypeCache()
+ {
+ return objectTypeCache;
+ }
+
+ public CDOClassRef readObjectType(IDBStoreReader storeReader, CDOID id)
+ {
+ CDOClassRef type = objectTypeCache.getObjectType(storeReader.getConnection(), id);
+ if (type == null)
+ {
+ type = readObjectTypeFromClassesWithObjectInfo(storeReader, id);
+ objectTypeCache.putObjectType(storeReader.getConnection(), id, type);
+ }
+
+ return type;
+ }
+
+ protected CDOClassRef readObjectTypeFromClassesWithObjectInfo(IDBStoreReader storeReader, CDOID id)
+ {
+ String prefix = "SELECT DISTINCT " + CDODBSchema.ATTRIBUTES_CLASS + " FROM ";
+ String suffix = " WHERE " + CDODBSchema.ATTRIBUTES_ID + "=" + id;
+ for (CDOClass cdoClass : getClassesWithObjectInfo())
+ {
+ IClassMapping mapping = getClassMapping(cdoClass);
+ if (mapping != null)
+ {
+ IDBTable table = mapping.getTable();
+ if (table != null)
+ {
+ String sql = prefix + table + suffix;
+ if (TRACER.isEnabled()) TRACER.trace(sql);
+ ResultSet resultSet = null;
+
+ try
+ {
+ resultSet = storeReader.getStatement().executeQuery(sql);
+ if (resultSet.next())
+ {
+ int classID = resultSet.getInt(1);
+ return getClassRef(storeReader, classID);
+ }
+ }
+ catch (SQLException ex)
+ {
+ throw new DBException(ex);
+ }
+ finally
+ {
+ DBUtil.close(resultSet);
+ }
+ }
+ }
+ }
+
+ throw new DBException("No object with id " + id);
+ }
+
@Override
protected IClassMapping createClassMapping(CDOClass cdoClass)
{
@@ -61,4 +136,25 @@ public class HorizontalMappingStrategy extends MappingStrategy
return result;
}
+
+ @Override
+ protected void doActivate() throws Exception
+ {
+ super.doActivate();
+ objectTypeCache = createObjectTypeCache(getStore());
+ LifecycleUtil.activate(objectTypeCache);
+ }
+
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ LifecycleUtil.deactivate(objectTypeCache);
+ objectTypeCache = null;
+ super.doDeactivate();
+ }
+
+ protected IObjectTypeCache createObjectTypeCache(IDBStore store)
+ {
+ return new ObjectTypeCache();
+ }
}
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 70a8a2e..5b6ae0f 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
@@ -28,6 +28,7 @@ import org.eclipse.net4j.db.DBException;
import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.IDBField;
import org.eclipse.net4j.db.IDBTable;
+import org.eclipse.net4j.internal.util.lifecycle.Lifecycle;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.io.CloseableIterator;
@@ -43,7 +44,7 @@ import java.util.Map;
/**
* @author Eike Stepper
*/
-public abstract class MappingStrategy implements IMappingStrategy
+public abstract class MappingStrategy extends Lifecycle implements IMappingStrategy
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, MappingStrategy.class);
@@ -144,6 +145,28 @@ public abstract class MappingStrategy implements IMappingStrategy
return referenceTables;
}
+ public CDOClassRef getClassRef(IDBStoreReader storeReader, int classID)
+ {
+ CDOClassRef classRef = classRefs.get(classID);
+ if (classRef == null)
+ {
+ if (classID == ClassServerInfo.CDO_RESOURCE_CLASS_DBID)
+ {
+ IPackageManager packageManager = getStore().getRepository().getPackageManager();
+ CDOResourceClass resourceClass = packageManager.getCDOResourcePackage().getCDOResourceClass();
+ classRef = resourceClass.createClassRef();
+ }
+ else
+ {
+ classRef = storeReader.readClassRef(classID);
+ }
+
+ classRefs.put(classID, classRef);
+ }
+
+ return classRef;
+ }
+
public IClassMapping getClassMapping(CDOClass cdoClass)
{
IClassMapping mapping = ClassServerInfo.getClassMapping(cdoClass);
@@ -273,69 +296,6 @@ public abstract class MappingStrategy implements IMappingStrategy
};
}
- public CDOClassRef readObjectType(IDBStoreReader storeReader, CDOID id)
- {
- // TODO Change to support vertical mappings
- String prefix = "SELECT DISTINCT " + CDODBSchema.ATTRIBUTES_CLASS + " FROM ";
- String suffix = " WHERE " + CDODBSchema.ATTRIBUTES_ID + "=" + id;
- for (CDOClass cdoClass : getClassesWithObjectInfo())
- {
- IClassMapping mapping = getClassMapping(cdoClass);
- if (mapping != null)
- {
- IDBTable table = mapping.getTable();
- if (table != null)
- {
- String sql = prefix + table + suffix;
- if (TRACER.isEnabled()) TRACER.trace(sql);
- ResultSet resultSet = null;
-
- try
- {
- resultSet = storeReader.getStatement().executeQuery(sql);
- if (resultSet.next())
- {
- int classID = resultSet.getInt(1);
- return getClassRef(storeReader, classID);
- }
- }
- catch (SQLException ex)
- {
- throw new DBException(ex);
- }
- finally
- {
- DBUtil.close(resultSet);
- }
- }
- }
- }
-
- throw new DBException("No object with id " + id);
- }
-
- public CDOClassRef getClassRef(IDBStoreReader storeReader, int classID)
- {
- CDOClassRef classRef = classRefs.get(classID);
- if (classRef == null)
- {
- if (classID == ClassServerInfo.CDO_RESOURCE_CLASS_DBID)
- {
- IPackageManager packageManager = getStore().getRepository().getPackageManager();
- CDOResourceClass resourceClass = packageManager.getCDOResourcePackage().getCDOResourceClass();
- classRef = resourceClass.createClassRef();
- }
- else
- {
- classRef = storeReader.readClassRef(classID);
- }
-
- classRefs.put(classID, classRef);
- }
-
- return classRef;
- }
-
public CDOID readResourceID(IDBStoreReader storeReader, String path)
{
IDBTable resourceTable = getResourceTable();
@@ -431,4 +391,11 @@ public abstract class MappingStrategy implements IMappingStrategy
protected abstract IClassMapping createClassMapping(CDOClass cdoClass);
protected abstract List<CDOClass> getClassesWithObjectInfo();
+
+ @Override
+ protected void doBeforeActivate() throws Exception
+ {
+ super.doBeforeActivate();
+ checkState(store, "store");
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/NoClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/NoClassMapping.java
index 73b2655..74f303a 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/NoClassMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/NoClassMapping.java
@@ -15,8 +15,8 @@ import org.eclipse.emf.cdo.protocol.model.CDOClass;
import org.eclipse.emf.cdo.protocol.model.CDOFeature;
import org.eclipse.emf.cdo.server.db.IAttributeMapping;
import org.eclipse.emf.cdo.server.db.IClassMapping;
-import org.eclipse.emf.cdo.server.db.IDBStoreAccessor;
import org.eclipse.emf.cdo.server.db.IDBStoreReader;
+import org.eclipse.emf.cdo.server.db.IDBStoreWriter;
import org.eclipse.emf.cdo.server.db.IMappingStrategy;
import org.eclipse.emf.cdo.server.db.IReferenceMapping;
@@ -77,7 +77,7 @@ public class NoClassMapping implements IClassMapping
return null;
}
- public void writeRevision(IDBStoreAccessor storeAccessor, CDORevisionImpl revision)
+ public void writeRevision(IDBStoreWriter storeWriter, CDORevisionImpl revision)
{
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IObjectTypeLookup.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectTypeCache.java
index 4e04c7a..12246ee 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IObjectTypeLookup.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectTypeCache.java
@@ -8,15 +8,31 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.emf.cdo.server.db;
+package org.eclipse.emf.cdo.server.internal.db;
import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.protocol.model.CDOClassRef;
+import org.eclipse.emf.cdo.server.db.IObjectTypeCache;
+
+import org.eclipse.net4j.internal.util.lifecycle.Lifecycle;
+
+import java.sql.Connection;
/**
* @author Eike Stepper
*/
-public interface IObjectTypeLookup
+public class ObjectTypeCache extends Lifecycle implements IObjectTypeCache
{
- public CDOClassRef getObjectType(IDBStoreReader storeReader, CDOID id);
+ public ObjectTypeCache()
+ {
+ }
+
+ public CDOClassRef getObjectType(Connection connection, CDOID id)
+ {
+ return null;
+ }
+
+ public void putObjectType(Connection connection, CDOID id, CDOClassRef type)
+ {
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ReferenceMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ReferenceMapping.java
index a4f8904..0c4b35b 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ReferenceMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ReferenceMapping.java
@@ -23,6 +23,7 @@ import org.eclipse.emf.cdo.server.IStoreChunkReader.Chunk;
import org.eclipse.emf.cdo.server.db.IDBStoreAccessor;
import org.eclipse.emf.cdo.server.db.IDBStoreChunkReader;
import org.eclipse.emf.cdo.server.db.IDBStoreReader;
+import org.eclipse.emf.cdo.server.db.IDBStoreWriter;
import org.eclipse.emf.cdo.server.db.IReferenceMapping;
import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
@@ -72,7 +73,7 @@ public class ReferenceMapping extends FeatureMapping implements IReferenceMappin
return table;
}
- public void writeReference(IDBStoreAccessor storeAccessor, CDORevisionImpl revision)
+ public void writeReference(IDBStoreWriter storeWriter, CDORevisionImpl revision)
{
long source = revision.getID().getValue();
int version = revision.getVersion();
@@ -91,7 +92,7 @@ public class ReferenceMapping extends FeatureMapping implements IReferenceMappin
builder.append(target);
builder.append(")");
String sql = builder.toString();
- getClassMapping().sqlUpdate(storeAccessor, sql);
+ getClassMapping().sqlUpdate(storeWriter, sql);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalClassMapping.java
index 89d4182..ff6a8d3 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalClassMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalClassMapping.java
@@ -13,7 +13,7 @@ package org.eclipse.emf.cdo.server.internal.db;
import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
import org.eclipse.emf.cdo.protocol.model.CDOClass;
import org.eclipse.emf.cdo.server.db.IClassMapping;
-import org.eclipse.emf.cdo.server.db.IDBStoreAccessor;
+import org.eclipse.emf.cdo.server.db.IDBStoreWriter;
import java.util.ArrayList;
import java.util.List;
@@ -61,14 +61,14 @@ public class VerticalClassMapping extends ClassMapping
}
@Override
- public void writeRevision(IDBStoreAccessor storeAccessor, CDORevisionImpl revision)
+ public void writeRevision(IDBStoreWriter storeWriter, CDORevisionImpl revision)
{
- super.writeRevision(storeAccessor, revision);
+ super.writeRevision(storeWriter, revision);
if (superMappings != null)
{
for (IClassMapping superMapping : superMappings)
{
- superMapping.writeRevision(storeAccessor, revision);
+ superMapping.writeRevision(storeWriter, revision);
}
}
}
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 4cf04d2..f2a4fc1 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
@@ -10,8 +10,11 @@
**************************************************************************/
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.IClassMapping;
+import org.eclipse.emf.cdo.server.db.IDBStoreReader;
import java.util.Collections;
import java.util.List;
@@ -43,6 +46,11 @@ public class VerticalMappingStrategy extends MappingStrategy
return rootClassMapping;
}
+ public CDOClassRef readObjectType(IDBStoreReader storeReader, CDOID id)
+ {
+ throw new UnsupportedOperationException();
+ }
+
@Override
protected IClassMapping createClassMapping(CDOClass cdoClass)
{