summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-08-20 14:52:40 (EDT)
committerEike Stepper2007-08-20 14:52:40 (EDT)
commitbaa31214ca8e33506713377a730a093ee4c4e430 (patch)
treeb4762c703ec4d88493560a2651245075bb75d9f8
parent4803976e13512affb0ef81d18198444c66458f66 (diff)
downloadcdo-baa31214ca8e33506713377a730a093ee4c4e430.zip
cdo-baa31214ca8e33506713377a730a093ee4c4e430.tar.gz
cdo-baa31214ca8e33506713377a730a093ee4c4e430.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBClassInfo.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBFeatureInfo.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBInfo.java36
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBPackageInfo.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreReader.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalMappingStrategy.java2
7 files changed, 46 insertions, 31 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBClassInfo.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBClassInfo.java
index 1302857..8a1f951 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBClassInfo.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBClassInfo.java
@@ -15,20 +15,13 @@ import org.eclipse.net4j.db.IDBTable;
/**
* @author Eike Stepper
*/
-public final class DBClassInfo
+public final class DBClassInfo extends DBInfo
{
- private int id;
-
private IDBTable table;
public DBClassInfo(int id)
{
- this.id = id;
- }
-
- public int getID()
- {
- return id;
+ super(id);
}
public IDBTable getTable()
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBFeatureInfo.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBFeatureInfo.java
index 221c91c..b9db661 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBFeatureInfo.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBFeatureInfo.java
@@ -18,20 +18,13 @@ import java.util.Map;
/**
* @author Eike Stepper
*/
-public final class DBFeatureInfo
+public final class DBFeatureInfo extends DBInfo
{
- private int id;
-
private Map<Object, IDBField> fields;
public DBFeatureInfo(int id)
{
- this.id = id;
- }
-
- public int getID()
- {
- return id;
+ super(id);
}
public IDBField getField(Object context)
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBInfo.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBInfo.java
new file mode 100644
index 0000000..f58485d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBInfo.java
@@ -0,0 +1,36 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.emf.cdo.protocol.model.CDOModelElement;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class DBInfo
+{
+ private int id;
+
+ public DBInfo(int id)
+ {
+ this.id = id;
+ }
+
+ public int getID()
+ {
+ return id;
+ }
+
+ public static int getDBID(CDOModelElement modelElement)
+ {
+ return ((DBInfo)modelElement.getServerInfo()).getID();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBPackageInfo.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBPackageInfo.java
index eec715f..343e85d 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBPackageInfo.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBPackageInfo.java
@@ -15,20 +15,13 @@ import org.eclipse.net4j.db.IDBSchema;
/**
* @author Eike Stepper
*/
-public final class DBPackageInfo
+public final class DBPackageInfo extends DBInfo
{
- private int id;
-
private IDBSchema schema;
public DBPackageInfo(int id)
{
- this.id = id;
- }
-
- public int getID()
- {
- return id;
+ super(id);
}
public IDBSchema getSchema()
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreReader.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreReader.java
index b9f44e5..aa63c36 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreReader.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreReader.java
@@ -134,7 +134,7 @@ public class DBStoreReader implements IStoreReader
}
};
- String where = CDODBSchema.CLASSES_PACKAGE.getName() + " = " + ((DBPackageInfo)cdoPackage.getServerInfo()).getID();
+ String where = CDODBSchema.CLASSES_PACKAGE.getName() + " = " + DBInfo.getDBID(cdoPackage);
DBUtil.select(connection, rowHandler, where, CDODBSchema.CLASSES_ID, CDODBSchema.CLASSES_CLASSIFIER,
CDODBSchema.CLASSES_NAME, CDODBSchema.CLASSES_ABSTRACT);
}
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 c1ccda8..7190d33 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
@@ -110,7 +110,7 @@ public class DBStoreWriter extends DBStoreReader implements IStoreWriter
cdoClass.setServerInfo(new DBClassInfo(id));
CDOPackageImpl cdoPackage = cdoClass.getContainingPackage();
- int packageID = ((DBPackageInfo)cdoPackage.getServerInfo()).getID();
+ int packageID = DBInfo.getDBID(cdoPackage);
int classifierID = cdoClass.getClassifierID();
String name = cdoClass.getName();
boolean isAbstract = cdoClass.isAbstract();
@@ -139,7 +139,7 @@ public class DBStoreWriter extends DBStoreReader implements IStoreWriter
int id = store.getNextFeatureID();
feature.setServerInfo(new DBFeatureInfo(id));
- int classID = ((DBClassInfo)feature.getContainingClass().getServerInfo()).getID();
+ int classID = DBInfo.getDBID(feature.getContainingClass());
String name = feature.getName();
int featureID = feature.getFeatureID();
int type = feature.getType().getTypeID();
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 335499f..ad11f22 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
@@ -213,7 +213,7 @@ public class HorizontalMappingStrategy extends MappingStrategy
Object[] values = new Object[table.getFieldCount()];
values[0] = revision.getID().getValue();
- values[1] = ((DBClassInfo)revision.getCDOClass().getServerInfo()).getID();
+ values[1] = DBInfo.getDBID(revision.getCDOClass());
values[2] = revision.getVersion();
values[3] = new Date(revision.getCreated());
values[4] = new Date(revision.getRevised());