Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ghsby
o2oa
提交
b75a6a7b
o2oa
项目概览
ghsby
/
o2oa
落后 Fork 源项目 2880 个版本
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
1
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,发现更多精彩内容 >>
提交
b75a6a7b
编写于
12月 12, 2022
作者:
NoSubject
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/develop' into develop
上级
05af0b09
26436a24
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
392 addition
and
482 deletion
+392
-482
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Query.java
...t/src/main/java/com/x/base/core/project/config/Query.java
+4
-0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/BaseTools.java
...rc/main/java/com/x/base/core/project/tools/BaseTools.java
+190
-189
o2server/x_console/src/main/java/com/x/server/console/Main.java
...er/x_console/src/main/java/com/x/server/console/Main.java
+4
-22
o2server/x_console/src/main/java/com/x/server/console/action/ActionConfig.java
...c/main/java/com/x/server/console/action/ActionConfig.java
+0
-78
o2server/x_console/src/main/java/com/x/server/console/action/ActionSetPassword.java
...n/java/com/x/server/console/action/ActionSetPassword.java
+32
-31
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/config/ActionChangePassword.java
...m/x/program/center/jaxrs/config/ActionChangePassword.java
+162
-162
未找到文件。
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Query.java
浏览文件 @
b75a6a7b
...
...
@@ -475,6 +475,10 @@ public class Query extends ConfigObject {
}
}
public
String
getHdfsDirectoryPath
()
{
return
this
.
adjustHdfsDirectoryPath
();
}
private
String
adjustHdfsDirectoryPath
()
{
return
StringUtils
.
startsWith
(
this
.
hdfsDirectoryPath
,
"/"
)
?
this
.
hdfsDirectoryPath
:
"/"
+
hdfsDirectoryPath
;
...
...
o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/BaseTools.java
浏览文件 @
b75a6a7b
...
...
@@ -25,6 +25,7 @@ import java.util.Map.Entry;
import
java.util.Objects
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
com.google.gson.Gson
;
...
...
@@ -182,7 +183,7 @@ public class BaseTools {
boolean
Syncflag
=
false
;
Nodes
nodes
=
Config
.
nodes
();
// 同步config文件
if
(
Config
.
general
().
getConfigApiEnable
(
))
{
if
(
BooleanUtils
.
isTrue
(
Config
.
general
().
getConfigApiEnable
()
))
{
for
(
String
node
:
nodes
.
keySet
())
{
if
(
nodes
.
get
(
node
).
getApplication
().
getEnable
()
||
nodes
.
get
(
node
).
getCenter
().
getEnable
())
{
Syncflag
=
executeSyncFile
(
syncFilePath
,
node
,
nodes
.
get
(
node
).
nodeAgentPort
());
...
...
@@ -226,7 +227,7 @@ public class BaseTools {
dos
.
write
(
bytes
,
0
,
length
);
dos
.
flush
();
}
logger
.
info
(
"同步文件:"
+
syncFilePath
+
"
end."
);
logger
.
info
(
"同步文件:"
+
syncFilePath
+
"
end."
);
}
finally
{
dos
.
close
();
...
...
o2server/x_console/src/main/java/com/x/server/console/Main.java
浏览文件 @
b75a6a7b
...
...
@@ -32,7 +32,6 @@ import java.util.regex.Matcher;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.quartz.Scheduler
;
import
com.x.base.core.project.config.ApplicationServer
;
import
com.x.base.core.project.config.CenterServer
;
...
...
@@ -44,7 +43,6 @@ import com.x.base.core.project.gson.XGsonBuilder;
import
com.x.base.core.project.tools.Crypto
;
import
com.x.base.core.project.tools.DefaultCharset
;
import
com.x.base.core.project.tools.StringTools
;
import
com.x.server.console.action.ActionConfig
;
import
com.x.server.console.action.ActionControl
;
import
com.x.server.console.action.ActionSetPassword
;
import
com.x.server.console.action.ActionVersion
;
...
...
@@ -123,7 +121,7 @@ public class Main {
public
static
void
main
(
String
[]
args
)
throws
Exception
{
init
();
if
(
null
==
Config
.
currentNode
())
{
throw
new
Exception
(
"无法找到当前节点,请检查config/node_{name}.json与local/node.cfg文件内容中的名称是否一致."
);
throw
new
IllegalState
Exception
(
"无法找到当前节点,请检查config/node_{name}.json与local/node.cfg文件内容中的名称是否一致."
);
}
swapCommandThread
.
start
();
consoleCommandThread
.
start
();
...
...
@@ -134,8 +132,8 @@ public class Main {
nodeAgent
.
start
();
}
SchedulerBuilder
schedulerBuilder
=
new
SchedulerBuilder
();
Scheduler
scheduler
=
schedulerBuilder
.
start
();
//
SchedulerBuilder schedulerBuilder = new SchedulerBuilder();
//
Scheduler scheduler = schedulerBuilder.start();
if
(
BooleanUtils
.
isTrue
(
Config
.
currentNode
().
autoStart
()))
{
startAll
();
...
...
@@ -217,12 +215,8 @@ public class Main {
matcher
=
CommandFactory
.
setPassword_pattern
.
matcher
(
cmd
);
if
(
matcher
.
find
())
{
setPassword
(
matcher
.
group
(
1
),
matcher
.
group
(
2
));
if
(
config
())
{
break
;
}
else
{
continue
;
}
}
matcher
=
CommandFactory
.
control_pattern
.
matcher
(
cmd
);
if
(
matcher
.
find
())
{
...
...
@@ -242,9 +236,6 @@ public class Main {
}
System
.
out
.
println
(
"unknown command:"
+
cmd
);
}
// 关闭定时器
scheduler
.
shutdown
();
// SystemOutErrorSideCopyBuilder.stop();
}
private
static
void
version
()
{
...
...
@@ -255,15 +246,6 @@ public class Main {
}
}
private
static
boolean
config
()
{
try
{
return
new
ActionConfig
().
execute
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
true
;
}
private
static
void
startDataServer
()
{
try
{
if
(
BooleanUtils
.
isTrue
(
Servers
.
dataServerIsRunning
()))
{
...
...
o2server/x_console/src/main/java/com/x/server/console/action/ActionConfig.java
已删除
100644 → 0
浏览文件 @
05af0b09
package
com.x.server.console.action
;
import
java.io.File
;
import
java.io.InputStream
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
org.apache.commons.codec.binary.Base64
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonObject
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.gson.XGsonBuilder
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.http.HttpMediaType
;
import
com.x.base.core.project.tools.JarTools
;
public
class
ActionConfig
extends
ActionBase
{
public
boolean
execute
()
throws
Exception
{
if
(
StringUtils
.
equalsIgnoreCase
(
Config
.
node
(),
Config
.
resource_node_centersPirmaryNode
()))
{
byte
[]
bytes
=
this
.
getZip
();
this
.
unzip
(
bytes
);
System
.
out
.
println
(
"synchronize config success, should to restart server."
);
return
true
;
}
else
{
System
.
out
.
println
(
"config command only synchronize config from primary center."
);
return
false
;
}
}
@SuppressWarnings
(
"deprecation"
)
private
byte
[]
getZip
()
throws
Exception
{
String
address
=
Config
.
url_x_program_center_jaxrs
(
"config"
);
URL
url
=
new
URL
(
address
);
HttpURLConnection
connection
=
(
HttpURLConnection
)
url
.
openConnection
();
connection
.
setUseCaches
(
false
);
connection
.
setRequestProperty
(
"Content-Type"
,
HttpMediaType
.
APPLICATION_JSON_UTF_8
);
EffectivePerson
effectivePerson
=
EffectivePerson
.
cipher
(
Config
.
token
().
getCipher
(),
Config
.
person
().
getEncryptType
());
connection
.
setRequestProperty
(
Config
.
person
().
getTokenName
(),
effectivePerson
.
getToken
());
connection
.
setRequestMethod
(
"GET"
);
connection
.
setDoOutput
(
false
);
connection
.
setDoInput
(
true
);
connection
.
connect
();
String
json
=
null
;
try
(
InputStream
input
=
connection
.
getInputStream
())
{
json
=
IOUtils
.
toString
(
input
);
}
JsonElement
jsonElement
=
XGsonBuilder
.
instance
().
fromJson
(
json
,
JsonElement
.
class
);
if
(
jsonElement
.
isJsonObject
())
{
JsonObject
jsonObject
=
jsonElement
.
getAsJsonObject
();
if
(
jsonObject
.
has
(
"type"
))
{
if
(
StringUtils
.
equals
(
"success"
,
jsonObject
.
get
(
"type"
).
getAsString
()))
{
String
value
=
jsonObject
.
get
(
"data"
).
getAsString
();
byte
[]
bytes
=
Base64
.
decodeBase64
(
value
);
return
bytes
;
}
else
{
throw
new
Exception
(
"return type not success."
);
}
}
else
{
throw
new
Exception
(
"can not read return type."
);
}
}
else
{
throw
new
Exception
(
"return object is not jsonObject."
);
}
}
private
void
unzip
(
byte
[]
bytes
)
throws
Exception
{
File
dir
=
new
File
(
Config
.
base
(),
"config"
);
FileUtils
.
forceMkdir
(
dir
);
JarTools
.
unjar
(
bytes
,
""
,
dir
,
true
);
}
}
\ No newline at end of file
o2server/x_console/src/main/java/com/x/server/console/action/ActionSetPassword.java
浏览文件 @
b75a6a7b
...
...
@@ -14,10 +14,11 @@ import com.x.base.core.project.config.DataServer;
import
com.x.base.core.project.config.Token
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.server.console.server.Servers
;
public
class
ActionSetPassword
extends
ActionBase
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionSetPassword
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionSetPassword
.
class
);
public
boolean
execute
(
String
oldPassword
,
String
newPassword
)
throws
Exception
{
/** 如果初始密码没有修改就设置为初始密码 */
...
...
@@ -25,13 +26,13 @@ public class ActionSetPassword extends ActionBase {
oldPassword
=
Token
.
initPassword
;
}
if
(!
StringUtils
.
equals
(
Config
.
token
().
getPassword
(),
oldPassword
))
{
logger
.
print
(
"old password not match."
);
LOGGER
.
print
(
"old password not match."
);
return
false
;
}
this
.
changeInternalDataServerPassword
(
oldPassword
,
newPassword
);
Config
.
token
().
setPassword
(
newPassword
);
Config
.
token
().
save
();
logger
.
print
(
"The initial manager password has been modified."
);
LOGGER
.
print
(
"The initial manager password has been modified."
);
return
true
;
}
...
...
@@ -39,7 +40,7 @@ public class ActionSetPassword extends ActionBase {
org
.
h2
.
Driver
.
load
();
for
(
Entry
<
String
,
DataServer
>
en
:
Config
.
nodes
().
dataServers
().
entrySet
())
{
DataServer
o
=
en
.
getValue
();
if
(
BooleanUtils
.
isTrue
(
o
.
getE
nable
()))
{
if
(
BooleanUtils
.
isTrue
(
o
.
getEnable
())
&&
(!
Config
.
externalDataSources
().
e
nable
()))
{
try
(
Connection
conn
=
DriverManager
.
getConnection
(
"jdbc:h2:tcp://"
+
en
.
getKey
()
+
":"
+
o
.
getTcpPort
()
+
"/X"
,
"sa"
,
oldPassword
))
{
RunScript
.
execute
(
conn
,
new
StringReader
(
"ALTER USER SA SET PASSWORD '"
+
newPassword
+
"'"
));
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/config/ActionChangePassword.java
浏览文件 @
b75a6a7b
...
...
@@ -107,7 +107,7 @@ class ActionChangePassword extends BaseAction {
org
.
h2
.
Driver
.
load
();
for
(
Entry
<
String
,
DataServer
>
en
:
Config
.
nodes
().
dataServers
().
entrySet
())
{
DataServer
o
=
en
.
getValue
();
if
(
BooleanUtils
.
isTrue
(
o
.
getE
nable
()))
{
if
(
BooleanUtils
.
isTrue
(
o
.
getEnable
())
&&
(!
Config
.
externalDataSources
().
e
nable
()))
{
try
(
Connection
conn
=
DriverManager
.
getConnection
(
"jdbc:h2:tcp://"
+
en
.
getKey
()
+
":"
+
o
.
getTcpPort
()
+
"/X"
,
"sa"
,
oldPassword
))
{
RunScript
.
execute
(
conn
,
new
StringReader
(
"ALTER USER SA SET PASSWORD '"
+
newPassword
+
"'"
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录