summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-08-15 03:24:39 (EDT)
committerEike Stepper2007-08-15 03:24:39 (EDT)
commit25a702b1c78fbdbd49287803f464e10731452aa3 (patch)
tree738086fe9700864fdc4461b9f3df1a2ef6b449b7
parent76eb45f224cfe21d7f660096a96f4cf4e24aee8c (diff)
downloadcdo-25a702b1c78fbdbd49287803f464e10731452aa3.zip
cdo-25a702b1c78fbdbd49287803f464e10731452aa3.tar.gz
cdo-25a702b1c78fbdbd49287803f464e10731452aa3.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBSchema.java19
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java25
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreWriter.java21
3 files changed, 52 insertions, 13 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBSchema.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBSchema.java
index 4409407..1e0e8bd 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBSchema.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBSchema.java
@@ -83,10 +83,13 @@ public class CDODBSchema extends DBSchema
public static final IDBTable SUPERTYPES = INSTANCE.addTable("cdo_supertypes");
public static final IDBField SUPERTYPES_TYPE = //
- SUPERTYPES.addField("type", IDBField.Type.INTEGER);
+ SUPERTYPES.addField("type_id", IDBField.Type.INTEGER);
- public static final IDBField SUPERTYPES_SUPERTYPE = //
- SUPERTYPES.addField("supertype", IDBField.Type.INTEGER);
+ public static final IDBField SUPERTYPES_SUPERTYPE_PACKAGE = //
+ SUPERTYPES.addField("supertype_package", IDBField.Type.VARCHAR, 255);
+
+ public static final IDBField SUPERTYPES_SUPERTYPE_CLASSIFIER = //
+ SUPERTYPES.addField("supertype_classifier", IDBField.Type.INTEGER);
public static final IDBIndex INDEX_SUPERTYPES_PK = //
SUPERTYPES.addIndex(IDBIndex.Type.PRIMARY_KEY, SUPERTYPES_TYPE);
@@ -99,11 +102,17 @@ public class CDODBSchema extends DBSchema
public static final IDBField FEATURES_ID = //
FEATURES.addField("id", IDBField.Type.INTEGER);
+ public static final IDBField FEATURES_NAME = //
+ FEATURES.addField("name", IDBField.Type.VARCHAR, 255);
+
public static final IDBField FEATURES_TYPE = //
FEATURES.addField("type", IDBField.Type.INTEGER);
- public static final IDBField FEATURES_REFERENCE = //
- FEATURES.addField("reference", IDBField.Type.INTEGER);
+ public static final IDBField FEATURES_REFERENCE_PACKAGE = //
+ FEATURES.addField("reference_package", IDBField.Type.VARCHAR, 255);
+
+ public static final IDBField FEATURES_REFERENCE_CLASSIFIER = //
+ FEATURES.addField("reference_classifier", IDBField.Type.INTEGER);
public static final IDBField FEATURES_MANY = //
FEATURES.addField("many", IDBField.Type.BOOLEAN);
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java
index 8bd5f38..73a5c30 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java
@@ -11,6 +11,7 @@
package org.eclipse.emf.cdo.server.internal.db;
import org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl;
+import org.eclipse.emf.cdo.internal.protocol.model.CDOClassProxy;
import org.eclipse.emf.cdo.internal.protocol.model.CDOFeatureImpl;
import org.eclipse.emf.cdo.internal.protocol.model.CDOPackageImpl;
import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
@@ -67,13 +68,13 @@ public class DBStoreWriter extends DBStoreReader implements IStoreWriter
public void writePackage(CDOPackageImpl cdoPackage)
{
+ int id = store.getNextPackageID();
+ cdoPackage.setServerInfo(id);
+
CDOIDRange metaIDRange = cdoPackage.getMetaIDRange();
long lb = metaIDRange.getLowerBound().getValue();
long ub = metaIDRange.getUpperBound().getValue();
- int id = store.getNextPackageID();
- cdoPackage.setServerInfo(id);
-
DBUtil.insertRow(connection, CDODBSchema.PACKAGES, id, cdoPackage.getPackageURI(), cdoPackage.getName(), cdoPackage
.getEcore(), cdoPackage.isDynamic(), lb, ub);
@@ -88,12 +89,13 @@ public class DBStoreWriter extends DBStoreReader implements IStoreWriter
int id = store.getNextClassID();
cdoClass.setServerInfo(id);
- DBUtil.insertRow(connection, CDODBSchema.CLASSES, id, cdoClass.getPackageURI(), cdoClass.getName(), cdoClass
- .getEcore(), cdoClass.isDynamic());
+ CDOPackageImpl cdoPackage = cdoClass.getContainingPackage();
+ DBUtil.insertRow(connection, CDODBSchema.CLASSES, id, cdoPackage.getPackageURI(), cdoClass.getClassifierID(),
+ cdoClass.getName(), cdoClass.isAbstract());
- for (CDOClassImpl superType : cdoClass.getSuperTypes())
+ for (CDOClassProxy superType : cdoClass.getSuperTypeProxies())
{
- writeSuperType(cdoClass, superType);
+ writeSuperType(id, superType);
}
for (CDOFeatureImpl feature : cdoClass.getFeatures())
@@ -102,12 +104,19 @@ public class DBStoreWriter extends DBStoreReader implements IStoreWriter
}
}
- public void writeSuperType(CDOClassImpl type, CDOClassImpl superType)
+ public void writeSuperType(int type, CDOClassProxy superType)
{
+ DBUtil.insertRow(connection, CDODBSchema.SUPERTYPES, type, superType.getPackageURI(), superType.getClassifierID());
}
public void writeFeature(CDOFeatureImpl feature)
{
+ int id = store.getNextFeatureID();
+ feature.setServerInfo(id);
+
+ CDOClassProxy reference = feature.getReferenceTypeProxy();
+ DBUtil.insertRow(connection, CDODBSchema.FEATURES, id, feature.getName(), reference.getPackageURI(), reference
+ .getClassifierID(), feature.isMany(), feature.isContainment(), feature.getFeatureIndex());
}
public void writeRevision(CDORevisionImpl revision)
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreWriter.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreWriter.java
index fd9c75d..0f81a99 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreWriter.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreWriter.java
@@ -10,8 +10,13 @@
**************************************************************************/
package org.eclipse.emf.cdo.server;
+import org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl;
+import org.eclipse.emf.cdo.internal.protocol.model.CDOClassProxy;
+import org.eclipse.emf.cdo.internal.protocol.model.CDOFeatureImpl;
import org.eclipse.emf.cdo.internal.protocol.model.CDOPackageImpl;
import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
+import org.eclipse.emf.cdo.protocol.model.CDOClass;
+import org.eclipse.emf.cdo.protocol.model.CDOFeature;
/**
* @author Eike Stepper
@@ -20,6 +25,22 @@ public interface IStoreWriter extends IStoreReader
{
public IView getView();
+ /**
+ * Stores a complete description of a package so that it can be restored to an
+ * identical state at a later point in time.
+ * <p>
+ * <b>Note:</b> The implementor of this method must not assume that
+ * references to classes in this package or in any other package are already
+ * resolved or are resolveable at the point in time when this method is called
+ * by the framework. References to classes frequently appear in
+ * {@link CDOClass#getSuperTypes()} and in
+ * {@link CDOFeature#getReferenceType()}. Instead
+ * {@link CDOClassImpl#getSuperTypeProxies()} and
+ * {@link CDOFeatureImpl#getReferenceTypeProxy()} should be used.
+ * <p>
+ *
+ * @see CDOClassProxy#getClassRef()
+ */
public void writePackage(CDOPackageImpl cdoPackage);
public void writeRevision(CDORevisionImpl revision);