Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_42566577
o2oa
提交
78911aca
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,发现更多精彩内容 >>
提交
78911aca
编写于
6月 09, 2020
作者:
hlwwx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
'修bug关于集群时创建RSA、上传WAR'
上级
9c0cc55b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
54 addition
and
11 deletion
+54
-11
o2server/x_console/src/main/java/com/x/server/console/action/ActionCreateEncryptKey.java
...a/com/x/server/console/action/ActionCreateEncryptKey.java
+8
-2
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/command/ActionCommand.java
...ava/com/x/program/center/jaxrs/command/ActionCommand.java
+33
-3
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/command/ActionUploadFile.java
.../com/x/program/center/jaxrs/command/ActionUploadFile.java
+12
-5
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/command/CommandAction.java
...ava/com/x/program/center/jaxrs/command/CommandAction.java
+1
-1
未找到文件。
o2server/x_console/src/main/java/com/x/server/console/action/ActionCreateEncryptKey.java
浏览文件 @
78911aca
...
...
@@ -8,6 +8,7 @@ import java.io.IOException;
import
java.io.InputStreamReader
;
import
java.security.KeyPair
;
import
java.security.KeyPairGenerator
;
import
java.security.SecureRandom
;
import
java.util.Date
;
import
org.apache.commons.codec.binary.Base64
;
...
...
@@ -33,12 +34,15 @@ public class ActionCreateEncryptKey extends ActionBase {
public
boolean
execute
(
String
password
)
throws
Exception
{
this
.
init
();
/*
if (!StringUtils.equals(Config.token().getPassword(), password)) {
logger.print("password not match.");
return false;
}
}*/
KeyPairGenerator
generator
=
KeyPairGenerator
.
getInstance
(
"RSA"
);
generator
.
initialize
(
1024
);
SecureRandom
random
=
new
SecureRandom
(
password
.
getBytes
());
generator
.
initialize
(
1024
,
random
);
KeyPair
pair
=
generator
.
generateKeyPair
();
File
publicKeyFile
=
new
File
(
Config
.
base
(),
"config/public.key"
);
File
privateKeyFile
=
new
File
(
Config
.
base
(),
"config/private.key"
);
...
...
@@ -51,6 +55,8 @@ public class ActionCreateEncryptKey extends ActionBase {
//为前端提供publicKey,为密码加密
this
.
writeConfigFile
(
new
String
(
Base64
.
encodeBase64
(
pair
.
getPublic
().
getEncoded
())));
System
.
out
.
println
(
"public key: config/public.key, private key: config/private.key, create key success!"
);
return
true
;
}
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/command/ActionCommand.java
浏览文件 @
78911aca
package
com.x.program.center.jaxrs.command
;
import
java.io.ByteArrayInputStream
;
import
java.io.DataInputStream
;
import
java.io.DataOutputStream
;
import
java.net.Socket
;
...
...
@@ -7,9 +8,13 @@ import java.text.SimpleDateFormat;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
com.google.gson.JsonElement
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.config.Nodes
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.gson.XGsonBuilder
;
import
com.x.base.core.project.http.ActionResult
;
...
...
@@ -23,13 +28,38 @@ public class ActionCommand extends BaseAction {
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionCommand
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
HttpServletRequest
request
,
JsonElement
jsonElement
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
String
ctl
=
wi
.
getCtl
();
String
nodeName
=
wi
.
getNodeName
()
;
int
nodePort
=
Integer
.
parseInt
(
wi
.
getNodePort
());
Wo
wo
=
executeCommand
(
ctl
,
nodeName
,
nodePort
);
String
curServer
=
request
.
getLocalAddr
();
Wo
wo
=
null
;
if
(
nodeName
.
equalsIgnoreCase
(
"*"
))
{
Nodes
nodes
=
Config
.
nodes
();
for
(
String
node
:
nodes
.
keySet
()){
//先其他服务器
if
(!
node
.
equalsIgnoreCase
(
curServer
))
{
if
(
nodes
.
get
(
node
).
getApplication
().
getEnable
()
||
nodes
.
get
(
node
).
getCenter
().
getEnable
()){
wo
=
executeCommand
(
ctl
,
node
,
nodePort
);
}
}
}
for
(
String
node
:
nodes
.
keySet
()){
//后当前服务器
if
(
node
.
equalsIgnoreCase
(
curServer
))
{
if
(
nodes
.
get
(
curServer
).
getApplication
().
getEnable
()
||
nodes
.
get
(
curServer
).
getCenter
().
getEnable
()){
wo
=
executeCommand
(
ctl
,
node
,
nodePort
);
}
}
}
}
else
{
wo
=
executeCommand
(
ctl
,
nodeName
,
nodePort
);
}
result
.
setData
(
wo
);
return
result
;
}
...
...
@@ -63,7 +93,7 @@ public class ActionCommand extends BaseAction {
public
static
class
Wi
extends
GsonPropertyObject
{
@FieldDescribe
(
"命令名称"
)
private
String
ctl
;
@FieldDescribe
(
"服务器地址"
)
@FieldDescribe
(
"服务器地址
(*代表多台应用服务器)
"
)
private
String
nodeName
;
@FieldDescribe
(
"服务端口"
)
private
String
nodePort
;
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/command/ActionUploadFile.java
浏览文件 @
78911aca
...
...
@@ -38,22 +38,29 @@ public class ActionUploadFile extends BaseAction {
fileInputStream
.
close
();
if
(
nodeName
.
equalsIgnoreCase
(
"*"
))
{
Nodes
nodes
=
Config
.
nodes
();
logger
.
info
(
"先其他服务器"
);
for
(
String
node
:
nodes
.
keySet
()){
//先其他服务器
if
(!
node
.
equalsIgnoreCase
(
curServer
))
{
if
(
nodes
.
get
(
node
).
getApplication
().
getEnable
()
||
nodes
.
get
(
node
).
getCenter
().
getEnable
()){
byteArrayInputStream
=
new
ByteArrayInputStream
(
byteArray
);
logger
.
info
(
"node="
+
node
);
wo
=
executeCommand
(
ctl
,
node
,
nodes
.
get
(
node
).
nodeAgentPort
(),
byteArrayInputStream
,
disposition
);
}
}
//后当前服务器
if
(
nodes
.
get
(
curServer
).
getApplication
().
getEnable
()
||
nodes
.
get
(
curServer
).
getCenter
().
getEnable
()){
}
logger
.
info
(
"后当前服务器"
);
for
(
String
node
:
nodes
.
keySet
())
{
//后当前服务器
if
(
node
.
equalsIgnoreCase
(
curServer
))
{
if
(
nodes
.
get
(
curServer
).
getApplication
().
getEnable
()
||
nodes
.
get
(
curServer
).
getCenter
().
getEnable
()){
byteArrayInputStream
=
new
ByteArrayInputStream
(
byteArray
);
wo
=
executeCommand
(
ctl
,
curServer
,
nodes
.
get
(
curServer
).
nodeAgentPort
(),
byteArrayInputStream
,
disposition
);
}
logger
.
info
(
"node="
+
node
);
wo
=
executeCommand
(
ctl
,
node
,
nodes
.
get
(
curServer
).
nodeAgentPort
(),
byteArrayInputStream
,
disposition
);
}
}
}
}
else
{
wo
=
executeCommand
(
ctl
,
nodeName
,
Integer
.
parseInt
(
nodePort
),
byteArrayInputStream
,
disposition
);
}
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/command/CommandAction.java
浏览文件 @
78911aca
...
...
@@ -45,7 +45,7 @@ public class CommandAction<Wo> extends StandardJaxrsAction {
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
ActionResult
<
ActionCommand
.
Wo
>
result
=
new
ActionResult
<>();
try
{
result
=
new
ActionCommand
().
execute
(
effectivePerson
,
jsonElement
);
result
=
new
ActionCommand
().
execute
(
effectivePerson
,
request
,
jsonElement
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
result
.
error
(
e
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录