Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_42566577
o2oa
提交
76d6c103
o2oa
项目概览
weixin_42566577
/
o2oa
与 Fork 源项目一致
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
0
Fork
0
代码
文件
提交
分支
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,发现更多精彩内容 >>
提交
76d6c103
编写于
8月 12, 2020
作者:
Z
zhourui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加lib目录支持
上级
69b92500
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
50 addition
and
7 deletion
+50
-7
o2server/x_base_core_project/src/main/java/com/x/base/core/container/EntityManagerContainer.java
...ava/com/x/base/core/container/EntityManagerContainer.java
+28
-0
o2server/x_console/src/main/java/com/x/server/console/server/JettySeverTools.java
...ain/java/com/x/server/console/server/JettySeverTools.java
+15
-1
o2server/x_console/src/main/java/com/x/server/console/server/application/ApplicationServerTools.java
...er/console/server/application/ApplicationServerTools.java
+7
-6
未找到文件。
o2server/x_base_core_project/src/main/java/com/x/base/core/container/EntityManagerContainer.java
浏览文件 @
76d6c103
...
...
@@ -16,6 +16,7 @@ import javax.persistence.Query;
import
javax.persistence.Tuple
;
import
javax.persistence.TypedQuery
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaDelete
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Root
;
...
...
@@ -38,6 +39,7 @@ import com.x.base.core.project.bean.WrapCopier;
import
com.x.base.core.project.exception.ExceptionWhen
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.base.core.project.tools.NumberTools
;
import
com.x.base.core.project.tools.StringTools
;
public
class
EntityManagerContainer
extends
EntityManagerContainerBasic
{
...
...
@@ -1905,4 +1907,30 @@ public class EntityManagerContainer extends EntityManagerContainerBasic {
return
list
;
}
public
<
T
extends
JpaObject
>
Long
clean
(
Class
<
T
>
cls
,
Integer
batchSize
)
throws
Exception
{
Long
count
=
0L
;
EntityManager
em
=
this
.
get
(
cls
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
String
>
cq
=
cb
.
createQuery
(
String
.
class
);
Root
<
T
>
root
=
cq
.
from
(
cls
);
cq
.
select
(
root
.
get
(
JpaObject
.
id_FIELDNAME
));
List
<
String
>
ids
;
do
{
ids
=
em
.
createQuery
(
cq
).
setMaxResults
(
NumberTools
.
nullOrLessThan
(
batchSize
,
1
)
?
500
:
batchSize
)
.
getResultList
();
if
(!
ids
.
isEmpty
())
{
em
.
getTransaction
().
begin
();
for
(
String
id
:
ids
)
{
T
t
=
em
.
find
(
cls
,
id
);
if
(
null
!=
t
)
{
em
.
remove
(
t
);
count
++;
}
}
em
.
getTransaction
().
commit
();
}
}
while
(!
ids
.
isEmpty
());
return
count
;
}
}
\ No newline at end of file
o2server/x_console/src/main/java/com/x/server/console/server/JettySeverTools.java
浏览文件 @
76d6c103
package
com.x.server.console.server
;
import
java.io.File
;
import
java.nio.file.FileVisitOption
;
import
java.nio.file.Files
;
import
java.nio.file.LinkOption
;
import
java.nio.file.Path
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Stream
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.io.filefilter.FileFilterUtils
;
...
...
@@ -65,7 +70,7 @@ public abstract class JettySeverTools {
FileUtils
.
cleanDirectory
(
dir
);
}
protected
static
String
calculateExtraClassPath
(
Class
<?>
cls
)
throws
Exception
{
protected
static
String
calculateExtraClassPath
(
Class
<?>
cls
,
Path
...
paths
)
throws
Exception
{
List
<
String
>
jars
=
new
ArrayList
<>();
jars
.
addAll
(
calculateExtraClassPathDefault
());
Module
module
=
cls
.
getAnnotation
(
Module
.
class
);
...
...
@@ -87,6 +92,15 @@ public abstract class JettySeverTools {
jars
.
add
(
file
.
getAbsolutePath
());
}
}
for
(
Path
path
:
paths
)
{
if
(
Files
.
exists
(
path
)
&&
Files
.
isDirectory
(
path
))
{
try
(
Stream
<
Path
>
stream
=
Files
.
walk
(
path
,
FileVisitOption
.
FOLLOW_LINKS
))
{
stream
.
filter
(
Files:
:
isRegularFile
)
.
filter
(
p
->
p
.
toAbsolutePath
().
toString
().
toLowerCase
().
endsWith
(
".jar"
))
.
forEach
(
p
->
jars
.
add
(
p
.
toAbsolutePath
().
toString
()));
}
}
}
return
StringUtils
.
join
(
jars
,
";"
);
}
...
...
o2server/x_console/src/main/java/com/x/server/console/server/application/ApplicationServerTools.java
浏览文件 @
76d6c103
...
...
@@ -2,6 +2,7 @@ package com.x.server.console.server.application;
import
java.io.ByteArrayInputStream
;
import
java.io.File
;
import
java.io.IOException
;
import
java.net.URL
;
import
java.net.URLClassLoader
;
import
java.util.ArrayList
;
...
...
@@ -22,6 +23,7 @@ import javax.xml.xpath.XPathFactory;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.io.FilenameUtils
;
import
org.apache.commons.io.filefilter.WildcardFileFilter
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.math.NumberUtils
;
import
org.eclipse.jetty.quickstart.QuickStartWebApp
;
...
...
@@ -65,7 +67,6 @@ import com.x.base.core.project.annotation.ModuleCategory;
import
com.x.base.core.project.annotation.ModuleType
;
import
com.x.base.core.project.config.ApplicationServer
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.gson.XGsonBuilder
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.DefaultCharset
;
...
...
@@ -126,7 +127,7 @@ public class ApplicationServerTools extends JettySeverTools {
webApp
.
setResourceBase
(
dir
.
getAbsolutePath
());
webApp
.
setDescriptor
(
new
File
(
dir
,
"WEB-INF/web.xml"
).
getAbsolutePath
());
webApp
.
setExtraClasspath
(
calculateExtraClassPath
(
clz
));
//webApp.getMimeTypes().addMimeMapping("wcss", "application/json");
//
webApp.getMimeTypes().addMimeMapping("wcss", "application/json");
webApp
.
getInitParams
().
put
(
"org.eclipse.jetty.servlet.Default.useFileMappedBuffer"
,
"false"
);
webApp
.
getInitParams
().
put
(
"org.eclipse.jetty.jsp.precompiled"
,
"true"
);
webApp
.
getInitParams
().
put
(
"org.eclipse.jetty.servlet.Default.dirAllowed"
,
"false"
);
...
...
@@ -161,12 +162,12 @@ public class ApplicationServerTools extends JettySeverTools {
webApp
.
setContextPath
(
"/"
+
name
);
webApp
.
setResourceBase
(
dir
.
getAbsolutePath
());
webApp
.
setDescriptor
(
dir
+
"/WEB-INF/web.xml"
);
webApp
.
setExtraClasspath
(
calculateExtraClassPath
(
cls
));
webApp
.
setExtraClasspath
(
calculateExtraClassPath
(
cls
,
dir
.
toPath
().
resolve
(
"WEB-INF/lib"
)
));
webApp
.
getInitParams
().
put
(
"org.eclipse.jetty.servlet.Default.useFileMappedBuffer"
,
"false"
);
webApp
.
getInitParams
().
put
(
"org.eclipse.jetty.jsp.precompiled"
,
"true"
);
webApp
.
getInitParams
().
put
(
"org.eclipse.jetty.servlet.Default.dirAllowed"
,
"false"
);
/* stat */
if
(
applicationServer
.
getStatEnable
(
))
{
if
(
BooleanUtils
.
isTrue
(
applicationServer
.
getStatEnable
()
))
{
FilterHolder
statFilterHolder
=
new
FilterHolder
(
new
WebStatFilter
());
statFilterHolder
.
setInitParameter
(
"exclusions"
,
applicationServer
.
getStatExclusions
());
webApp
.
addFilter
(
statFilterHolder
,
"/*"
,
EnumSet
.
of
(
DispatcherType
.
REQUEST
));
...
...
@@ -187,7 +188,7 @@ public class ApplicationServerTools extends JettySeverTools {
Server
server
=
new
Server
(
threadPool
);
server
.
setAttribute
(
"maxFormContentSize"
,
applicationServer
.
getMaxFormContent
()
*
1024
*
1024
);
if
(
applicationServer
.
getSslEnable
(
))
{
if
(
BooleanUtils
.
isTrue
(
applicationServer
.
getSslEnable
()
))
{
addHttpsConnector
(
server
,
applicationServer
.
getPort
());
}
else
{
addHttpConnector
(
server
,
applicationServer
.
getPort
());
...
...
@@ -292,7 +293,7 @@ public class ApplicationServerTools extends JettySeverTools {
}
}
private
static
void
modified
(
File
war
,
File
dir
)
throws
Exception
{
private
static
void
modified
(
File
war
,
File
dir
)
throws
IO
Exception
{
File
lastModified
=
new
File
(
dir
,
"WEB-INF/lastModified"
);
if
((!
lastModified
.
exists
())
||
lastModified
.
isDirectory
()
||
(
war
.
lastModified
()
!=
NumberUtils
.
toLong
(
FileUtils
.
readFileToString
(
lastModified
,
DefaultCharset
.
charset_utf_8
),
0
)))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录