Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
b9c7ab79
提交
b9c7ab79
authored
10 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Issue 559: Make dependency on org.osgi.service.jdbc optional.
上级
bba66ba7
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
44 行增加
和
21 行删除
+44
-21
changelog.html
h2/src/docsrc/html/changelog.html
+3
-2
MANIFEST.MF
h2/src/main/META-INF/MANIFEST.MF
+1
-1
DbDriverActivator.java
h2/src/main/org/h2/util/DbDriverActivator.java
+14
-18
OsgiDataSourceFactory.java
h2/src/main/org/h2/util/OsgiDataSourceFactory.java
+26
-0
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
b9c7ab79
...
...
@@ -18,9 +18,10 @@ Change Log
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
Improve error message when the user specifies an unsupported combination of database settings.
<ul><li>
Issue 559: Make dependency on org.osgi.service.jdbc optional.
</li><li>
Improve error message when the user specifies an unsupported combination of database settings.
</li><li>
MVStore: in the multi-threaded mode, NullPointerException and other exceptions could occur.
</li><li>
MVStore: some database file could not be compacted due to a bug in
</li><li>
MVStore: some database file could not be compacted due to a bug in
the bookkeeping of the fill rate. Also, database file were compacted quite slowly.
This has been improved; but more changes in this area are expected.
</li><li>
MVStore: support for volatile maps (that don't store changes).
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/META-INF/MANIFEST.MF
浏览文件 @
b9c7ab79
...
...
@@ -41,7 +41,7 @@ Import-Package: javax.management,
org.h2.util;version="[${version},1.5.0)",
org.h2.value;version="[${version},1.5.0)",
org.osgi.framework;version="1.5",
org.osgi.service.jdbc;version="1.0",
org.osgi.service.jdbc;version="1.0"
;resolution:=optional
,
org.slf4j;version="[1.6.0,1.7.0)";resolution:=optional
Export-Package: org.h2;version="${version}",
org.h2.api;version="${version}",
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/DbDriverActivator.java
浏览文件 @
b9c7ab79
...
...
@@ -6,11 +6,8 @@
*/
package
org
.
h2
.
util
;
import
java.util.Properties
;
import
org.h2.engine.Constants
;
import
org.osgi.framework.BundleActivator
;
import
org.osgi.framework.BundleContext
;
import
org.osgi.service.jdbc.DataSourceFactory
;
/**
* The driver activator loads the H2 driver when starting the bundle. The driver
...
...
@@ -18,28 +15,27 @@ import org.osgi.service.jdbc.DataSourceFactory;
*/
public
class
DbDriverActivator
implements
BundleActivator
{
private
static
final
String
DATASOURCE_FACTORY_CLASS
=
"org.osgi.service.jdbc.DataSourceFactory"
;
/**
* Start the bundle. This will load the database driver and register the
* DataSourceFactory service.
* Start the bundle. If the 'org.osgi.service.jdbc.DataSourceFactory' class
* is available in the class path, this will load the database driver and
* register the DataSourceFactory service.
*
* @param bundleContext the bundle context
*/
@Override
public
void
start
(
BundleContext
bundleContext
)
{
org
.
h2
.
Driver
driver
=
org
.
h2
.
Driver
.
load
();
Properties
properties
=
new
Properties
();
properties
.
put
(
DataSourceFactory
.
OSGI_JDBC_DRIVER_CLASS
,
org
.
h2
.
Driver
.
class
.
getName
());
properties
.
put
(
DataSourceFactory
.
OSGI_JDBC_DRIVER_NAME
,
"H2 JDBC Driver"
);
properties
.
put
(
DataSourceFactory
.
OSGI_JDBC_DRIVER_VERSION
,
Constants
.
getFullVersion
());
bundleContext
.
registerService
(
DataSourceFactory
.
class
.
getName
(),
new
OsgiDataSourceFactory
(
driver
),
properties
);
try
{
Utils
.
loadUserClass
(
DATASOURCE_FACTORY_CLASS
);
}
catch
(
Exception
e
)
{
// class not found - don't register
return
;
}
// but don't ignore exceptions in this call
OsgiDataSourceFactory
.
registerService
(
bundleContext
,
driver
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/OsgiDataSourceFactory.java
浏览文件 @
b9c7ab79
...
...
@@ -9,11 +9,14 @@ package org.h2.util;
import
java.sql.SQLException
;
import
java.sql.SQLFeatureNotSupportedException
;
import
java.util.Properties
;
import
javax.sql.ConnectionPoolDataSource
;
import
javax.sql.DataSource
;
import
javax.sql.XADataSource
;
import
org.h2.engine.Constants
;
import
org.h2.jdbcx.JdbcDataSource
;
import
org.osgi.framework.BundleContext
;
import
org.osgi.service.jdbc.DataSourceFactory
;
/**
...
...
@@ -279,4 +282,27 @@ public class OsgiDataSourceFactory implements DataSourceFactory {
"Pooling properties are not supported by H2"
);
}
}
/**
* Register the H2 JDBC driver service.
*
* @param bundleContext the bundle context
* @param driver the driver
*/
static
void
registerService
(
BundleContext
bundleContext
,
org
.
h2
.
Driver
driver
)
{
Properties
properties
=
new
Properties
();
properties
.
put
(
DataSourceFactory
.
OSGI_JDBC_DRIVER_CLASS
,
org
.
h2
.
Driver
.
class
.
getName
());
properties
.
put
(
DataSourceFactory
.
OSGI_JDBC_DRIVER_NAME
,
"H2 JDBC Driver"
);
properties
.
put
(
DataSourceFactory
.
OSGI_JDBC_DRIVER_VERSION
,
Constants
.
getFullVersion
());
bundleContext
.
registerService
(
DataSourceFactory
.
class
.
getName
(),
new
OsgiDataSourceFactory
(
driver
),
properties
);
}
}
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论