Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
浙江兰德纵横网络技术股份有限公司
o2oa
提交
37a3bff6
o2oa
项目概览
浙江兰德纵横网络技术股份有限公司
/
o2oa
通知
333
Star
10
Fork
6
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
37a3bff6
编写于
4月 30, 2024
作者:
NoSubject
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'feature/pgSupport' into 'develop'
修改默认配置可以设置数据库方言以及jdbc驱动类. See merge request o2oa/o2oa!2634
上级
625c0fe9
7d2a8f25
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
361 addition
and
365 deletion
+361
-365
o2server/configSample/externalDataSources.json
o2server/configSample/externalDataSources.json
+1
-1
o2server/x_base_core_project/src/main/java/com/x/base/core/container/factory/EntityManagerContainerFactory.java
...core/container/factory/EntityManagerContainerFactory.java
+0
-3
o2server/x_base_core_project/src/main/java/com/x/base/core/container/factory/PersistenceXmlHelper.java
...m/x/base/core/container/factory/PersistenceXmlHelper.java
+286
-289
o2server/x_base_core_project/src/main/java/com/x/base/core/container/factory/SlicePropertiesBuilder.java
...x/base/core/container/factory/SlicePropertiesBuilder.java
+61
-60
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ExternalDataSource.java
...va/com/x/base/core/project/config/ExternalDataSource.java
+3
-2
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ExternalDataSources.java
...a/com/x/base/core/project/config/ExternalDataSources.java
+8
-8
o2server/x_console/src/main/java/com/x/server/console/ResourceFactory.java
...e/src/main/java/com/x/server/console/ResourceFactory.java
+2
-2
未找到文件。
o2server/configSample/externalDataSources.json
浏览文件 @
37a3bff6
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
"testConnectionOnCheckout"
:
false
,
"testConnectionOnCheckout"
:
false
,
"maxIdleTime"
:
300.0
,
"maxIdleTime"
:
300.0
,
"autoCommit"
:
false
,
"autoCommit"
:
false
,
"schema"
:
"
X
"
,
"schema"
:
""
,
"logStatEnable"
:
false
,
"logStatEnable"
:
false
,
"logStatInterval"
:
180.0
,
"logStatInterval"
:
180.0
,
"slowSqlEnable"
:
true
,
"slowSqlEnable"
:
true
,
...
...
o2server/x_base_core_project/src/main/java/com/x/base/core/container/factory/EntityManagerContainerFactory.java
浏览文件 @
37a3bff6
package
com.x.base.core.container.factory
;
package
com.x.base.core.container.factory
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
import
java.sql.Driver
;
import
java.sql.DriverManager
;
import
java.util.Enumeration
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
...
o2server/x_base_core_project/src/main/java/com/x/base/core/container/factory/PersistenceXmlHelper.java
浏览文件 @
37a3bff6
此差异已折叠。
点击以展开。
o2server/x_base_core_project/src/main/java/com/x/base/core/container/factory/SlicePropertiesBuilder.java
浏览文件 @
37a3bff6
...
@@ -121,66 +121,67 @@ public class SlicePropertiesBuilder {
...
@@ -121,66 +121,67 @@ public class SlicePropertiesBuilder {
throw
new
Exception
(
"can not get dictionary of url: "
+
url
+
"."
);
throw
new
Exception
(
"can not get dictionary of url: "
+
url
+
"."
);
}
}
public
static
boolean
hasSchemaOfUrl
(
String
url
)
throws
Exception
{
// public static boolean hasSchemaOfUrl(String url) throws Exception {
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:db2:"
))
{
// if (StringUtils.containsIgnoreCase(url, "jdbc:db2:")) {
return
true
;
// return true;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:oracle:"
))
{
// } else if (StringUtils.containsIgnoreCase(url, "jdbc:oracle:")) {
return
true
;
// return true;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:mysql:"
))
{
// } else if (StringUtils.containsIgnoreCase(url, "jdbc:mysql:")) {
return
false
;
// return false;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:postgresql:"
))
{
// } else if (StringUtils.containsIgnoreCase(url, "jdbc:postgresql:")) {
return
true
;
// return true;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:informix-sqli:"
))
{
// } else if (StringUtils.containsIgnoreCase(url, "jdbc:informix-sqli:")) {
return
true
;
// return true;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:gbasedbt-sqli:"
))
{
// } else if (StringUtils.containsIgnoreCase(url, "jdbc:gbasedbt-sqli:")) {
return
true
;
// return true;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:gbase:"
))
{
// } else if (StringUtils.containsIgnoreCase(url, "jdbc:gbase:")) {
return
false
;
// return false;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:h2:tcp:"
))
{
// } else if (StringUtils.containsIgnoreCase(url, "jdbc:h2:tcp:")) {
return
false
;
// return false;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:dm:"
))
{
// } else if (StringUtils.containsIgnoreCase(url, "jdbc:dm:")) {
return
true
;
// return true;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:sqlserver:"
))
{
// } else if (StringUtils.containsIgnoreCase(url, "jdbc:sqlserver:")) {
return
false
;
// return false;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:kingbase:"
))
{
// } else if (StringUtils.containsIgnoreCase(url, "jdbc:kingbase:")) {
return
true
;
// return true;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:kingbase8:"
))
{
// } else if (StringUtils.containsIgnoreCase(url, "jdbc:kingbase8:")) {
return
true
;
// return true;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:oscar:"
))
{
// } else if (StringUtils.containsIgnoreCase(url, "jdbc:oscar:")) {
return
true
;
// return true;
}
// }
throw
new
Exception
(
"can not get schema of url: "
+
url
+
"."
);
// return false;
}
// //throw new Exception("can not get schema of url: " + url + ".");
// }
public
static
String
validationQueryOfUrl
(
String
url
)
throws
Exception
{
//
public static String validationQueryOfUrl(String url) throws Exception {
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:db2:"
))
{
//
if (StringUtils.containsIgnoreCase(url, "jdbc:db2:")) {
return
validationQuery_db2
;
//
return validationQuery_db2;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:oracle:"
))
{
//
} else if (StringUtils.containsIgnoreCase(url, "jdbc:oracle:")) {
return
validationQuery_oracle
;
//
return validationQuery_oracle;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:mysql:"
))
{
//
} else if (StringUtils.containsIgnoreCase(url, "jdbc:mysql:")) {
return
validationQuery_mysql
;
//
return validationQuery_mysql;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:postgresql:"
))
{
//
} else if (StringUtils.containsIgnoreCase(url, "jdbc:postgresql:")) {
return
validationQuery_postgresql
;
//
return validationQuery_postgresql;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:informix-sqli:"
))
{
//
} else if (StringUtils.containsIgnoreCase(url, "jdbc:informix-sqli:")) {
return
validationQuery_informix
;
//
return validationQuery_informix;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:gbasedbt-sqli:"
))
{
//
} else if (StringUtils.containsIgnoreCase(url, "jdbc:gbasedbt-sqli:")) {
return
validationQuery_gbase
;
//
return validationQuery_gbase;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:gbase:"
))
{
//
} else if (StringUtils.containsIgnoreCase(url, "jdbc:gbase:")) {
return
validationQuery_gbasemysql
;
//
return validationQuery_gbasemysql;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:h2:tcp:"
))
{
//
} else if (StringUtils.containsIgnoreCase(url, "jdbc:h2:tcp:")) {
return
validationQuery_h2
;
//
return validationQuery_h2;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:dm:"
))
{
//
} else if (StringUtils.containsIgnoreCase(url, "jdbc:dm:")) {
return
validationQuery_dm
;
//
return validationQuery_dm;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:sqlserver:"
))
{
//
} else if (StringUtils.containsIgnoreCase(url, "jdbc:sqlserver:")) {
return
validationQuery_sqlserver
;
//
return validationQuery_sqlserver;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:kingbase:"
))
{
//
} else if (StringUtils.containsIgnoreCase(url, "jdbc:kingbase:")) {
return
validationQuery_kingbase
;
//
return validationQuery_kingbase;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:kingbase8:"
))
{
//
} else if (StringUtils.containsIgnoreCase(url, "jdbc:kingbase8:")) {
return
validationQuery_kingbase8
;
//
return validationQuery_kingbase8;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:oscar:"
))
{
//
} else if (StringUtils.containsIgnoreCase(url, "jdbc:oscar:")) {
return
validationQuery_oscar
;
//
return validationQuery_oscar;
}
//
}
throw
new
Exception
(
"can not get schema of url: "
+
url
+
"."
);
//
throw new Exception("can not get schema of url: " + url + ".");
}
//
}
}
}
\ No newline at end of file
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ExternalDataSource.java
浏览文件 @
37a3bff6
...
@@ -63,8 +63,9 @@ public class ExternalDataSource extends ConfigObject {
...
@@ -63,8 +63,9 @@ public class ExternalDataSource extends ConfigObject {
public
static
final
Integer
DEFAULT_MAXIDLETIME
=
300
;
public
static
final
Integer
DEFAULT_MAXIDLETIME
=
300
;
public
static
final
Boolean
DEFAULT_AUTOCOMMIT
=
false
;
public
static
final
Boolean
DEFAULT_AUTOCOMMIT
=
false
;
// 20240428修改为空值,取消默认的SCHEMA这样可以手工适陪各种postgres变种版本.
public
static
final
String
DEFAULT_SCHEMA
=
"X"
;
// public static final String DEFAULT_SCHEMA = "X";
public
static
final
String
DEFAULT_SCHEMA
=
""
;
public
static
ExternalDataSource
defaultInstance
()
{
public
static
ExternalDataSource
defaultInstance
()
{
...
...
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ExternalDataSources.java
浏览文件 @
37a3bff6
...
@@ -117,14 +117,14 @@ public class ExternalDataSources extends CopyOnWriteArrayList<ExternalDataSource
...
@@ -117,14 +117,14 @@ public class ExternalDataSources extends CopyOnWriteArrayList<ExternalDataSource
throw
new
IllegalStateException
(
"get schema error."
);
throw
new
IllegalStateException
(
"get schema error."
);
}
}
public
boolean
hasSchema
()
throws
Exception
{
//
public boolean hasSchema() throws Exception {
for
(
ExternalDataSource
o
:
this
)
{
//
for (ExternalDataSource o : this) {
if
(
BooleanUtils
.
isTrue
(
o
.
getEnable
()))
{
//
if (BooleanUtils.isTrue(o.getEnable())) {
return
SlicePropertiesBuilder
.
hasSchemaOfUrl
(
o
.
getUrl
());
//
return SlicePropertiesBuilder.hasSchemaOfUrl(o.getUrl());
}
//
}
}
//
}
throw
new
Exception
(
"hasSchema error."
);
//
throw new Exception("hasSchema error.");
}
//
}
public
String
getTransactionIsolation
()
{
public
String
getTransactionIsolation
()
{
for
(
ExternalDataSource
o
:
this
)
{
for
(
ExternalDataSource
o
:
this
)
{
...
...
o2server/x_console/src/main/java/com/x/server/console/ResourceFactory.java
浏览文件 @
37a3bff6
...
@@ -189,7 +189,7 @@ public class ResourceFactory {
...
@@ -189,7 +189,7 @@ public class ResourceFactory {
DruidDataSourceC3P0Adapter
dataSource
=
new
DruidDataSourceC3P0Adapter
();
DruidDataSourceC3P0Adapter
dataSource
=
new
DruidDataSourceC3P0Adapter
();
dataSource
.
setJdbcUrl
(
ds
.
getUrl
());
dataSource
.
setJdbcUrl
(
ds
.
getUrl
());
dataSource
.
setDriverClass
(
ds
.
getDriverClassName
());
dataSource
.
setDriverClass
(
ds
.
getDriverClassName
());
dataSource
.
setPreferredTestQuery
(
SlicePropertiesBuilder
.
validationQueryOfUrl
(
ds
.
getUrl
()));
//
dataSource.setPreferredTestQuery(SlicePropertiesBuilder.validationQueryOfUrl(ds.getUrl()));
dataSource
.
setUser
(
ds
.
getUsername
());
dataSource
.
setUser
(
ds
.
getUsername
());
dataSource
.
setPassword
(
ds
.
getPassword
());
dataSource
.
setPassword
(
ds
.
getPassword
());
dataSource
.
setMaxPoolSize
(
ds
.
getMaxTotal
());
dataSource
.
setMaxPoolSize
(
ds
.
getMaxTotal
());
...
@@ -250,7 +250,7 @@ public class ResourceFactory {
...
@@ -250,7 +250,7 @@ public class ResourceFactory {
+
";CACHE_SIZE="
+
(
entry
.
getValue
().
getCacheSize
()
*
1024
);
+
";CACHE_SIZE="
+
(
entry
.
getValue
().
getCacheSize
()
*
1024
);
dataSource
.
setJdbcUrl
(
url
);
dataSource
.
setJdbcUrl
(
url
);
dataSource
.
setDriverClass
(
SlicePropertiesBuilder
.
driver_h2
);
dataSource
.
setDriverClass
(
SlicePropertiesBuilder
.
driver_h2
);
dataSource
.
setPreferredTestQuery
(
SlicePropertiesBuilder
.
validationQueryOfUrl
(
url
));
//
dataSource.setPreferredTestQuery(SlicePropertiesBuilder.validationQueryOfUrl(url));
dataSource
.
setUser
(
H2Tools
.
USER
);
dataSource
.
setUser
(
H2Tools
.
USER
);
dataSource
.
setPassword
(
Config
.
token
().
getPassword
());
dataSource
.
setPassword
(
Config
.
token
().
getPassword
());
dataSource
.
setMaxPoolSize
(
entry
.
getValue
().
getMaxTotal
());
dataSource
.
setMaxPoolSize
(
entry
.
getValue
().
getMaxTotal
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录