Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ghsby
o2oa
提交
85887e83
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,发现更多精彩内容 >>
提交
85887e83
编写于
12月 07, 2020
作者:
O
o2null
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'release' into 'master'
Release See merge request o2oa/o2oa!2450
上级
c98a777e
004b89eb
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
197 addition
and
87 deletion
+197
-87
o2server/restart_linux.sh
o2server/restart_linux.sh
+16
-0
o2server/x_console/src/main/java/com/x/server/console/CommandFactory.java
...le/src/main/java/com/x/server/console/CommandFactory.java
+4
-2
o2server/x_console/src/main/java/com/x/server/console/Main.java
...er/x_console/src/main/java/com/x/server/console/Main.java
+103
-12
o2server/x_console/src/main/java/com/x/server/console/NodeAgent.java
...console/src/main/java/com/x/server/console/NodeAgent.java
+25
-2
o2server/x_organization_core_entity/src/main/java/com/x/organization/core/entity/Custom.java
.../src/main/java/com/x/organization/core/entity/Custom.java
+2
-2
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionGetWithWorkOrWorkCompleted.java
...ce/jaxrs/attachment/ActionGetWithWorkOrWorkCompleted.java
+3
-12
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/command/ActionCommand.java
...ava/com/x/program/center/jaxrs/command/ActionCommand.java
+34
-54
o2web/source/x_component_Common/Main.js
o2web/source/x_component_Common/Main.js
+6
-3
o2web/source/x_desktop/smapsso.html
o2web/source/x_desktop/smapsso.html
+4
-0
未找到文件。
o2server/restart_linux.sh
0 → 100755
浏览文件 @
85887e83
echo
ready to stop server
$(
cd
"
$(
dirname
"
$0
"
)
"
;
pwd
)
$(
cd
"
$(
dirname
"
$0
"
)
"
;
pwd
)
/jvm/linux/bin/java
-javaagent
:
$(
cd
"
$(
dirname
"
$0
"
)
"
;
pwd
)
/console.jar
-cp
$(
cd
"
$(
dirname
"
$0
"
)
"
;
pwd
)
/console.jar com.x.server.console.swapcommand.Exit
echo
'check server stoped wait 2s-10s'
sleep
2
PID
=
`
ps
-ef
|
grep
"
$(
cd
"
$(
dirname
"
$0
"
)
"
;
pwd
)
"
|
grep
-v
grep
|
awk
'{print $2}'
`
if
[
"X
$PID
"
!=
"X"
]
then
sleep
8
if
[
"X
$PID
"
!=
"X"
]
then
echo
ready to
kill
server
$PID
kill
-9
$PID
fi
fi
echo
'server stoped ready to start'
$(
cd
"
$(
dirname
"
$0
"
)
"
;
pwd
)
/start_linux.sh
o2server/x_console/src/main/java/com/x/server/console/CommandFactory.java
浏览文件 @
85887e83
...
@@ -18,10 +18,10 @@ public class CommandFactory {
...
@@ -18,10 +18,10 @@ public class CommandFactory {
public
static
final
Pattern
test_pattern
=
Pattern
.
compile
(
"^ {0,}test {0,}$"
,
Pattern
.
CASE_INSENSITIVE
);
public
static
final
Pattern
test_pattern
=
Pattern
.
compile
(
"^ {0,}test {0,}$"
,
Pattern
.
CASE_INSENSITIVE
);
//public static final Pattern create_encrypt_key_pattern = Pattern.compile("^ {0,}create encrypt key{0,}$",Pattern.CASE_INSENSITIVE);
//public static final Pattern create_encrypt_key_pattern = Pattern.compile("^ {0,}create encrypt key{0,}$",Pattern.CASE_INSENSITIVE);
public
static
final
Pattern
create_encrypt_key_pattern
=
Pattern
.
compile
(
"^ {0,}create encrypt key {0,}$"
,
public
static
final
Pattern
create_encrypt_key_pattern
=
Pattern
.
compile
(
"^ {0,}create encrypt key {0,}$"
,
Pattern
.
CASE_INSENSITIVE
);
Pattern
.
CASE_INSENSITIVE
);
public
static
final
Pattern
start_pattern
=
Pattern
public
static
final
Pattern
start_pattern
=
Pattern
.
compile
(
"^ {0,}start {0,}(data|storage|center|application|web|all|) {0,}$"
,
Pattern
.
CASE_INSENSITIVE
);
.
compile
(
"^ {0,}start {0,}(data|storage|center|application|web|all|) {0,}$"
,
Pattern
.
CASE_INSENSITIVE
);
...
@@ -50,6 +50,8 @@ public class CommandFactory {
...
@@ -50,6 +50,8 @@ public class CommandFactory {
public
static
final
Pattern
exit_pattern
=
Pattern
.
compile
(
"^ {0,}exit {0,}$"
,
Pattern
.
CASE_INSENSITIVE
);
public
static
final
Pattern
exit_pattern
=
Pattern
.
compile
(
"^ {0,}exit {0,}$"
,
Pattern
.
CASE_INSENSITIVE
);
public
static
final
Pattern
restart_pattern
=
Pattern
.
compile
(
"^ {0,}restart {0,}$"
,
Pattern
.
CASE_INSENSITIVE
);
// public static final Pattern updateFile_pattern = Pattern.compile("^ {0,}update file (.+) (true|false) {0,}$",
// public static final Pattern updateFile_pattern = Pattern.compile("^ {0,}update file (.+) (true|false) {0,}$",
// Pattern.CASE_INSENSITIVE);
// Pattern.CASE_INSENSITIVE);
...
...
o2server/x_console/src/main/java/com/x/server/console/Main.java
浏览文件 @
85887e83
package
com.x.server.console
;
package
com.x.server.console
;
import
java.io.BufferedReader
;
import
java.io.*
;
import
java.io.File
;
import
java.io.FileReader
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.io.RandomAccessFile
;
import
java.lang.management.ManagementFactory
;
import
java.lang.management.ManagementFactory
;
import
java.lang.management.RuntimeMXBean
;
import
java.lang.management.RuntimeMXBean
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.net.Socket
;
import
java.net.URL
;
import
java.net.URL
;
import
java.net.URLClassLoader
;
import
java.net.URLClassLoader
;
import
java.nio.MappedByteBuffer
;
import
java.nio.MappedByteBuffer
;
...
@@ -19,12 +15,12 @@ import java.nio.file.Files;
...
@@ -19,12 +15,12 @@ import java.nio.file.Files;
import
java.nio.file.Path
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.nio.file.Paths
;
import
java.nio.file.StandardOpenOption
;
import
java.nio.file.StandardOpenOption
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
import
com.x.base.core.project.gson.XGsonBuilder
;
import
com.x.base.core.project.tools.Crypto
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.io.FilenameUtils
;
import
org.apache.commons.io.FilenameUtils
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.BooleanUtils
;
...
@@ -52,6 +48,7 @@ public class Main {
...
@@ -52,6 +48,7 @@ public class Main {
private
static
final
String
MANIFEST_FILENAME
=
"manifest.cfg"
;
private
static
final
String
MANIFEST_FILENAME
=
"manifest.cfg"
;
private
static
final
String
GITIGNORE_FILENAME
=
".gitignore"
;
private
static
final
String
GITIGNORE_FILENAME
=
".gitignore"
;
private
static
final
LinkedBlockingQueue
<
String
>
commandQueue
=
new
LinkedBlockingQueue
<>();
private
static
final
LinkedBlockingQueue
<
String
>
commandQueue
=
new
LinkedBlockingQueue
<>();
private
static
NodeAgent
nodeAgent
;
private
static
final
Thread
swapCommandThread
=
new
Thread
(()
->
{
private
static
final
Thread
swapCommandThread
=
new
Thread
(()
->
{
// 文件中的命令输出到解析器
// 文件中的命令输出到解析器
...
@@ -122,7 +119,7 @@ public class Main {
...
@@ -122,7 +119,7 @@ public class Main {
swapCommandThread
.
start
();
swapCommandThread
.
start
();
consoleCommandThread
.
start
();
consoleCommandThread
.
start
();
if
(
BooleanUtils
.
isTrue
(
Config
.
currentNode
().
nodeAgentEnable
()))
{
if
(
BooleanUtils
.
isTrue
(
Config
.
currentNode
().
nodeAgentEnable
()))
{
NodeAgent
nodeAgent
=
new
NodeAgent
();
nodeAgent
=
new
NodeAgent
();
nodeAgent
.
setCommandQueue
(
commandQueue
);
nodeAgent
.
setCommandQueue
(
commandQueue
);
nodeAgent
.
setDaemon
(
true
);
nodeAgent
.
setDaemon
(
true
);
nodeAgent
.
start
();
nodeAgent
.
start
();
...
@@ -234,6 +231,12 @@ public class Main {
...
@@ -234,6 +231,12 @@ public class Main {
if
(
matcher
.
find
())
{
if
(
matcher
.
find
())
{
exit
();
exit
();
}
}
matcher
=
CommandFactory
.
restart_pattern
.
matcher
(
cmd
);
if
(
matcher
.
find
())
{
restart
();
continue
;
}
System
.
out
.
println
(
"unknown command:"
+
cmd
);
System
.
out
.
println
(
"unknown command:"
+
cmd
);
}
}
// 关闭定时器
// 关闭定时器
...
@@ -421,6 +424,94 @@ public class Main {
...
@@ -421,6 +424,94 @@ public class Main {
System
.
exit
(
0
);
System
.
exit
(
0
);
}
}
private
static
void
restart
()
{
try
{
System
.
out
.
println
(
"ready to restart..."
);
stopAll
();
stopAllThreads
();
String
osName
=
System
.
getProperty
(
"os.name"
);
//System.out.println("当前操作系统是:"+osName);
File
file
=
new
File
(
Config
.
base
(),
"start_linux.sh"
);
if
(
osName
.
toLowerCase
().
startsWith
(
"mac"
)){
file
=
new
File
(
Config
.
base
(),
"start_macos.sh"
);
}
else
if
(
osName
.
toLowerCase
().
startsWith
(
"windows"
))
{
file
=
new
File
(
Config
.
base
(),
"start_windows.bat"
);
}
else
if
(!
file
.
exists
())
{
file
=
new
File
(
"start_aix.sh"
);
if
(!
file
.
exists
())
{
file
=
new
File
(
"start_arm.sh"
);
if
(!
file
.
exists
())
{
file
=
new
File
(
"start_mips.sh"
);
if
(!
file
.
exists
())
{
file
=
new
File
(
"start_raspi.sh"
);
}
}
}
}
if
(
file
.
exists
())
{
System
.
out
.
println
(
"server will start in new process!"
);
Process
ps
=
Runtime
.
getRuntime
().
exec
(
file
.
getAbsolutePath
());
Thread
.
sleep
(
2000
);
if
(!
Config
.
currentNode
().
autoStart
())
{
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
try
(
Socket
socket
=
new
Socket
(
Config
.
node
(),
Config
.
currentNode
().
nodeAgentPort
()))
{
socket
.
setKeepAlive
(
true
);
socket
.
setSoTimeout
(
2000
);
try
(
DataOutputStream
dos
=
new
DataOutputStream
(
socket
.
getOutputStream
());
DataInputStream
dis
=
new
DataInputStream
(
socket
.
getInputStream
()))
{
Map
<
String
,
Object
>
commandObject
=
new
HashMap
<>();
commandObject
.
put
(
"command"
,
"command:start"
);
commandObject
.
put
(
"credential"
,
Crypto
.
rsaEncrypt
(
"o2@"
,
Config
.
publicKey
()));
dos
.
writeUTF
(
XGsonBuilder
.
toJson
(
commandObject
));
dos
.
flush
();
break
;
}
}
catch
(
Exception
ex
)
{
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
}
}
}
}
}
else
{
System
.
out
.
println
(
"not support restart in current operating system!start server failure!"
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
System
.
exit
(
0
);
}
}
private
static
void
stopAllThreads
(){
if
(
swapCommandThread
!=
null
){
try
{
swapCommandThread
.
interrupt
();
}
catch
(
Exception
e
)
{
}
}
if
(
consoleCommandThread
!=
null
){
try
{
consoleCommandThread
.
interrupt
();
}
catch
(
Exception
e
)
{
}
}
if
(
nodeAgent
!=
null
){
try
{
nodeAgent
.
stopAgent
();
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
}
nodeAgent
.
interrupt
();
nodeAgent
=
null
;
}
catch
(
Exception
e
)
{
}
}
}
private
static
void
stopAll
()
{
private
static
void
stopAll
()
{
try
{
try
{
WebServer
webServer
=
Config
.
currentNode
().
getWeb
();
WebServer
webServer
=
Config
.
currentNode
().
getWeb
();
...
@@ -466,7 +557,7 @@ public class Main {
...
@@ -466,7 +557,7 @@ public class Main {
/**
/**
* 检查store目录下的war文件是否全部在manifest.cfg中
* 检查store目录下的war文件是否全部在manifest.cfg中
*
*
* @param base o2server的根目录
* @param base o2server的根目录
*/
*/
private
static
void
scanWar
(
String
base
)
throws
Exception
{
private
static
void
scanWar
(
String
base
)
throws
Exception
{
...
@@ -621,4 +712,4 @@ public class Main {
...
@@ -621,4 +712,4 @@ public class Main {
Files
.
write
(
path
,
Long
.
toString
(
pid
).
getBytes
(),
StandardOpenOption
.
CREATE
,
Files
.
write
(
path
,
Long
.
toString
(
pid
).
getBytes
(),
StandardOpenOption
.
CREATE
,
StandardOpenOption
.
TRUNCATE_EXISTING
);
StandardOpenOption
.
TRUNCATE_EXISTING
);
}
}
}
}
\ No newline at end of file
o2server/x_console/src/main/java/com/x/server/console/NodeAgent.java
浏览文件 @
85887e83
...
@@ -92,11 +92,16 @@ public class NodeAgent extends Thread {
...
@@ -92,11 +92,16 @@ public class NodeAgent extends Thread {
this
.
commandQueue
=
commandQueue
;
this
.
commandQueue
=
commandQueue
;
}
}
private
volatile
boolean
runFlag
=
true
;
private
ServerSocket
serverSocket
=
null
;
@Override
@Override
public
void
run
()
{
public
void
run
()
{
try
(
ServerSocket
serverSocket
=
new
ServerSocket
(
Config
.
currentNode
().
nodeAgentPort
()))
{
try
{
serverSocket
=
new
ServerSocket
(
Config
.
currentNode
().
nodeAgentPort
());
Matcher
matcher
;
Matcher
matcher
;
while
(
true
)
{
while
(
runFlag
)
{
try
(
Socket
socket
=
serverSocket
.
accept
())
{
try
(
Socket
socket
=
serverSocket
.
accept
())
{
try
(
DataOutputStream
dos
=
new
DataOutputStream
(
socket
.
getOutputStream
());
try
(
DataOutputStream
dos
=
new
DataOutputStream
(
socket
.
getOutputStream
());
DataInputStream
dis
=
new
DataInputStream
(
socket
.
getInputStream
()))
{
DataInputStream
dis
=
new
DataInputStream
(
socket
.
getInputStream
()))
{
...
@@ -261,6 +266,24 @@ public class NodeAgent extends Thread {
...
@@ -261,6 +266,24 @@ public class NodeAgent extends Thread {
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
finally
{
if
(
serverSocket
!=
null
){
try
{
serverSocket
.
close
();
}
catch
(
IOException
e
)
{
}
}
}
}
public
void
stopAgent
(){
try
{
this
.
runFlag
=
false
;
if
(
serverSocket
!=
null
)
{
this
.
serverSocket
.
close
();
this
.
serverSocket
=
null
;
}
}
catch
(
Exception
e
)
{
}
}
}
}
...
...
o2server/x_organization_core_entity/src/main/java/com/x/organization/core/entity/Custom.java
浏览文件 @
85887e83
...
@@ -61,7 +61,7 @@ public class Custom extends SliceJpaObject {
...
@@ -61,7 +61,7 @@ public class Custom extends SliceJpaObject {
public
static
final
String
person_FIELDNAME
=
"person"
;
public
static
final
String
person_FIELDNAME
=
"person"
;
@FieldDescribe
(
"属性所属个人,不可为空."
)
@FieldDescribe
(
"属性所属个人,不可为空."
)
@Column
(
length
=
JpaObject
.
length_id
,
name
=
ColumnNamePrefix
+
person_FIELDNAME
)
@Column
(
length
=
length_255B
,
name
=
ColumnNamePrefix
+
person_FIELDNAME
)
@Index
(
name
=
TABLE
+
IndexNameMiddle
+
person_FIELDNAME
)
@Index
(
name
=
TABLE
+
IndexNameMiddle
+
person_FIELDNAME
)
@CheckPersist
(
allowEmpty
=
false
)
@CheckPersist
(
allowEmpty
=
false
)
private
String
person
;
private
String
person
;
...
@@ -103,4 +103,4 @@ public class Custom extends SliceJpaObject {
...
@@ -103,4 +103,4 @@ public class Custom extends SliceJpaObject {
this
.
name
=
name
;
this
.
name
=
name
;
}
}
}
}
\ No newline at end of file
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionGetWithWorkOrWorkCompleted.java
浏览文件 @
85887e83
...
@@ -13,8 +13,6 @@ import com.x.base.core.project.http.EffectivePerson;
...
@@ -13,8 +13,6 @@ import com.x.base.core.project.http.EffectivePerson;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.core.entity.content.Attachment
;
import
com.x.processplatform.core.entity.content.Attachment
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
import
java.util.List
;
import
java.util.List
;
...
@@ -23,20 +21,13 @@ class ActionGetWithWorkOrWorkCompleted extends BaseAction {
...
@@ -23,20 +21,13 @@ class ActionGetWithWorkOrWorkCompleted extends BaseAction {
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
Business
business
=
new
Business
(
emc
);
Work
work
=
emc
.
find
(
workId
,
Work
.
class
);
if
(
work
==
null
){
WorkCompleted
workCompleted
=
emc
.
find
(
workId
,
WorkCompleted
.
class
);
if
(
null
==
workCompleted
)
{
throw
new
ExceptionEntityNotExist
(
workId
,
Work
.
class
);
}
}
Attachment
attachment
=
emc
.
find
(
id
,
Attachment
.
class
);
Attachment
attachment
=
emc
.
find
(
id
,
Attachment
.
class
);
if
(
null
==
attachment
)
{
if
(
null
==
attachment
)
{
throw
new
ExceptionEntityNotExist
(
id
,
Attachment
.
class
);
throw
new
ExceptionEntityNotExist
(
id
,
Attachment
.
class
);
}
}
if
(!
business
.
readableWithWorkOrWorkCompleted
(
effectivePerson
,
work
.
getId
()
,
if
(!
business
.
readableWithWorkOrWorkCompleted
(
effectivePerson
,
work
Id
,
new
ExceptionEntityNotExist
(
work
.
getId
()
)))
{
new
ExceptionEntityNotExist
(
work
Id
)))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
);
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
}
...
@@ -157,4 +148,4 @@ class ActionGetWithWorkOrWorkCompleted extends BaseAction {
...
@@ -157,4 +148,4 @@ class ActionGetWithWorkOrWorkCompleted extends BaseAction {
}
}
return
value
;
return
value
;
}
}
}
}
\ No newline at end of file
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/command/ActionCommand.java
浏览文件 @
85887e83
package
com.x.program.center.jaxrs.command
;
package
com.x.program.center.jaxrs.command
;
import
java.io.ByteArrayInputStream
;
import
java.io.DataInputStream
;
import
java.io.DataInputStream
;
import
java.io.DataOutputStream
;
import
java.io.DataOutputStream
;
import
java.io.File
;
import
java.io.File
;
...
@@ -11,8 +10,6 @@ import java.text.SimpleDateFormat;
...
@@ -11,8 +10,6 @@ import java.text.SimpleDateFormat;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -30,32 +27,24 @@ import com.x.base.core.project.tools.Crypto;
...
@@ -30,32 +27,24 @@ import com.x.base.core.project.tools.Crypto;
/*执行服务器命令*/
/*执行服务器命令*/
public
class
ActionCommand
extends
BaseAction
{
public
class
ActionCommand
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionCommand
.
class
);
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionCommand
.
class
);
ActionResult
<
Wo
>
execute
(
HttpServletRequest
request
,
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
ActionResult
<
Wo
>
execute
(
HttpServletRequest
request
,
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
String
ctl
=
wi
.
getCtl
();
String
ctl
=
wi
.
getCtl
();
String
nodeName
=
wi
.
getNodeName
()
;
String
nodeName
=
wi
.
getNodeName
()
;
String
curServer
=
request
.
getLocalAddr
();
Wo
wo
=
null
;
Wo
wo
=
null
;
if
(
nodeName
.
equalsIgnoreCase
(
"*"
))
{
if
(
nodeName
.
equalsIgnoreCase
(
"*"
))
{
Nodes
nodes
=
Config
.
nodes
();
Nodes
nodes
=
Config
.
nodes
();
if
(
ctl
.
indexOf
(
"create encrypt"
)>-
1
)
{
if
(
ctl
.
indexOf
(
"create encrypt"
)>-
1
)
{
//生成key文件
//生成key文件
for
(
String
node
:
nodes
.
keySet
()){
wo
=
executeCommand
(
ctl
,
Config
.
node
(),
nodes
.
get
(
Config
.
node
()).
nodeAgentPort
());
//当前服务器
if
(
node
.
equalsIgnoreCase
(
curServer
))
{
if
(
nodes
.
get
(
curServer
).
getApplication
().
getEnable
()
||
nodes
.
get
(
curServer
).
getCenter
().
getEnable
()){
wo
=
executeCommand
(
ctl
,
node
,
nodes
.
get
(
node
).
nodeAgentPort
());
}
}
}
//同步key文件
//同步key文件
for
(
String
node
:
nodes
.
keySet
()){
for
(
String
node
:
nodes
.
keySet
()){
//其他服务器
//其他服务器
if
(!
node
.
equalsIgnoreCase
(
curServer
))
{
if
(!
node
.
equalsIgnoreCase
(
Config
.
node
()
))
{
if
(
nodes
.
get
(
node
).
getApplication
().
getEnable
()
||
nodes
.
get
(
node
).
getCenter
().
getEnable
()){
if
(
nodes
.
get
(
node
).
getApplication
().
getEnable
()
||
nodes
.
get
(
node
).
getCenter
().
getEnable
()){
boolean
Syncflag
=
executeSyncFile
(
"config/public.key"
,
node
,
nodes
.
get
(
node
).
nodeAgentPort
());
boolean
Syncflag
=
executeSyncFile
(
"config/public.key"
,
node
,
nodes
.
get
(
node
).
nodeAgentPort
());
Syncflag
=
executeSyncFile
(
"config/private.key"
,
node
,
nodes
.
get
(
node
).
nodeAgentPort
());
Syncflag
=
executeSyncFile
(
"config/private.key"
,
node
,
nodes
.
get
(
node
).
nodeAgentPort
());
...
@@ -63,35 +52,26 @@ public class ActionCommand extends BaseAction {
...
@@ -63,35 +52,26 @@ public class ActionCommand extends BaseAction {
}
}
}
}
}
}
}
else
{
}
else
{
//先其他服务器再当前服务器
for
(
String
node
:
nodes
.
keySet
()){
//先其他服务器
if
(!
node
.
equalsIgnoreCase
(
curServer
))
{
if
(
nodes
.
get
(
node
).
getApplication
().
getEnable
()
||
nodes
.
get
(
node
).
getCenter
().
getEnable
()){
wo
=
executeCommand
(
ctl
,
node
,
nodes
.
get
(
node
).
nodeAgentPort
());
}
}
}
for
(
String
node
:
nodes
.
keySet
()){
for
(
String
node
:
nodes
.
keySet
()){
//后当前服务器
if
(!
node
.
equalsIgnoreCase
(
Config
.
node
()))
{
if
(
node
.
equalsIgnoreCase
(
curServer
))
{
logger
.
print
(
"{} executeCommand {} on node {}"
,
effectivePerson
.
getDistinguishedName
(),
ctl
,
node
);
if
(
nodes
.
get
(
curServer
).
getApplication
().
getEnable
()
||
nodes
.
get
(
curServer
).
getCenter
().
getEnable
()){
wo
=
executeCommand
(
ctl
,
node
,
nodes
.
get
(
node
).
nodeAgentPort
());
wo
=
executeCommand
(
ctl
,
node
,
nodes
.
get
(
node
).
nodeAgentPort
());
}
}
}
}
}
logger
.
print
(
"{} executeCommand {} on node {}"
,
effectivePerson
.
getDistinguishedName
(),
ctl
,
Config
.
node
());
wo
=
executeCommand
(
ctl
,
Config
.
node
(),
nodes
.
get
(
Config
.
node
()).
nodeAgentPort
());
}
}
}
else
{
}
else
{
wo
=
executeCommand
(
ctl
,
nodeName
,
Integer
.
parseInt
(
wi
.
getNodePort
()));
logger
.
print
(
"{} executeCommand {} on node {}"
,
effectivePerson
.
getDistinguishedName
(),
ctl
,
nodeName
);
wo
=
executeCommand
(
ctl
,
nodeName
,
Integer
.
parseInt
(
wi
.
getNodePort
()));
}
}
result
.
setData
(
wo
);
result
.
setData
(
wo
);
return
result
;
return
result
;
}
}
synchronized
private
Wo
executeCommand
(
String
ctl
,
String
nodeName
,
int
nodePort
)
throws
Exception
{
synchronized
private
Wo
executeCommand
(
String
ctl
,
String
nodeName
,
int
nodePort
)
throws
Exception
{
Wo
wo
=
new
Wo
();
Wo
wo
=
new
Wo
();
wo
.
setNode
(
nodeName
);
wo
.
setNode
(
nodeName
);
...
@@ -106,7 +86,7 @@ public class ActionCommand extends BaseAction {
...
@@ -106,7 +86,7 @@ public class ActionCommand extends BaseAction {
commandObject
.
put
(
"credential"
,
Crypto
.
rsaEncrypt
(
"o2@"
,
Config
.
publicKey
()));
commandObject
.
put
(
"credential"
,
Crypto
.
rsaEncrypt
(
"o2@"
,
Config
.
publicKey
()));
dos
.
writeUTF
(
XGsonBuilder
.
toJson
(
commandObject
));
dos
.
writeUTF
(
XGsonBuilder
.
toJson
(
commandObject
));
dos
.
flush
();
dos
.
flush
();
if
(
ctl
.
indexOf
(
"create encrypt"
)>-
1
)
{
if
(
ctl
.
indexOf
(
"create encrypt"
)>-
1
)
{
String
createEncrypt
=
dis
.
readUTF
();
String
createEncrypt
=
dis
.
readUTF
();
logger
.
info
(
createEncrypt
);
logger
.
info
(
createEncrypt
);
...
@@ -120,18 +100,18 @@ public class ActionCommand extends BaseAction {
...
@@ -120,18 +100,18 @@ public class ActionCommand extends BaseAction {
wo
.
setTime
(
df
.
format
(
new
Date
()));
wo
.
setTime
(
df
.
format
(
new
Date
()));
return
wo
;
return
wo
;
}
}
private
boolean
executeSyncFile
(
String
syncFilePath
,
String
nodeName
,
int
nodePort
){
private
boolean
executeSyncFile
(
String
syncFilePath
,
String
nodeName
,
int
nodePort
){
boolean
syncFileFlag
=
false
;
boolean
syncFileFlag
=
false
;
File
syncFile
;
File
syncFile
;
InputStream
fileInputStream
=
null
;
InputStream
fileInputStream
=
null
;
try
(
Socket
socket
=
new
Socket
(
nodeName
,
nodePort
))
{
try
(
Socket
socket
=
new
Socket
(
nodeName
,
nodePort
))
{
syncFile
=
new
File
(
Config
.
base
(),
syncFilePath
);
syncFile
=
new
File
(
Config
.
base
(),
syncFilePath
);
fileInputStream
=
new
FileInputStream
(
syncFile
);
fileInputStream
=
new
FileInputStream
(
syncFile
);
socket
.
setKeepAlive
(
true
);
socket
.
setKeepAlive
(
true
);
socket
.
setSoTimeout
(
5000
);
socket
.
setSoTimeout
(
5000
);
DataOutputStream
dos
=
null
;
DataOutputStream
dos
=
null
;
...
@@ -139,17 +119,17 @@ public class ActionCommand extends BaseAction {
...
@@ -139,17 +119,17 @@ public class ActionCommand extends BaseAction {
try
{
try
{
dos
=
new
DataOutputStream
(
socket
.
getOutputStream
());
dos
=
new
DataOutputStream
(
socket
.
getOutputStream
());
dis
=
new
DataInputStream
(
socket
.
getInputStream
());
dis
=
new
DataInputStream
(
socket
.
getInputStream
());
Map
<
String
,
Object
>
commandObject
=
new
HashMap
<>();
Map
<
String
,
Object
>
commandObject
=
new
HashMap
<>();
commandObject
.
put
(
"command"
,
"syncFile:"
+
syncFilePath
);
commandObject
.
put
(
"command"
,
"syncFile:"
+
syncFilePath
);
commandObject
.
put
(
"credential"
,
Crypto
.
rsaEncrypt
(
"o2@"
,
Config
.
publicKey
()));
commandObject
.
put
(
"credential"
,
Crypto
.
rsaEncrypt
(
"o2@"
,
Config
.
publicKey
()));
dos
.
writeUTF
(
XGsonBuilder
.
toJson
(
commandObject
));
dos
.
writeUTF
(
XGsonBuilder
.
toJson
(
commandObject
));
dos
.
flush
();
dos
.
flush
();
dos
.
writeUTF
(
syncFilePath
);
dos
.
writeUTF
(
syncFilePath
);
dos
.
flush
();
dos
.
flush
();
logger
.
info
(
"同步文件starting......."
);
logger
.
info
(
"同步文件starting......."
);
byte
[]
bytes
=
new
byte
[
1024
];
byte
[]
bytes
=
new
byte
[
1024
];
int
length
=
0
;
int
length
=
0
;
...
@@ -158,14 +138,14 @@ public class ActionCommand extends BaseAction {
...
@@ -158,14 +138,14 @@ public class ActionCommand extends BaseAction {
dos
.
flush
();
dos
.
flush
();
}
}
logger
.
info
(
"同步文件end......."
);
logger
.
info
(
"同步文件end......."
);
}
finally
{
}
finally
{
dos
.
close
();
dos
.
close
();
dis
.
close
();
dis
.
close
();
socket
.
close
();
socket
.
close
();
fileInputStream
.
close
();
fileInputStream
.
close
();
}
}
syncFileFlag
=
true
;
syncFileFlag
=
true
;
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
logger
.
error
(
ex
);
logger
.
error
(
ex
);
...
@@ -173,7 +153,7 @@ public class ActionCommand extends BaseAction {
...
@@ -173,7 +153,7 @@ public class ActionCommand extends BaseAction {
}
}
return
syncFileFlag
;
return
syncFileFlag
;
}
}
public
static
class
Wi
extends
GsonPropertyObject
{
public
static
class
Wi
extends
GsonPropertyObject
{
@FieldDescribe
(
"命令名称"
)
@FieldDescribe
(
"命令名称"
)
private
String
ctl
;
private
String
ctl
;
...
@@ -181,7 +161,7 @@ public class ActionCommand extends BaseAction {
...
@@ -181,7 +161,7 @@ public class ActionCommand extends BaseAction {
private
String
nodeName
;
private
String
nodeName
;
@FieldDescribe
(
"服务端口"
)
@FieldDescribe
(
"服务端口"
)
private
String
nodePort
;
private
String
nodePort
;
public
String
getCtl
()
{
public
String
getCtl
()
{
return
ctl
;
return
ctl
;
}
}
...
@@ -201,9 +181,9 @@ public class ActionCommand extends BaseAction {
...
@@ -201,9 +181,9 @@ public class ActionCommand extends BaseAction {
this
.
nodePort
=
nodePort
;
this
.
nodePort
=
nodePort
;
}
}
}
}
public
static
class
Wo
extends
GsonPropertyObject
{
public
static
class
Wo
extends
GsonPropertyObject
{
@FieldDescribe
(
"执行时间"
)
@FieldDescribe
(
"执行时间"
)
private
String
time
;
private
String
time
;
@FieldDescribe
(
"执行结束"
)
@FieldDescribe
(
"执行结束"
)
...
@@ -214,11 +194,11 @@ public class ActionCommand extends BaseAction {
...
@@ -214,11 +194,11 @@ public class ActionCommand extends BaseAction {
public
String
getTime
()
{
public
String
getTime
()
{
return
time
;
return
time
;
}
}
public
void
setTime
(
String
time
)
{
public
void
setTime
(
String
time
)
{
this
.
time
=
time
;
this
.
time
=
time
;
}
}
public
String
getNode
()
{
public
String
getNode
()
{
return
node
;
return
node
;
}
}
...
@@ -235,7 +215,7 @@ public class ActionCommand extends BaseAction {
...
@@ -235,7 +215,7 @@ public class ActionCommand extends BaseAction {
this
.
status
=
status
;
this
.
status
=
status
;
}
}
}
}
}
}
o2web/source/x_component_Common/Main.js
浏览文件 @
85887e83
...
@@ -268,9 +268,12 @@ MWF.xApplication.Common.Main = new Class({
...
@@ -268,9 +268,12 @@ MWF.xApplication.Common.Main = new Class({
window
.
addEventListener
(
"
beforeunload
"
,
function
(
e
)
{
window
.
addEventListener
(
"
beforeunload
"
,
function
(
e
)
{
this
.
fireAppEvent
(
"
queryClose
"
);
this
.
fireAppEvent
(
"
queryClose
"
);
}.
bind
(
this
));
}.
bind
(
this
));
// window.addEventListener("pagehide", function (e) {
// this.fireAppEvent("queryClose");
if
(
layout
.
mobile
){
// }.bind(this));
window
.
addEventListener
(
"
pagehide
"
,
function
(
e
)
{
this
.
fireAppEvent
(
"
queryClose
"
);
}.
bind
(
this
));
}
// window.onbeforeunload = function(e){
// window.onbeforeunload = function(e){
// this.fireAppEvent("queryClose");
// this.fireAppEvent("queryClose");
...
...
o2web/source/x_desktop/smapsso.html
浏览文件 @
85887e83
...
@@ -25,6 +25,10 @@
...
@@ -25,6 +25,10 @@
}
}
var
redirect
=
uri
.
getData
(
"
redirect
"
);
var
redirect
=
uri
.
getData
(
"
redirect
"
);
redirect
=
redirect
+
"
&uniqueId=
"
+
uniqueId
+
"
&flushPortalUrl=
"
+
flushPortalUrl
;
redirect
=
redirect
+
"
&uniqueId=
"
+
uniqueId
+
"
&flushPortalUrl=
"
+
flushPortalUrl
;
var
nav
=
uri
.
getData
(
"
nav
"
);
if
(
nav
)
redirect
=
redirect
+
"
&nav=
"
+
nav
;
if
(
xtoken
){
if
(
xtoken
){
var
res
=
new
Request
.
JSON
({
var
res
=
new
Request
.
JSON
({
url
:
o2
.
filterUrl
(
address
+
"
?SMAP_SESSION_DATA=
"
+
encodeURIComponent
(
xtoken
)
+
"
&appID=
"
+
appID
+
"
&date=
"
+
(
new
Date
()).
getTime
()),
url
:
o2
.
filterUrl
(
address
+
"
?SMAP_SESSION_DATA=
"
+
encodeURIComponent
(
xtoken
)
+
"
&appID=
"
+
appID
+
"
&date=
"
+
(
new
Date
()).
getTime
()),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录