summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-08-16 15:03:30 (EDT)
committerEike Stepper2007-08-16 15:03:30 (EDT)
commit20de13c6b109f77ba7995324f5e953ccbb3cd12f (patch)
tree1880a0e3bd101198e2fe38e082886947771c96ab
parent79cc56a78effc914738348407f75235d78db1a13 (diff)
downloadcdo-20de13c6b109f77ba7995324f5e953ccbb3cd12f.zip
cdo-20de13c6b109f77ba7995324f5e953ccbb3cd12f.tar.gz
cdo-20de13c6b109f77ba7995324f5e953ccbb3cd12f.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/build.properties3
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/plugin.xml15
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/schema/mappingStrategies.exsd112
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/CDODBUtil.java38
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IMappingStrategy.java (renamed from plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBType.java)27
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBSchema.java51
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreFactory.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalMappingStrategy.java56
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java165
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalMappingStrategy.java71
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java30
-rw-r--r--plugins/org.eclipse.net4j.db.derby/src/org/eclipse/net4j/db/internal/derby/DerbyAdapter.java4
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBType.java61
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBField.java62
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBTable.java12
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapter.java4
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBField.java7
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBTable.java13
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBType.java61
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/bundle/OM.java4
-rw-r--r--plugins/org.eclipse.net4j.jms.server.jdbc/src/org/eclipse/net4j/jms/server/internal/jdbc/JMSSchema.java11
22 files changed, 650 insertions, 191 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/build.properties b/plugins/org.eclipse.emf.cdo.server.db/build.properties
index 0e3eda4..4f6e8ac 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/build.properties
+++ b/plugins/org.eclipse.emf.cdo.server.db/build.properties
@@ -7,4 +7,5 @@ bin.includes = META-INF/,\
copyright.txt,\
epl-v10.html,\
license.html,\
- plugin.xml
+ plugin.xml,\
+ schema/
diff --git a/plugins/org.eclipse.emf.cdo.server.db/plugin.xml b/plugins/org.eclipse.emf.cdo.server.db/plugin.xml
index 2e8ea0e..5f579c7 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.server.db/plugin.xml
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
+
+ <extension-point id="mappingStrategies" name="CDO Mapping Strategies" schema="schema/mappingStrategies.exsd"/>
+
<extension
point="org.eclipse.emf.cdo.server.storeFactories">
<storeFactory
@@ -9,4 +12,16 @@
</storeFactory>
</extension>
+ <extension
+ point="org.eclipse.emf.cdo.server.db.mappingStrategies">
+ <mappingStrategy
+ class="org.eclipse.emf.cdo.server.internal.db.HorizontalMappingStrategy"
+ type="Horizontal">
+ </mappingStrategy>
+ <mappingStrategy
+ class="org.eclipse.emf.cdo.server.internal.db.VerticalMappingStrategy"
+ type="Vertical">
+ </mappingStrategy>
+ </extension>
+
</plugin>
diff --git a/plugins/org.eclipse.emf.cdo.server.db/schema/mappingStrategies.exsd b/plugins/org.eclipse.emf.cdo.server.db/schema/mappingStrategies.exsd
new file mode 100644
index 0000000..e9c35f5
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/schema/mappingStrategies.exsd
@@ -0,0 +1,112 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.emf.cdo.server.db">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.emf.cdo.server.db" id="mappingStrategies" name="CDO Mapping Strategies"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="mappingStrategy" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="mappingStrategy">
+ <complexType>
+ <attribute name="type" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.emf.cdo.server.db.IMappingStrategy"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/CDODBUtil.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/CDODBUtil.java
index 70a975a..60e338a 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/CDODBUtil.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/CDODBUtil.java
@@ -10,15 +10,53 @@
**************************************************************************/
package org.eclipse.emf.cdo.server.db;
+import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
+
+import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.WrappedException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+
/**
* @author Eike Stepper
*/
public final class CDODBUtil
{
+ public static final String EXT_POINT = "mappingStrategies";
+
private CDODBUtil()
{
}
+ public static IMappingStrategy createMappingStrategy(String type)
+ {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IConfigurationElement[] elements = registry.getConfigurationElementsFor(OM.BUNDLE_ID, EXT_POINT);
+ for (final IConfigurationElement element : elements)
+ {
+ if ("mappingStrategy".equals(element.getName()))
+ {
+ String typeAttr = element.getAttribute("type");
+ if (ObjectUtil.equals(typeAttr, type))
+ {
+ try
+ {
+ return (IMappingStrategy)element.createExecutableExtension("class");
+ }
+ catch (CoreException ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
// public static CDODBStoreManager getStoreManager(IDBAdapter dbAdapter,
// DataSource dataSource)
// {
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBType.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IMappingStrategy.java
index 79acfe4..c74cabf 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBType.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IMappingStrategy.java
@@ -8,29 +8,28 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.net4j.db;
+package org.eclipse.emf.cdo.server.db;
-import org.eclipse.net4j.internal.db.DBType;
+import org.eclipse.emf.cdo.protocol.model.CDOPackage;
+import org.eclipse.emf.cdo.server.IRepository;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
+import org.eclipse.net4j.db.IDBSchema;
+import org.eclipse.net4j.db.IDBTable;
+
+import java.util.Properties;
/**
* @author Eike Stepper
*/
-@Deprecated
-public interface IDBType<JAVA>
+public interface IMappingStrategy
{
- public static final IDBType<Boolean> BOOLEAN = DBType.BOOLEAN;
-
- public String getName();
+ public String getType();
- public int getCode();
+ public Properties getProperties();
- public String format(JAVA value);
+ public void setProperties(Properties properties);
- public JAVA get(ResultSet resultSet, int index) throws SQLException;
+ public IDBSchema createSchema(IRepository repository);
- public void set(PreparedStatement statement, int index, JAVA value) throws SQLException;
+ public IDBTable[] map(IDBSchema schema, CDOPackage cdoPackage);
}
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 2aefd22..adf81f2 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
@@ -10,6 +10,7 @@
**************************************************************************/
package org.eclipse.emf.cdo.server.internal.db;
+import org.eclipse.net4j.db.DBType;
import org.eclipse.net4j.db.IDBField;
import org.eclipse.net4j.db.IDBIndex;
import org.eclipse.net4j.db.IDBTable;
@@ -28,25 +29,25 @@ public class CDODBSchema extends DBSchema
public static final IDBTable PACKAGES = INSTANCE.addTable("cdo_packages");
public static final IDBField PACKAGES_ID = //
- PACKAGES.addField("id", IDBField.Type.INTEGER);
+ PACKAGES.addField("id", DBType.INTEGER);
public static final IDBField PACKAGES_URI = //
- PACKAGES.addField("uri", IDBField.Type.VARCHAR, 255);
+ PACKAGES.addField("uri", DBType.VARCHAR, 255);
public static final IDBField PACKAGES_NAME = //
- PACKAGES.addField("name", IDBField.Type.VARCHAR, 255);
+ PACKAGES.addField("name", DBType.VARCHAR, 255);
public static final IDBField PACKAGES_ECORE = //
- PACKAGES.addField("ecore", IDBField.Type.LONGVARCHAR);
+ PACKAGES.addField("ecore", DBType.LONGVARCHAR);
public static final IDBField PACKAGES_DYNAMIC = //
- PACKAGES.addField("dynamic", IDBField.Type.BOOLEAN);
+ PACKAGES.addField("dynamic", DBType.BOOLEAN);
public static final IDBField PACKAGES_RANGE_LB = //
- PACKAGES.addField("range_lb", IDBField.Type.BIGINT);
+ PACKAGES.addField("range_lb", DBType.BIGINT);
public static final IDBField PACKAGES_RANGE_UB = //
- PACKAGES.addField("range_ub", IDBField.Type.BIGINT);
+ PACKAGES.addField("range_ub", DBType.BIGINT);
public static final IDBIndex INDEX_PACKAGES_PK = //
PACKAGES.addIndex(IDBIndex.Type.PRIMARY_KEY, PACKAGES_ID);
@@ -60,19 +61,19 @@ public class CDODBSchema extends DBSchema
public static final IDBTable CLASSES = INSTANCE.addTable("cdo_classes");
public static final IDBField CLASSES_ID = //
- CLASSES.addField("id", IDBField.Type.INTEGER);
+ CLASSES.addField("id", DBType.INTEGER);
public static final IDBField CLASSES_PACKAGE = //
- CLASSES.addField("package", IDBField.Type.INTEGER);
+ CLASSES.addField("package", DBType.INTEGER);
public static final IDBField CLASSES_CLASSIFIER = //
- CLASSES.addField("classifier", IDBField.Type.INTEGER);
+ CLASSES.addField("classifier", DBType.INTEGER);
public static final IDBField CLASSES_NAME = //
- CLASSES.addField("name", IDBField.Type.VARCHAR, 255);
+ CLASSES.addField("name", DBType.VARCHAR, 255);
public static final IDBField CLASSES_ABSTRACT = //
- CLASSES.addField("abstract", IDBField.Type.BOOLEAN);
+ CLASSES.addField("abstract", DBType.BOOLEAN);
public static final IDBIndex INDEX_CLASSES_PK = //
CLASSES.addIndex(IDBIndex.Type.PRIMARY_KEY, CLASSES_ID);
@@ -83,13 +84,13 @@ public class CDODBSchema extends DBSchema
public static final IDBTable SUPERTYPES = INSTANCE.addTable("cdo_supertypes");
public static final IDBField SUPERTYPES_TYPE = //
- SUPERTYPES.addField("type_id", IDBField.Type.INTEGER);
+ SUPERTYPES.addField("type_id", DBType.INTEGER);
public static final IDBField SUPERTYPES_SUPERTYPE_PACKAGE = //
- SUPERTYPES.addField("supertype_package", IDBField.Type.VARCHAR, 255);
+ SUPERTYPES.addField("supertype_package", DBType.VARCHAR, 255);
public static final IDBField SUPERTYPES_SUPERTYPE_CLASSIFIER = //
- SUPERTYPES.addField("supertype_classifier", IDBField.Type.INTEGER);
+ SUPERTYPES.addField("supertype_classifier", DBType.INTEGER);
public static final IDBIndex INDEX_SUPERTYPES_PK = //
SUPERTYPES.addIndex(IDBIndex.Type.PRIMARY_KEY, SUPERTYPES_TYPE);
@@ -100,34 +101,34 @@ public class CDODBSchema extends DBSchema
public static final IDBTable FEATURES = INSTANCE.addTable("cdo_features");
public static final IDBField FEATURES_ID = //
- FEATURES.addField("id", IDBField.Type.INTEGER);
+ FEATURES.addField("id", DBType.INTEGER);
public static final IDBField FEATURES_CLASS = //
- FEATURES.addField("class", IDBField.Type.INTEGER);
+ FEATURES.addField("class", DBType.INTEGER);
public static final IDBField FEATURES_FEATURE = //
- FEATURES.addField("feature", IDBField.Type.INTEGER);
+ FEATURES.addField("feature", DBType.INTEGER);
public static final IDBField FEATURES_NAME = //
- FEATURES.addField("name", IDBField.Type.VARCHAR, 255);
+ FEATURES.addField("name", DBType.VARCHAR, 255);
public static final IDBField FEATURES_TYPE = //
- FEATURES.addField("type", IDBField.Type.INTEGER);
+ FEATURES.addField("type", DBType.INTEGER);
public static final IDBField FEATURES_REFERENCE_PACKAGE = //
- FEATURES.addField("reference_package", IDBField.Type.VARCHAR, 255);
+ FEATURES.addField("reference_package", DBType.VARCHAR, 255);
public static final IDBField FEATURES_REFERENCE_CLASSIFIER = //
- FEATURES.addField("reference_classifier", IDBField.Type.INTEGER);
+ FEATURES.addField("reference_classifier", DBType.INTEGER);
public static final IDBField FEATURES_MANY = //
- FEATURES.addField("many", IDBField.Type.BOOLEAN);
+ FEATURES.addField("many", DBType.BOOLEAN);
public static final IDBField FEATURES_CONTAINMENT = //
- FEATURES.addField("containment", IDBField.Type.BOOLEAN);
+ FEATURES.addField("containment", DBType.BOOLEAN);
public static final IDBField FEATURES_INDEX = //
- FEATURES.addField("idx", IDBField.Type.INTEGER);
+ FEATURES.addField("idx", DBType.INTEGER);
public static final IDBIndex INDEX_FEATURES_PK = //
FEATURES.addIndex(IDBIndex.Type.PRIMARY_KEY, FEATURES_ID);
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 8ab170b..19b3368 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
@@ -14,6 +14,7 @@ import org.eclipse.emf.cdo.internal.server.Store;
import org.eclipse.emf.cdo.server.IStoreReader;
import org.eclipse.emf.cdo.server.IStoreWriter;
import org.eclipse.emf.cdo.server.IView;
+import org.eclipse.emf.cdo.server.db.IMappingStrategy;
import org.eclipse.net4j.db.DBException;
import org.eclipse.net4j.db.DBUtil;
@@ -30,6 +31,8 @@ public class DBStore extends Store
{
private static final String TYPE = "db";
+ private IMappingStrategy mappingStrategy;
+
private IDBAdapter dbAdapter;
private DataSource dataSource;
@@ -40,7 +43,7 @@ public class DBStore extends Store
private int nextFeatureID;
- public DBStore(IDBAdapter dbAdapter, DataSource dataSource)
+ public DBStore(IMappingStrategy mappingStrategy, IDBAdapter dbAdapter, DataSource dataSource)
{
super(TYPE);
if (dbAdapter == null)
@@ -57,6 +60,11 @@ public class DBStore extends Store
this.dataSource = dataSource;
}
+ public IMappingStrategy getMappingStrategy()
+ {
+ return mappingStrategy;
+ }
+
public IDBAdapter getDBAdapter()
{
return dbAdapter;
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreFactory.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreFactory.java
index 3796bc3..50d3418 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreFactory.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreFactory.java
@@ -10,8 +10,11 @@
**************************************************************************/
package org.eclipse.emf.cdo.server.internal.db;
+import org.eclipse.emf.cdo.internal.server.RepositoryConfigurator;
import org.eclipse.emf.cdo.server.IStore;
import org.eclipse.emf.cdo.server.IStoreFactory;
+import org.eclipse.emf.cdo.server.db.CDODBUtil;
+import org.eclipse.emf.cdo.server.db.IMappingStrategy;
import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.IDBAdapter;
@@ -41,9 +44,26 @@ public class DBStoreFactory implements IStoreFactory
public IStore createStore(Element storeConfig)
{
+ IMappingStrategy mappingStrategy = getMappingStrategy(storeConfig);
IDBAdapter dbAdapter = getDBAdapter(storeConfig);
DataSource dataSource = getDataSource(storeConfig);
- return new DBStore(dbAdapter, dataSource);
+ return new DBStore(mappingStrategy, dbAdapter, dataSource);
+ }
+
+ private IMappingStrategy getMappingStrategy(Element storeConfig)
+ {
+ NodeList mappingStrategyConfigs = storeConfig.getElementsByTagName("mappingStrategy");
+ if (mappingStrategyConfigs.getLength() != 1)
+ {
+ throw new IllegalStateException("Exactly one mappingStrategy must be configured for DB store");
+ }
+
+ Element mappingStrategyConfig = (Element)mappingStrategyConfigs.item(0);
+ String mappingStrategyType = mappingStrategyConfig.getAttribute("type");
+ IMappingStrategy mappingStrategy = CDODBUtil.createMappingStrategy(mappingStrategyType);
+ Properties properties = RepositoryConfigurator.getProperties(mappingStrategyConfig);
+ mappingStrategy.setProperties(properties);
+ return mappingStrategy;
}
private IDBAdapter getDBAdapter(Element storeConfig)
@@ -55,7 +75,7 @@ public class DBStoreFactory implements IStoreFactory
}
Element dbAdapterConfig = (Element)dbAdapterConfigs.item(0);
- String dbAdapterName = dbAdapterConfig.getAttribute("type");
+ String dbAdapterName = dbAdapterConfig.getAttribute("name");
return DBUtil.getDBAdapter(dbAdapterName);
}
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
new file mode 100644
index 0000000..4dddd2a
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalMappingStrategy.java
@@ -0,0 +1,56 @@
+/***************************************************************************
+ * 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.CDOClass;
+import org.eclipse.emf.cdo.protocol.model.CDOFeature;
+
+import org.eclipse.net4j.db.IDBField;
+import org.eclipse.net4j.db.IDBSchema;
+import org.eclipse.net4j.db.IDBTable;
+
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public class HorizontalMappingStrategy extends MappingStrategy
+{
+ public HorizontalMappingStrategy()
+ {
+ }
+
+ public String getType()
+ {
+ return "Horizontal";
+ }
+
+ @Override
+ protected IDBTable map(IDBSchema schema, CDOClass cdoClass, Set<IDBTable> affectedTables)
+ {
+ if (cdoClass.isAbstract())
+ {
+ return null;
+ }
+
+ IDBTable table = schema.addTable(cdoClass.getName());
+ initTable(table, true);
+ return table;
+ }
+
+ @Override
+ protected IDBField map(IDBSchema schema, CDOClass cdoClass, CDOFeature cdoFeature, Set<IDBTable> affectedTables)
+ {
+ DBClassInfo classInfo = (DBClassInfo)cdoClass.getServerInfo();
+ IDBTable table = classInfo.getTable();
+ return table.addField(cdoFeature.getName(), getDBType(cdoFeature.getType()));
+ }
+}
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
new file mode 100644
index 0000000..aedcc0e
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java
@@ -0,0 +1,165 @@
+/***************************************************************************
+ * 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.CDOClass;
+import org.eclipse.emf.cdo.protocol.model.CDOFeature;
+import org.eclipse.emf.cdo.protocol.model.CDOPackage;
+import org.eclipse.emf.cdo.protocol.model.CDOType;
+import org.eclipse.emf.cdo.server.IRepository;
+import org.eclipse.emf.cdo.server.db.IMappingStrategy;
+
+import org.eclipse.net4j.db.DBType;
+import org.eclipse.net4j.db.IDBField;
+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 java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class MappingStrategy implements IMappingStrategy
+{
+ private Properties properties;
+
+ public MappingStrategy()
+ {
+ }
+
+ public Properties getProperties()
+ {
+ return properties;
+ }
+
+ public void setProperties(Properties properties)
+ {
+ this.properties = properties;
+ }
+
+ @Override
+ public String toString()
+ {
+ return getType();
+ }
+
+ public IDBSchema createSchema(IRepository repository)
+ {
+ return new DBSchema(repository.getName());
+ }
+
+ public IDBTable[] map(IDBSchema schema, CDOPackage cdoPackage)
+ {
+ Set<IDBTable> affectedTables = new HashSet();
+ ((DBPackageInfo)cdoPackage.getServerInfo()).setSchema(schema);
+ for (CDOClass cdoClass : cdoPackage.getClasses())
+ {
+ IDBTable table = map(schema, cdoClass, affectedTables);
+ if (table != null)
+ {
+ ((DBClassInfo)cdoClass.getServerInfo()).setTable(table);
+ affectedTables.add(table);
+ }
+
+ for (CDOFeature cdoFeature : cdoClass.getAllFeatures())
+ {
+ IDBField field = map(schema, cdoClass, cdoFeature, affectedTables);
+ if (table != null)
+ {
+ ((DBFeatureInfo)cdoFeature.getServerInfo()).setField(field);
+ affectedTables.add(field.getTable());
+ }
+ }
+ }
+
+ return affectedTables.toArray(new IDBTable[affectedTables.size()]);
+ }
+
+ /**
+ * @param affectedTables
+ * Can be used to indicate the creation or modification of additional
+ * tables. There is no need to add the returned table to this set of
+ * affected tables. The caller takes care of that.
+ */
+ protected abstract IDBTable map(IDBSchema schema, CDOClass cdoClass, Set<IDBTable> affectedTables);
+
+ /**
+ * @param affectedTables
+ * Can be used to indicate the creation or modification of additional
+ * tables. There is no need to add the table of the returned field to
+ * this set of affected tables. The caller takes care of that.
+ */
+ protected abstract IDBField map(IDBSchema schema, CDOClass cdoClass, CDOFeature cdoFeature,
+ Set<IDBTable> affectedTables);
+
+ protected void initTable(IDBTable table, boolean full)
+ {
+ table.addField("cdo_id", DBType.BIGINT);
+ if (full)
+ {
+ table.addField("cdo_class", DBType.INTEGER);
+ }
+ }
+
+ protected DBType getDBType(CDOType type)
+ {
+ if (type == CDOType.BOOLEAN || type == CDOType.BOOLEAN_OBJECT)
+ {
+ return DBType.BOOLEAN;
+ }
+ else if (type == CDOType.BYTE || type == CDOType.BYTE_OBJECT)
+ {
+ return DBType.SMALLINT;
+ }
+ else if (type == CDOType.CHAR || type == CDOType.CHARACTER_OBJECT)
+ {
+ return DBType.CHAR;
+ }
+ else if (type == CDOType.DATE)
+ {
+ return DBType.DATE;
+ }
+ else if (type == CDOType.DOUBLE || type == CDOType.DOUBLE_OBJECT)
+ {
+ return DBType.DOUBLE;
+ }
+ else if (type == CDOType.FLOAT || type == CDOType.FLOAT_OBJECT)
+ {
+ return DBType.FLOAT;
+ }
+ else if (type == CDOType.INT || type == CDOType.INTEGER_OBJECT)
+ {
+ return DBType.INTEGER;
+ }
+ else if (type == CDOType.LONG || type == CDOType.INTEGER_OBJECT)
+ {
+ return DBType.BIGINT;
+ }
+ else if (type == CDOType.OBJECT)
+ {
+ return DBType.BIGINT;
+ }
+ else if (type == CDOType.SHORT || type == CDOType.SHORT_OBJECT)
+ {
+ return DBType.SMALLINT;
+ }
+ else if (type == CDOType.STRING)
+ {
+ return DBType.LONGVARCHAR;
+ }
+
+ throw new ImplementationError("Unrecognized type: " + type);
+ }
+} \ No newline at end of file
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
new file mode 100644
index 0000000..7e5ce3d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalMappingStrategy.java
@@ -0,0 +1,71 @@
+/***************************************************************************
+ * 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.CDOClass;
+import org.eclipse.emf.cdo.protocol.model.CDOFeature;
+import org.eclipse.emf.cdo.server.IRepository;
+
+import org.eclipse.net4j.db.IDBField;
+import org.eclipse.net4j.db.IDBSchema;
+import org.eclipse.net4j.db.IDBTable;
+
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public class VerticalMappingStrategy extends MappingStrategy
+{
+ public VerticalMappingStrategy()
+ {
+ }
+
+ public String getType()
+ {
+ return "Vertical";
+ }
+
+ @Override
+ public IDBSchema createSchema(IRepository repository)
+ {
+ IDBSchema schema = super.createSchema(repository);
+ IDBTable table = schema.addTable("CDO_REVISIONS");
+ initTable(table, true);
+ return schema;
+ }
+
+ @Override
+ protected IDBTable map(IDBSchema schema, CDOClass cdoClass, Set<IDBTable> affectedTables)
+ {
+ if (cdoClass.isRoot())
+ {
+ return null;
+ }
+
+ IDBTable table = schema.addTable(cdoClass.getName());
+ initTable(table, false);
+ return table;
+ }
+
+ @Override
+ protected IDBField map(IDBSchema schema, CDOClass cdoClass, CDOFeature cdoFeature, Set<IDBTable> affectedTables)
+ {
+ if (cdoFeature.getContainingClass() != cdoClass)
+ {
+ return null;
+ }
+
+ DBClassInfo classInfo = (DBClassInfo)cdoClass.getServerInfo();
+ IDBTable table = classInfo.getTable();
+ return table.addField(cdoFeature.getName(), getDBType(cdoFeature.getType()));
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java
index a460032..ffe3a72 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java
@@ -24,6 +24,7 @@ import org.eclipse.core.runtime.Platform;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
@@ -35,6 +36,7 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Properties;
/**
* @author Eike Stepper
@@ -108,4 +110,32 @@ public class RepositoryConfigurator
Document document = builder.parse(configFile);
return document;
}
+
+ public static Properties getProperties(Element element)
+ {
+ Properties properties = new Properties();
+ collectProperties(element, "", properties);
+ return properties;
+ }
+
+ private static void collectProperties(Element element, String prefix, Properties properties)
+ {
+ if ("property".equals(element.getNodeName()))
+ {
+ String name = element.getAttribute("name");
+ String value = element.getAttribute("value");
+ properties.put(prefix + name, value);
+ prefix += name + ".";
+ }
+
+ NodeList childNodes = element.getChildNodes();
+ for (int i = 0; i < childNodes.getLength(); i++)
+ {
+ Node childNode = childNodes.item(i);
+ if (childNode instanceof Element)
+ {
+ collectProperties((Element)childNode, prefix, properties);
+ }
+ }
+ }
}
diff --git a/plugins/org.eclipse.net4j.db.derby/src/org/eclipse/net4j/db/internal/derby/DerbyAdapter.java b/plugins/org.eclipse.net4j.db.derby/src/org/eclipse/net4j/db/internal/derby/DerbyAdapter.java
index 61ec168..b3067ee 100644
--- a/plugins/org.eclipse.net4j.db.derby/src/org/eclipse/net4j/db/internal/derby/DerbyAdapter.java
+++ b/plugins/org.eclipse.net4j.db.derby/src/org/eclipse/net4j/db/internal/derby/DerbyAdapter.java
@@ -10,7 +10,7 @@
**************************************************************************/
package org.eclipse.net4j.db.internal.derby;
-import org.eclipse.net4j.db.IDBField.Type;
+import org.eclipse.net4j.db.DBType;
import org.eclipse.net4j.internal.db.DBAdapter;
import org.eclipse.net4j.internal.db.DBField;
@@ -36,7 +36,7 @@ public class DerbyAdapter extends DBAdapter
@Override
protected String getTypeName(DBField field)
{
- Type type = field.getType();
+ DBType type = field.getType();
switch (type)
{
case BOOLEAN:
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBType.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBType.java
new file mode 100644
index 0000000..4e8c0ef
--- /dev/null
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBType.java
@@ -0,0 +1,61 @@
+package org.eclipse.net4j.db;
+
+/**
+ * @author Eike Stepper
+ */
+public enum DBType
+{
+ BOOLEAN(16), //
+ BIT(-7), //
+ TINYINT(-6), //
+ SMALLINT(5), //
+ INTEGER(4), //
+ BIGINT(-5), //
+ FLOAT(6), //
+ REAL(7), //
+ DOUBLE(8), //
+ NUMERIC(2), //
+ DECIMAL(3), //
+ CHAR(1), //
+ VARCHAR(12), //
+ LONGVARCHAR(-1, "LONG VARCHAR"), //
+ DATE(91), //
+ TIME(92), //
+ TIMESTAMP(93), //
+ BINARY(-2), //
+ VARBINARY(-3), //
+ LONGVARBINARY(-4, "LONG VARBINARY"), //
+ BLOB(2004), //
+ CLOB(2005); //
+
+ private int code;
+
+ private String keyword;
+
+ private DBType(int code, String keyword)
+ {
+ this.code = code;
+ this.keyword = keyword;
+ }
+
+ private DBType(int code)
+ {
+ this(code, null);
+ }
+
+ public int getCode()
+ {
+ return code;
+ }
+
+ public String getKeyword()
+ {
+ return keyword == null ? super.toString() : keyword;
+ }
+
+ @Override
+ public String toString()
+ {
+ return getKeyword();
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBField.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBField.java
index 44994ca..c1cc896 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBField.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBField.java
@@ -21,7 +21,7 @@ public interface IDBField
public String getName();
- public Type getType();
+ public DBType getType();
public int getPrecision();
@@ -32,64 +32,4 @@ public interface IDBField
public int getPosition();
public String getFullName();
-
- /**
- * @author Eike Stepper
- */
- public enum Type
- {
- BOOLEAN(16), //
- BIT(-7), //
- TINYINT(-6), //
- SMALLINT(5), //
- INTEGER(4), //
- BIGINT(-5), //
- FLOAT(6), //
- REAL(7), //
- DOUBLE(8), //
- NUMERIC(2), //
- DECIMAL(3), //
- CHAR(1), //
- VARCHAR(12), //
- LONGVARCHAR(-1, "LONG VARCHAR"), //
- DATE(91), //
- TIME(92), //
- TIMESTAMP(93), //
- BINARY(-2), //
- VARBINARY(-3), //
- LONGVARBINARY(-4, "LONG VARBINARY"), //
- BLOB(2004), //
- CLOB(2005); //
-
- private int code;
-
- private String keyword;
-
- private Type(int code, String keyword)
- {
- this.code = code;
- this.keyword = keyword;
- }
-
- private Type(int code)
- {
- this(code, null);
- }
-
- public int getCode()
- {
- return code;
- }
-
- public String getKeyword()
- {
- return keyword == null ? super.toString() : keyword;
- }
-
- @Override
- public String toString()
- {
- return getKeyword();
- }
- }
}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBTable.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBTable.java
index 71e626e..4d43132 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBTable.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBTable.java
@@ -21,17 +21,17 @@ public interface IDBTable
public String getName();
- public IDBField addField(String name, IDBField.Type type);
+ public IDBField addField(String name, DBType type);
- public DBField addField(String name, IDBField.Type type, boolean notNull);
+ public DBField addField(String name, DBType type, boolean notNull);
- public DBField addField(String name, IDBField.Type type, int precision);
+ public DBField addField(String name, DBType type, int precision);
- public DBField addField(String name, IDBField.Type type, int precision, boolean notNull);
+ public DBField addField(String name, DBType type, int precision, boolean notNull);
- public DBField addField(String name, IDBField.Type type, int precision, int scale);
+ public DBField addField(String name, DBType type, int precision, int scale);
- public DBField addField(String name, IDBField.Type type, int precision, int scale, boolean notNull);
+ public DBField addField(String name, DBType type, int precision, int scale, boolean notNull);
public IDBField getField(String name);
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapter.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapter.java
index bec99e6..4352fd7 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapter.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapter.java
@@ -11,8 +11,8 @@
package org.eclipse.net4j.internal.db;
import org.eclipse.net4j.db.DBException;
+import org.eclipse.net4j.db.DBType;
import org.eclipse.net4j.db.IDBAdapter;
-import org.eclipse.net4j.db.IDBField.Type;
import org.eclipse.net4j.internal.db.bundle.OM;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
@@ -107,7 +107,7 @@ public abstract class DBAdapter implements IDBAdapter
protected String getTypeName(DBField field)
{
- Type type = field.getType();
+ DBType type = field.getType();
switch (type)
{
case BOOLEAN:
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBField.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBField.java
index d86375e..de4a75e 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBField.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBField.java
@@ -10,6 +10,7 @@
**************************************************************************/
package org.eclipse.net4j.internal.db;
+import org.eclipse.net4j.db.DBType;
import org.eclipse.net4j.db.IDBField;
/**
@@ -23,7 +24,7 @@ public class DBField implements IDBField
private String name;
- private Type type;
+ private DBType type;
private int precision;
@@ -33,7 +34,7 @@ public class DBField implements IDBField
private int position;
- public DBField(DBTable table, String name, Type type, int precision, int scale, boolean notNull, int position)
+ public DBField(DBTable table, String name, DBType type, int precision, int scale, boolean notNull, int position)
{
this.table = table;
this.name = name;
@@ -54,7 +55,7 @@ public class DBField implements IDBField
return name;
}
- public Type getType()
+ public DBType getType()
{
return type;
}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBTable.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBTable.java
index 3c15211..99de963 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBTable.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBTable.java
@@ -10,6 +10,7 @@
**************************************************************************/
package org.eclipse.net4j.internal.db;
+import org.eclipse.net4j.db.DBType;
import org.eclipse.net4j.db.IDBField;
import org.eclipse.net4j.db.IDBIndex;
import org.eclipse.net4j.db.IDBTable;
@@ -48,32 +49,32 @@ public class DBTable implements IDBTable
return name;
}
- public DBField addField(String name, IDBField.Type type)
+ public DBField addField(String name, DBType type)
{
return addField(name, type, IDBField.DEFAULT, IDBField.DEFAULT, false);
}
- public DBField addField(String name, IDBField.Type type, boolean notNull)
+ public DBField addField(String name, DBType type, boolean notNull)
{
return addField(name, type, IDBField.DEFAULT, IDBField.DEFAULT, notNull);
}
- public DBField addField(String name, IDBField.Type type, int precision)
+ public DBField addField(String name, DBType type, int precision)
{
return addField(name, type, precision, IDBField.DEFAULT, false);
}
- public DBField addField(String name, IDBField.Type type, int precision, boolean notNull)
+ public DBField addField(String name, DBType type, int precision, boolean notNull)
{
return addField(name, type, precision, IDBField.DEFAULT, notNull);
}
- public DBField addField(String name, IDBField.Type type, int precision, int scale)
+ public DBField addField(String name, DBType type, int precision, int scale)
{
return addField(name, type, precision, scale, false);
}
- public DBField addField(String name, IDBField.Type type, int precision, int scale, boolean notNull)
+ public DBField addField(String name, DBType type, int precision, int scale, boolean notNull)
{
schema.assertUnlocked();
if (getField(name) != null)
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBType.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBType.java
deleted file mode 100644
index 6f1bf0e..0000000
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBType.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/***************************************************************************
- * 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.net4j.internal.db;
-
-import org.eclipse.net4j.db.IDBType;
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-/**
- * @author Eike Stepper
- */
-@Deprecated
-public abstract class DBType<JAVA> implements IDBType<JAVA>
-{
- public static final DBType<Boolean> BOOLEAN = new DBType<Boolean>()
- {
- public String getName()
- {
- return "BOOLEAN";
- }
-
- public int getCode()
- {
- return 0;
- }
-
- public Boolean get(ResultSet resultSet, int index) throws SQLException
- {
- return resultSet.getBoolean(index);
- }
-
- public void set(PreparedStatement statement, int index, Boolean value) throws SQLException
- {
- }
- };
-
- protected DBType()
- {
- }
-
- public String format(JAVA value)
- {
- return value.toString();
- }
-
- @Override
- public String toString()
- {
- return getName();
- }
-}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/bundle/OM.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/bundle/OM.java
index 10703a8..5d3acfb 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/bundle/OM.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/bundle/OM.java
@@ -57,10 +57,10 @@ public abstract class OM
public void start(BundleContext context) throws Exception
{
super.start(context);
- initAdapterRegistry();
+ initDBAdapterRegistry();
}
- private void initAdapterRegistry()
+ private void initDBAdapterRegistry()
{
IExtensionRegistry registry = Platform.getExtensionRegistry();
IConfigurationElement[] elements = registry.getConfigurationElementsFor(BUNDLE_ID, EXT_POINT);
diff --git a/plugins/org.eclipse.net4j.jms.server.jdbc/src/org/eclipse/net4j/jms/server/internal/jdbc/JMSSchema.java b/plugins/org.eclipse.net4j.jms.server.jdbc/src/org/eclipse/net4j/jms/server/internal/jdbc/JMSSchema.java
index 7ae2274..44367a1 100644
--- a/plugins/org.eclipse.net4j.jms.server.jdbc/src/org/eclipse/net4j/jms/server/internal/jdbc/JMSSchema.java
+++ b/plugins/org.eclipse.net4j.jms.server.jdbc/src/org/eclipse/net4j/jms/server/internal/jdbc/JMSSchema.java
@@ -10,6 +10,7 @@
**************************************************************************/
package org.eclipse.net4j.jms.server.internal.jdbc;
+import org.eclipse.net4j.db.DBType;
import org.eclipse.net4j.db.IDBField;
import org.eclipse.net4j.db.IDBIndex;
import org.eclipse.net4j.db.IDBTable;
@@ -28,10 +29,10 @@ public class JMSSchema extends DBSchema
public static final IDBTable DESTINATIONS = INSTANCE.addTable("destinations");
public static final IDBField DESTINATIONS_NAME = //
- DESTINATIONS.addField("name", IDBField.Type.VARCHAR, 255);
+ DESTINATIONS.addField("name", DBType.VARCHAR, 255);
public static final IDBField DESTINATIONS_TYPE = //
- DESTINATIONS.addField("type", IDBField.Type.INTEGER);
+ DESTINATIONS.addField("type", DBType.INTEGER);
public static final IDBIndex INDEX_DESTINATIONS_PK = //
DESTINATIONS.addIndex(IDBIndex.Type.PRIMARY_KEY, DESTINATIONS_NAME);
@@ -42,13 +43,13 @@ public class JMSSchema extends DBSchema
public static final IDBTable MESSAGES = INSTANCE.addTable("messages");
public static final IDBField MESSAGES_ID = //
- MESSAGES.addField("id", IDBField.Type.VARCHAR);
+ MESSAGES.addField("id", DBType.VARCHAR);
public static final IDBField MESSAGES_DESTINATION = //
- MESSAGES.addField("destination", IDBField.Type.VARCHAR);
+ MESSAGES.addField("destination", DBType.VARCHAR);
public static final IDBField MESSAGES_PRIORITY = //
- MESSAGES.addField("priority", IDBField.Type.INTEGER);
+ MESSAGES.addField("priority", DBType.INTEGER);
public static final IDBIndex INDEX_MESSAGES_PK = //
MESSAGES.addIndex(IDBIndex.Type.PRIMARY_KEY, MESSAGES_ID);