Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2013-09-26 05:58:45 -0400
committerEike Stepper2013-09-26 05:58:45 -0400
commit4bc6f5ff208881583a71a84b4d42ee3a5583a1fc (patch)
tree7c4292bacebd071de891a7c68820ad3db26146da
parent8c0eef51dcd32ed54494d20eb57d3037c4126ba7 (diff)
downloadcdo-4bc6f5ff208881583a71a84b4d42ee3a5583a1fc.tar.gz
cdo-4bc6f5ff208881583a71a84b4d42ee3a5583a1fc.tar.xz
cdo-4bc6f5ff208881583a71a84b4d42ee3a5583a1fc.zip
[418076] [DB] Add OracleConfig for execution of DBStore tests
https://bugs.eclipse.org/bugs/show_bug.cgi?id=418076
-rw-r--r--features/org.eclipse.net4j.db.h2-feature/feature.xml2
-rw-r--r--features/org.eclipse.net4j.db.oracle-feature/feature.xml2
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.client.offline/META-INF/MANIFEST.MF8
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeType.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.clone/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.clone/src/org/eclipse/emf/cdo/examples/server/offline/AbstractOfflineExampleServer.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/META-INF/MANIFEST.MF8
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeType.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.clone/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.clone/src/org/eclipse/emf/cdo/examples/server/offline/AbstractOfflineExampleServer.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml10
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.server/META-INF/MANIFEST.MF6
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.server/src/org/gastro/internal/server/OM.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml10
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.server/META-INF/MANIFEST.MF6
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/DemoConfiguration.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.examples/META-INF/MANIFEST.MF10
-rw-r--r--plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/Server.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/AbstractOfflineExampleServer.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IDBStore.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreFactory.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/SQLQueryHandler.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.server.product/CDOServer.launch4
-rw-r--r--plugins/org.eclipse.emf.cdo.server.product/config/cdo-server.xml10
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/StoreAccessorBase.java14
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (Oracle).launch16
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AbstractSetupDBConfig.java68
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBOracle.java40
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfig.java20
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBStoreTest.java40
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/MysqlConfig.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/Net4jDBTest.java98
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/OracleConfig.java172
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/PostgresqlConfig.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/DBOfflineConfig.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/revisioncache/AbstractDBRevisionCacheTest.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/CommitInfoTest.java20
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SessionTest.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/efs/CDOFS.java10
-rw-r--r--plugins/org.eclipse.net4j.db.h2/META-INF/MANIFEST.MF6
-rw-r--r--plugins/org.eclipse.net4j.db.h2/src/org/eclipse/net4j/db/h2/H2Adapter.java9
-rw-r--r--plugins/org.eclipse.net4j.db.jdbc/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.net4j.db.jdbc/src/org/eclipse/net4j/db/jdbc/DelegatingConnection.java54
-rw-r--r--plugins/org.eclipse.net4j.db.jdbc/src/org/eclipse/net4j/db/jdbc/JDBCUtil.java30
-rw-r--r--plugins/org.eclipse.net4j.db.oracle/META-INF/MANIFEST.MF6
-rw-r--r--plugins/org.eclipse.net4j.db.oracle/Oracle Problems.docxbin0 -> 12076 bytes
-rw-r--r--plugins/org.eclipse.net4j.db.oracle/src/org/eclipse/net4j/db/oracle/OracleAdapter.java100
-rw-r--r--plugins/org.eclipse.net4j.db.tests/META-INF/MANIFEST.MF6
-rw-r--r--plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/AbstractDBTest.java2
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java25
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBAdapter.java10
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBConnection.java3
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBConnectionProvider2.java27
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBDatabase.java2
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBConnection.java21
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBDatabase.java26
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBPreparedStatement.java17
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBResultSet.java18
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DataSourceConnectionProvider.java16
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBSchema.java4
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBAdapter.java52
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java12
-rw-r--r--plugins/org.gastro.server/META-INF/MANIFEST.MF6
-rw-r--r--plugins/org.gastro.server/src/org/gastro/internal/server/OM.java3
67 files changed, 954 insertions, 154 deletions
diff --git a/features/org.eclipse.net4j.db.h2-feature/feature.xml b/features/org.eclipse.net4j.db.h2-feature/feature.xml
index 08cef176a1..2813abf1c4 100644
--- a/features/org.eclipse.net4j.db.h2-feature/feature.xml
+++ b/features/org.eclipse.net4j.db.h2-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.net4j.db.h2"
label="%featureName"
- version="4.2.0.qualifier"
+ version="4.2.100.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.emf.cdo.license"
license-feature-version="0.0.0">
diff --git a/features/org.eclipse.net4j.db.oracle-feature/feature.xml b/features/org.eclipse.net4j.db.oracle-feature/feature.xml
index b376e5d887..6899def05b 100644
--- a/features/org.eclipse.net4j.db.oracle-feature/feature.xml
+++ b/features/org.eclipse.net4j.db.oracle-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.net4j.db.oracle"
label="%featureName"
- version="1.0.0.qualifier"
+ version="1.1.0.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.emf.cdo.license"
license-feature-version="0.0.0">
diff --git a/plugins/org.eclipse.emf.cdo.examples.client.offline/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.examples.client.offline/META-INF/MANIFEST.MF
index 6b49191d36..d62604f1ee 100644
--- a/plugins/org.eclipse.emf.cdo.examples.client.offline/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.examples.client.offline/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.emf.cdo.examples.client.offline;singleton:=true
-Bundle-Version: 4.2.0.qualifier
+Bundle-Version: 4.2.100.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
@@ -23,6 +23,6 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.net4j.util.ui;bundle-version="[3.0.0,4.0.0)"
Import-Package: org.h2.jdbcx;version="[1.0.0,2.0.0)"
Bundle-ClassPath: .
-Export-Package: org.eclipse.emf.cdo.examples.client.offline;version="4.2.0";x-internal:=true,
- org.eclipse.emf.cdo.examples.client.offline.nodes;version="4.2.0";x-internal:=true,
- org.eclipse.wb.swt;version="4.2.0";x-internal:=true
+Export-Package: org.eclipse.emf.cdo.examples.client.offline;version="4.2.100";x-internal:=true,
+ org.eclipse.emf.cdo.examples.client.offline.nodes;version="4.2.100";x-internal:=true,
+ org.eclipse.wb.swt;version="4.2.100";x-internal:=true
diff --git a/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeType.java b/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeType.java
index 8a62c5b569..6f23f5160e 100644
--- a/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeType.java
+++ b/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeType.java
@@ -36,7 +36,6 @@ import org.eclipse.emf.cdo.view.CDOViewTargetChangedEvent;
import org.eclipse.net4j.Net4jUtil;
import org.eclipse.net4j.acceptor.IAcceptor;
import org.eclipse.net4j.connector.IConnector;
-import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.IDBConnectionProvider;
import org.eclipse.net4j.db.h2.H2Adapter;
@@ -314,7 +313,7 @@ public abstract class NodeType extends SetContainer<Node> implements IElement
IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(true, true);
IDBAdapter dbAdapter = new H2Adapter();
- IDBConnectionProvider dbConnectionProvider = DBUtil.createConnectionProvider(dataSource);
+ IDBConnectionProvider dbConnectionProvider = dbAdapter.createConnectionProvider(dataSource);
IStore store = CDODBUtil.createStore(mappingStrategy, dbAdapter, dbConnectionProvider);
Map<String, String> props = new HashMap<String, String>();
diff --git a/plugins/org.eclipse.emf.cdo.examples.clone/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.examples.clone/META-INF/MANIFEST.MF
index d046fe56c7..d52bdd333e 100644
--- a/plugins/org.eclipse.emf.cdo.examples.clone/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.examples.clone/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.emf.cdo.examples.clone;singleton:=true
-Bundle-Version: 4.1.0.qualifier
+Bundle-Version: 4.1.100.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
@@ -18,4 +18,4 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.net4j.db.h2;bundle-version="[4.0.0,5.0.0)",
org.eclipse.emf.cdo.examples.company;bundle-version="[4.0.0,5.0.0)"
Import-Package: org.h2.jdbcx;version="[1.0.0,2.0.0)"
-Export-Package: org.eclipse.emf.cdo.examples.server.offline;version="4.1.0";x-internal:=true
+Export-Package: org.eclipse.emf.cdo.examples.server.offline;version="4.1.100";x-internal:=true
diff --git a/plugins/org.eclipse.emf.cdo.examples.clone/src/org/eclipse/emf/cdo/examples/server/offline/AbstractOfflineExampleServer.java b/plugins/org.eclipse.emf.cdo.examples.clone/src/org/eclipse/emf/cdo/examples/server/offline/AbstractOfflineExampleServer.java
index d257bdaa5a..bba02a56ee 100644
--- a/plugins/org.eclipse.emf.cdo.examples.clone/src/org/eclipse/emf/cdo/examples/server/offline/AbstractOfflineExampleServer.java
+++ b/plugins/org.eclipse.emf.cdo.examples.clone/src/org/eclipse/emf/cdo/examples/server/offline/AbstractOfflineExampleServer.java
@@ -22,7 +22,6 @@ import org.eclipse.emf.cdo.server.db.CDODBUtil;
import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
import org.eclipse.net4j.acceptor.IAcceptor;
-import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.IDBConnectionProvider;
import org.eclipse.net4j.db.h2.H2Adapter;
@@ -225,7 +224,7 @@ public abstract class AbstractOfflineExampleServer
IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(true, true);
IDBAdapter dbAdapter = new H2Adapter();
- IDBConnectionProvider dbConnectionProvider = DBUtil.createConnectionProvider(dataSource);
+ IDBConnectionProvider dbConnectionProvider = dbAdapter.createConnectionProvider(dataSource);
return CDODBUtil.createStore(mappingStrategy, dbAdapter, dbConnectionProvider);
}
diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/META-INF/MANIFEST.MF
index 6b49191d36..d62604f1ee 100644
--- a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.emf.cdo.examples.client.offline;singleton:=true
-Bundle-Version: 4.2.0.qualifier
+Bundle-Version: 4.2.100.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
@@ -23,6 +23,6 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.net4j.util.ui;bundle-version="[3.0.0,4.0.0)"
Import-Package: org.h2.jdbcx;version="[1.0.0,2.0.0)"
Bundle-ClassPath: .
-Export-Package: org.eclipse.emf.cdo.examples.client.offline;version="4.2.0";x-internal:=true,
- org.eclipse.emf.cdo.examples.client.offline.nodes;version="4.2.0";x-internal:=true,
- org.eclipse.wb.swt;version="4.2.0";x-internal:=true
+Export-Package: org.eclipse.emf.cdo.examples.client.offline;version="4.2.100";x-internal:=true,
+ org.eclipse.emf.cdo.examples.client.offline.nodes;version="4.2.100";x-internal:=true,
+ org.eclipse.wb.swt;version="4.2.100";x-internal:=true
diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeType.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeType.java
index 8a62c5b569..6f23f5160e 100644
--- a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeType.java
+++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeType.java
@@ -36,7 +36,6 @@ import org.eclipse.emf.cdo.view.CDOViewTargetChangedEvent;
import org.eclipse.net4j.Net4jUtil;
import org.eclipse.net4j.acceptor.IAcceptor;
import org.eclipse.net4j.connector.IConnector;
-import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.IDBConnectionProvider;
import org.eclipse.net4j.db.h2.H2Adapter;
@@ -314,7 +313,7 @@ public abstract class NodeType extends SetContainer<Node> implements IElement
IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(true, true);
IDBAdapter dbAdapter = new H2Adapter();
- IDBConnectionProvider dbConnectionProvider = DBUtil.createConnectionProvider(dataSource);
+ IDBConnectionProvider dbConnectionProvider = dbAdapter.createConnectionProvider(dataSource);
IStore store = CDODBUtil.createStore(mappingStrategy, dbAdapter, dbConnectionProvider);
Map<String, String> props = new HashMap<String, String>();
diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.clone/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.clone/META-INF/MANIFEST.MF
index d046fe56c7..d52bdd333e 100644
--- a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.clone/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.clone/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.emf.cdo.examples.clone;singleton:=true
-Bundle-Version: 4.1.0.qualifier
+Bundle-Version: 4.1.100.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
@@ -18,4 +18,4 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.net4j.db.h2;bundle-version="[4.0.0,5.0.0)",
org.eclipse.emf.cdo.examples.company;bundle-version="[4.0.0,5.0.0)"
Import-Package: org.h2.jdbcx;version="[1.0.0,2.0.0)"
-Export-Package: org.eclipse.emf.cdo.examples.server.offline;version="4.1.0";x-internal:=true
+Export-Package: org.eclipse.emf.cdo.examples.server.offline;version="4.1.100";x-internal:=true
diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.clone/src/org/eclipse/emf/cdo/examples/server/offline/AbstractOfflineExampleServer.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.clone/src/org/eclipse/emf/cdo/examples/server/offline/AbstractOfflineExampleServer.java
index d257bdaa5a..bba02a56ee 100644
--- a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.clone/src/org/eclipse/emf/cdo/examples/server/offline/AbstractOfflineExampleServer.java
+++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.clone/src/org/eclipse/emf/cdo/examples/server/offline/AbstractOfflineExampleServer.java
@@ -22,7 +22,6 @@ import org.eclipse.emf.cdo.server.db.CDODBUtil;
import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
import org.eclipse.net4j.acceptor.IAcceptor;
-import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.IDBConnectionProvider;
import org.eclipse.net4j.db.h2.H2Adapter;
@@ -225,7 +224,7 @@ public abstract class AbstractOfflineExampleServer
IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(true, true);
IDBAdapter dbAdapter = new H2Adapter();
- IDBConnectionProvider dbConnectionProvider = DBUtil.createConnectionProvider(dataSource);
+ IDBConnectionProvider dbConnectionProvider = dbAdapter.createConnectionProvider(dataSource);
return CDODBUtil.createStore(mappingStrategy, dbAdapter, dbConnectionProvider);
}
diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml
index be3dd9b6fc..b5d657a089 100644
--- a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml
+++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml
@@ -23,8 +23,8 @@
<property name="serializeCommits" value="false"/>
<property name="optimisticLockingTimeout" value="10000"/>
- <!-- Example http://wiki.eclipse.org/CDO/Security_Manager
<securityManager type="default" description="/security:annotation:home(/home)"/>
+ <!-- Example http://wiki.eclipse.org/CDO/Security_Manager
-->
<!-- Example http://bugs.eclipse.org/302775
@@ -105,11 +105,11 @@
<dbAdapter name="oracle"/>
<dataSource class="oracle.jdbc.pool.OracleDataSource"
driverType="thin"
- serverName="serverURL"
+ serverName="localhost"
portNumber="1521"
- databaseName="SID"
- user="user"
- password="passwd"/>
+ databaseName="TEST"
+ user="cdotest"
+ password="oracle"/>
-->
</store>
diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.server/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.server/META-INF/MANIFEST.MF
index 34d174d4a3..cb6b8c2533 100644
--- a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.server/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.server/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: CDO Electronic Restaurant Example Server
Bundle-SymbolicName: org.gastro.server;singleton:=true
-Bundle-Version: 4.0.200.qualifier
+Bundle-Version: 4.0.300.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.emf.cdo.server;bundle-version="[4.0.0,5.0.0)";visibility:=reexport,
@@ -17,6 +17,6 @@ Import-Package: org.h2;version="[1.0.0,2.0.0)",
org.h2.tools;version="[1.0.0,2.0.0)",
org.h2.util;version="[1.0.0,2.0.0)"
Bundle-Vendor: Eclipse Modeling Project
-Export-Package: org.gastro.internal.server;version="4.0.200";x-internal:=true,
- org.gastro.server;version="4.0.200"
+Export-Package: org.gastro.internal.server;version="4.0.300";x-internal:=true,
+ org.gastro.server;version="4.0.300"
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.server/src/org/gastro/internal/server/OM.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.server/src/org/gastro/internal/server/OM.java
index 215a5e27ab..e60e095919 100644
--- a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.server/src/org/gastro/internal/server/OM.java
+++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.server/src/org/gastro/internal/server/OM.java
@@ -21,7 +21,6 @@ import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
import org.eclipse.emf.cdo.server.net4j.CDONet4jServerUtil;
import org.eclipse.net4j.acceptor.IAcceptor;
-import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.IDBConnectionProvider;
import org.eclipse.net4j.db.h2.H2Adapter;
@@ -84,7 +83,7 @@ public abstract class OM
IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(true);
IDBAdapter dbAdapter = new H2Adapter();
- IDBConnectionProvider dbConnectionProvider = DBUtil.createConnectionProvider(dataSource);
+ IDBConnectionProvider dbConnectionProvider = dbAdapter.createConnectionProvider(dataSource);
IStore store = CDODBUtil.createStore(mappingStrategy, dbAdapter, dbConnectionProvider);
Map<String, String> props = new HashMap<String, String>();
diff --git a/plugins/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml b/plugins/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml
index be3dd9b6fc..b5d657a089 100644
--- a/plugins/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml
+++ b/plugins/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml
@@ -23,8 +23,8 @@
<property name="serializeCommits" value="false"/>
<property name="optimisticLockingTimeout" value="10000"/>
- <!-- Example http://wiki.eclipse.org/CDO/Security_Manager
<securityManager type="default" description="/security:annotation:home(/home)"/>
+ <!-- Example http://wiki.eclipse.org/CDO/Security_Manager
-->
<!-- Example http://bugs.eclipse.org/302775
@@ -105,11 +105,11 @@
<dbAdapter name="oracle"/>
<dataSource class="oracle.jdbc.pool.OracleDataSource"
driverType="thin"
- serverName="serverURL"
+ serverName="localhost"
portNumber="1521"
- databaseName="SID"
- user="user"
- password="passwd"/>
+ databaseName="TEST"
+ user="cdotest"
+ password="oracle"/>
-->
</store>
diff --git a/plugins/org.eclipse.emf.cdo.examples.server/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.examples.server/META-INF/MANIFEST.MF
index 3313f15732..b2457bf445 100644
--- a/plugins/org.eclipse.emf.cdo.examples.server/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.examples.server/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.emf.cdo.examples.server; singleton:=true
-Bundle-Version: 4.0.200.qualifier
+Bundle-Version: 4.0.300.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -14,7 +14,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.net4j.jvm;bundle-version="[4.0.0,5.0.0)",
org.eclipse.net4j.tcp;bundle-version="[4.0.0,5.0.0)"
Import-Package: org.h2.jdbcx;version="[1.0.0,2.0.0)"
-Export-Package: org.eclipse.emf.cdo.examples.internal.server;version="4.0.200";x-internal:=true,
- org.eclipse.emf.cdo.examples.server;version="4.0.200"
+Export-Package: org.eclipse.emf.cdo.examples.internal.server;version="4.0.300";x-internal:=true,
+ org.eclipse.emf.cdo.examples.server;version="4.0.300"
Bundle-Activator: org.eclipse.emf.cdo.examples.internal.server.OM$Activator
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/DemoConfiguration.java b/plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/DemoConfiguration.java
index 0cd9e1de8a..961192adca 100644
--- a/plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/DemoConfiguration.java
+++ b/plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/DemoConfiguration.java
@@ -179,7 +179,7 @@ public class DemoConfiguration extends Lifecycle
{
IMappingStrategy mappingStrategy = createMappingStrategy();
IDBAdapter dbAdapter = DBUtil.getDBAdapter("h2");
- IDBConnectionProvider dbConnectionProvider = DBUtil.createConnectionProvider(createDataSource());
+ IDBConnectionProvider dbConnectionProvider = dbAdapter.createConnectionProvider(createDataSource());
IDBStore store = CDODBUtil.createStore(mappingStrategy, dbAdapter, dbConnectionProvider);
return store;
}
diff --git a/plugins/org.eclipse.emf.cdo.examples/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.examples/META-INF/MANIFEST.MF
index 8bad4cb7f8..13f3e7ac15 100644
--- a/plugins/org.eclipse.emf.cdo.examples/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.examples/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.emf.cdo.examples;singleton:=true
-Bundle-Version: 4.0.200.qualifier
+Bundle-Version: 4.0.300.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Activator: org.eclipse.emf.cdo.internal.examples.bundle.OM$Activator
@@ -20,7 +20,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)";resoluti
org.eclipse.net4j.tcp;bundle-version="[4.0.0,5.0.0)",
org.eclipse.net4j.db.h2;bundle-version="[4.0.0,5.0.0)"
Import-Package: org.h2.jdbcx;version="[1.0.0,2.0.0)"
-Export-Package: org.eclipse.emf.cdo.examples;version="4.0.200";x-internal:=true,
- org.eclipse.emf.cdo.examples.server;version="4.0.200";x-internal:=true,
- org.eclipse.emf.cdo.examples.server.offline;version="4.0.200";x-internal:=true,
- org.eclipse.emf.cdo.internal.examples.bundle;version="4.0.200";x-internal:=true
+Export-Package: org.eclipse.emf.cdo.examples;version="4.0.300";x-internal:=true,
+ org.eclipse.emf.cdo.examples.server;version="4.0.300";x-internal:=true,
+ org.eclipse.emf.cdo.examples.server.offline;version="4.0.300";x-internal:=true,
+ org.eclipse.emf.cdo.internal.examples.bundle;version="4.0.300";x-internal:=true
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java
index d7ffde5b70..aa248426ca 100644
--- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java
+++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java
@@ -41,7 +41,6 @@ import org.eclipse.emf.cdo.util.CommitException;
import org.eclipse.net4j.Net4jUtil;
import org.eclipse.net4j.acceptor.IAcceptor;
import org.eclipse.net4j.connector.IConnector;
-import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.IDBConnectionProvider;
import org.eclipse.net4j.db.h2.H2Adapter;
@@ -229,7 +228,7 @@ public abstract class FailoverExample
IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(true, true);
IDBAdapter dbAdapter = new H2Adapter();
- IDBConnectionProvider dbConnectionProvider = DBUtil.createConnectionProvider(dataSource);
+ IDBConnectionProvider dbConnectionProvider = dbAdapter.createConnectionProvider(dataSource);
return CDODBUtil.createStore(mappingStrategy, dbAdapter, dbConnectionProvider);
}
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/Server.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/Server.java
index 4ee530245b..4bcbafbc09 100644
--- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/Server.java
+++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/Server.java
@@ -18,7 +18,6 @@ import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
import org.eclipse.emf.cdo.server.net4j.CDONet4jServerUtil;
import org.eclipse.net4j.Net4jUtil;
-import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.IDBConnectionProvider;
import org.eclipse.net4j.db.h2.H2Adapter;
@@ -75,7 +74,7 @@ public class Server
IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(true, true);
IDBAdapter dbAdapter = new H2Adapter();
- IDBConnectionProvider dbConnectionProvider = DBUtil.createConnectionProvider(dataSource);
+ IDBConnectionProvider dbConnectionProvider = dbAdapter.createConnectionProvider(dataSource);
return CDODBUtil.createStore(mappingStrategy, dbAdapter, dbConnectionProvider);
}
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/AbstractOfflineExampleServer.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/AbstractOfflineExampleServer.java
index d257bdaa5a..bba02a56ee 100644
--- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/AbstractOfflineExampleServer.java
+++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/AbstractOfflineExampleServer.java
@@ -22,7 +22,6 @@ import org.eclipse.emf.cdo.server.db.CDODBUtil;
import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
import org.eclipse.net4j.acceptor.IAcceptor;
-import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.IDBConnectionProvider;
import org.eclipse.net4j.db.h2.H2Adapter;
@@ -225,7 +224,7 @@ public abstract class AbstractOfflineExampleServer
IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(true, true);
IDBAdapter dbAdapter = new H2Adapter();
- IDBConnectionProvider dbConnectionProvider = DBUtil.createConnectionProvider(dataSource);
+ IDBConnectionProvider dbConnectionProvider = dbAdapter.createConnectionProvider(dataSource);
return CDODBUtil.createStore(mappingStrategy, dbAdapter, dbConnectionProvider);
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IDBStore.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IDBStore.java
index 5fab3d742a..6c9083be1b 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IDBStore.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IDBStore.java
@@ -109,6 +109,9 @@ public interface IDBStore extends IStore, IDBConnectionProvider, CanHandleClient
*/
public interface Props
{
+ /**
+ * In minutes.
+ */
public static final String CONNECTION_KEEPALIVE_PERIOD = "connectionKeepAlivePeriod"; //$NON-NLS-1$
/**
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 a1c87a559f..734bc0a468 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
@@ -750,6 +750,8 @@ public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor,
@Override
protected void doActivate() throws Exception
{
+ super.doActivate();
+
DBStore store = getStore();
connection = store.getDatabase().getConnection();
connectionKeepAliveTask = new ConnectionKeepAliveTask(this);
@@ -776,6 +778,8 @@ public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor,
DBUtil.close(connection);
connection = null;
+
+ super.doDeactivate();
}
@Override
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 e276d9588b..bfc45eabf5 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
@@ -51,7 +51,7 @@ public class DBStoreFactory implements IStoreFactory
IMappingStrategy mappingStrategy = getMappingStrategy(repositoryName, repositoryProperties, storeConfig);
IDBAdapter dbAdapter = getDBAdapter(storeConfig);
DataSource dataSource = getDataSource(storeConfig);
- IDBConnectionProvider connectionProvider = DBUtil.createConnectionProvider(dataSource);
+ IDBConnectionProvider connectionProvider = dbAdapter.createConnectionProvider(dataSource);
DBStore store = new DBStore();
store.setMappingStrategy(mappingStrategy);
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/SQLQueryHandler.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/SQLQueryHandler.java
index 7f898f246c..d4ac989418 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/SQLQueryHandler.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/SQLQueryHandler.java
@@ -17,10 +17,12 @@ import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.util.CDOQueryInfo;
import org.eclipse.emf.cdo.server.IQueryContext;
import org.eclipse.emf.cdo.server.IQueryHandler;
+import org.eclipse.emf.cdo.server.db.IDBStore;
import org.eclipse.emf.cdo.server.db.IIDHandler;
import org.eclipse.net4j.db.DBException;
import org.eclipse.net4j.db.DBUtil;
+import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.IDBPreparedStatement;
import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability;
@@ -197,7 +199,11 @@ public class SQLQueryHandler implements IQueryHandler
resultSet = stmt.executeQuery();
if (firstResult > -1)
{
- resultSet.absolute(firstResult);
+ IDBStore store = (IDBStore)context.getView().getRepository().getStore();
+ IDBAdapter dbAdapter = store.getDBAdapter();
+
+ int row = dbAdapter.convertRowNumberToDriver(1 + firstResult);
+ resultSet.absolute(row);
}
String[] columnNames = null;
diff --git a/plugins/org.eclipse.emf.cdo.server.product/CDOServer.launch b/plugins/org.eclipse.emf.cdo.server.product/CDOServer.launch
index 8fe044366f..bb153e588f 100644
--- a/plugins/org.eclipse.emf.cdo.server.product/CDOServer.launch
+++ b/plugins/org.eclipse.emf.cdo.server.product/CDOServer.launch
@@ -31,8 +31,8 @@
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.eclipse.platform.ide"/>
<stringAttribute key="selectedPlugin" value="org.eclipse.emf.cdo"/>
-<stringAttribute key="selected_target_plugins" value="com.ibm.icu@default:default,com.mysql.jdbc,javax.xml,org.apache.derby,org.apache.felix.gogo.command,org.apache.felix.gogo.runtime,org.apache.felix.gogo.shell,org.eclipse.ant.core@default:default,org.eclipse.compare.core@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filesystem.win32.x86_64@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.resources.win32.x86_64,org.eclipse.core.resources@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.console,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.orbit.mongodb,org.eclipse.osgi.compatibility.state,org.eclipse.osgi@-1:true,org.eclipse.team.core@default:default,org.h2,org.hsqldb,org.postgresql"/>
-<stringAttribute key="selected_workspace_plugins" value="org.eclipse.emf.cdo.common@default:default,org.eclipse.emf.cdo.ecore.retrofit,org.eclipse.emf.cdo.examples.company@default:default,org.eclipse.emf.cdo.expressions,org.eclipse.emf.cdo.net4j@default:default,org.eclipse.emf.cdo.security@default:default,org.eclipse.emf.cdo.server,org.eclipse.emf.cdo.server.admin,org.eclipse.emf.cdo.server.db,org.eclipse.emf.cdo.server.mongodb,org.eclipse.emf.cdo.server.net4j,org.eclipse.emf.cdo.server.security,org.eclipse.emf.cdo@default:default,org.eclipse.net4j.db,org.eclipse.net4j.db.derby,org.eclipse.net4j.db.h2,org.eclipse.net4j.db.hsqldb,org.eclipse.net4j.db.jdbc,org.eclipse.net4j.db.mysql,org.eclipse.net4j.db.postgresql,org.eclipse.net4j.jvm,org.eclipse.net4j.tcp@default:default,org.eclipse.net4j.util@default:default,org.eclipse.net4j@default:default"/>
+<stringAttribute key="selected_target_plugins" value="com.ibm.icu@default:default,com.mysql.jdbc@default:default,javax.xml@default:default,org.apache.derby@default:default,org.apache.felix.gogo.command@default:default,org.apache.felix.gogo.runtime@default:default,org.apache.felix.gogo.shell@default:default,org.eclipse.ant.core@default:default,org.eclipse.compare.core@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filesystem.win32.x86_64@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.resources.win32.x86_64@default:false,org.eclipse.core.resources@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.console@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.orbit.mongodb@default:default,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi@-1:true,org.eclipse.team.core@default:default,org.h2@default:default,org.hsqldb@default:default,org.postgresql@default:default"/>
+<stringAttribute key="selected_workspace_plugins" value="org.eclipse.emf.cdo.common@default:default,org.eclipse.emf.cdo.ecore.retrofit@default:false,org.eclipse.emf.cdo.examples.company@default:default,org.eclipse.emf.cdo.expressions@default:default,org.eclipse.emf.cdo.net4j@default:default,org.eclipse.emf.cdo.security@default:default,org.eclipse.emf.cdo.server.admin@default:default,org.eclipse.emf.cdo.server.db@default:default,org.eclipse.emf.cdo.server.mongodb@default:default,org.eclipse.emf.cdo.server.net4j@default:default,org.eclipse.emf.cdo.server.security@default:default,org.eclipse.emf.cdo.server@default:default,org.eclipse.emf.cdo@default:default,org.eclipse.net4j.db.derby@default:default,org.eclipse.net4j.db.h2@default:default,org.eclipse.net4j.db.hsqldb@default:default,org.eclipse.net4j.db.jdbc@default:default,org.eclipse.net4j.db.mysql@default:default,org.eclipse.net4j.db.postgresql@default:default,org.eclipse.net4j.db@default:default,org.eclipse.net4j.jvm@default:default,org.eclipse.net4j.tcp@default:default,org.eclipse.net4j.util@default:default,org.eclipse.net4j@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/>
<stringAttribute key="templateConfig" value="${target_home}\configuration\config.ini"/>
<booleanAttribute key="tracing" value="false"/>
diff --git a/plugins/org.eclipse.emf.cdo.server.product/config/cdo-server.xml b/plugins/org.eclipse.emf.cdo.server.product/config/cdo-server.xml
index 2692ee9a53..f6032f249f 100644
--- a/plugins/org.eclipse.emf.cdo.server.product/config/cdo-server.xml
+++ b/plugins/org.eclipse.emf.cdo.server.product/config/cdo-server.xml
@@ -23,8 +23,8 @@
<property name="serializeCommits" value="false"/>
<property name="optimisticLockingTimeout" value="10000"/>
- <!-- Example http://wiki.eclipse.org/CDO/Security_Manager
<securityManager type="default" description="/security:annotation:home(/home)"/>
+ <!-- Example http://wiki.eclipse.org/CDO/Security_Manager
-->
<!-- Example http://bugs.eclipse.org/302775
@@ -105,11 +105,11 @@
<dbAdapter name="oracle"/>
<dataSource class="oracle.jdbc.pool.OracleDataSource"
driverType="thin"
- serverName="serverURL"
+ serverName="localhost"
portNumber="1521"
- databaseName="SID"
- user="user"
- password="passwd"/>
+ databaseName="TEST"
+ user="cdotest"
+ password="oracle"/>
-->
</store>
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/StoreAccessorBase.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/StoreAccessorBase.java
index 1689f2bb1a..28a7253f5b 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/StoreAccessorBase.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/StoreAccessorBase.java
@@ -67,6 +67,8 @@ public abstract class StoreAccessorBase extends Lifecycle implements IStoreAcces
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, StoreAccessorBase.class);
+ // private static int COUNT;
+
private Store store;
private Object context;
@@ -262,6 +264,18 @@ public abstract class StoreAccessorBase extends Lifecycle implements IStoreAcces
protected abstract CDOID getNextCDOID(CDORevision revision);
+ // @Override
+ // protected void doActivate() throws Exception
+ // {
+ // System.out.println("Active accessors: " + ++COUNT);
+ // }
+ //
+ // @Override
+ // protected void doDeactivate() throws Exception
+ // {
+ // System.out.println("Active accessors: " + --COUNT);
+ // }
+
protected void doPassivate() throws Exception
{
}
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (Oracle).launch b/plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (Oracle).launch
new file mode 100644
index 0000000000..61b7fb8250
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (Oracle).launch
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBOracle.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.emf.cdo.tests.db.AllTestsDBOracle"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.emf.cdo.tests.db"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m&#13;&#10;-Xmx2G&#13;&#10;-Dorg.eclipse.net4j.util.om.trace.disable=true&#13;&#10;-XX:+HeapDumpOnOutOfMemoryError"/>
+</launchConfiguration>
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.tests.db/META-INF/MANIFEST.MF
index d6da4d3d22..0ef4124802 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.tests.db/META-INF/MANIFEST.MF
@@ -16,6 +16,9 @@ Require-Bundle: org.eclipse.emf.cdo.tests;bundle-version="[4.0.0,5.0.0)";visibil
org.eclipse.net4j.db.mysql;bundle-version="[4.0.0,5.0.0)";visibility:=reexport,
org.eclipse.net4j.db.h2;bundle-version="[4.0.0,5.0.0)";visibility:=reexport,
org.eclipse.net4j.db.postgresql;bundle-version="[4.0.0,5.0.0)",
+ org.eclipse.net4j.db.jdbc;bundle-version="[4.0.0,5.0.0)",
+ org.eclipse.net4j.db.oracle;bundle-version="[1.0.0,2.0.0)",
+ oracle.database.driver;bundle-version="[6.0.0,7.0.0)",
org.eclipse.emf.cdo.common.db;bundle-version="[3.0.0,4.0.0)"
Eclipse-BuddyPolicy: dependent
Import-Package: com.mysql.jdbc.jdbc2.optional;version="[5.0.0,6.0.0)",
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AbstractSetupDBConfig.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AbstractSetupDBConfig.java
index 6140764cc2..2bb0951d49 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AbstractSetupDBConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AbstractSetupDBConfig.java
@@ -12,6 +12,7 @@ package org.eclipse.emf.cdo.tests.db;
import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
+import org.eclipse.net4j.db.DBException;
import org.eclipse.net4j.db.DBUtil;
import javax.sql.DataSource;
@@ -19,8 +20,6 @@ import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.List;
/**
* @author Victor Roldan Betancort
@@ -31,44 +30,45 @@ public abstract class AbstractSetupDBConfig extends DBConfig
private transient DataSource setupDataSource;
- private transient List<String> databases = new ArrayList<String>();
-
public AbstractSetupDBConfig(String name, boolean supportingAudits, boolean supportingBranches, boolean withRanges,
boolean copyOnBranch, IDGenerationLocation idGenerationLocation)
{
super(name, supportingAudits, supportingBranches, withRanges, copyOnBranch, idGenerationLocation);
}
- @Override
- protected DataSource createDataSource(String repoName)
+ protected String getDBName(String repoName)
{
- String dbName = "test_" + repoName;
- initDatabase(dbName);
-
- return createDataSourceForDB(dbName);
+ return "test_" + repoName;
}
@Override
- protected void deactivateRepositories()
+ protected DataSource createDataSource(String repoName)
{
- super.deactivateRepositories();
- for (String dbName : databases)
+ String dbName = getDBName(repoName);
+ initDatabase(dbName);
+
+ try
+ {
+ return createDataSourceForDB(dbName);
+ }
+ catch (SQLException ex)
{
- dropDatabase(dbName);
+ throw new DBException(ex);
}
}
- private void initDatabase(String dbName)
+ protected void initDatabase(String dbName)
{
dropDatabase(dbName);
+
Connection connection = null;
Statement stmt = null;
try
{
- connection = getSetupDataSource().getConnection();
+ connection = getSetupConnection();
stmt = connection.createStatement();
- stmt.execute("CREATE DATABASE " + dbName);
+ initDatabase(connection, stmt, dbName);
}
catch (SQLException ignore)
{
@@ -80,16 +80,21 @@ public abstract class AbstractSetupDBConfig extends DBConfig
}
}
- private void dropDatabase(String dbName)
+ protected void initDatabase(Connection connection, Statement stmt, String dbName) throws SQLException
+ {
+ stmt.execute("CREATE DATABASE " + dbName);
+ }
+
+ protected void dropDatabase(String dbName)
{
Connection connection = null;
Statement stmt = null;
try
{
- connection = getSetupDataSource().getConnection();
+ connection = getSetupConnection();
stmt = connection.createStatement();
- stmt.execute("DROP DATABASE " + dbName);
+ dropDatabase(connection, stmt, dbName);
}
catch (SQLException ignore)
{
@@ -101,7 +106,24 @@ public abstract class AbstractSetupDBConfig extends DBConfig
}
}
- private DataSource getSetupDataSource()
+ protected void dropDatabase(Connection connection, Statement stmt, String dbName) throws SQLException
+ {
+ stmt.execute("DROP DATABASE " + dbName);
+ }
+
+ protected final Connection getSetupConnection()
+ {
+ try
+ {
+ return getSetupDataSource().getConnection();
+ }
+ catch (SQLException ex)
+ {
+ throw new DBException(ex);
+ }
+ }
+
+ protected final DataSource getSetupDataSource() throws SQLException
{
if (setupDataSource == null)
{
@@ -113,7 +135,7 @@ public abstract class AbstractSetupDBConfig extends DBConfig
/**
* Note that <code>dbName</code> can be <code>null</code>, in which case a <i>setup</i> datasource must be returned.
- * A connection form a setup< datasource can be used to create or drop other databases.
+ * A connection from a setup datasource can be used to create or drop other databases.
*/
- protected abstract DataSource createDataSourceForDB(String dbName);
+ protected abstract DataSource createDataSourceForDB(String dbName) throws SQLException;
}
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBOracle.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBOracle.java
new file mode 100644
index 0000000000..6ece6ee4a7
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBOracle.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2010-2013 Eike Stepper (Berlin, Germany) and others.
+ * 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
+ * Stefan Winkler - introduced variable mapping strategies
+ */
+package org.eclipse.emf.cdo.tests.db;
+
+import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author Eike Stepper
+ */
+public class AllTestsDBOracle extends DBConfigs
+{
+ public static Test suite()
+ {
+ return new AllTestsDBOracle().getTestSuite();
+ }
+
+ @Override
+ protected void initConfigSuites(TestSuite parent)
+ {
+ addScenarios(parent, IDGenerationLocation.STORE);
+ // addScenarios(parent, IDGenerationLocation.CLIENT);
+ }
+
+ private void addScenarios(TestSuite parent, IDGenerationLocation idGenerationLocation)
+ {
+ addScenario(parent, new OracleConfig.SingleUser(false, false, idGenerationLocation), JVM, NATIVE);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfig.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfig.java
index d12df32e2c..7bce439fdd 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfig.java
@@ -18,7 +18,6 @@ import org.eclipse.emf.cdo.server.db.mapping.ITypeMapping;
import org.eclipse.emf.cdo.server.internal.db.mapping.TypeMappingRegistry;
import org.eclipse.emf.cdo.tests.config.impl.RepositoryConfig;
-import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.IDBConnectionProvider;
import org.eclipse.net4j.util.container.IPluginContainer;
@@ -34,6 +33,8 @@ import java.util.Set;
*/
public abstract class DBConfig extends RepositoryConfig
{
+ public static final String CAPABILITY = "DB";
+
public static final String CAPABILITY_RANGES = "DB.ranges";
public static final String CAPABILITY_COPY_ON_BRANCH = "DB.copy.on.branch";
@@ -46,6 +47,8 @@ public abstract class DBConfig extends RepositoryConfig
private boolean copyOnBranch;
+ private transient IDBAdapter dbAdapter;
+
public DBConfig(String name, boolean supportingAudits, boolean supportingBranches, boolean withRanges,
boolean copyOnBranch, IDGenerationLocation idGenerationLocation)
{
@@ -58,6 +61,7 @@ public abstract class DBConfig extends RepositoryConfig
public void initCapabilities(Set<String> capabilities)
{
super.initCapabilities(capabilities);
+ capabilities.add(CAPABILITY);
capabilities.add(getDBAdapterName());
if (isWithRanges())
@@ -71,6 +75,16 @@ public abstract class DBConfig extends RepositoryConfig
}
}
+ protected IDBAdapter getDBAdapter()
+ {
+ if (dbAdapter == null)
+ {
+ dbAdapter = createDBAdapter();
+ }
+
+ return dbAdapter;
+ }
+
protected abstract String getDBAdapterName();
@Override
@@ -108,10 +122,10 @@ public abstract class DBConfig extends RepositoryConfig
IMappingStrategy mappingStrategy = createMappingStrategy();
mappingStrategy.setProperties(createMappingStrategyProperties());
- IDBAdapter dbAdapter = createDBAdapter();
+ IDBAdapter dbAdapter = getDBAdapter();
DataSource dataSource = createDataSource(repoName);
- IDBConnectionProvider connectionProvider = DBUtil.createConnectionProvider(dataSource);
+ IDBConnectionProvider connectionProvider = dbAdapter.createConnectionProvider(dataSource);
Map<String, String> props = new HashMap<String, String>();
// props.put(IDBStore.Props.ID_COLUMN_LENGTH, "66");
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBStoreTest.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBStoreTest.java
index 0818db19c3..bf9cdda15b 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBStoreTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBStoreTest.java
@@ -11,6 +11,8 @@
*/
package org.eclipse.emf.cdo.tests.db;
+import oracle.jdbc.pool.OracleDataSource;
+
import org.eclipse.emf.cdo.common.model.EMFUtil;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.session.CDOSession;
@@ -23,7 +25,10 @@ import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.emf.cdo.util.CommitException;
import org.eclipse.emf.cdo.view.CDOView;
+import org.eclipse.net4j.db.DBUtil;
+import org.eclipse.net4j.db.jdbc.DelegatingConnection;
import org.eclipse.net4j.util.WrappedException;
+import org.eclipse.net4j.util.security.IUserAware;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
@@ -34,13 +39,48 @@ import org.eclipse.emf.ecore.EcoreFactory;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.util.EcoreUtil;
+import java.sql.Connection;
import java.util.GregorianCalendar;
+import java.util.List;
/**
* @author Stefan Winkler
*/
public class DBStoreTest extends AbstractCDOTest
{
+ public static void main(String[] args) throws Exception
+ {
+ Connection connection = null;
+
+ try
+ {
+ final String userName = "test_repo1";
+ OracleDataSource dataSource = OracleConfig.createDataSourceForUser(userName);
+
+ class UserConnection extends DelegatingConnection.Default implements IUserAware
+ {
+ public UserConnection(Connection delegate)
+ {
+ super(delegate);
+ }
+
+ public String getUserID()
+ {
+ return userName;
+ }
+ }
+
+ connection = new UserConnection(dataSource.getConnection());
+
+ List<String> names = DBUtil.getAllTableNames(connection, null);
+ System.out.println(names);
+ }
+ finally
+ {
+ DBUtil.close(connection);
+ }
+ }
+
// Bug 256462
public void testInsertNull() throws Exception
{
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/MysqlConfig.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/MysqlConfig.java
index 309b87065d..82f69fb120 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/MysqlConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/MysqlConfig.java
@@ -19,6 +19,8 @@ import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
import javax.sql.DataSource;
+import java.sql.SQLException;
+
/**
* @author Simon McDuff
*/
@@ -57,7 +59,7 @@ public class MysqlConfig extends AbstractSetupDBConfig
}
@Override
- protected DataSource createDataSourceForDB(String dbName)
+ protected DataSource createDataSourceForDB(String dbName) throws SQLException
{
MysqlDataSource dataSource = new MysqlDataSource();
dataSource.setUrl("jdbc:mysql://" + HOST);
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/Net4jDBTest.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/Net4jDBTest.java
index cdc06bbc14..e96b5caf9b 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/Net4jDBTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/Net4jDBTest.java
@@ -18,6 +18,8 @@ import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.IDBDatabase;
import org.eclipse.net4j.db.ddl.IDBSchema;
import org.eclipse.net4j.db.ddl.IDBTable;
+import org.eclipse.net4j.db.oracle.OracleAdapter;
+import org.eclipse.net4j.spi.db.DBAdapter;
import org.eclipse.net4j.util.collection.Pair;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
@@ -67,7 +69,10 @@ public class Net4jDBTest extends AbstractCDOTest
public void testBinary() throws Exception
{
- registerColumn(DBType.BINARY, new byte[0]);
+ if (!isOracle())
+ {
+ registerColumn(DBType.BINARY, new byte[0]);
+ }
byte[] data = new byte[100];
for (int i = 0; i < data.length; i++)
@@ -81,7 +86,10 @@ public class Net4jDBTest extends AbstractCDOTest
public void testVarBinary() throws Exception
{
- registerColumn(DBType.VARBINARY, new byte[0]);
+ if (!isOracle())
+ {
+ registerColumn(DBType.VARBINARY, new byte[0]);
+ }
byte[] data = new byte[100];
for (int i = 0; i < data.length; i++)
@@ -95,7 +103,10 @@ public class Net4jDBTest extends AbstractCDOTest
public void testLongVarBinary() throws Exception
{
- registerColumn(DBType.LONGVARBINARY, new byte[0]);
+ if (!isOracle())
+ {
+ registerColumn(DBType.LONGVARBINARY, new byte[0]);
+ }
byte[] data = new byte[100];
for (int i = 0; i < data.length; i++)
@@ -126,6 +137,7 @@ public class Net4jDBTest extends AbstractCDOTest
doTest(getName());
}
+ @Skips("oracle")
public void testBlobLength0() throws Exception
{
registerColumn(DBType.BLOB, new byte[0]);
@@ -143,11 +155,16 @@ public class Net4jDBTest extends AbstractCDOTest
{
registerColumn(DBType.CHAR, "0");
registerColumn(DBType.CHAR, "a");
- registerColumn(DBType.CHAR, "\255"); // Fails for DB2
+ registerColumn(DBType.CHAR, "\377"); // Fails for DB2
registerColumn(DBType.CHAR, "\u1234"); // Fails for DB2
doTest(getName());
}
+ public static void main(String[] args)
+ {
+ System.out.println((int)'\377');
+ }
+
public void testClob() throws Exception
{
registerColumn(DBType.CLOB, "Test");
@@ -215,7 +232,11 @@ public class Net4jDBTest extends AbstractCDOTest
public void testDouble() throws Exception
{
- registerColumn(DBType.DOUBLE, new Double(Double.MAX_VALUE));
+ if (!isOracle())
+ {
+ registerColumn(DBType.DOUBLE, new Double(Double.MAX_VALUE));
+ }
+
// registerColumn(DBType.DOUBLE, new Double(Double.MIN_VALUE));
registerColumn(DBType.DOUBLE, -.1d);
registerColumn(DBType.DOUBLE, 3.33333d);
@@ -273,12 +294,14 @@ public class Net4jDBTest extends AbstractCDOTest
public void testVarChar() throws Exception
{
registerColumn(DBType.VARCHAR, "");
- registerColumn(DBType.VARCHAR, "\n");
- registerColumn(DBType.VARCHAR, "\t");
- registerColumn(DBType.VARCHAR, "\r");
- registerColumn(DBType.VARCHAR, "\u1234");
- registerColumn(DBType.VARCHAR, "The quick brown fox jumps over the lazy dog.");
- registerColumn(DBType.VARCHAR, "\\,:\",\'");
+ // registerColumn(DBType.VARCHAR, null);
+ // registerColumn(DBType.VARCHAR, " ");
+ // registerColumn(DBType.VARCHAR, "\n");
+ // registerColumn(DBType.VARCHAR, "\t");
+ // registerColumn(DBType.VARCHAR, "\r");
+ // registerColumn(DBType.VARCHAR, "\u1234");
+ // registerColumn(DBType.VARCHAR, "The quick brown fox jumps over the lazy dog.");
+ // registerColumn(DBType.VARCHAR, "\\,:\",\'");
doTest(getName());
}
@@ -286,12 +309,16 @@ public class Net4jDBTest extends AbstractCDOTest
public void testLongVarChar() throws Exception
{
registerColumn(DBType.LONGVARCHAR, "");
- registerColumn(DBType.LONGVARCHAR, "\n");
- registerColumn(DBType.LONGVARCHAR, "\t");
- registerColumn(DBType.LONGVARCHAR, "\r");
- registerColumn(DBType.LONGVARCHAR, "\u1234");
- registerColumn(DBType.LONGVARCHAR, "The quick brown fox jumps over the lazy dog.");
- registerColumn(DBType.LONGVARCHAR, "\\,:\",\'");
+
+ if (!isOracle()) // Only 1 LONGVARCHAR allowed per table
+ {
+ registerColumn(DBType.LONGVARCHAR, "\n");
+ registerColumn(DBType.LONGVARCHAR, "\t");
+ registerColumn(DBType.LONGVARCHAR, "\r");
+ registerColumn(DBType.LONGVARCHAR, "\u1234");
+ registerColumn(DBType.LONGVARCHAR, "The quick brown fox jumps over the lazy dog.");
+ registerColumn(DBType.LONGVARCHAR, "\\,:\",\'");
+ }
doTest(getName());
}
@@ -301,7 +328,11 @@ public class Net4jDBTest extends AbstractCDOTest
registerColumn(DBType.DATE, new GregorianCalendar(2010, 04, 21).getTimeInMillis());
registerColumn(DBType.DATE, new GregorianCalendar(1950, 04, 21).getTimeInMillis());
registerColumn(DBType.DATE, new GregorianCalendar(2030, 12, 31).getTimeInMillis());
- registerColumn(DBType.DATE, new GregorianCalendar(0, 0, 0).getTimeInMillis()); // Fails for DB2
+
+ if (!isOracle())
+ {
+ registerColumn(DBType.DATE, new GregorianCalendar(0, 0, 0).getTimeInMillis()); // Fails for DB2 and Oracle
+ }
doTest(getName());
}
@@ -359,7 +390,6 @@ public class Net4jDBTest extends AbstractCDOTest
IDBDatabase database = store.getDatabase();
database.updateSchema(new IDBDatabase.RunnableWithSchema()
{
-
public void run(IDBSchema schema)
{
IDBTable table = schema.addTable(tableName);
@@ -392,7 +422,18 @@ public class Net4jDBTest extends AbstractCDOTest
StringBuilder builder = new StringBuilder("INSERT INTO " + tableName + " VALUES (");
for (Pair<DBType, Object> column : columns)
{
- writeTypeValue(outs, column.getElement1(), column.getElement2());
+ Object value = column.getElement2();
+ if (value instanceof String)
+ {
+ String str = (String)value;
+
+ DBStore store = (DBStore)getRepository().getStore();
+ IDBDatabase database = store.getDatabase();
+ DBAdapter adapter = (DBAdapter)database.getAdapter();
+ value = adapter.convertString((PreparedStatement)null, 0, str);
+ }
+
+ writeTypeValue(outs, column.getElement1(), value);
if (first)
{
builder.append("?");
@@ -470,6 +511,12 @@ public class Net4jDBTest extends AbstractCDOTest
private void assertEquals(Object expected, Object actual, DBType dbType, int c)
{
+ if (expected == null || actual == null)
+ {
+ assertEquals("Error in column " + c + " with type " + dbType, expected, actual);
+ return;
+ }
+
Class<? extends Object> type = expected.getClass();
if (type.isArray())
{
@@ -647,7 +694,10 @@ public class Net4jDBTest extends AbstractCDOTest
case VARCHAR:
case LONGVARCHAR:
- return ins.readString();
+ DBStore store = (DBStore)getRepository().getStore();
+ IDBDatabase database = store.getDatabase();
+ DBAdapter adapter = (DBAdapter)database.getAdapter();
+ return adapter.convertString((ResultSet)null, 0, ins.readString());
case CLOB:
{
@@ -706,4 +756,10 @@ public class Net4jDBTest extends AbstractCDOTest
{
return 1000L * 60L * minutes;
}
+
+ private boolean isOracle()
+ {
+ DBStore store = (DBStore)getRepository().getStore();
+ return OracleAdapter.NAME.equals(store.getDBAdapter().getName());
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/OracleConfig.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/OracleConfig.java
new file mode 100644
index 0000000000..42a70de207
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/OracleConfig.java
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2011-2013 Eike Stepper (Berlin, Germany) and others.
+ * 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.tests.db;
+
+import oracle.jdbc.pool.OracleDataSource;
+
+import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
+import org.eclipse.emf.cdo.server.db.IDBStore;
+import org.eclipse.emf.cdo.tests.db.bundle.OM;
+
+import org.eclipse.net4j.db.DBUtil;
+import org.eclipse.net4j.db.IDBAdapter;
+import org.eclipse.net4j.db.oracle.OracleAdapter;
+import org.eclipse.net4j.util.tests.AbstractOMTest;
+
+import javax.sql.DataSource;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Map;
+
+/**
+ * @author Simon McDuff
+ */
+public abstract class OracleConfig extends AbstractSetupDBConfig
+{
+ public static final String DB_ADAPTER_NAME = OracleAdapter.NAME;
+
+ private static final String DRIVER_TYPE = System.getProperty("test.oracle.drivertype", "thin");
+
+ private static final String SERVER_NAME = System.getProperty("test.oracle.servername", "localhost");
+
+ private static final int PORT_NUMBER = Integer.getInteger("test.oracle.portnumber", 1521);
+
+ private static final String DATABASE_NAME = System.getProperty("test.oracle.databasename", "TEST");
+
+ private static final String USER = System.getProperty("test.oracle.user", "cdotest");
+
+ private static final String PASSWORD = System.getProperty("test.oracle.password", "oracle");
+
+ private static final long serialVersionUID = 1L;
+
+ public OracleConfig(boolean supportingAudits, boolean supportingBranches, IDGenerationLocation idGenerationLocation)
+ {
+ super(DB_ADAPTER_NAME, supportingAudits, supportingBranches, false, false, idGenerationLocation);
+ }
+
+ @Override
+ protected String getDBAdapterName()
+ {
+ return DB_ADAPTER_NAME;
+ }
+
+ @Override
+ protected IDBAdapter createDBAdapter()
+ {
+ return new OracleAdapter();
+ }
+
+ @Override
+ protected void initRepositoryProperties(Map<String, String> props)
+ {
+ super.initRepositoryProperties(props);
+ props.put(IDBStore.Props.CONNECTION_KEEPALIVE_PERIOD, "5");
+ props.put(IDBStore.Props.READER_POOL_CAPACITY, "5");
+ props.put(IDBStore.Props.WRITER_POOL_CAPACITY, "5");
+ }
+
+ protected String getUserName(String dbName)
+ {
+ return USER;
+ }
+
+ @Override
+ protected DataSource createDataSourceForDB(String dbName) throws SQLException
+ {
+ String userName = getUserName(dbName);
+ return createDataSourceForUser(userName);
+ }
+
+ public static OracleDataSource createDataSourceForUser(String userName) throws SQLException
+ {
+ OracleDataSource dataSource = new OracleDataSource();
+ dataSource.setDriverType(DRIVER_TYPE);
+ dataSource.setServerName(SERVER_NAME);
+ dataSource.setPortNumber(PORT_NUMBER);
+ dataSource.setDatabaseName(DATABASE_NAME);
+ dataSource.setUser(userName);
+ dataSource.setPassword(PASSWORD);
+ return dataSource;
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class SingleUser extends OracleConfig
+ {
+ private static final long serialVersionUID = 1L;
+
+ public SingleUser(boolean supportingAudits, boolean supportingBranches, IDGenerationLocation idGenerationLocation)
+ {
+ super(supportingAudits, supportingBranches, idGenerationLocation);
+ }
+
+ @Override
+ protected void initDatabase(String dbName)
+ {
+ if (!getDBName(REPOSITORY_NAME).equals(dbName))
+ {
+ OM.LOG.info("Skipping database " + dbName + " in " + getCurrentTest());
+ AbstractOMTest.skipTest();
+ }
+
+ super.initDatabase(dbName);
+ }
+
+ @Override
+ protected void dropDatabase(Connection connection, Statement stmt, String dbName) throws SQLException
+ {
+ OM.LOG.info("Dropping all tables...");
+ DBUtil.dropAllTables(connection, null);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class MultiUser extends OracleConfig
+ {
+ private static final long serialVersionUID = 1L;
+
+ public MultiUser(boolean supportingAudits, boolean supportingBranches, IDGenerationLocation idGenerationLocation)
+ {
+ super(supportingAudits, supportingBranches, idGenerationLocation);
+ }
+
+ @Override
+ protected void initDatabase(Connection connection, Statement stmt, String dbName) throws SQLException
+ {
+ String userName = getUserName(dbName);
+ stmt.execute("CREATE USER " + userName + " IDENTIFIED BY oracle");
+ stmt.execute("GRANT DBA TO " + userName);
+ }
+
+ @Override
+ protected void dropDatabase(Connection connection, Statement stmt, String dbName) throws SQLException
+ {
+ String userName = getUserName(dbName);
+ stmt.execute("DROP USER " + userName + " CASCADE");
+ }
+
+ @Override
+ protected String getUserName(String dbName)
+ {
+ if (dbName == null)
+ {
+ return USER;
+ }
+
+ return dbName;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/PostgresqlConfig.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/PostgresqlConfig.java
index d5d34f4a14..32a13f1bfe 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/PostgresqlConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/PostgresqlConfig.java
@@ -19,6 +19,8 @@ import org.postgresql.ds.PGSimpleDataSource;
import javax.sql.DataSource;
+import java.sql.SQLException;
+
/**
* @author Victor Roldan Betancort
*/
@@ -55,7 +57,7 @@ public class PostgresqlConfig extends AbstractSetupDBConfig
}
@Override
- protected DataSource createDataSourceForDB(String dbName)
+ protected DataSource createDataSourceForDB(String dbName) throws SQLException
{
PGSimpleDataSource dataSource = new PGSimpleDataSource();
dataSource.setServerName(HOST);
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/DBOfflineConfig.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/DBOfflineConfig.java
index 602c0d38b5..6d0b193b4b 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/DBOfflineConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/DBOfflineConfig.java
@@ -17,7 +17,6 @@ import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
import org.eclipse.emf.cdo.tests.config.impl.RepositoryConfig.OfflineConfig;
import org.eclipse.emf.cdo.tests.db.DBConfig;
-import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.IDBConnectionProvider;
import org.eclipse.net4j.util.container.IPluginContainer;
@@ -88,7 +87,7 @@ public abstract class DBOfflineConfig extends OfflineConfig
IDBAdapter dbAdapter = createDBAdapter();
DataSource dataSource = createDataSource(repoName);
- IDBConnectionProvider connectionProvider = DBUtil.createConnectionProvider(dataSource);
+ IDBConnectionProvider connectionProvider = dbAdapter.createConnectionProvider(dataSource);
return CDODBUtil.createStore(mappingStrategy, dbAdapter, connectionProvider);
}
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/revisioncache/AbstractDBRevisionCacheTest.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/revisioncache/AbstractDBRevisionCacheTest.java
index 4b0882a2e9..458260a627 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/revisioncache/AbstractDBRevisionCacheTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/revisioncache/AbstractDBRevisionCacheTest.java
@@ -43,9 +43,11 @@ public abstract class AbstractDBRevisionCacheTest extends AbstractRevisionCacheT
clearDb(dataSource);
+ IDBAdapter dbAdapter = getAdapter();
+
CDORevisionCache revisionCache = CDOCommonDBUtil.createDBCache(//
- getAdapter() //
- , DBUtil.createConnectionProvider(dataSource)//
+ dbAdapter //
+ , dbAdapter.createConnectionProvider(dataSource)//
, CDOListFactory.DEFAULT//
, session.getPackageRegistry() //
, ((InternalCDOSession)session).getRevisionManager().getFactory());
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/CommitInfoTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/CommitInfoTest.java
index 3a17706197..5be4c7c91e 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/CommitInfoTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/CommitInfoTest.java
@@ -45,6 +45,8 @@ public class CommitInfoTest extends AbstractCDOTest
{
private static final String REPO_NAME = "commitinforepo";
+ // private static final String REPO_NAME = IRepositoryConfig.REPOSITORY_NAME;
+
private static final String USER_ID = "stepper";
private static final char[] PASSWORD = "eike2010".toCharArray();
@@ -200,6 +202,7 @@ public class CommitInfoTest extends AbstractCDOTest
@Skips("MongoDB")
@CleanRepositoriesBefore(reason = "Commit info counting")
+ @CleanRepositoriesAfter(reason = "Commit info counting")
public void testServerUser() throws Exception
{
UserManager userManager = new UserManager();
@@ -232,6 +235,7 @@ public class CommitInfoTest extends AbstractCDOTest
@Skips("MongoDB")
@CleanRepositoriesBefore(reason = "Commit info counting")
+ @CleanRepositoriesAfter(reason = "Commit info counting")
public void testServerComment() throws Exception
{
CDOSession session = openSession();
@@ -257,6 +261,7 @@ public class CommitInfoTest extends AbstractCDOTest
@Skips("MongoDB")
@CleanRepositoriesBefore(reason = "Commit info counting")
+ @CleanRepositoriesAfter(reason = "Commit info counting")
public void testServerTimestampWithBranch() throws Exception
{
CDOSession session = openSession();
@@ -280,6 +285,7 @@ public class CommitInfoTest extends AbstractCDOTest
@Skips("MongoDB")
@CleanRepositoriesBefore(reason = "Commit info counting")
+ @CleanRepositoriesAfter(reason = "Commit info counting")
public void testServerBranchWithBranch() throws Exception
{
CDOSession session = openSession();
@@ -326,6 +332,7 @@ public class CommitInfoTest extends AbstractCDOTest
@Skips("MongoDB")
@CleanRepositoriesBefore(reason = "Commit info counting")
+ @CleanRepositoriesAfter(reason = "Commit info counting")
public void testServerUserWithBranch() throws Exception
{
UserManager userManager = new UserManager();
@@ -359,6 +366,7 @@ public class CommitInfoTest extends AbstractCDOTest
@Skips("MongoDB")
@CleanRepositoriesBefore(reason = "Commit info counting")
+ @CleanRepositoriesAfter(reason = "Commit info counting")
public void testServerCommentWithBranch() throws Exception
{
CDOSession session = openSession();
@@ -503,6 +511,7 @@ public class CommitInfoTest extends AbstractCDOTest
}
@CleanRepositoriesBefore(reason = "Commit info counting")
+ @CleanRepositoriesAfter(reason = "Commit info counting")
public void testClientTimestamp() throws Exception
{
CDOSession session = openSession();
@@ -522,6 +531,7 @@ public class CommitInfoTest extends AbstractCDOTest
}
@CleanRepositoriesBefore(reason = "Commit info counting")
+ @CleanRepositoriesAfter(reason = "Commit info counting")
public void testClientBranch() throws Exception
{
CDOSession session = openSession();
@@ -542,6 +552,7 @@ public class CommitInfoTest extends AbstractCDOTest
@Requires(IRepositoryConfig.CAPABILITY_BRANCHING)
@CleanRepositoriesBefore(reason = "Commit info counting")
+ @CleanRepositoriesAfter(reason = "Commit info counting")
public void testClientSubBranch() throws Exception
{
CDOSession session = openSession();
@@ -562,6 +573,7 @@ public class CommitInfoTest extends AbstractCDOTest
}
@CleanRepositoriesBefore(reason = "Commit info counting")
+ @CleanRepositoriesAfter(reason = "Commit info counting")
public void testClientUser() throws Exception
{
UserManager userManager = new UserManager();
@@ -591,6 +603,7 @@ public class CommitInfoTest extends AbstractCDOTest
}
@CleanRepositoriesBefore(reason = "Commit info counting")
+ @CleanRepositoriesAfter(reason = "Commit info counting")
public void testClientComment() throws Exception
{
CDOSession session = openSession();
@@ -613,6 +626,7 @@ public class CommitInfoTest extends AbstractCDOTest
}
@CleanRepositoriesBefore(reason = "Commit info counting")
+ @CleanRepositoriesAfter(reason = "Commit info counting")
public void testClientTimestampWithBranch() throws Exception
{
CDOSession session = openSession();
@@ -632,6 +646,7 @@ public class CommitInfoTest extends AbstractCDOTest
}
@CleanRepositoriesBefore(reason = "Commit info counting")
+ @CleanRepositoriesAfter(reason = "Commit info counting")
public void testClientBranchWithBranch() throws Exception
{
CDOSession session = openSession();
@@ -671,6 +686,7 @@ public class CommitInfoTest extends AbstractCDOTest
}
@CleanRepositoriesBefore(reason = "Commit info counting")
+ @CleanRepositoriesAfter(reason = "Commit info counting")
public void testClientUserWithBranch() throws Exception
{
UserManager userManager = new UserManager();
@@ -700,6 +716,7 @@ public class CommitInfoTest extends AbstractCDOTest
}
@CleanRepositoriesBefore(reason = "Commit info counting")
+ @CleanRepositoriesAfter(reason = "Commit info counting")
public void testClientCommentWithBranch() throws Exception
{
CDOSession session = openSession();
@@ -831,6 +848,7 @@ public class CommitInfoTest extends AbstractCDOTest
}
@CleanRepositoriesBefore(reason = "Commit info counting")
+ @CleanRepositoriesAfter(reason = "Commit info counting")
public void testMultipleEntries() throws Exception
{
CDOSession session = openSession();
@@ -860,6 +878,7 @@ public class CommitInfoTest extends AbstractCDOTest
}
@CleanRepositoriesBefore(reason = "Commit info counting")
+ @CleanRepositoriesAfter(reason = "Commit info counting")
public void testMultipleEntriesByCountDown() throws Exception
{
CDOSession session = openSession();
@@ -890,6 +909,7 @@ public class CommitInfoTest extends AbstractCDOTest
}
@CleanRepositoriesBefore(reason = "Commit info counting")
+ @CleanRepositoriesAfter(reason = "Commit info counting")
public void testMultipleEntriesByCountUp() throws Exception
{
CDOSession session = openSession();
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SessionTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SessionTest.java
index c4b6977412..5920f88e99 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SessionTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SessionTest.java
@@ -251,6 +251,7 @@ public class SessionTest extends AbstractCDOTest
session2.close();
}
+ @CleanRepositoriesAfter(reason = "Repository not used again")
public void testNoAuthentication() throws Exception
{
IRepository repository = getRepository("authrepo1");
@@ -264,6 +265,7 @@ public class SessionTest extends AbstractCDOTest
session.close();
}
+ @CleanRepositoriesAfter(reason = "Repository not used again")
public void testWithAuthentication() throws Exception
{
UserManager userManager = new UserManager();
@@ -284,6 +286,7 @@ public class SessionTest extends AbstractCDOTest
session.close();
}
+ @CleanRepositoriesAfter(reason = "Repository not used again")
public void testWithAuthenticationNoCredentialsProvider() throws Exception
{
UserManager userManager = new UserManager();
@@ -304,6 +307,7 @@ public class SessionTest extends AbstractCDOTest
}
}
+ @CleanRepositoriesAfter(reason = "Repository not used again")
public void testWithAuthenticationNoCredentials() throws Exception
{
UserManager userManager = new UserManager();
@@ -326,6 +330,7 @@ public class SessionTest extends AbstractCDOTest
}
}
+ @CleanRepositoriesAfter(reason = "Repository not used again")
public void testWithAuthenticationWrongCredentials() throws Exception
{
UserManager userManager = new UserManager();
@@ -349,6 +354,7 @@ public class SessionTest extends AbstractCDOTest
}
}
+ @CleanRepositoriesAfter(reason = "Repository not used again")
public void testWithAuthenticationNoUserID() throws Exception
{
UserManager userManager = new UserManager();
@@ -372,6 +378,7 @@ public class SessionTest extends AbstractCDOTest
}
}
+ @CleanRepositoriesAfter(reason = "Repository not used again")
public void testWithAuthenticationNoPassword() throws Exception
{
UserManager userManager = new UserManager();
diff --git a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/efs/CDOFS.java b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/efs/CDOFS.java
index ada68d1f52..a2a8939167 100644
--- a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/efs/CDOFS.java
+++ b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/efs/CDOFS.java
@@ -23,7 +23,6 @@ import org.eclipse.emf.cdo.workspace.CDOWorkspaceUtil;
import org.eclipse.emf.cdo.workspace.internal.efs.CDOWorkspaceFileSystem;
import org.eclipse.emf.cdo.workspace.internal.efs.CDOWorkspaceStore;
-import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.IDBConnectionProvider;
import org.eclipse.net4j.db.h2.H2Adapter;
@@ -129,12 +128,13 @@ public final class CDOFS
private static IDBStore createLocalStore(File projectFolder)
{
+ DataSource dataSource = createLocalDataSource(new File(projectFolder, "local"));
+
IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(false);
IDBAdapter dbAdapter = createLocalAdapter();
- IDBConnectionProvider dbConnectionProvider = DBUtil.createConnectionProvider(createLocalDataSource(new File(
- projectFolder, "local")));
- IDBStore local = CDODBUtil.createStore(mappingStrategy, dbAdapter, dbConnectionProvider);
- return local;
+ IDBConnectionProvider dbConnectionProvider = dbAdapter.createConnectionProvider(dataSource);
+
+ return CDODBUtil.createStore(mappingStrategy, dbAdapter, dbConnectionProvider);
}
private static IDBAdapter createLocalAdapter()
diff --git a/plugins/org.eclipse.net4j.db.h2/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.db.h2/META-INF/MANIFEST.MF
index 9ee32462bc..97fc700a69 100644
--- a/plugins/org.eclipse.net4j.db.h2/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.db.h2/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.net4j.db.h2;singleton:=true
-Bundle-Version: 4.2.0.qualifier
+Bundle-Version: 4.2.100.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-ClassPath: .
@@ -18,6 +18,6 @@ Import-Package: org.h2;version="[1.0.0,2.0.0)";resolution:=optional,
org.h2.value;version="[1.0.0,2.0.0)";resolution:=optional
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.net4j.db;bundle-version="[4.0.0,5.0.0)";visibility:=reexport
-Export-Package: org.eclipse.net4j.db.h2;version="4.2.0",
- org.eclipse.net4j.db.internal.h2.bundle;version="4.2.0";x-internal:=true
+Export-Package: org.eclipse.net4j.db.h2;version="4.2.100",
+ org.eclipse.net4j.db.internal.h2.bundle;version="4.2.100";x-internal:=true
Eclipse-RegisterBuddy: org.eclipse.net4j.db
diff --git a/plugins/org.eclipse.net4j.db.h2/src/org/eclipse/net4j/db/h2/H2Adapter.java b/plugins/org.eclipse.net4j.db.h2/src/org/eclipse/net4j/db/h2/H2Adapter.java
index 02ef7e0c81..b2df3d8a9f 100644
--- a/plugins/org.eclipse.net4j.db.h2/src/org/eclipse/net4j/db/h2/H2Adapter.java
+++ b/plugins/org.eclipse.net4j.db.h2/src/org/eclipse/net4j/db/h2/H2Adapter.java
@@ -97,6 +97,15 @@ public class H2Adapter extends DBAdapter
}
/**
+ * See H2 bug http://code.google.com/p/h2database/issues/detail?id=508
+ */
+ @Override
+ public int convertRowNumberToDriver(int row)
+ {
+ return row - 1;
+ }
+
+ /**
* @since 4.2
*/
public static void createSchema(DataSource dataSource, final String name, final boolean dropIfExists)
diff --git a/plugins/org.eclipse.net4j.db.jdbc/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.db.jdbc/META-INF/MANIFEST.MF
index 4fa2175741..fc983a7110 100644
--- a/plugins/org.eclipse.net4j.db.jdbc/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.db.jdbc/META-INF/MANIFEST.MF
@@ -9,3 +9,4 @@ Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.net4j.db.jdbc;version="4.3.0"
Bundle-ActivationPolicy: lazy
+Require-Bundle: org.eclipse.net4j.util;bundle-version="[3.4.0,4.0.0)"
diff --git a/plugins/org.eclipse.net4j.db.jdbc/src/org/eclipse/net4j/db/jdbc/DelegatingConnection.java b/plugins/org.eclipse.net4j.db.jdbc/src/org/eclipse/net4j/db/jdbc/DelegatingConnection.java
index f8ed479182..bf56075c25 100644
--- a/plugins/org.eclipse.net4j.db.jdbc/src/org/eclipse/net4j/db/jdbc/DelegatingConnection.java
+++ b/plugins/org.eclipse.net4j.db.jdbc/src/org/eclipse/net4j/db/jdbc/DelegatingConnection.java
@@ -31,11 +31,15 @@ import java.util.concurrent.Executor;
*/
public abstract class DelegatingConnection implements Connection
{
+ // protected static int COUNT;
+
private final Connection delegate;
public DelegatingConnection(Connection delegate)
{
this.delegate = delegate;
+ // System.out.println("++ Open connections: " + ++COUNT);
+ // ReflectUtil.printStackTrace();
}
public final Connection getDelegate()
@@ -101,6 +105,7 @@ public abstract class DelegatingConnection implements Connection
public void close() throws SQLException
{
delegate.close();
+ // System.out.println("-- Open connections: " + --COUNT);
}
public boolean isClosed() throws SQLException
@@ -358,4 +363,53 @@ public abstract class DelegatingConnection implements Connection
{
return delegate.getNetworkTimeout();
}
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class Default extends DelegatingConnection
+ {
+ public Default(Connection delegate)
+ {
+ super(delegate);
+ }
+
+ @Override
+ public PreparedStatement prepareStatement(String sql) throws SQLException
+ {
+ return getDelegate().prepareStatement(sql);
+ }
+
+ @Override
+ public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
+ throws SQLException
+ {
+ return getDelegate().prepareStatement(sql, resultSetType, resultSetConcurrency);
+ }
+
+ @Override
+ public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency,
+ int resultSetHoldability) throws SQLException
+ {
+ return getDelegate().prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
+ }
+
+ @Override
+ public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException
+ {
+ return getDelegate().prepareStatement(sql, autoGeneratedKeys);
+ }
+
+ @Override
+ public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException
+ {
+ return getDelegate().prepareStatement(sql, columnIndexes);
+ }
+
+ @Override
+ public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException
+ {
+ return getDelegate().prepareStatement(sql, columnNames);
+ }
+ }
}
diff --git a/plugins/org.eclipse.net4j.db.jdbc/src/org/eclipse/net4j/db/jdbc/JDBCUtil.java b/plugins/org.eclipse.net4j.db.jdbc/src/org/eclipse/net4j/db/jdbc/JDBCUtil.java
new file mode 100644
index 0000000000..dd3443f007
--- /dev/null
+++ b/plugins/org.eclipse.net4j.db.jdbc/src/org/eclipse/net4j/db/jdbc/JDBCUtil.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2004-2013 Eike Stepper (Berlin, Germany) and others.
+ * 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.db.jdbc;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Properties;
+
+/**
+ * @author Eike Stepper
+ */
+public final class JDBCUtil
+{
+ private JDBCUtil()
+ {
+ }
+
+ public static Properties getClientInfo(Connection connection) throws SQLException
+ {
+ return connection.getClientInfo();
+ }
+}
diff --git a/plugins/org.eclipse.net4j.db.oracle/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.db.oracle/META-INF/MANIFEST.MF
index 1c4764ca27..8e6700da78 100644
--- a/plugins/org.eclipse.net4j.db.oracle/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.db.oracle/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.net4j.db.oracle;singleton:=true
-Bundle-Version: 1.0.0.qualifier
+Bundle-Version: 1.1.0.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-RequiredExecutionEnvironment: J2SE-1.5
@@ -13,6 +13,6 @@ Import-Package: oracle.jdbc;resolution:=optional,
oracle.jdbc.driver;resolution:=optional,
oracle.jdbc.pool;resolution:=optional,
org.osgi.framework;version="[1.0.0,2.0.0)"
-Export-Package: org.eclipse.net4j.db.oracle;version="1.0.0",
- org.eclipse.net4j.db.oracle.internal.bundle;version="1.0.0";x-internal:=true
+Export-Package: org.eclipse.net4j.db.oracle;version="1.1.0",
+ org.eclipse.net4j.db.oracle.internal.bundle;version="1.1.0";x-internal:=true
Eclipse-RegisterBuddy: org.eclipse.net4j.db
diff --git a/plugins/org.eclipse.net4j.db.oracle/Oracle Problems.docx b/plugins/org.eclipse.net4j.db.oracle/Oracle Problems.docx
new file mode 100644
index 0000000000..170b0102be
--- /dev/null
+++ b/plugins/org.eclipse.net4j.db.oracle/Oracle Problems.docx
Binary files differ
diff --git a/plugins/org.eclipse.net4j.db.oracle/src/org/eclipse/net4j/db/oracle/OracleAdapter.java b/plugins/org.eclipse.net4j.db.oracle/src/org/eclipse/net4j/db/oracle/OracleAdapter.java
index d39289ae33..89d752e4b3 100644
--- a/plugins/org.eclipse.net4j.db.oracle/src/org/eclipse/net4j/db/oracle/OracleAdapter.java
+++ b/plugins/org.eclipse.net4j.db.oracle/src/org/eclipse/net4j/db/oracle/OracleAdapter.java
@@ -11,10 +11,21 @@
*/
package org.eclipse.net4j.db.oracle;
+import oracle.jdbc.pool.OracleDataSource;
+
import org.eclipse.net4j.db.DBType;
+import org.eclipse.net4j.db.DBUtil;
+import org.eclipse.net4j.db.IDBConnectionProvider;
import org.eclipse.net4j.db.ddl.IDBField;
import org.eclipse.net4j.spi.db.DBAdapter;
+import org.eclipse.net4j.util.security.IUserAware;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -31,6 +42,17 @@ public class OracleAdapter extends DBAdapter
super(NAME, VERSION);
}
+ @Override
+ public IDBConnectionProvider createConnectionProvider(DataSource dataSource)
+ {
+ if (dataSource instanceof OracleDataSource)
+ {
+ return DBUtil.createConnectionProvider(dataSource, ((OracleDataSource)dataSource).getUser());
+ }
+
+ return super.createConnectionProvider(dataSource);
+ }
+
public String[] getReservedWords()
{
List<String> list = new ArrayList<String>(Arrays.asList(getSQL92ReservedWords()));
@@ -70,6 +92,7 @@ public class OracleAdapter extends DBAdapter
return "NUMBER(5)";
case SMALLINT:
case BOOLEAN:
+ case BIT:
return "NUMBER(7)";
case INTEGER:
return "NUMBER(12)";
@@ -78,7 +101,13 @@ public class OracleAdapter extends DBAdapter
return "DATE";
case CHAR:
case VARCHAR:
- return "VARCHAR2(" + field.getPrecision() + ")";
+ return "VARCHAR2(" + field.getPrecision() + " CHAR)";
+ case LONGVARCHAR:
+ return "LONG";
+ case BINARY:
+ case VARBINARY:
+ case LONGVARBINARY:
+ return "LONG RAW";
default:
return super.getTypeName(field);
}
@@ -144,4 +173,73 @@ public class OracleAdapter extends DBAdapter
{
return "ALTER TABLE " + tableName + " MODIFY " + fieldName + " " + definition;
}
+
+ @Override
+ protected ResultSet readTables(Connection connection, DatabaseMetaData metaData, String schemaName)
+ throws SQLException
+ {
+ if (schemaName == null && connection instanceof IUserAware)
+ {
+ schemaName = ((IUserAware)connection).getUserID();
+ }
+
+ return metaData.getTables(null, schemaName, null, new String[] { "TABLE" });
+ }
+
+ @Override
+ public String convertString(PreparedStatement preparedStatement, int parameterIndex, String value)
+ {
+ if (value != null && value.length() == 0)
+ {
+ String replacement = getEmptyStringReplacement();
+ if (replacement != null)
+ {
+ value = replacement;
+ }
+ }
+
+ return super.convertString(preparedStatement, parameterIndex, value);
+ }
+
+ @Override
+ public String convertString(ResultSet resultSet, int columnIndex, String value)
+ {
+ value = super.convertString(resultSet, columnIndex, value);
+
+ if (value != null)
+ {
+ String replacement = getEmptyStringReplacement();
+ if (replacement != null && replacement.equals(value))
+ {
+ value = "";
+ }
+ }
+
+ return value;
+ }
+
+ @Override
+ public String convertString(ResultSet resultSet, String columnLabel, String value)
+ {
+ value = super.convertString(resultSet, columnLabel, value);
+
+ if (value != null)
+ {
+ String replacement = getEmptyStringReplacement();
+ if (replacement != null && replacement.equals(value))
+ {
+ value = null;
+ }
+ }
+
+ return value;
+ }
+
+ /**
+ * @since 1.1
+ */
+ protected String getEmptyStringReplacement()
+ {
+ return "<empty>";
+ }
}
diff --git a/plugins/org.eclipse.net4j.db.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.db.tests/META-INF/MANIFEST.MF
index 7699af2a7a..83d6908d1e 100644
--- a/plugins/org.eclipse.net4j.db.tests/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.db.tests/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.net4j.db.tests
-Bundle-Version: 4.0.200.qualifier
+Bundle-Version: 4.0.300.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -27,5 +27,5 @@ Import-Package: org.h2;version="[1.0.0,2.0.0)";resolution:=optional,
com.mysql.jdbc.jdbc2.optional;version="[5.1.0,6.0.0)";resolution:=optional,
org.apache.derby.jdbc;version="[10.0.0,11.0.0)";resolution:=optional,
org.hsqldb.jdbc;version="[2.0.0,3.0.0)";resolution:=optional
-Export-Package: org.eclipse.net4j.db.tests;version="4.0.200";x-internal:=true,
- org.eclipse.net4j.db.tests.bundle;version="4.0.200";x-internal:=true
+Export-Package: org.eclipse.net4j.db.tests;version="4.0.300";x-internal:=true,
+ org.eclipse.net4j.db.tests.bundle;version="4.0.300";x-internal:=true
diff --git a/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/AbstractDBTest.java b/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/AbstractDBTest.java
index ac4f2d7d26..cf89abcb76 100644
--- a/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/AbstractDBTest.java
+++ b/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/AbstractDBTest.java
@@ -47,7 +47,7 @@ public abstract class AbstractDBTest extends AbstractOMTest
adapter = createAdapter();
DataSource dataSource = createDataSource();
- connectionProvider = DBUtil.createConnectionProvider(dataSource);
+ connectionProvider = adapter.createConnectionProvider(dataSource);
}
@Override
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java
index bbddeb55ef..f019877ea6 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java
@@ -28,6 +28,7 @@ import org.eclipse.net4j.util.om.OMPlatform;
import org.eclipse.net4j.util.om.monitor.OMMonitor;
import org.eclipse.net4j.util.om.monitor.OMMonitor.Async;
import org.eclipse.net4j.util.om.trace.ContextTracer;
+import org.eclipse.net4j.util.security.IUserAware;
import javax.sql.DataSource;
@@ -371,7 +372,15 @@ public final class DBUtil
public static IDBConnectionProvider createConnectionProvider(DataSource dataSource)
{
- return new DataSourceConnectionProvider(dataSource);
+ return createConnectionProvider(dataSource, null);
+ }
+
+ /**
+ * @since 4.3
+ */
+ public static IDBConnectionProvider2 createConnectionProvider(DataSource dataSource, String user)
+ {
+ return new DataSourceConnectionProvider(dataSource, user);
}
/**
@@ -584,6 +593,11 @@ public final class DBUtil
}
}
+ if (dbName == null && connection instanceof IUserAware)
+ {
+ dbName = ((IUserAware)connection).getUserID();
+ }
+
tables = metaData.getTables(null, dbName, null, new String[] { "TABLE" }); //$NON-NLS-1$
while (tables.next())
{
@@ -608,12 +622,13 @@ public final class DBUtil
*/
public static List<Exception> dropAllTables(Connection connection, String dbName)
{
- List<Exception> exceptions = new ArrayList<Exception>();
Statement statement = null;
try
{
statement = connection.createStatement();
+ List<Exception> exceptions = new ArrayList<Exception>();
+
for (String tableName : getAllTableNames(connection, dbName))
{
String sql = "DROP TABLE " + tableName; //$NON-NLS-1$
@@ -628,6 +643,8 @@ public final class DBUtil
exceptions.add(ex);
}
}
+
+ return exceptions;
}
catch (SQLException ex)
{
@@ -637,8 +654,6 @@ public final class DBUtil
{
close(statement);
}
-
- return exceptions;
}
/**
@@ -812,7 +827,7 @@ public final class DBUtil
}
catch (SQLException ex)
{
- throw new DBException(ex);
+ throw new DBException(ex.getMessage() + " --> " + sql, ex);
}
finally
{
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBAdapter.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBAdapter.java
index 78df8c43b9..77eabe24ae 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBAdapter.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBAdapter.java
@@ -55,6 +55,11 @@ public interface IDBAdapter
public DataSource createJDBCDataSource();
/**
+ * @since 4.3
+ */
+ public IDBConnectionProvider createConnectionProvider(DataSource dataSource);
+
+ /**
* @since 4.2
*/
public IDBSchema readSchema(Connection connection, String name);
@@ -144,4 +149,9 @@ public interface IDBAdapter
* @since 4.2
*/
public String sqlModifyField(IDBField field);
+
+ /**
+ * @since 4.3
+ */
+ public int convertRowNumberToDriver(int row);
}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBConnection.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBConnection.java
index 0867f424c5..c5901d711d 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBConnection.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBConnection.java
@@ -11,6 +11,7 @@
package org.eclipse.net4j.db;
import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability;
+import org.eclipse.net4j.util.security.IUserAware;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -22,7 +23,7 @@ import java.sql.SQLException;
* @noimplement This interface is not intended to be implemented by clients.
* @noextend This interface is not intended to be extended by clients.
*/
-public interface IDBConnection extends Connection
+public interface IDBConnection extends Connection, IUserAware
{
public IDBDatabase getDatabase();
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBConnectionProvider2.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBConnectionProvider2.java
new file mode 100644
index 0000000000..98731365f1
--- /dev/null
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBConnectionProvider2.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2008, 2011, 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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.db;
+
+import org.eclipse.net4j.util.security.IUserAware;
+
+import javax.sql.DataSource;
+
+import java.sql.Connection;
+
+/**
+ * Provides a database {@link Connection connection}, roughly comparable with a {@link DataSource data source}.
+ *
+ * @author Eike Stepper
+ * @since 4.3
+ */
+public interface IDBConnectionProvider2 extends IDBConnectionProvider, IUserAware
+{
+}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBDatabase.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBDatabase.java
index 14cb7c2776..2eb04118e4 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBDatabase.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBDatabase.java
@@ -22,7 +22,7 @@ import org.eclipse.net4j.util.event.IEvent;
* @noextend This interface is not intended to be extended by clients.
* @since 4.2
*/
-public interface IDBDatabase extends IContainer<IDBConnection>, IDBConnectionProvider, Closeable
+public interface IDBDatabase extends IContainer<IDBConnection>, IDBConnectionProvider2, Closeable
{
public static final int DEFAULT_STATEMENT_CACHE_CAPACITY = 200;
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBConnection.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBConnection.java
index 4128f3f852..5d6330e5da 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBConnection.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBConnection.java
@@ -62,10 +62,16 @@ public final class DBConnection extends DelegatingConnection implements IDBConne
return database;
}
+ public String getUserID()
+ {
+ return database.getUserID();
+ }
+
@Override
public void close()
{
DBUtil.close(getDelegate());
+ // System.out.println("-- Open connections: " + --COUNT);
closed = true;
database.closeConnection(this);
}
@@ -208,4 +214,19 @@ public final class DBConnection extends DelegatingConnection implements IDBConne
cache.clear();
}
}
+
+ public String convertString(DBPreparedStatement preparedStatement, int parameterIndex, String value)
+ {
+ return getDatabase().convertString(preparedStatement, parameterIndex, value);
+ }
+
+ public String convertString(DBResultSet resultSet, int columnIndex, String value)
+ {
+ return getDatabase().convertString(resultSet, columnIndex, value);
+ }
+
+ public String convertString(DBResultSet resultSet, String columnLabel, String value)
+ {
+ return getDatabase().convertString(resultSet, columnLabel, value);
+ }
}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBDatabase.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBDatabase.java
index d0a4662e18..4bb00c09b1 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBDatabase.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBDatabase.java
@@ -24,6 +24,7 @@ import org.eclipse.net4j.spi.db.ddl.InternalDBSchema;
import org.eclipse.net4j.util.WrappedException;
import org.eclipse.net4j.util.container.SetContainer;
import org.eclipse.net4j.util.event.Event;
+import org.eclipse.net4j.util.security.IUserAware;
import java.sql.Connection;
import java.sql.SQLException;
@@ -65,6 +66,16 @@ public final class DBDatabase extends SetContainer<IDBConnection> implements IDB
activate();
}
+ public String getUserID()
+ {
+ if (connectionProvider instanceof IUserAware)
+ {
+ return ((IUserAware)connectionProvider).getUserID();
+ }
+
+ return null;
+ }
+
public DBAdapter getAdapter()
{
return adapter;
@@ -251,6 +262,21 @@ public final class DBDatabase extends SetContainer<IDBConnection> implements IDB
}
}
+ public String convertString(DBPreparedStatement preparedStatement, int parameterIndex, String value)
+ {
+ return adapter.convertString(preparedStatement, parameterIndex, value);
+ }
+
+ public String convertString(DBResultSet resultSet, int columnIndex, String value)
+ {
+ return adapter.convertString(resultSet, columnIndex, value);
+ }
+
+ public String convertString(DBResultSet resultSet, String columnLabel, String value)
+ {
+ return adapter.convertString(resultSet, columnLabel, value);
+ }
+
/**
* @author Eike Stepper
*/
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBPreparedStatement.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBPreparedStatement.java
index 4e1669e457..295fb361da 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBPreparedStatement.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBPreparedStatement.java
@@ -119,4 +119,21 @@ public final class DBPreparedStatement extends DelegatingPreparedStatement imple
{
throw new UnsupportedOperationException();
}
+
+ @Override
+ public void setString(int parameterIndex, String value) throws SQLException
+ {
+ value = getConnection().convertString(this, parameterIndex, value);
+ super.setString(parameterIndex, value);
+ }
+
+ public String convertString(DBResultSet resultSet, int columnIndex, String value) throws SQLException
+ {
+ return getConnection().convertString(resultSet, columnIndex, value);
+ }
+
+ public String convertString(DBResultSet resultSet, String columnLabel, String value) throws SQLException
+ {
+ return getConnection().convertString(resultSet, columnLabel, value);
+ }
}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBResultSet.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBResultSet.java
index b07a7894e9..5baf6bc23f 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBResultSet.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBResultSet.java
@@ -28,8 +28,22 @@ public final class DBResultSet extends DelegatingResultSet implements IDBResultS
}
@Override
- public IDBPreparedStatement getStatement() throws SQLException
+ public DBPreparedStatement getStatement() throws SQLException
{
- return (IDBPreparedStatement)super.getStatement();
+ return (DBPreparedStatement)super.getStatement();
+ }
+
+ @Override
+ public String getString(int columnIndex) throws SQLException
+ {
+ String value = super.getString(columnIndex);
+ return getStatement().convertString(this, columnIndex, value);
+ }
+
+ @Override
+ public String getString(String columnLabel) throws SQLException
+ {
+ String value = super.getString(columnLabel);
+ return getStatement().convertString(this, columnLabel, value);
}
}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DataSourceConnectionProvider.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DataSourceConnectionProvider.java
index dfb603cbdc..53fca9c632 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DataSourceConnectionProvider.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DataSourceConnectionProvider.java
@@ -11,7 +11,7 @@
package org.eclipse.net4j.internal.db;
import org.eclipse.net4j.db.DBException;
-import org.eclipse.net4j.db.IDBConnectionProvider;
+import org.eclipse.net4j.db.IDBConnectionProvider2;
import javax.sql.DataSource;
@@ -21,13 +21,16 @@ import java.sql.SQLException;
/**
* @author Eike Stepper
*/
-public class DataSourceConnectionProvider implements IDBConnectionProvider
+public class DataSourceConnectionProvider implements IDBConnectionProvider2
{
- private DataSource dataSource;
+ private final DataSource dataSource;
- public DataSourceConnectionProvider(DataSource dataSource)
+ private final String user;
+
+ public DataSourceConnectionProvider(DataSource dataSource, String user)
{
this.dataSource = dataSource;
+ this.user = user;
}
public DataSource getDataSource()
@@ -35,6 +38,11 @@ public class DataSourceConnectionProvider implements IDBConnectionProvider
return dataSource;
}
+ public String getUserID()
+ {
+ return user;
+ }
+
public Connection getConnection()
{
try
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBSchema.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBSchema.java
index f4cb4fe56c..c5cfc1cc88 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBSchema.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBSchema.java
@@ -286,7 +286,7 @@ public class DBSchema extends DBSchemaElement implements InternalDBSchema
public Set<IDBTable> create(IDBAdapter dbAdapter, DataSource dataSource) throws DBException
{
- return create(dbAdapter, DBUtil.createConnectionProvider(dataSource));
+ return create(dbAdapter, dbAdapter.createConnectionProvider(dataSource));
}
public Set<IDBTable> create(IDBAdapter dbAdapter, IDBConnectionProvider connectionProvider) throws DBException
@@ -316,7 +316,7 @@ public class DBSchema extends DBSchemaElement implements InternalDBSchema
public void drop(IDBAdapter dbAdapter, DataSource dataSource) throws DBException
{
- drop(dbAdapter, DBUtil.createConnectionProvider(dataSource));
+ drop(dbAdapter, dbAdapter.createConnectionProvider(dataSource));
}
public void drop(IDBAdapter dbAdapter, IDBConnectionProvider connectionProvider) throws DBException
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBAdapter.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBAdapter.java
index 165da1dfe9..e140e5bbc9 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBAdapter.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBAdapter.java
@@ -15,6 +15,7 @@ import org.eclipse.net4j.db.DBException;
import org.eclipse.net4j.db.DBType;
import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.IDBAdapter;
+import org.eclipse.net4j.db.IDBConnectionProvider;
import org.eclipse.net4j.db.ddl.IDBField;
import org.eclipse.net4j.db.ddl.IDBIndex;
import org.eclipse.net4j.db.ddl.IDBSchema;
@@ -134,6 +135,14 @@ public abstract class DBAdapter implements IDBAdapter
}
/**
+ * @since 4.3
+ */
+ public IDBConnectionProvider createConnectionProvider(DataSource dataSource)
+ {
+ return DBUtil.createConnectionProvider(dataSource);
+ }
+
+ /**
* @since 4.2
*/
public IDBSchema readSchema(Connection connection, String name)
@@ -158,7 +167,7 @@ public abstract class DBAdapter implements IDBAdapter
schemaName = null;
}
- ResultSet tables = metaData.getTables(null, schemaName, null, new String[] { "TABLE" });
+ ResultSet tables = readTables(connection, metaData, schemaName);
while (tables.next())
{
String tableName = tables.getString(3);
@@ -179,6 +188,15 @@ public abstract class DBAdapter implements IDBAdapter
}
/**
+ * @since 4.3
+ */
+ protected ResultSet readTables(Connection connection, DatabaseMetaData metaData, String schemaName)
+ throws SQLException
+ {
+ return metaData.getTables(null, schemaName, null, new String[] { "TABLE" });
+ }
+
+ /**
* @since 4.2
*/
protected void readFields(Connection connection, IDBTable table) throws SQLException
@@ -698,6 +716,30 @@ public abstract class DBAdapter implements IDBAdapter
}
/**
+ * @since 4.3
+ */
+ public String convertString(PreparedStatement preparedStatement, int parameterIndex, String value)
+ {
+ return value;
+ }
+
+ /**
+ * @since 4.3
+ */
+ public String convertString(ResultSet resultSet, int columnIndex, String value)
+ {
+ return value;
+ }
+
+ /**
+ * @since 4.3
+ */
+ public String convertString(ResultSet resultSet, String columnLabel, String value)
+ {
+ return value;
+ }
+
+ /**
* @since 2.0
*/
protected void doCreateTable(IDBTable table, Statement statement) throws SQLException
@@ -1043,6 +1085,14 @@ public abstract class DBAdapter implements IDBAdapter
}
/**
+ * @since 4.3
+ */
+ public int convertRowNumberToDriver(int row)
+ {
+ return row;
+ }
+
+ /**
* @since 4.2
*/
public String format(PreparedStatement stmt)
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
index f84385ebd7..1c6e6cf656 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
@@ -471,6 +471,12 @@ public abstract class AbstractOMTest extends TestCase
return file;
}
+ @Override
+ public String toString()
+ {
+ return getClass().getSimpleName() + "." + getName();
+ }
+
public static AbstractOMTest getCurrrentTest()
{
return (AbstractOMTest)TestExecuter.getValue();
@@ -645,7 +651,7 @@ public abstract class AbstractOMTest extends TestCase
}
}
- protected static void msg(Object m)
+ public static void msg(Object m)
{
if (!SUPPRESS_OUTPUT)
{
@@ -656,7 +662,7 @@ public abstract class AbstractOMTest extends TestCase
}
}
- protected static void skipTest(boolean skip)
+ public static void skipTest(boolean skip)
{
if (skip)
{
@@ -664,7 +670,7 @@ public abstract class AbstractOMTest extends TestCase
}
}
- protected static void skipTest()
+ public static void skipTest()
{
skipTest(true);
}
diff --git a/plugins/org.gastro.server/META-INF/MANIFEST.MF b/plugins/org.gastro.server/META-INF/MANIFEST.MF
index 34d174d4a3..cb6b8c2533 100644
--- a/plugins/org.gastro.server/META-INF/MANIFEST.MF
+++ b/plugins/org.gastro.server/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: CDO Electronic Restaurant Example Server
Bundle-SymbolicName: org.gastro.server;singleton:=true
-Bundle-Version: 4.0.200.qualifier
+Bundle-Version: 4.0.300.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.emf.cdo.server;bundle-version="[4.0.0,5.0.0)";visibility:=reexport,
@@ -17,6 +17,6 @@ Import-Package: org.h2;version="[1.0.0,2.0.0)",
org.h2.tools;version="[1.0.0,2.0.0)",
org.h2.util;version="[1.0.0,2.0.0)"
Bundle-Vendor: Eclipse Modeling Project
-Export-Package: org.gastro.internal.server;version="4.0.200";x-internal:=true,
- org.gastro.server;version="4.0.200"
+Export-Package: org.gastro.internal.server;version="4.0.300";x-internal:=true,
+ org.gastro.server;version="4.0.300"
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.gastro.server/src/org/gastro/internal/server/OM.java b/plugins/org.gastro.server/src/org/gastro/internal/server/OM.java
index 215a5e27ab..e60e095919 100644
--- a/plugins/org.gastro.server/src/org/gastro/internal/server/OM.java
+++ b/plugins/org.gastro.server/src/org/gastro/internal/server/OM.java
@@ -21,7 +21,6 @@ import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
import org.eclipse.emf.cdo.server.net4j.CDONet4jServerUtil;
import org.eclipse.net4j.acceptor.IAcceptor;
-import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.IDBConnectionProvider;
import org.eclipse.net4j.db.h2.H2Adapter;
@@ -84,7 +83,7 @@ public abstract class OM
IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(true);
IDBAdapter dbAdapter = new H2Adapter();
- IDBConnectionProvider dbConnectionProvider = DBUtil.createConnectionProvider(dataSource);
+ IDBConnectionProvider dbConnectionProvider = dbAdapter.createConnectionProvider(dataSource);
IStore store = CDODBUtil.createStore(mappingStrategy, dbAdapter, dbConnectionProvider);
Map<String, String> props = new HashMap<String, String>();

Back to the top