summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-09-14 08:02:29 (EDT)
committerEike Stepper2007-09-14 08:02:29 (EDT)
commit6182b2e367ae282a8762275ec6fd15c1ee165714 (patch)
tree5287b3595d19fca08046aaf4e371606fc46973f6
parentb151716fefd72acc69e0bba6cdea04aa4579c3b3 (diff)
downloadcdo-6182b2e367ae282a8762275ec6fd15c1ee165714.zip
cdo-6182b2e367ae282a8762275ec6fd15c1ee165714.tar.gz
cdo-6182b2e367ae282a8762275ec6fd15c1ee165714.tar.bz2
[202833] Horizontal Mapping Strategy
https://bugs.eclipse.org/bugs/show_bug.cgi?id=202833
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/AttributeMapping.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassMapping.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java39
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ReferenceMapping.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/PackageManager.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/QueryObjectTypesIndication.java11
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java2
8 files changed, 39 insertions, 44 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/AttributeMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/AttributeMapping.java
index 3d68112..709df85 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/AttributeMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/AttributeMapping.java
@@ -8,7 +8,6 @@ import org.eclipse.emf.cdo.server.db.IAttributeMapping;
import org.eclipse.net4j.db.DBException;
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.IDBField;
-import org.eclipse.net4j.util.ImplementationError;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -46,11 +45,6 @@ public abstract class AttributeMapping extends FeatureMapping implements IAttrib
public void extractValue(ResultSet resultSet, int column, CDORevisionImpl revision)
{
- if (column != field.getPosition() + 1)
- {
- throw new ImplementationError("Column mismatch");
- }
-
try
{
Object value = getResultSetValue(resultSet, column);
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 c8fdd8f..2b52a18 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
@@ -520,7 +520,7 @@ public abstract class ClassMapping implements IClassMapping
throw new IllegalStateException("Revision not found: " + id);
}
- int i = 0;
+ int i = 1;
if (hasFullRevisionInfo())
{
if (readVersion)
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
index 648dbbb..c9606da 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
@@ -176,29 +176,26 @@ public class DBStoreAccessor implements IDBStoreAccessor
{
for (CDOPackageImpl cdoPackage : cdoPackages)
{
- if (!cdoPackage.isSystem())
+ int id = store.getNextPackageID();
+ PackageServerInfo.setDBID(cdoPackage, id);
+ if (TRACER.isEnabled())
{
- int id = store.getNextPackageID();
- PackageServerInfo.setDBID(cdoPackage, id);
- if (TRACER.isEnabled())
- {
- TRACER.format("Inserting package: {0} --> {1}", cdoPackage, id);
- }
+ TRACER.format("Inserting package: {0} --> {1}", cdoPackage, id);
+ }
- String packageURI = cdoPackage.getPackageURI();
- String name = cdoPackage.getName();
- String ecore = cdoPackage.getEcore();
- boolean dynamic = cdoPackage.isDynamic();
- CDOIDRange metaIDRange = cdoPackage.getMetaIDRange();
- long lb = metaIDRange == null ? 0L : metaIDRange.getLowerBound().getValue();
- long ub = metaIDRange == null ? 0L : metaIDRange.getUpperBound().getValue();
- DBUtil.insertRow(connection, store.getDBAdapter(), CDODBSchema.PACKAGES, id, packageURI, name, ecore, dynamic,
- lb, ub);
-
- for (CDOClassImpl cdoClass : cdoPackage.getClasses())
- {
- writeClass(cdoClass);
- }
+ String packageURI = cdoPackage.getPackageURI();
+ String name = cdoPackage.getName();
+ String ecore = cdoPackage.getEcore();
+ boolean dynamic = cdoPackage.isDynamic();
+ CDOIDRange metaIDRange = cdoPackage.getMetaIDRange();
+ long lb = metaIDRange == null ? 0L : metaIDRange.getLowerBound().getValue();
+ long ub = metaIDRange == null ? 0L : metaIDRange.getUpperBound().getValue();
+ DBUtil.insertRow(connection, store.getDBAdapter(), CDODBSchema.PACKAGES, id, packageURI, name, ecore, dynamic,
+ lb, ub);
+
+ for (CDOClassImpl cdoClass : cdoPackage.getClasses())
+ {
+ writeClass(cdoClass);
}
}
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 d3dfebd..fe2d41b 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
@@ -318,7 +318,17 @@ public abstract class MappingStrategy implements IMappingStrategy
CDOClassRef classRef = classRefs.get(classID);
if (classRef == null)
{
- classRef = storeAccessor.readClassRef(classID);
+ if (classID == ClassServerInfo.CDO_RESOURCE_CLASS_DBID)
+ {
+ IPackageManager packageManager = getStore().getRepository().getPackageManager();
+ CDOResourceClass resourceClass = packageManager.getCDOResourcePackage().getCDOResourceClass();
+ classRef = resourceClass.createClassRef();
+ }
+ else
+ {
+ classRef = storeAccessor.readClassRef(classID);
+ }
+
classRefs.put(classID, classRef);
}
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 bbc46a5..a0c6b69 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
@@ -7,6 +7,7 @@ import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.protocol.model.CDOClass;
import org.eclipse.emf.cdo.protocol.model.CDOFeature;
import org.eclipse.emf.cdo.protocol.model.CDOPackage;
+import org.eclipse.emf.cdo.protocol.revision.CDORevision;
import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.server.IStoreChunkReader.Chunk;
import org.eclipse.emf.cdo.server.db.IDBStoreAccessor;
@@ -96,7 +97,7 @@ public class ReferenceMapping extends FeatureMapping implements IReferenceMappin
try
{
resultSet = storeAccessor.getStatement().executeQuery(sql);
- while (resultSet.next() && --referenceChunk >= 0)
+ while (resultSet.next() && (referenceChunk == CDORevision.UNCHUNKED || --referenceChunk >= 0))
{
long target = resultSet.getLong(1);
list.add(CDOIDImpl.create(target));
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/PackageManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/PackageManager.java
index 6d06a77..e9a3790 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/PackageManager.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/PackageManager.java
@@ -29,8 +29,6 @@ public class PackageManager extends CDOPackageManagerImpl implements IPackageMan
{
private Repository repository;
- private boolean resourcePackageStored;
-
public PackageManager(Repository repository)
{
this.repository = repository;
@@ -94,12 +92,6 @@ public class PackageManager extends CDOPackageManagerImpl implements IPackageMan
public void phase1(IStoreWriter storeWriter) throws Exception
{
- if (!resourcePackageStored)
- {
- storeWriter.writePackages(getCDOResourcePackage());
- resourcePackageStored = true;
- }
-
storeWriter.writePackages(cdoPackages);
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/QueryObjectTypesIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/QueryObjectTypesIndication.java
index 600784b..223272d 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/QueryObjectTypesIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/QueryObjectTypesIndication.java
@@ -12,11 +12,12 @@ package org.eclipse.emf.cdo.internal.server.protocol;
import org.eclipse.emf.cdo.internal.protocol.CDOIDImpl;
import org.eclipse.emf.cdo.internal.protocol.model.CDOClassRefImpl;
-import org.eclipse.emf.cdo.internal.server.RevisionManager;
+import org.eclipse.emf.cdo.internal.server.StoreUtil;
+import org.eclipse.emf.cdo.internal.server.TypeManager;
import org.eclipse.emf.cdo.internal.server.bundle.OM;
import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.protocol.model.CDOClass;
+import org.eclipse.emf.cdo.server.IStoreReader;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
@@ -60,11 +61,11 @@ public class QueryObjectTypesIndication extends CDOReadIndication
@Override
protected void responding(ExtendedDataOutputStream out) throws IOException
{
- RevisionManager revisionManager = getRevisionManager();
+ IStoreReader storeReader = StoreUtil.getReader();
+ TypeManager typeManager = getRepository().getTypeManager();
for (CDOID id : ids)
{
- CDOClass type = revisionManager.getObjectType(id);
- CDOClassRefImpl classRef = (CDOClassRefImpl)type.createClassRef();
+ CDOClassRefImpl classRef = (CDOClassRefImpl)typeManager.getObjectType(storeReader, id);
if (PROTOCOL.isEnabled()) PROTOCOL.format("Wrinting type: {0}", classRef);
classRef.write(out, null);
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
index b8c6481..ef26efc 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
@@ -258,7 +258,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements CDOTransaction
throw new IllegalStateException("Missing CDO package: " + ePackage.getNsURI());
}
- if (!cdoPackage.isPersistent())
+ if (!cdoPackage.isPersistent() && !cdoPackage.isSystem())
{
cdoPackages.add(cdoPackage);
}