Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_42566577
o2oa
提交
4087122f
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,发现更多精彩内容 >>
提交
4087122f
编写于
2月 11, 2019
作者:
R
roo00
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改部署方式
上级
2521f437
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
45 addition
and
187 deletion
+45
-187
o2server/x_base_core_project/src/main/java/com/x/base/core/entity/StorageObject.java
...t/src/main/java/com/x/base/core/entity/StorageObject.java
+0
-6
o2server/x_base_core_project/src/main/java/com/x/base/core/project/Context.java
...roject/src/main/java/com/x/base/core/project/Context.java
+32
-14
o2server/x_base_core_project/src/main/java/com/x/base/core/project/ServiceA.java
...oject/src/main/java/com/x/base/core/project/ServiceA.java
+1
-165
o2server/x_collaboration_service_message/src/main/webapp/WEB-INF/web.xml
...aboration_service_message/src/main/webapp/WEB-INF/web.xml
+5
-0
o2server/x_component_assemble_control/src/main/webapp/WEB-INF/web.xml
...omponent_assemble_control/src/main/webapp/WEB-INF/web.xml
+7
-2
未找到文件。
o2server/x_base_core_project/src/main/java/com/x/base/core/entity/StorageObject.java
浏览文件 @
4087122f
...
...
@@ -36,12 +36,6 @@ public abstract class StorageObject extends SliceJpaObject {
synchronized
(
StorageObject
.
class
)
{
if
(
FILESYSTEMANAGERINSTANCE
==
null
)
{
StandardFileSystemManager
fs
=
new
StandardFileSystemManager
();
// DefaultFileSystemManager fs = new
// DefaultFileSystemManager();
// File file = new File(Config.base(), "local/temp/vfs");
// FileUtils.forceMkdir(file);
// fs.setTemporaryFileStore(new
// DefaultFileReplicator(file));
fs
.
setFilesCache
(
new
NullFilesCache
());
fs
.
setCacheStrategy
(
CacheStrategy
.
ON_RESOLVE
);
fs
.
init
();
...
...
o2server/x_base_core_project/src/main/java/com/x/base/core/project/Context.java
浏览文件 @
4087122f
...
...
@@ -8,7 +8,6 @@ import javax.servlet.ServletContext;
import
javax.servlet.ServletContextEvent
;
import
javax.servlet.ServletRequest
;
import
org.apache.commons.lang3.reflect.FieldUtils
;
import
org.apache.openjpa.enhance.PCRegistry
;
import
org.quartz.CronScheduleBuilder
;
import
org.quartz.DateBuilder
;
...
...
@@ -26,7 +25,6 @@ import org.quartz.impl.matchers.EverythingMatcher;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.JpaObject
;
import
com.x.base.core.entity.StorageType
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.config.DataMappings
;
import
com.x.base.core.project.config.StorageMappings
;
...
...
@@ -97,13 +95,33 @@ public class Context extends AbstractContext {
return
this
.
clazz
;
}
/** 随机令牌 */
private
Deployable
clazzInstance
;
public
Deployable
clazzInstance
()
{
return
this
.
clazzInstance
;
}
/* 随机令牌 */
private
volatile
String
token
;
public
String
token
()
{
return
this
.
token
;
}
/* contextPath */
private
volatile
String
contextPath
;
public
String
contextPath
()
{
return
this
.
contextPath
;
}
/* title */
private
volatile
String
name
;
public
String
name
()
{
return
this
.
name
;
}
/* Storage资源 */
private
volatile
StorageMappings
storageMappings
;
...
...
@@ -170,15 +188,17 @@ public class Context extends AbstractContext {
}
public
static
Context
concrete
(
ServletContextEvent
servletContextEvent
)
throws
Exception
{
/** 强制忽略ssl服务器认证 */
// HttpsURLConnection.setDefaultHostnameVerifier((hostname, session) -> true);
/* 强制忽略ssl服务器认证 */
SslTools
.
ignoreSsl
();
ServletContext
servletContext
=
servletContextEvent
.
getServletContext
();
Context
context
=
new
Context
();
context
.
contextPath
=
servletContext
.
getContextPath
();
context
.
clazz
=
Class
.
forName
(
servletContext
.
getInitParameter
(
INITPARAMETER_PORJECT
));
context
.
clazzInstance
=
(
Deployable
)
context
.
clazz
.
newInstance
();
context
.
name
=
getName
(
context
.
clazz
);
context
.
path
=
servletContext
.
getRealPath
(
""
);
context
.
servletContext
=
servletContext
;
context
.
servletContextName
=
servletContext
.
getServletContextName
();
context
.
clazz
=
Class
.
forName
(
Packages
.
com_x_base_core_project_dot
+
context
.
servletContextName
);
context
.
weight
=
Config
.
currentNode
().
getApplication
().
weight
(
context
.
clazz
);
context
.
sslEnable
=
Config
.
currentNode
().
getApplication
().
getSslEnable
();
context
.
initDatasFromCenters
();
...
...
@@ -262,10 +282,9 @@ public class Context extends AbstractContext {
}
private
void
initDatasFromCenters
()
throws
Exception
{
@SuppressWarnings
(
"unchecked"
)
List
<
String
>
containerEntities
=
(
List
<
String
>)
FieldUtils
.
readStaticField
(
clazz
,
"containerEntities"
);
if
(
ListTools
.
isNotEmpty
(
containerEntities
))
{
logger
.
print
(
"{} loading datas, entity size:{}."
,
this
.
clazz
.
getName
(),
containerEntities
.
size
());
if
(
ListTools
.
isNotEmpty
(
clazzInstance
.
dependency
.
containerEntities
))
{
logger
.
print
(
"{} loading datas, entity size:{}."
,
this
.
clazz
.
getName
(),
clazzInstance
.
dependency
.
containerEntities
.
size
());
DataMappings
dataMappings
=
null
;
do
{
try
{
...
...
@@ -282,10 +301,9 @@ public class Context extends AbstractContext {
}
private
void
initStoragesFromCenters
()
throws
Exception
{
@SuppressWarnings
(
"unchecked"
)
List
<
StorageType
>
usedStorageTypes
=
(
List
<
StorageType
>)
FieldUtils
.
readStaticField
(
clazz
,
"usedStorageTypes"
);
if
(
ListTools
.
isNotEmpty
(
usedStorageTypes
))
{
logger
.
print
(
"{} loading storages, type size:{}."
,
this
.
clazz
.
getName
(),
usedStorageTypes
.
size
());
if
(
ListTools
.
isNotEmpty
(
clazzInstance
.
dependency
.
storageTypes
))
{
logger
.
print
(
"{} loading storages, type size:{}."
,
this
.
clazz
.
getName
(),
clazzInstance
.
dependency
.
storageTypes
.
size
());
StorageMappings
storageMappings
=
null
;
do
{
try
{
...
...
o2server/x_base_core_project/src/main/java/com/x/base/core/project/ServiceA.java
浏览文件 @
4087122f
package
com.x.base.core.project
;
import
java.io.File
;
import
java.util.Collection
;
import
java.util.TreeMap
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.io.filefilter.WildcardFileFilter
;
import
org.apache.commons.lang3.StringUtils
;
import
com.x.base.core.project.gson.XGsonBuilder
;
import
com.x.base.core.project.tools.JarTools
;
public
abstract
class
ServiceA
extends
Deployable
{
private
File
concreteStructure
(
String
distPath
,
String
repositoryPath
)
throws
Exception
{
File
dir
=
new
File
(
distPath
,
this
.
getName
());
FileUtils
.
forceMkdir
(
dir
);
FileUtils
.
cleanDirectory
(
dir
);
File
webInf
=
new
File
(
dir
,
"WEB-INF"
);
FileUtils
.
forceMkdir
(
webInf
);
File
lib
=
new
File
(
webInf
,
"lib"
);
FileUtils
.
forceMkdir
(
lib
);
File
classes
=
new
File
(
webInf
,
"classes"
);
FileUtils
.
forceMkdir
(
classes
);
File
metaInf
=
new
File
(
classes
,
"META-INF"
);
FileUtils
.
forceMkdir
(
metaInf
);
this
.
copyPersistence
(
metaInf
,
repositoryPath
);
this
.
copyJar_independent
(
lib
,
repositoryPath
);
this
.
extractJar
(
classes
,
repositoryPath
);
this
.
extractZip
(
dir
,
repositoryPath
);
this
.
createWebXml
(
webInf
);
return
dir
;
}
private
void
createCenterServerFile
(
File
metaInf
,
String
host
,
Integer
port
,
String
cipher
)
throws
Exception
{
TreeMap
<
String
,
Object
>
map
=
new
TreeMap
<>();
map
.
put
(
"host"
,
StringUtils
.
trimToEmpty
(
host
));
map
.
put
(
"port"
,
null
!=
port
?
port
:
20080
);
map
.
put
(
"cipher"
,
cipher
);
FileUtils
.
writeStringToFile
(
new
File
(
metaInf
,
"centerServer.json"
),
XGsonBuilder
.
toJson
(
map
));
}
private
void
createConfigFile
(
File
metaInf
,
String
configApplicationServer
)
throws
Exception
{
TreeMap
<
String
,
Object
>
map
=
new
TreeMap
<>();
map
.
put
(
"applicationServer"
,
StringUtils
.
trimToEmpty
(
configApplicationServer
));
FileUtils
.
writeStringToFile
(
new
File
(
metaInf
,
"config.json"
),
XGsonBuilder
.
toJson
(
map
));
}
private
void
copyJar_independent
(
File
lib
,
String
repositoryPath
)
throws
Exception
{
File
repositoryLib
=
new
File
(
repositoryPath
);
FileUtils
.
copyDirectory
(
repositoryLib
,
lib
,
new
WildcardFileFilter
(
"x_base_core*.jar"
));
FileUtils
.
copyDirectory
(
repositoryLib
,
lib
,
new
WildcardFileFilter
(
"x_common_core*.jar"
));
FileUtils
.
copyDirectory
(
new
File
(
repositoryLib
,
"openjpa"
),
lib
,
new
WildcardFileFilter
(
"*.jar"
));
FileUtils
.
copyDirectory
(
new
File
(
repositoryLib
,
"ehcache"
),
lib
,
new
WildcardFileFilter
(
"*.jar"
));
FileUtils
.
copyDirectory
(
new
File
(
repositoryLib
,
"slf4j"
),
lib
,
new
WildcardFileFilter
(
"*.jar"
));
}
private
void
copyPersistence
(
File
metaInf
,
String
repositoryPath
)
throws
Exception
{
FileUtils
.
copyFile
(
new
File
(
repositoryPath
,
"x_persistence_"
+
this
.
getName
()
+
".xml"
),
new
File
(
metaInf
,
"x_persistence.xml"
),
false
);
}
private
void
createWebXml
(
File
webInf
)
throws
Exception
{
String
xml
=
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+
"<web-app id=\""
+
this
.
getName
()
+
"\" metadata-complete=\"false\" version=\"3.0\">"
+
"<display-name>"
+
this
.
getName
()
+
"</display-name>"
;
xml
+=
druid_servlet
;
xml
+=
druid_servlet_mapping
;
xml
+=
druid_filter
;
xml
+=
druid_filter_mapping
;
xml
+=
"</web-app>"
;
File
file
=
new
File
(
webInf
,
"web.xml"
);
FileUtils
.
writeStringToFile
(
file
,
xml
,
"UTF-8"
);
}
private
void
extractJar
(
File
classes
,
String
repositoryPath
)
throws
Exception
{
File
repositoryLib
=
new
File
(
repositoryPath
);
Collection
<
File
>
files
=
FileUtils
.
listFiles
(
repositoryLib
,
new
WildcardFileFilter
(
this
.
getName
()
+
"*.jar"
),
null
);
JarTools
.
unjar
(
files
.
iterator
().
next
(),
""
,
classes
,
true
);
}
private
void
extractZip
(
File
dir
,
String
repositoryPath
)
throws
Exception
{
File
file
=
new
File
(
repositoryPath
,
this
.
getName
()
+
".zip"
);
JarTools
.
unjar
(
file
,
""
,
dir
,
true
);
}
@Override
public
String
pack
(
String
distPath
,
String
repositoryPath
)
throws
Exception
{
File
dir
=
this
.
concreteStructure
(
distPath
,
repositoryPath
);
custom
(
dir
,
repositoryPath
);
File
war
=
new
File
(
distPath
,
this
.
getName
()
+
".war"
);
JarTools
.
jar
(
dir
,
war
);
return
war
.
getAbsolutePath
();
}
protected
abstract
void
custom
(
File
dir
,
String
repositoryPath
)
throws
Exception
;
protected
String
getName
()
{
return
StringUtils
.
replace
(
this
.
getClass
().
getSimpleName
(),
"."
,
"_"
);
}
public
class
Argument
{
private
String
distPath
;
private
String
repositoryPath
;
private
String
resourcesPath
;
private
String
centerHost
;
private
Integer
centerPort
;
private
String
centerCipher
;
private
String
configApplicationServer
;
public
String
getDistPath
()
{
return
distPath
;
}
public
void
setDistPath
(
String
distPath
)
{
this
.
distPath
=
distPath
;
}
public
String
getRepositoryPath
()
{
return
repositoryPath
;
}
public
void
setRepositoryPath
(
String
repositoryPath
)
{
this
.
repositoryPath
=
repositoryPath
;
}
public
String
getResourcesPath
()
{
return
resourcesPath
;
}
public
void
setResourcesPath
(
String
resourcesPath
)
{
this
.
resourcesPath
=
resourcesPath
;
}
public
String
getCenterHost
()
{
return
centerHost
;
}
public
void
setCenterHost
(
String
centerHost
)
{
this
.
centerHost
=
centerHost
;
}
public
Integer
getCenterPort
()
{
return
centerPort
;
}
public
void
setCenterPort
(
Integer
centerPort
)
{
this
.
centerPort
=
centerPort
;
}
public
String
getCenterCipher
()
{
return
centerCipher
;
}
public
void
setCenterCipher
(
String
centerCipher
)
{
this
.
centerCipher
=
centerCipher
;
}
public
String
getConfigApplicationServer
()
{
return
configApplicationServer
;
}
public
void
setConfigApplicationServer
(
String
configApplicationServer
)
{
this
.
configApplicationServer
=
configApplicationServer
;
}
}
}
o2server/x_collaboration_service_message/src/main/webapp/WEB-INF/web.xml
浏览文件 @
4087122f
...
...
@@ -2,4 +2,9 @@
<web-app
id=
"x_collaboration_service_message"
metadata-complete=
"false"
version=
"3.0"
>
<display-name>
x_collaboration_service_message
</display-name>
<context-param>
<param-name>
project
</param-name>
<param-value>
com.x.base.core.project.x_collaboration_service_message
</param-value>
</context-param>
</web-app>
o2server/x_component_assemble_control/src/main/webapp/WEB-INF/web.xml
浏览文件 @
4087122f
<?xml version="1.0" encoding="UTF-8"?>
<web-app
id=
"x_component_assemble_control"
metadata-complete=
"false"
version=
"3.0"
>
<web-app
id=
"x_component_assemble_control"
metadata-complete=
"false"
version=
"3.0"
>
<display-name>
x_component_assemble_control
</display-name>
<context-param>
<param-name>
project
</param-name>
<param-value>
com.x.base.core.project.x_component_assemble_control
</param-value>
</context-param>
</web-app>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录