Merge branch 'dev'

This commit is contained in:
bwcx_jzy 2021-12-02 13:44:59 +08:00
commit b0de99b8fd
402 changed files with 11940 additions and 2967 deletions

View File

@ -1,5 +1,35 @@
# 版本日志
# 2.7.3
### 新增功能
1. 【server】新增自定义系统网页标题配置`jpom.name`
2. 【server】新增自定义系统网页 Logo 配置`jpom.logoFile`
3. 【server】新增自定义系统登录页面标题配置`jpom.loginTitle`
4. 【server】新增自定义系统 logo 文字标题配置`jpom.subTitle`
5. 新增在线下载最新版本更新包功能(在线检测最新版本)
6. 【server】新增菜单`系统管理-数据库备份`,支持 Jpom 使用的 H2 数据库备份、还原
### 解决BUG、优化功能
1. 【server】修护构建产物为匹配符无法正常发布问题感谢@Kay
2. 【server】修护在线升级页面在二级路径下无法使用的问题 (感谢@hu向...🤡)
3. 【server】修护构建执行命令阻塞问题感谢@小猿同学)
4. 【server】修护限制 IP 访问和插件端授权信息不正确状态码冲突(感谢@小龙、@大灰灰)
5. 取消 tools.jar 依赖
6. 【server】优化初始化数据库流程避免多次执行相同修改节省启动时间
7. 【fix】修护项目副本集乱码感谢@ʟᴊx
8. 【server】添加在线升级完成后的回调提示
9. 【server】ssh安装节点按钮动态显示
10. 【server】修护构建信息中脚本过长无法构建的bug感谢@Dream
11. 在网页的编辑器中修改配置文件时兼容tab键感谢@Dream
> 取消 tools.jar 依赖后Java 项目状态监控使用 `jps` 命令实现
------
# 2.7.2 (fix)
### 新增功能

View File

@ -17,4 +17,4 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -33,7 +33,7 @@
<a href="https://jpom.io/">https://jpom.io/</a> | <a href="https://jpom-site.keepbx.cn/">https://jpom-site.keepbx.cn/</a> | <a href="https://jpom.keepbx.cn/">https://jpom.keepbx.cn/</a>
</p>
#### 你为什么需要[Jpom](https://gitee.com/dromara/Jpom)
#### 你为什么需要 [Jpom](https://gitee.com/dromara/Jpom)
> Java 项目在实际部署运维,通用的方法是登录服务器上传新的项目包,执行相应命令管理,如果管理多个项目则重复操作上述步骤
@ -56,20 +56,21 @@
1. 创建、修改、删除项目、Jar包管理
2. 实时查看控制台日志、备份日志、删除日志、导出日志
3. cpu、ram 监控、导出堆栈信息、查看项目进程端口、服务器状态监控
3. 在线构建项目发布项目一键搞定
4. 多节点管理、多节点自动分发
5. 实时监控项目状态异常自动报警
6. 在线构建项目发布项目一键搞定
7. 多用户管理,用户项目权限独立(上传、删除权限可控制),完善的操作日志
8. 系统路径白名单模式,杜绝用户误操作系统文件
9. 在线管理Nginx配置、ssl证书文件
10. Tomcat状态、文件、war包在线实时管理
5. 在线 SSH 终端,并且有终端日志和禁用命令
6. 实时监控项目状态异常自动报警
7. cpu、ram 监控、导出堆栈信息、查看项目进程端口、服务器状态监控
8. 多用户管理,用户项目权限独立(上传、删除权限可控制),完善的操作日志
9. 系统路径白名单模式,杜绝用户误操作系统文件
10. 在线管理 Nginx 配置文件、ssl 证书文件
11. ~~Tomcat状态、文件、war包在线实时管理 (不再长期维护)~~
> 特别提醒:
> 1. 在Windows服务器中可能有部分功能因为系统特性造成兼容性问题建议在实际使用中充分测试。Linux目前兼容良好
> 1. 在 Windows 服务器中可能有部分功能因为系统特性造成兼容性问题建议在实际使用中充分测试。Linux 目前兼容良好
> 2. 服务端和插件端请安装到不同目录中,切勿安装到同一目录中
> 3. 卸载Jpom插件端或者服务端先停止对应服务删除对应的程序文件、日志文件夹、数据目录文件夹即可
> 4. 构建依赖的是系统环境如果需要maven或者node需要服务端所在的服务器中有对应插件如果已经启动服务端再安装的对应环境需要通过命令行重启服务端后才生效。
> 3. 卸载 Jpom 插件端或者服务端,先停止对应服务,删除对应的程序文件、日志文件夹、数据目录文件夹即可
> 4. 构建依赖的是系统环境,如果需要 maven 或者 node 需要服务端所在的服务器中有对应插件,如果已经启动服务端再安装的对应环境需要通过命令行重启服务端后才生效。
> 升级 2.7.x 后不建议降级操作,会涉及到数据不兼容到情况
>
@ -168,6 +169,8 @@ yum install -y wget && wget -O install.sh https://dromara.gitee.io/jpom/docs/ins
3. 命令运行Server.sh、Server.bat
4. 默认运行端口:`2122` 访问管理页面 例如`http://localhost:2122/`
> 也可以使用 `script/release.bat` `script/release.sh` 快速打包
### 编译运行
1. 访问 [Jpom](https://gitee.com/dromara/Jpom) 的码云主页,拉取最新完整代码(建议使用master分支、如果想体验新功能请使用dev分支)
@ -185,7 +188,7 @@ yum install -y wget && wget -O install.sh https://dromara.gitee.io/jpom/docs/ins
### 管理命令
1. windows中Agent.bat 、Server.bat
1. windows Agent.bat 、Server.bat
```
# 服务端
@ -195,7 +198,9 @@ Server.bat 启动管理面板(按照面板提示输入操作)
Agent.bat 启动管理面板(按照面板提示输入操作)
```
2. linux中Agent.sh 、Server.sh
> windows 中执行启动后需要根据日志取跟进启动的状态
2. linux 中 Agent.sh 、Server.sh
```
# 服务端
@ -230,7 +235,6 @@ Agent.sh create 创建Jpom插件端的应用服务jpom-agent
### 演示项目
[https://jpom.keepbx.cn](https://jpom.keepbx.cn)
```

View File

@ -1 +1 @@
var version = '2.7.2';
var version = '2.7.3';

View File

@ -2,6 +2,8 @@
| 日期 | 渠道 | 金额 | 昵称 |
|---|---|---|---|
| 2021-10-11 | 微信赞赏码 | 10 | chenice |
| 2021-10-11 | 微信赞赏码 | 1 | chenice |
| 2021-09-01 | 微信赞赏码 | 100 | CoCo |
| 2021-09-01 | 微信赞赏码 | 20 | 大灰灰 |
| 2021-08-31 | 微信赞赏码 | 1 | 大灰灰 |

View File

@ -1,6 +1,6 @@
{
"tag_name": "v2.7.2",
"agentUrl": "https://jpom-releases.oss-cn-hangzhou.aliyuncs.com/agent-2.7.2-release.zip",
"serverUrl": "https://jpom-releases.oss-cn-hangzhou.aliyuncs.com/server-2.7.2-release.zip",
"changelog": "https://gitee.com/dromara/Jpom/raw/master/CHANGELOG.md"
"tag_name": "v2.7.3",
"agentUrl": "https://jpom-releases.oss-cn-hangzhou.aliyuncs.com/agent-2.7.3-release.zip",
"serverUrl": "https://jpom-releases.oss-cn-hangzhou.aliyuncs.com/server-2.7.3-release.zip",
"changelogUrl": "https://gitee.com/dromara/Jpom/raw/master/CHANGELOG.md"
}

View File

@ -1,3 +1,27 @@
<!--
The MIT License (MIT)
Copyright (c) 2019 码之科技工作室
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<!DOCTYPE html>
<html lang='zh-CN'>
<head>

View File

@ -5,12 +5,12 @@
<parent>
<artifactId>jpom-parent</artifactId>
<groupId>io.jpom</groupId>
<version>2.7.2</version>
<version>2.7.3</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>agent</artifactId>
<version>2.7.2</version>
<version>2.7.3</version>
<name>Jpom 插件端</name>
<properties>
<start-class>io.jpom.JpomAgentApplication</start-class>

View File

@ -21,6 +21,7 @@
@REM
@echo off
CHCP 65001
setlocal enabledelayedexpansion
@REM 设置环境变量,避免部分服务器没有 taskkill
@ -89,7 +90,7 @@ EXIT 0
echo 启动中.....启动成功后关闭窗口不影响运行
echo 启动详情请查看:%LogName%
javaw %JVM% -Djava.class.path="%JAVA_HOME%/lib/tools.jar;%RUNJAR%" -Dapplication=%Tag% -Dbasedir=%basePath% %MainClass% %ARGS% >> %basePath%%LogName%
javaw %JVM% -Djava.class.path="%RUNJAR%" -Dapplication=%Tag% -Dbasedir=%basePath% %MainClass% %ARGS% >> %basePath%%LogName%
timeout 3
goto:eof

View File

@ -97,10 +97,8 @@ function start() {
echo "没有找到jar"
exit 2
fi
if [[ -z "${NOW_JAVA_HOME}/lib/tools.jar" ]]; then
echo "JDK 中没有 ${NOW_JAVA_HOME}/lib/tools.jar"
fi
nohup ${JAVA} ${JVM} -Xbootclasspath/a:${NOW_JAVA_HOME}/lib/tools.jar -jar ${Lib}${RUNJAR} -Dapplication=${Tag} -Dbasedir=${Path} ${ARGS} >>${Log} 2>&1 &
nohup ${JAVA} ${JVM} -jar ${Lib}${RUNJAR} -Dapplication=${Tag} -Dbasedir=${Path} ${ARGS} >>${Log} 2>&1 &
# 升级不执行查看日志
if [[ ${upgrade} == "upgrade" ]]; then
exit 0

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom;
import cn.jiangzeyin.common.EnableCommonBoot;
@ -30,7 +52,7 @@ public class JpomAgentApplication {
// 拦截器
.addInterceptor(AuthorizeInterceptor.class)
// 添加 参数 url 解码
.addHandlerMethodArgumentResolver(UrlDecodeHandlerMethodArgumentResolver.class)
// .addHandlerMethodArgumentResolver(UrlDecodeHandlerMethodArgumentResolver.class)
.run(args);
}

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.common;
import cn.hutool.extra.servlet.ServletUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.common;
import cn.hutool.core.util.CharsetUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.common;
import cn.hutool.core.util.ReflectUtil;
@ -19,24 +41,24 @@ import java.lang.reflect.Field;
*/
public class UrlDecodeHandlerMethodArgumentResolver extends DefaultHandlerMethodArgumentResolver {
@Override
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
Object argument = super.resolveArgument(parameter, mavContainer, webRequest, binderFactory);
if (argument instanceof String) {
// 解码
return URLUtil.decode(argument.toString());
} else if (argument instanceof BaseJsonModel) {
// 解码对象属性
Field[] fields = ReflectUtil.getFields(argument.getClass());
for (Field field : fields) {
Class<?> type = field.getType();
if (type == String.class) {
String fieldValue = (String) ReflectUtil.getFieldValue(argument, field);
fieldValue = URLUtil.decode(fieldValue);
ReflectUtil.setFieldValue(argument, field, fieldValue);
}
}
}
return argument;
}
// @Override
// public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
// Object argument = super.resolveArgument(parameter, mavContainer, webRequest, binderFactory);
// if (argument instanceof String) {
// // 解码
// return URLUtil.decode(argument.toString());
// } else if (argument instanceof BaseJsonModel) {
// // 解码对象属性
// Field[] fields = ReflectUtil.getFields(argument.getClass());
// for (Field field : fields) {
// Class<?> type = field.getType();
// if (type == String.class) {
// String fieldValue = (String) ReflectUtil.getFieldValue(argument, field);
// fieldValue = URLUtil.decode(fieldValue);
// ReflectUtil.setFieldValue(argument, field, fieldValue);
// }
// }
// }
// return argument;
// }
}

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.common.commander;
import cn.hutool.cache.impl.LRUCache;
@ -16,7 +38,6 @@ import cn.hutool.http.HttpUtil;
import cn.hutool.system.SystemUtil;
import cn.jiangzeyin.common.DefaultSystemLog;
import cn.jiangzeyin.common.spring.SpringUtil;
import com.sun.tools.attach.VirtualMachine;
import io.jpom.common.commander.impl.LinuxProjectCommander;
import io.jpom.common.commander.impl.MacOSProjectCommander;
import io.jpom.common.commander.impl.WindowsProjectCommander;
@ -49,493 +70,488 @@ import java.util.jar.Manifest;
*/
public abstract class AbstractProjectCommander {
public static final String RUNNING_TAG = "running";
public static final String STOP_TAG = "stopped";
public static final String RUNNING_TAG = "running";
public static final String STOP_TAG = "stopped";
private static AbstractProjectCommander abstractProjectCommander = null;
private static AbstractProjectCommander abstractProjectCommander = null;
/**
* 进程id 对应Jpom 名称
*/
public static final ConcurrentHashMap<Integer, String> PID_JPOM_NAME = new ConcurrentHashMap<>();
/**
* 进程Id 获取端口号
*/
public static final LRUCache<Integer, String> PID_PORT = new LRUCache<>(100, TimeUnit.MINUTES.toMillis(10));
/**
* 进程id 对应Jpom 名称
*/
public static final ConcurrentHashMap<Integer, String> PID_JPOM_NAME = new ConcurrentHashMap<>();
/**
* 进程Id 获取端口号
*/
public static final LRUCache<Integer, String> PID_PORT = new LRUCache<>(100, TimeUnit.MINUTES.toMillis(10));
/**
* 实例化Commander
*
* @return 命令执行对象
*/
public static AbstractProjectCommander getInstance() {
if (abstractProjectCommander != null) {
return abstractProjectCommander;
}
if (SystemUtil.getOsInfo().isLinux()) {
// Linux系统
abstractProjectCommander = new LinuxProjectCommander();
} else if (SystemUtil.getOsInfo().isWindows()) {
// Windows系统
abstractProjectCommander = new WindowsProjectCommander();
} else if (SystemUtil.getOsInfo().isMac()) {
abstractProjectCommander = new MacOSProjectCommander();
} else {
throw new JpomRuntimeException("不支持的:" + SystemUtil.getOsInfo().getName());
}
return abstractProjectCommander;
}
/**
* 实例化Commander
*
* @return 命令执行对象
*/
public static AbstractProjectCommander getInstance() {
if (abstractProjectCommander != null) {
return abstractProjectCommander;
}
if (SystemUtil.getOsInfo().isLinux()) {
// Linux系统
abstractProjectCommander = new LinuxProjectCommander();
} else if (SystemUtil.getOsInfo().isWindows()) {
// Windows系统
abstractProjectCommander = new WindowsProjectCommander();
} else if (SystemUtil.getOsInfo().isMac()) {
abstractProjectCommander = new MacOSProjectCommander();
} else {
throw new JpomRuntimeException("不支持的:" + SystemUtil.getOsInfo().getName());
}
return abstractProjectCommander;
}
//---------------------------------------------------- 基本操作----start
//---------------------------------------------------- 基本操作----start
/**
* 生成可以执行的命令
*
* @param projectInfoModel 项目
* @param javaCopyItem 副本信息
* @return null 是条件不足
*/
public abstract String buildCommand(ProjectInfoModel projectInfoModel, ProjectInfoModel.JavaCopyItem javaCopyItem);
/**
* 生成可以执行的命令
*
* @param projectInfoModel 项目
* @param javaCopyItem 副本信息
* @return null 是条件不足
*/
public abstract String buildCommand(ProjectInfoModel projectInfoModel, ProjectInfoModel.JavaCopyItem javaCopyItem);
protected String getRunJavaPath(ProjectInfoModel projectInfoModel, boolean w) {
if (StrUtil.isEmpty(projectInfoModel.getJdkId())) {
return w ? "javaw" : "java";
}
JdkInfoService bean = SpringUtil.getBean(JdkInfoService.class);
JdkInfoModel item = bean.getItem(projectInfoModel.getJdkId());
if (item == null) {
return w ? "javaw" : "java";
}
String jdkJavaPath = FileUtils.getJdkJavaPath(item.getPath(), w);
if (jdkJavaPath.contains(StrUtil.SPACE)) {
jdkJavaPath = String.format("\"%s\"", jdkJavaPath);
}
return jdkJavaPath;
}
protected String getRunJavaPath(ProjectInfoModel projectInfoModel, boolean w) {
if (StrUtil.isEmpty(projectInfoModel.getJdkId())) {
return w ? "javaw" : "java";
}
JdkInfoService bean = SpringUtil.getBean(JdkInfoService.class);
JdkInfoModel item = bean.getItem(projectInfoModel.getJdkId());
if (item == null) {
return w ? "javaw" : "java";
}
String jdkJavaPath = FileUtils.getJdkJavaPath(item.getPath(), w);
if (jdkJavaPath.contains(StrUtil.SPACE)) {
jdkJavaPath = String.format("\"%s\"", jdkJavaPath);
}
return jdkJavaPath;
}
/**
* 启动
*
* @param projectInfoModel 项目
* @return 结果
* @throws Exception 异常
*/
public String start(ProjectInfoModel projectInfoModel, ProjectInfoModel.JavaCopyItem javaCopyItem) throws Exception {
String msg = checkStart(projectInfoModel, javaCopyItem);
if (msg != null) {
return msg;
}
String command = buildCommand(projectInfoModel, javaCopyItem);
if (command == null) {
throw new JpomRuntimeException("没有需要执行的命令");
}
// 执行命令
ThreadUtil.execute(() -> {
try {
File file = FileUtil.file(projectInfoModel.allLib());
if (SystemUtil.getOsInfo().isWindows()) {
CommandUtil.execSystemCommand(command, file);
} else {
CommandUtil.asyncExeLocalCommand(file, command);
}
} catch (Exception e) {
DefaultSystemLog.getLog().error("执行命令失败", e);
}
});
//
loopCheckRun(projectInfoModel.getId(), true);
return status(projectInfoModel.getId());
}
/**
* 启动
*
* @param projectInfoModel 项目
* @return 结果
* @throws Exception 异常
*/
public String start(ProjectInfoModel projectInfoModel, ProjectInfoModel.JavaCopyItem javaCopyItem) throws Exception {
String msg = checkStart(projectInfoModel, javaCopyItem);
if (msg != null) {
return msg;
}
String command = buildCommand(projectInfoModel, javaCopyItem);
if (command == null) {
throw new JpomRuntimeException("没有需要执行的命令");
}
// 执行命令
ThreadUtil.execute(() -> {
try {
File file = FileUtil.file(projectInfoModel.allLib());
if (SystemUtil.getOsInfo().isWindows()) {
CommandUtil.execSystemCommand(command, file);
} else {
CommandUtil.asyncExeLocalCommand(file, command);
}
} catch (Exception e) {
DefaultSystemLog.getLog().error("执行命令失败", e);
}
});
//
loopCheckRun(projectInfoModel.getId(), true);
return status(projectInfoModel.getId());
}
/**
* 查询出指定端口信息
*
* @param pid 进程id
* @param listening 是否只获取检查状态的
* @return 数组
*/
public abstract List<NetstatModel> listNetstat(int pid, boolean listening);
/**
* 查询出指定端口信息
*
* @param pid 进程id
* @param listening 是否只获取检查状态的
* @return 数组
*/
public abstract List<NetstatModel> listNetstat(int pid, boolean listening);
/**
* 停止
*
* @param projectInfoModel 项目
* @return 结果
* @throws Exception 异常
*/
public String stop(ProjectInfoModel projectInfoModel, ProjectInfoModel.JavaCopyItem javaCopyItem) throws Exception {
String tag = javaCopyItem == null ? projectInfoModel.getId() : javaCopyItem.getTagId();
String token = projectInfoModel.getToken();
if (StrUtil.isNotEmpty(token)) {
try {
HttpRequest httpRequest = HttpUtil.createGet(token)
.form("projectId", projectInfoModel.getId());
if (javaCopyItem != null) {
httpRequest.form("copyId", javaCopyItem.getId());
}
String body = httpRequest.execute().body();
DefaultSystemLog.getLog().info(projectInfoModel.getName() + ":" + body);
} catch (Exception e) {
DefaultSystemLog.getLog().error("WebHooks 调用错误", e);
return "WebHooks error:" + e.getMessage();
}
}
// 再次查看进程信息
String result = status(tag);
//
int pid = parsePid(result);
if (pid > 0) {
// 清空名称缓存
PID_JPOM_NAME.remove(pid);
// 端口号缓存
PID_PORT.remove(pid);
}
return result;
}
/**
* 停止
*
* @param projectInfoModel 项目
* @return 结果
* @throws Exception 异常
*/
public String stop(ProjectInfoModel projectInfoModel, ProjectInfoModel.JavaCopyItem javaCopyItem) throws Exception {
String tag = javaCopyItem == null ? projectInfoModel.getId() : javaCopyItem.getTagId();
String token = projectInfoModel.getToken();
if (StrUtil.isNotEmpty(token)) {
try {
HttpRequest httpRequest = HttpUtil.createGet(token)
.form("projectId", projectInfoModel.getId());
if (javaCopyItem != null) {
httpRequest.form("copyId", javaCopyItem.getId());
}
String body = httpRequest.execute().body();
DefaultSystemLog.getLog().info(projectInfoModel.getName() + ":" + body);
} catch (Exception e) {
DefaultSystemLog.getLog().error("WebHooks 调用错误", e);
return "WebHooks error:" + e.getMessage();
}
}
// 再次查看进程信息
String result = status(tag);
//
int pid = parsePid(result);
if (pid > 0) {
// 清空名称缓存
PID_JPOM_NAME.remove(pid);
// 端口号缓存
PID_PORT.remove(pid);
}
return result;
}
/**
* 重启
*
* @param projectInfoModel 项目
* @return 结果
* @throws Exception 异常
*/
public String restart(ProjectInfoModel projectInfoModel, ProjectInfoModel.JavaCopyItem javaCopyItem) throws Exception {
if (javaCopyItem == null) {
if (isRun(projectInfoModel.getId())) {
stop(projectInfoModel, javaCopyItem);
}
} else {
if (isRun(javaCopyItem.getTagId())) {
stop(projectInfoModel, javaCopyItem);
}
}
return start(projectInfoModel, javaCopyItem);
}
/**
* 重启
*
* @param projectInfoModel 项目
* @return 结果
* @throws Exception 异常
*/
public String restart(ProjectInfoModel projectInfoModel, ProjectInfoModel.JavaCopyItem javaCopyItem) throws Exception {
if (javaCopyItem == null) {
if (isRun(projectInfoModel.getId())) {
stop(projectInfoModel, javaCopyItem);
}
} else {
if (isRun(javaCopyItem.getTagId())) {
stop(projectInfoModel, javaCopyItem);
}
}
return start(projectInfoModel, javaCopyItem);
}
/**
* 启动项目前基本检查
*
* @param projectInfoModel 项目
* @return null 检查一切正常
* @throws Exception 异常
*/
private String checkStart(ProjectInfoModel projectInfoModel, ProjectInfoModel.JavaCopyItem javaCopyItem) throws Exception {
int pid = javaCopyItem == null ? getPid(projectInfoModel.getId()) : this.getPid(javaCopyItem.getTagId());
if (pid > 0) {
return "当前程序正常运行中,不能重复启动,PID:" + pid;
}
String lib = projectInfoModel.allLib();
File fileLib = new File(lib);
File[] files = fileLib.listFiles();
if (files == null || files.length <= 0) {
return "没有jar包,请先到文件管理中上传程序的jar";
}
//
if (projectInfoModel.getRunMode() == RunMode.ClassPath || projectInfoModel.getRunMode() == RunMode.JavaExtDirsCp) {
JarClassLoader jarClassLoader = JarClassLoader.load(fileLib);
// 判断主类
try {
jarClassLoader.loadClass(projectInfoModel.getMainClass());
} catch (ClassNotFoundException notFound) {
return "没有找到对应的MainClass:" + projectInfoModel.getMainClass();
}
} else {
List<File> fileList = ProjectInfoModel.listJars(projectInfoModel);
if (fileList.size() <= 0) {
return String.format("没有%s包,请先到文件管理中上传程序的%s", projectInfoModel.getRunMode().name(), projectInfoModel.getRunMode().name());
}
File jarFile = fileList.get(0);
String checkJar = checkJar(jarFile);
if (checkJar != null) {
return checkJar;
}
}
// 备份日志
backLog(projectInfoModel, javaCopyItem);
return null;
}
/**
* 启动项目前基本检查
*
* @param projectInfoModel 项目
* @return null 检查一切正常
* @throws Exception 异常
*/
private String checkStart(ProjectInfoModel projectInfoModel, ProjectInfoModel.JavaCopyItem javaCopyItem) throws Exception {
int pid = javaCopyItem == null ? getPid(projectInfoModel.getId()) : this.getPid(javaCopyItem.getTagId());
if (pid > 0) {
return "当前程序正常运行中,不能重复启动,PID:" + pid;
}
String lib = projectInfoModel.allLib();
File fileLib = new File(lib);
File[] files = fileLib.listFiles();
if (files == null || files.length <= 0) {
return "没有jar包,请先到文件管理中上传程序的jar";
}
//
if (projectInfoModel.getRunMode() == RunMode.ClassPath || projectInfoModel.getRunMode() == RunMode.JavaExtDirsCp) {
JarClassLoader jarClassLoader = JarClassLoader.load(fileLib);
// 判断主类
try {
jarClassLoader.loadClass(projectInfoModel.getMainClass());
} catch (ClassNotFoundException notFound) {
return "没有找到对应的MainClass:" + projectInfoModel.getMainClass();
}
} else {
List<File> fileList = ProjectInfoModel.listJars(projectInfoModel);
if (fileList.size() <= 0) {
return String.format("没有%s包,请先到文件管理中上传程序的%s", projectInfoModel.getRunMode().name(), projectInfoModel.getRunMode().name());
}
File jarFile = fileList.get(0);
String checkJar = checkJar(jarFile);
if (checkJar != null) {
return checkJar;
}
}
// 备份日志
backLog(projectInfoModel, javaCopyItem);
return null;
}
private static String checkJar(File jarFile) {
try (JarFile jarFile1 = new JarFile(jarFile)) {
Manifest manifest = jarFile1.getManifest();
Attributes attributes = manifest.getMainAttributes();
String mainClass = attributes.getValue(Attributes.Name.MAIN_CLASS);
if (mainClass == null) {
return jarFile.getAbsolutePath() + "中没有找到对应的MainClass属性";
}
JarClassLoader jarClassLoader = JarClassLoader.load(jarFile);
try {
jarClassLoader.loadClass(mainClass);
} catch (ClassNotFoundException notFound) {
return jarFile.getAbsolutePath() + "中没有找到对应的MainClass:" + mainClass;
}
} catch (Exception e) {
DefaultSystemLog.getLog().error("解析jar", e);
return jarFile.getAbsolutePath() + " 解析错误:" + e.getMessage();
}
return null;
}
private static String checkJar(File jarFile) {
try (JarFile jarFile1 = new JarFile(jarFile)) {
Manifest manifest = jarFile1.getManifest();
Attributes attributes = manifest.getMainAttributes();
String mainClass = attributes.getValue(Attributes.Name.MAIN_CLASS);
if (mainClass == null) {
return jarFile.getAbsolutePath() + "中没有找到对应的MainClass属性";
}
JarClassLoader jarClassLoader = JarClassLoader.load(jarFile);
try {
jarClassLoader.loadClass(mainClass);
} catch (ClassNotFoundException notFound) {
return jarFile.getAbsolutePath() + "中没有找到对应的MainClass:" + mainClass;
}
} catch (Exception e) {
DefaultSystemLog.getLog().error("解析jar", e);
return jarFile.getAbsolutePath() + " 解析错误:" + e.getMessage();
}
return null;
}
/**
* 清空日志信息
*
* @param projectInfoModel 项目
* @return 结果
*/
public String backLog(ProjectInfoModel projectInfoModel, ProjectInfoModel.JavaCopyItem javaCopyItem) {
File file = javaCopyItem == null ? new File(projectInfoModel.getLog()) : projectInfoModel.getLog(javaCopyItem);
if (!file.exists() || file.isDirectory()) {
return "not exists";
}
// 文件内容太少不处理
if (file.length() <= 1000) {
return "ok";
}
if (AgentExtConfigBean.getInstance().openLogBack()) {
// 开启日志备份才移动文件
File backPath = javaCopyItem == null ? projectInfoModel.getLogBack() : projectInfoModel.getLogBack(javaCopyItem);
backPath = new File(backPath, DateTime.now().toString(DatePattern.PURE_DATETIME_FORMAT) + ".log");
FileUtil.copy(file, backPath, true);
}
// 清空日志
String r = AbstractSystemCommander.getInstance().emptyLogFile(file);
if (StrUtil.isNotEmpty(r)) {
DefaultSystemLog.getLog().info(r);
}
return "ok";
}
/**
* 清空日志信息
*
* @param projectInfoModel 项目
* @return 结果
*/
public String backLog(ProjectInfoModel projectInfoModel, ProjectInfoModel.JavaCopyItem javaCopyItem) {
File file = javaCopyItem == null ? new File(projectInfoModel.getLog()) : projectInfoModel.getLog(javaCopyItem);
if (!file.exists() || file.isDirectory()) {
return "not exists";
}
// 文件内容太少不处理
if (file.length() <= 1000) {
return "ok";
}
if (AgentExtConfigBean.getInstance().openLogBack()) {
// 开启日志备份才移动文件
File backPath = javaCopyItem == null ? projectInfoModel.getLogBack() : projectInfoModel.getLogBack(javaCopyItem);
backPath = new File(backPath, DateTime.now().toString(DatePattern.PURE_DATETIME_FORMAT) + ".log");
FileUtil.copy(file, backPath, true);
}
// 清空日志
String r = AbstractSystemCommander.getInstance().emptyLogFile(file);
if (StrUtil.isNotEmpty(r)) {
DefaultSystemLog.getLog().info(r);
}
return "ok";
}
/**
* 查看状态
*
* @param tag 运行标识
* @return 查询结果
* @throws Exception 异常
*/
public String status(String tag) throws Exception {
boolean disableVirtualMachine = AgentExtConfigBean.getInstance().isDisableVirtualMachine();
if (disableVirtualMachine) {
String jpsStatus = getJpsStatus(tag);
if (StrUtil.equals(AbstractProjectCommander.STOP_TAG, jpsStatus) && SystemUtil.getOsInfo().isLinux()) {
return getLinuxPsStatus(tag);
}
return jpsStatus;
} else {
VirtualMachine virtualMachine = JvmUtil.getVirtualMachine(tag);
if (virtualMachine == null) {
String jpsStatus = getJpsStatus(tag);
if (StrUtil.equals(AbstractProjectCommander.STOP_TAG, jpsStatus) && SystemUtil.getOsInfo().isLinux()) {
return getLinuxPsStatus(tag);
}
return jpsStatus;
}
try {
return StrUtil.format("{}:{}", AbstractProjectCommander.RUNNING_TAG, virtualMachine.id());
} finally {
virtualMachine.detach();
}
}
}
/**
* 查看状态
*
* @param tag 运行标识
* @return 查询结果
* @throws Exception 异常
*/
public String status(String tag) throws Exception {
boolean disableVirtualMachine = AgentExtConfigBean.getInstance().isDisableVirtualMachine();
if (disableVirtualMachine) {
String jpsStatus = getJpsStatus(tag);
if (StrUtil.equals(AbstractProjectCommander.STOP_TAG, jpsStatus) && SystemUtil.getOsInfo().isLinux()) {
return getLinuxPsStatus(tag);
}
return jpsStatus;
} else {
Integer pid = JvmUtil.getPidByTag(tag);
if (pid == null) {
String jpsStatus = getJpsStatus(tag);
if (StrUtil.equals(AbstractProjectCommander.STOP_TAG, jpsStatus) && SystemUtil.getOsInfo().isLinux()) {
return getLinuxPsStatus(tag);
}
return jpsStatus;
}
return StrUtil.format("{}:{}", AbstractProjectCommander.RUNNING_TAG, pid);
/**
* 尝试jps 中查看进程id
*
* @param tag 进程标识
* @return 运行标识
*/
private String getJpsStatus(String tag) {
String execSystemCommand = CommandUtil.execSystemCommand("jps -mv");
List<String> list = StrSplitter.splitTrim(execSystemCommand, StrUtil.LF, true);
for (String item : list) {
if (JvmUtil.checkCommandLineIsJpom(item, tag)) {
String[] split = StrUtil.splitToArray(item, StrUtil.SPACE);
return StrUtil.format("{}:{}", AbstractProjectCommander.RUNNING_TAG, split[0]);
}
}
return AbstractProjectCommander.STOP_TAG;
}
}
}
/**
* 尝试jps 中查看进程id
*
* @param tag 进程标识
* @return 运行标识
*/
private String getJpsStatus(String tag) {
String execSystemCommand = CommandUtil.execSystemCommand("jps -mv");
List<String> list = StrSplitter.splitTrim(execSystemCommand, StrUtil.LF, true);
for (String item : list) {
if (JvmUtil.checkCommandLineIsJpom(item, tag)) {
String[] split = StrUtil.splitToArray(item, StrUtil.SPACE);
return StrUtil.format("{}:{}", AbstractProjectCommander.RUNNING_TAG, split[0]);
}
}
return AbstractProjectCommander.STOP_TAG;
}
/**
* 尝试ps -ef | grep 中查看进程id
*
* @param tag 进程标识
* @return 运行标识
*/
private String getLinuxPsStatus(String tag) {
String execSystemCommand = CommandUtil.execSystemCommand("ps -ef | grep " + tag);
List<String> list = StrSplitter.splitTrim(execSystemCommand, StrUtil.LF, true);
for (String item : list) {
if (JvmUtil.checkCommandLineIsJpom(item, tag)) {
String[] split = StrUtil.splitToArray(item, StrUtil.SPACE);
return StrUtil.format("{}:{}", AbstractProjectCommander.RUNNING_TAG, split[1]);
}
}
return AbstractProjectCommander.STOP_TAG;
}
/**
* 尝试ps -ef | grep 中查看进程id
*
* @param tag 进程标识
* @return 运行标识
*/
private String getLinuxPsStatus(String tag) {
String execSystemCommand = CommandUtil.execSystemCommand("ps -ef | grep " + tag);
List<String> list = StrSplitter.splitTrim(execSystemCommand, StrUtil.LF, true);
for (String item : list) {
if (JvmUtil.checkCommandLineIsJpom(item, tag)) {
String[] split = StrUtil.splitToArray(item, StrUtil.SPACE);
return StrUtil.format("{}:{}", AbstractProjectCommander.RUNNING_TAG, split[1]);
}
}
return AbstractProjectCommander.STOP_TAG;
}
//---------------------------------------------------- 基本操作----end
//---------------------------------------------------- 基本操作----end
/**
* 获取进程占用的主要端口
*
* @param pid 进程id
* @return 端口
*/
public String getMainPort(int pid) {
String cachePort = PID_PORT.get(pid);
if (cachePort != null) {
return cachePort;
}
List<NetstatModel> list = listNetstat(pid, true);
if (list == null) {
return StrUtil.DASHED;
}
List<Integer> ports = new ArrayList<>();
for (NetstatModel model : list) {
String local = model.getLocal();
String portStr = getPortFormLocalIp(local);
if (portStr == null) {
continue;
}
// 取最小的端口号
int minPort = Convert.toInt(portStr, Integer.MAX_VALUE);
if (minPort == Integer.MAX_VALUE) {
continue;
}
ports.add(minPort);
}
if (CollUtil.isEmpty(ports)) {
return StrUtil.DASHED;
}
String allPort = CollUtil.join(ports, ",");
// 缓存
PID_PORT.put(pid, allPort);
return allPort;
}
/**
* 获取进程占用的主要端口
*
* @param pid 进程id
* @return 端口
*/
public String getMainPort(int pid) {
String cachePort = PID_PORT.get(pid);
if (cachePort != null) {
return cachePort;
}
List<NetstatModel> list = listNetstat(pid, true);
if (list == null) {
return StrUtil.DASHED;
}
List<Integer> ports = new ArrayList<>();
for (NetstatModel model : list) {
String local = model.getLocal();
String portStr = getPortFormLocalIp(local);
if (portStr == null) {
continue;
}
// 取最小的端口号
int minPort = Convert.toInt(portStr, Integer.MAX_VALUE);
if (minPort == Integer.MAX_VALUE) {
continue;
}
ports.add(minPort);
}
if (CollUtil.isEmpty(ports)) {
return StrUtil.DASHED;
}
String allPort = CollUtil.join(ports, ",");
// 缓存
PID_PORT.put(pid, allPort);
return allPort;
}
/**
* 判断ip 信息是否为本地ip
*
* @param local ip信息
* @return true 是本地ip
*/
private String getPortFormLocalIp(String local) {
if (StrUtil.isEmpty(local)) {
return null;
}
List<String> ipPort = StrSplitter.splitTrim(local, StrUtil.COLON, true);
if (ipPort.isEmpty()) {
return null;
}
if ("0.0.0.0".equals(ipPort.get(0)) || ipPort.size() == 1) {
// 0.0.0.0:8084 || :::18000
return ipPort.get(ipPort.size() - 1);
}
return null;
}
/**
* 判断ip 信息是否为本地ip
*
* @param local ip信息
* @return true 是本地ip
*/
private String getPortFormLocalIp(String local) {
if (StrUtil.isEmpty(local)) {
return null;
}
List<String> ipPort = StrSplitter.splitTrim(local, StrUtil.COLON, true);
if (ipPort.isEmpty()) {
return null;
}
if ("0.0.0.0".equals(ipPort.get(0)) || ipPort.size() == 1) {
// 0.0.0.0:8084 || :::18000
return ipPort.get(ipPort.size() - 1);
}
return null;
}
/**
* 根据指定进程id获取Jpom 名称
*
* @param pid 进程id
* @return false 不是来自Jpom
* @throws IOException 异常
*/
public String getJpomNameByPid(int pid) throws IOException {
String name = PID_JPOM_NAME.get(pid);
if (name != null) {
return name;
}
DefaultSystemLog.getLog().debug("getJpomNameByPid pid: {}", pid);
ProjectInfoService projectInfoService = SpringUtil.getBean(ProjectInfoService.class);
List<ProjectInfoModel> projectInfoModels = projectInfoService.list();
if (projectInfoModels == null || projectInfoModels.isEmpty()) {
return StrUtil.DASHED;
}
VirtualMachine virtualMachine = JvmUtil.getVirtualMachine(pid);
if (virtualMachine == null) {
return StrUtil.DASHED;
}
try {
for (ProjectInfoModel projectInfoModel : projectInfoModels) {
if (JvmUtil.checkVirtualMachineIsJpom(virtualMachine, projectInfoModel.getId())) {
name = projectInfoModel.getName();
break;
}
}
} finally {
virtualMachine.detach();
}
if (name != null) {
PID_JPOM_NAME.put(pid, name);
return name;
}
return StrUtil.DASHED;
}
/**
* 根据指定进程id获取Jpom 名称
*
* @param pid 进程id
* @return false 不是来自Jpom
* @throws IOException 异常
*/
public String getJpomNameByPid(int pid) throws IOException {
String name = PID_JPOM_NAME.get(pid);
if (name != null) {
return name;
}
DefaultSystemLog.getLog().debug("getJpomNameByPid pid: {}", pid);
ProjectInfoService projectInfoService = SpringUtil.getBean(ProjectInfoService.class);
List<ProjectInfoModel> projectInfoModels = projectInfoService.list();
if (projectInfoModels == null || projectInfoModels.isEmpty()) {
return StrUtil.DASHED;
}
String virtualMachine = JvmUtil.getVirtualMachineInfo(pid);
if (virtualMachine == null) {
return StrUtil.DASHED;
}
for (ProjectInfoModel projectInfoModel : projectInfoModels) {
if (JvmUtil.checkCommandLineIsJpom(virtualMachine, projectInfoModel.getId())) {
name = projectInfoModel.getName();
break;
}
}
if (name != null) {
PID_JPOM_NAME.put(pid, name);
return name;
}
return StrUtil.DASHED;
}
/**
* 获取进程id
*
* @param tag 项目Id
* @return 未运行 返回 0
* @throws Exception 异常
*/
public int getPid(String tag) throws Exception {
String result = status(tag);
return parsePid(result);
}
/**
* 获取进程id
*
* @param tag 项目Id
* @return 未运行 返回 0
* @throws Exception 异常
*/
public int getPid(String tag) throws Exception {
String result = status(tag);
return parsePid(result);
}
/**
* 转换pid
*
* @param result 查询信息
* @return int
*/
public static int parsePid(String result) {
if (result.startsWith(AbstractProjectCommander.RUNNING_TAG)) {
String[] split = result.split(":");
return Convert.toInt(ArrayUtil.get(split, 1), 0);
}
return 0;
}
/**
* 转换pid
*
* @param result 查询信息
* @return int
*/
public static int parsePid(String result) {
if (result.startsWith(AbstractProjectCommander.RUNNING_TAG)) {
String[] split = result.split(":");
return Convert.toInt(ArrayUtil.get(split, 1), 0);
}
return 0;
}
/**
* 是否正在运行
*
* @param tag id
* @return true 正在运行
* @throws Exception 异常
*/
public boolean isRun(String tag) throws Exception {
String result = status(tag);
return result.contains(AbstractProjectCommander.RUNNING_TAG);
}
/**
* 是否正在运行
*
* @param tag id
* @return true 正在运行
* @throws Exception 异常
*/
public boolean isRun(String tag) throws Exception {
String result = status(tag);
return result.contains(AbstractProjectCommander.RUNNING_TAG);
}
/***
* 阻塞检查程序状态
* @param tag 程序tag
* @param status 要检查的状态
* @throws Exception 异常
* @return 和参数status相反
*/
protected boolean loopCheckRun(String tag, boolean status) throws Exception {
int stopWaitTime = AgentExtConfigBean.getInstance().getStopWaitTime();
stopWaitTime = Math.max(stopWaitTime, 1);
int loopCount = (int) (TimeUnit.SECONDS.toMillis(stopWaitTime) / 500);
int count = 0;
do {
if (isRun(tag) == status) {
return status;
}
try {
Thread.sleep(500);
} catch (InterruptedException ignored) {
}
} while (count++ < loopCount);
return !status;
}
/***
* 阻塞检查程序状态
* @param tag 程序tag
* @param status 要检查的状态
* @throws Exception 异常
* @return 和参数status相反
*/
protected boolean loopCheckRun(String tag, boolean status) throws Exception {
int stopWaitTime = AgentExtConfigBean.getInstance().getStopWaitTime();
stopWaitTime = Math.max(stopWaitTime, 1);
int loopCount = (int) (TimeUnit.SECONDS.toMillis(stopWaitTime) / 500);
int count = 0;
do {
if (isRun(tag) == status) {
return status;
}
try {
Thread.sleep(500);
} catch (InterruptedException ignored) {
}
} while (count++ < loopCount);
return !status;
}
}

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.common.commander;
import cn.hutool.system.SystemUtil;
@ -20,112 +42,112 @@ import java.util.List;
*/
public abstract class AbstractSystemCommander {
private static AbstractSystemCommander abstractSystemCommander = null;
private static AbstractSystemCommander abstractSystemCommander = null;
public static AbstractSystemCommander getInstance() {
if (abstractSystemCommander != null) {
return abstractSystemCommander;
}
if (SystemUtil.getOsInfo().isLinux()) {
// Linux系统
abstractSystemCommander = new LinuxSystemCommander();
} else if (SystemUtil.getOsInfo().isWindows()) {
// Windows系统
abstractSystemCommander = new WindowsSystemCommander();
} else if (SystemUtil.getOsInfo().isMac()) {
abstractSystemCommander = new MacOSSystemCommander();
} else {
throw new JpomRuntimeException("不支持的:" + SystemUtil.getOsInfo().getName());
}
return abstractSystemCommander;
}
public static AbstractSystemCommander getInstance() {
if (abstractSystemCommander != null) {
return abstractSystemCommander;
}
if (SystemUtil.getOsInfo().isLinux()) {
// Linux系统
abstractSystemCommander = new LinuxSystemCommander();
} else if (SystemUtil.getOsInfo().isWindows()) {
// Windows系统
abstractSystemCommander = new WindowsSystemCommander();
} else if (SystemUtil.getOsInfo().isMac()) {
abstractSystemCommander = new MacOSSystemCommander();
} else {
throw new JpomRuntimeException("不支持的:" + SystemUtil.getOsInfo().getName());
}
return abstractSystemCommander;
}
/**
* 获取整个服务器监控信息
*
* @return data
*/
public abstract JSONObject getAllMonitor();
/**
* 获取整个服务器监控信息
*
* @return data
*/
public abstract JSONObject getAllMonitor();
/**
* 获取当前服务器的所有进程列表
*
* @return array
*/
public abstract List<ProcessModel> getProcessList();
/**
* 获取当前服务器的所有进程列表
*
* @return array
*/
public abstract List<ProcessModel> getProcessList();
/**
* 获取指定进程的 内存信息
*
* @param pid 进程id
* @return json
*/
public abstract ProcessModel getPidInfo(int pid);
/**
* 获取指定进程的 内存信息
*
* @param pid 进程id
* @return json
*/
public abstract ProcessModel getPidInfo(int pid);
/**
* 清空文件内容
*
* @param file 文件
* @return 执行结果
*/
public abstract String emptyLogFile(File file);
/**
* 清空文件内容
*
* @param file 文件
* @return 执行结果
*/
public abstract String emptyLogFile(File file);
/**
* 磁盘占用
*
* @return 磁盘占用
*/
protected static String getHardDisk() {
File[] files = File.listRoots();
double totalSpace = 0;
double useAbleSpace = 0;
for (File file : files) {
double total = file.getTotalSpace();
totalSpace += total;
useAbleSpace += total - file.getUsableSpace();
}
return String.format("%.2f", useAbleSpace / totalSpace * 100);
}
/**
* 磁盘占用
*
* @return 磁盘占用
*/
protected static String getHardDisk() {
File[] files = File.listRoots();
double totalSpace = 0;
double useAbleSpace = 0;
for (File file : files) {
double total = file.getTotalSpace();
totalSpace += total;
useAbleSpace += total - file.getUsableSpace();
}
return totalSpace <= 0 ? "0" : String.format("%.2f", useAbleSpace / totalSpace * 100);
}
/**
* 查询服务状态
*
* @param serviceName 服务名称
* @return true 运行中
*/
public abstract boolean getServiceStatus(String serviceName);
/**
* 查询服务状态
*
* @param serviceName 服务名称
* @return true 运行中
*/
public abstract boolean getServiceStatus(String serviceName);
/**
* 启动服务
*
* @param serviceName 服务名称
* @return 结果
*/
public abstract String startService(String serviceName);
/**
* 启动服务
*
* @param serviceName 服务名称
* @return 结果
*/
public abstract String startService(String serviceName);
/**
* 关闭服务
*
* @param serviceName 服务名称
* @return 结果
*/
public abstract String stopService(String serviceName);
/**
* 关闭服务
*
* @param serviceName 服务名称
* @return 结果
*/
public abstract String stopService(String serviceName);
/**
* 构建kill 命令
*
* @param pid 进程编号
* @return 结束进程命令
*/
public abstract String buildKill(int pid);
/**
* 构建kill 命令
*
* @param pid 进程编号
* @return 结束进程命令
*/
public abstract String buildKill(int pid);
/**
* kill
*
* @param pid 进程编号
*/
public String kill(File file, int pid) {
String kill = buildKill(pid);
return CommandUtil.execSystemCommand(kill, file);
}
/**
* kill
*
* @param pid 进程编号
*/
public String kill(File file, int pid) {
String kill = buildKill(pid);
return CommandUtil.execSystemCommand(kill, file);
}
}

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.common.commander;
import cn.hutool.http.HttpRequest;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.common.commander.impl;
import cn.hutool.core.collection.CollUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.common.commander.impl;
import cn.hutool.core.convert.Convert;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.common.commander.impl;
import cn.hutool.core.io.FileUtil;
@ -29,7 +51,7 @@ public class LinuxTomcatCommander extends AbstractTomcatCommander {
List<String> list = StrSplitter.splitTrim(setPidCmd, StrUtil.LF, true);
for (String item : list) {
//路径格式转换
String msg = FileUtil.normalize(item + "/");
String msg = FileUtil.normalize(item + StrUtil.SLASH);
//判断集合中元素是否包含指定Tomcat路径
boolean w = msg.contains(tomcatInfoModel.getPath());
if (w) {

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.common.commander.impl;
import cn.hutool.core.collection.CollUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.common.commander.impl;
import cn.hutool.core.convert.Convert;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.common.commander.impl;
import cn.hutool.core.io.FileUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.common.commander.impl;
import cn.hutool.core.convert.Convert;
@ -12,11 +34,9 @@ import com.sun.management.OperatingSystemMXBean;
import io.jpom.common.commander.AbstractSystemCommander;
import io.jpom.model.system.ProcessModel;
import io.jpom.util.CommandUtil;
import io.jpom.util.JvmUtil;
import java.io.File;
import java.lang.management.ManagementFactory;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@ -125,22 +145,22 @@ public class WindowsSystemCommander extends AbstractSystemCommander {
processModel.setTime(memList.get(8));
try {
JvmUtil.getOperatingSystemMXBean(memList.get(1), operatingSystemMXBean -> {
if (operatingSystemMXBean != null) {
//最近jvm cpu使用率
double processCpuLoad = operatingSystemMXBean.getProcessCpuLoad() * 100;
if (processCpuLoad <= 0) {
processCpuLoad = 0;
}
processModel.setCpu(String.format("%.2f", processCpuLoad) + "%");
//服务器总内存
long totalMemorySize = operatingSystemMXBean.getTotalPhysicalMemorySize();
BigDecimal total = new BigDecimal(totalMemorySize / 1024);
// 进程
double v = new BigDecimal(aLong).divide(total, 4, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
processModel.setMem(String.format("%.2f", v) + "%");
}
});
// JvmUtil.getOperatingSystemMXBean(memList.get(1), operatingSystemMXBean -> {
// if (operatingSystemMXBean != null) {
// //最近jvm cpu使用率
// double processCpuLoad = operatingSystemMXBean.getProcessCpuLoad() * 100;
// if (processCpuLoad <= 0) {
// processCpuLoad = 0;
// }
// processModel.setCpu(String.format("%.2f", processCpuLoad) + "%");
// //服务器总内存
// long totalMemorySize = operatingSystemMXBean.getTotalPhysicalMemorySize();
// BigDecimal total = new BigDecimal(totalMemorySize / 1024);
// // 进程
// double v = new BigDecimal(aLong).divide(total, 4, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
// processModel.setMem(String.format("%.2f", v) + "%");
// }
// });
} catch (Exception ignored) {

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.common.commander.impl;
import cn.hutool.core.io.FileUtil;
@ -29,8 +51,8 @@ public class WindowsTomcatCommander extends AbstractTomcatCommander {
String tomcatPath = tomcatInfoModel.pathAndCheck();
//截取盘符
String dcPath = null;
if (tomcatPath != null && tomcatPath.indexOf("/") > 1) {
dcPath = tomcatPath.substring(0, tomcatPath.indexOf("/"));
if (tomcatPath != null && tomcatPath.indexOf(StrUtil.SLASH) > 1) {
dcPath = tomcatPath.substring(0, tomcatPath.indexOf(StrUtil.SLASH));
}
String command = null;
if (StrUtil.isBlank(tomcatPath)) {
@ -42,7 +64,7 @@ public class WindowsTomcatCommander extends AbstractTomcatCommander {
List<String> list = StrSplitter.splitTrim(setPidCmd, StrUtil.LF, true);
for (String item : list) {
//window下路径格式转换
String msg = FileUtil.normalize(item + "/");
String msg = FileUtil.normalize(item + StrUtil.SLASH);
//判断集合中元素是否包含指定Tomcat路径
boolean w = msg.contains(tomcatInfoModel.getPath());
if (w) {

View File

@ -1,28 +1,23 @@
/**
* 各个端实现包
* <p>
* The MIT License(MIT)
* <p>
* Copyright(c) 2019 码之科技工作室
* <p>
* Permission is hereby granted,free of charge,to any person obtaining a copy of
* this software and associated documentation files(the"Software"),to deal in
* the Software without restriction,including without limitation the rights to
* use,copy,modify,merge,publish,distribute,sublicense,and/or sell copies of
* the Software,and to permit persons to whom the Software is furnished to do so,
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* <p>
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* <p>
* THE SOFTWARE IS PROVIDED"AS IS",WITHOUT WARRANTY OF ANY KIND,EXPRESS OR
* IMPLIED,INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER LIABILITY,WHETHER
* IN AN ACTION OF CONTRACT,TORT OR OTHERWISE,ARISING FROM,OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* <p>
*
* @author jiangzeyin
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.common.commander.impl;

View File

@ -1,28 +1,23 @@
/**
* Jpom 管理项目实现管理的工具包
* <p>
* The MIT License(MIT)
* <p>
* Copyright(c) 2019 码之科技工作室
* <p>
* Permission is hereby granted,free of charge,to any person obtaining a copy of
* this software and associated documentation files(the"Software"),to deal in
* the Software without restriction,including without limitation the rights to
* use,copy,modify,merge,publish,distribute,sublicense,and/or sell copies of
* the Software,and to permit persons to whom the Software is furnished to do so,
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* <p>
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* <p>
* THE SOFTWARE IS PROVIDED"AS IS",WITHOUT WARRANTY OF ANY KIND,EXPRESS OR
* IMPLIED,INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER LIABILITY,WHETHER
* IN AN ACTION OF CONTRACT,TORT OR OTHERWISE,ARISING FROM,OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* <p>
*
* @author jiangzeyin
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.common.commander;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.common.interceptor;
import cn.hutool.core.util.StrUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.common.interceptor;
import java.lang.annotation.*;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.controller;
import cn.hutool.core.io.FileUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.controller;
import cn.hutool.cache.impl.CacheObj;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.controller.manage;
import cn.hutool.core.io.FileUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.controller.manage;
import cn.hutool.core.collection.CollUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.controller.manage;
import cn.hutool.core.collection.CollUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.controller.manage;
import cn.hutool.core.collection.CollUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.controller.manage;
import cn.hutool.core.util.StrUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.controller.manage;
import cn.hutool.core.util.StrUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.controller.manage.log;
import cn.hutool.core.io.FileUtil;

View File

@ -1,21 +1,37 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.controller.monitor;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.PageUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.servlet.ServletUtil;
import cn.jiangzeyin.common.DefaultSystemLog;
import cn.jiangzeyin.common.JsonMessage;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.jpom.common.BaseAgentController;
import io.jpom.common.commander.AbstractProjectCommander;
import io.jpom.common.commander.AbstractSystemCommander;
import io.jpom.model.data.ProjectInfoModel;
import io.jpom.model.system.NetstatModel;
import io.jpom.model.system.ProcessModel;
import io.jpom.system.AgentConfigBean;
import io.jpom.util.CommandUtil;
import io.jpom.util.JvmUtil;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@ -24,12 +40,6 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.lang.management.MemoryMXBean;
import java.lang.management.MemoryUsage;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;
import java.math.BigDecimal;
import java.util.List;
/**
* 内存查看
@ -40,195 +50,197 @@ import java.util.List;
@RequestMapping(value = "/manage/")
public class InternalController extends BaseAgentController {
/**
* 获取内存信息
*
* @param tag 程序运行标识
* @return json
* @throws Exception 异常
*/
@RequestMapping(value = "internal_data", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public String getInternal(String tag, String copyId) throws Exception {
String tagId = ProjectInfoModel.JavaCopyItem.getTagId(tag, copyId);
int pid = AbstractProjectCommander.getInstance().getPid(tagId);
if (pid <= 0) {
return JsonMessage.getString(400, "");
}
JSONObject jsonObject = new JSONObject();
ProcessModel item = AbstractSystemCommander.getInstance().getPidInfo(pid);
jsonObject.put("process", item);
JSONObject beanMem = getBeanMem(tagId);
jsonObject.put("beanMem", beanMem);
//获取端口信息
List<NetstatModel> netstatModels = AbstractProjectCommander.getInstance().listNetstat(pid, false);
jsonObject.put("netstat", netstatModels);
return JsonMessage.getString(200, "", jsonObject);
}
/**
* 获取内存信息
*
* @param tag 程序运行标识
* @return json
* @throws Exception 异常
*/
@RequestMapping(value = "internal_data", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public String getInternal(String tag, String copyId) throws Exception {
// String tagId = ProjectInfoModel.JavaCopyItem.getTagId(tag, copyId);
// int pid = AbstractProjectCommander.getInstance().getPid(tagId);
// if (pid <= 0) {
// return JsonMessage.getString(400, "");
// }
// JSONObject jsonObject = new JSONObject();
// ProcessModel item = AbstractSystemCommander.getInstance().getPidInfo(pid);
// jsonObject.put("process", item);
// JSONObject beanMem = getBeanMem(tagId);
// jsonObject.put("beanMem", beanMem);
// //获取端口信息
// List<NetstatModel> netstatModels = AbstractProjectCommander.getInstance().listNetstat(pid, false);
// jsonObject.put("netstat", netstatModels);
// return JsonMessage.getString(200, "", jsonObject);
return JsonMessage.getString(404, "功能已经下架");
}
/**
* 查询监控线程列表
*
* @param tag 程序运行标识
* @return json
* @throws Exception 异常
*/
@RequestMapping(value = "threadInfos", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public String getThreadInfos(String tag, String copyId) throws Exception {
int limit = getParameterInt("limit", 10);
int page = getParameterInt("page", 1);
/**
* 查询监控线程列表
*
* @param tag 程序运行标识
* @return json
* @throws Exception 异常
*/
@RequestMapping(value = "threadInfos", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public String getThreadInfos(String tag, String copyId) throws Exception {
// int limit = getParameterInt("limit", 10);
// int page = getParameterInt("page", 1);
//
// ThreadMXBean bean = JvmUtil.getThreadMXBean(ProjectInfoModel.JavaCopyItem.getTagId(tag, copyId));
// if (bean == null) {
// return JsonMessage.getString(400, "未获取到对应信息");
// }
// //启用线程争用监视
// bean.setThreadContentionMonitoringEnabled(true);
// ThreadInfo[] threadInfos = bean.dumpAllThreads(false, false);
// if (threadInfos == null || threadInfos.length <= 0) {
// return JsonMessage.getString(404, "没有获取到任何线程");
// }
//
// JSONArray array = new JSONArray();
// int index = PageUtil.getStart(page, limit);
// int len = limit + index;
// int length = threadInfos.length;
// if (len > length) {
// len = length;
// }
// for (int i = index; i < len; i++) {
// ThreadInfo threadInfo = threadInfos[i];
// Thread.State threadState = threadInfo.getThreadState();
// JSONObject object = new JSONObject();
// object.put("id", threadInfo.getThreadId());
// object.put("name", threadInfo.getThreadName());
// object.put("status", threadState);
// object.put("waitedCount", threadInfo.getWaitedCount());
// object.put("waitedTime", threadInfo.getWaitedTime());
// object.put("blockedCount", threadInfo.getBlockedCount());
// object.put("blockedTime", threadInfo.getBlockedTime());
// object.put("isInNative", threadInfo.isInNative());
// object.put("isSuspended", threadInfo.isSuspended());
// array.add(object);
// }
// JSONObject object = new JSONObject();
// object.put("count", length);
// object.put("data", array);
// return JsonMessage.getString(200, "", object);
return JsonMessage.getString(404, "功能已经下架");
}
ThreadMXBean bean = JvmUtil.getThreadMXBean(ProjectInfoModel.JavaCopyItem.getTagId(tag, copyId));
if (bean == null) {
return JsonMessage.getString(400, "未获取到对应信息");
}
//启用线程争用监视
bean.setThreadContentionMonitoringEnabled(true);
ThreadInfo[] threadInfos = bean.dumpAllThreads(false, false);
if (threadInfos == null || threadInfos.length <= 0) {
return JsonMessage.getString(404, "没有获取到任何线程");
}
JSONArray array = new JSONArray();
int index = PageUtil.getStart(page, limit);
int len = limit + index;
int length = threadInfos.length;
if (len > length) {
len = length;
}
for (int i = index; i < len; i++) {
ThreadInfo threadInfo = threadInfos[i];
Thread.State threadState = threadInfo.getThreadState();
JSONObject object = new JSONObject();
object.put("id", threadInfo.getThreadId());
object.put("name", threadInfo.getThreadName());
object.put("status", threadState);
object.put("waitedCount", threadInfo.getWaitedCount());
object.put("waitedTime", threadInfo.getWaitedTime());
object.put("blockedCount", threadInfo.getBlockedCount());
object.put("blockedTime", threadInfo.getBlockedTime());
object.put("isInNative", threadInfo.isInNative());
object.put("isSuspended", threadInfo.isSuspended());
array.add(object);
}
JSONObject object = new JSONObject();
object.put("count", length);
object.put("data", array);
return JsonMessage.getString(200, "", object);
}
/**
* 获取jvm内存
*
* @param tag tag
* @return JSONObject
*/
private JSONObject getBeanMem(String tag) {
try {
MemoryMXBean bean = JvmUtil.getMemoryMXBean(tag);
if (bean == null) {
return null;
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("mount", bean.getObjectPendingFinalizationCount());
//堆内存
MemoryUsage memory = bean.getHeapMemoryUsage();
//非堆内存
MemoryUsage nonHeapMemoryUsage = bean.getNonHeapMemoryUsage();
long used = memory.getUsed();
long max = memory.getMax();
//未定义
if (-1 == max) {
max = memory.getCommitted();
}
//计算使用内存占最大内存的百分比
double v = new BigDecimal(used).divide(new BigDecimal(max), 2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
jsonObject.put("heapUsed", FileUtil.readableFileSize(used));
jsonObject.put("heapProportion", String.format("%.2f", v) + "%");
jsonObject.put("heapCommitted", FileUtil.readableFileSize(memory.getCommitted()));
long nonUsed = nonHeapMemoryUsage.getUsed();
long nonMax = nonHeapMemoryUsage.getMax();
long nonCommitted = nonHeapMemoryUsage.getCommitted();
if (-1 == nonMax) {
nonMax = nonCommitted;
}
jsonObject.put("nonHeapUsed", FileUtil.readableFileSize(nonUsed));
double proportion = new BigDecimal(nonUsed).divide(new BigDecimal(nonMax), 2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
jsonObject.put("nonHeapProportion", String.format("%.2f", proportion) + "%");
jsonObject.put("nonHeapCommitted", FileUtil.readableFileSize(nonCommitted));
return jsonObject;
} catch (Exception e) {
DefaultSystemLog.getLog().error(e.getMessage(), e);
}
return null;
}
// /**
// * 获取jvm内存
// *
// * @param tag tag
// * @return JSONObject
// */
// private JSONObject getBeanMem(String tag) {
// try {
// MemoryMXBean bean = JvmUtil.getMemoryMXBean(tag);
// if (bean == null) {
// return null;
// }
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("mount", bean.getObjectPendingFinalizationCount());
// //堆内存
// MemoryUsage memory = bean.getHeapMemoryUsage();
// //非堆内存
// MemoryUsage nonHeapMemoryUsage = bean.getNonHeapMemoryUsage();
// long used = memory.getUsed();
// long max = memory.getMax();
// //未定义
// if (-1 == max) {
// max = memory.getCommitted();
// }
// //计算使用内存占最大内存的百分比
// double v = new BigDecimal(used).divide(new BigDecimal(max), 2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
// jsonObject.put("heapUsed", FileUtil.readableFileSize(used));
// jsonObject.put("heapProportion", String.format("%.2f", v) + "%");
// jsonObject.put("heapCommitted", FileUtil.readableFileSize(memory.getCommitted()));
// long nonUsed = nonHeapMemoryUsage.getUsed();
// long nonMax = nonHeapMemoryUsage.getMax();
// long nonCommitted = nonHeapMemoryUsage.getCommitted();
// if (-1 == nonMax) {
// nonMax = nonCommitted;
// }
// jsonObject.put("nonHeapUsed", FileUtil.readableFileSize(nonUsed));
// double proportion = new BigDecimal(nonUsed).divide(new BigDecimal(nonMax), 2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
// jsonObject.put("nonHeapProportion", String.format("%.2f", proportion) + "%");
// jsonObject.put("nonHeapCommitted", FileUtil.readableFileSize(nonCommitted));
// return jsonObject;
// } catch (Exception e) {
// DefaultSystemLog.getLog().error(e.getMessage(), e);
// }
// return null;
// }
/**
* 导出堆栈信息
*
* @param tag 程序运行标识
* @return json
*/
@RequestMapping(value = "internal_stack", method = RequestMethod.GET)
@ResponseBody
public String stack(String tag, String copyId) {
tag = ProjectInfoModel.JavaCopyItem.getTagId(tag, copyId);
//
String fileName = AgentConfigBean.getInstance().getTempPathName() + "/" + tag + "_java_cpu.txt";
fileName = FileUtil.normalize(fileName);
try {
int pid = AbstractProjectCommander.getInstance().getPid(tag);
if (pid <= 0) {
return JsonMessage.getString(400, "未运行");
}
String command = String.format("jstack -F %s >> %s ", pid, fileName);
CommandUtil.execSystemCommand(command);
downLoad(getResponse(), fileName);
} catch (Exception e) {
DefaultSystemLog.getLog().error(e.getMessage(), e);
/**
* 导出堆栈信息
*
* @param tag 程序运行标识
* @return json
*/
@RequestMapping(value = "internal_stack", method = RequestMethod.GET)
@ResponseBody
public String stack(String tag, String copyId) {
tag = ProjectInfoModel.JavaCopyItem.getTagId(tag, copyId);
//
String fileName = AgentConfigBean.getInstance().getTempPathName() + StrUtil.SLASH + tag + "_java_cpu.txt";
fileName = FileUtil.normalize(fileName);
try {
int pid = AbstractProjectCommander.getInstance().getPid(tag);
if (pid <= 0) {
return JsonMessage.getString(400, "未运行");
}
String command = String.format("jstack -F %s >> %s ", pid, fileName);
CommandUtil.execSystemCommand(command);
downLoad(getResponse(), fileName);
} catch (Exception e) {
DefaultSystemLog.getLog().error(e.getMessage(), e);
// getResponse().sendRedirect("internal?tag=" + tag);
}
return JsonMessage.getString(200, "");
}
}
return JsonMessage.getString(200, "");
}
/**
* 导出内存信息
*
* @param tag 程序运行标识
* @return json
*/
@RequestMapping(value = "internal_ram", method = RequestMethod.GET)
@ResponseBody
public String ram(String tag, String copyId) {
tag = ProjectInfoModel.JavaCopyItem.getTagId(tag, copyId);
//
String fileName = AgentConfigBean.getInstance().getTempPathName() + "/" + tag + "_java_ram.txt";
fileName = FileUtil.normalize(fileName);
try {
int pid = AbstractProjectCommander.getInstance().getPid(tag);
if (pid <= 0) {
return JsonMessage.getString(400, "未运行");
}
String command = String.format("jmap -histo:live %s >> %s", pid, fileName);
CommandUtil.execSystemCommand(command);
downLoad(getResponse(), fileName);
} catch (Exception e) {
DefaultSystemLog.getLog().error(e.getMessage(), e);
/**
* 导出内存信息
*
* @param tag 程序运行标识
* @return json
*/
@RequestMapping(value = "internal_ram", method = RequestMethod.GET)
@ResponseBody
public String ram(String tag, String copyId) {
tag = ProjectInfoModel.JavaCopyItem.getTagId(tag, copyId);
//
String fileName = AgentConfigBean.getInstance().getTempPathName() + StrUtil.SLASH + tag + "_java_ram.txt";
fileName = FileUtil.normalize(fileName);
try {
int pid = AbstractProjectCommander.getInstance().getPid(tag);
if (pid <= 0) {
return JsonMessage.getString(400, "未运行");
}
String command = String.format("jmap -histo:live %s >> %s", pid, fileName);
CommandUtil.execSystemCommand(command);
downLoad(getResponse(), fileName);
} catch (Exception e) {
DefaultSystemLog.getLog().error(e.getMessage(), e);
// getResponse().sendRedirect("internal?tag=" + tag);
}
return JsonMessage.getString(200, "");
}
}
return JsonMessage.getString(200, "");
}
/**
* 下载文件
*
* @param response response
* @param fileName 文件名字
*/
private void downLoad(HttpServletResponse response, String fileName) {
//获取项目根路径
File file = new File(fileName);
ServletUtil.write(response, file);
FileUtil.del(file);
}
/**
* 下载文件
*
* @param response response
* @param fileName 文件名字
*/
private void downLoad(HttpServletResponse response, String fileName) {
//获取项目根路径
File file = new File(fileName);
ServletUtil.write(response, file);
FileUtil.del(file);
}
}

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.controller.script;
import cn.hutool.core.io.FileUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.controller.system;
import cn.hutool.core.io.FileUtil;
@ -9,7 +31,6 @@ import io.jpom.common.BaseAgentController;
import io.jpom.common.commander.AbstractProjectCommander;
import io.jpom.socket.AgentFileTailWatcher;
import io.jpom.system.ConfigBean;
import io.jpom.util.JvmUtil;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@ -46,7 +67,6 @@ public class AgentCacheManageController extends BaseAgentController {
int oneLineCount = AgentFileTailWatcher.getOneLineCount();
jsonObject.put("readFileOnLineCount", oneLineCount);
//
jsonObject.put("pidError", JvmUtil.PID_ERROR.size());
return JsonMessage.getString(200, "ok", jsonObject);
}
@ -71,9 +91,6 @@ public class AgentCacheManageController extends BaseAgentController {
return JsonMessage.getString(504, "清空文件缓存失败");
}
break;
case "pidError":
JvmUtil.PID_ERROR.clear();
break;
default:
return JsonMessage.getString(405, "没有对应类型:" + type);

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.controller.system;
import cn.hutool.core.io.FileUtil;
@ -201,7 +223,7 @@ public class CertificateController extends BaseAgentController {
}
}
// 移动位置
String temporary = certModel.getWhitePath() + "/" + certModel.getId() + "/";
String temporary = certModel.getWhitePath() + StrUtil.SLASH + certModel.getId() + StrUtil.SLASH;
File pemFile = FileUtil.file(temporary + certModel.getId() + "." + certModel.getType().name());
File keyFile = FileUtil.file(temporary + certModel.getId() + ".key");
if (add) {

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.controller.system;
import cn.hutool.core.io.FileUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.controller.system;
import cn.hutool.core.io.FileUtil;
@ -59,7 +81,7 @@ public class NginxController extends BaseAgentController {
boolean checkNgxDirectory = whitelistDirectoryService.checkNgxDirectory(whitePath);
Assert.state(checkNgxDirectory, "文件路径错误,非白名单路径");
if (StrUtil.isEmpty(name)) {
name = "/";
name = StrUtil.SLASH;
}
String newName = pathSafe(name);
JSONArray array = nginxService.list(whitePath, newName);

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.controller.system;
import cn.hutool.core.convert.Convert;
@ -49,14 +71,15 @@ public class SystemConfigController extends BaseAgentController {
}
try {
YamlPropertySourceLoader yamlPropertySourceLoader = new YamlPropertySourceLoader();
ByteArrayResource resource = new ByteArrayResource(content.getBytes(StandardCharsets.UTF_8));
// @author hjk 前端编辑器允许使用tab键并设定为2个空格再转换为yml时要把tab键换成2个空格
ByteArrayResource resource = new ByteArrayResource(content.replace("\t", " ").getBytes(StandardCharsets.UTF_8));
yamlPropertySourceLoader.load("test", resource);
} catch (Exception e) {
DefaultSystemLog.getLog().warn("内容格式错误,请检查修正", e);
return JsonMessage.getString(500, "内容格式错误,请检查修正:" + e.getMessage());
}
if (JpomManifest.getInstance().isDebug()) {
return JsonMessage.getString(405, "调试模式不支持在线修改,请到resource目录下");
return JsonMessage.getString(405, "调试模式不支持在线修改,请到resources目录下的bin目录修改extConfig.yml");
}
File resourceFile = ExtConfigBean.getResourceFile();
FileUtil.writeString(content, resourceFile, CharsetUtil.CHARSET_UTF_8);

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.controller.system;
import cn.hutool.core.io.FileUtil;
@ -16,6 +38,7 @@ import io.jpom.common.JpomManifest;
import io.jpom.common.RemoteVersion;
import io.jpom.common.Type;
import io.jpom.system.AgentConfigBean;
import io.jpom.system.ConfigBean;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -87,4 +110,16 @@ public class SystemUpdateController extends BaseAgentController {
RemoteVersion remoteVersion = RemoteVersion.loadRemoteInfo();
return JsonMessage.getString(200, "", remoteVersion);
}
/**
* 远程下载升级
*
* @return json
* @see RemoteVersion
*/
@PostMapping(value = "remote_upgrade.json", produces = MediaType.APPLICATION_JSON_VALUE)
public String upgrade() throws IOException {
RemoteVersion.upgrade(ConfigBean.getInstance().getTempPath().getAbsolutePath());
return JsonMessage.getString(200, "升级中大约需要30秒");
}
}

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.controller.system;
import cn.hutool.core.collection.CollUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.controller.tomcat;
import cn.hutool.core.date.DateUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.controller.tomcat;
import cn.hutool.core.date.DateUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.controller.tomcat;
/**

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.model.data;
import cn.hutool.core.io.FileUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.model.data;
import io.jpom.model.BaseModel;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.model.data;
import cn.hutool.core.collection.CollUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.model.data;
import cn.hutool.core.lang.ObjectId;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.model.data;
import cn.hutool.core.date.DatePattern;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.model.data;
import cn.hutool.core.io.FileUtil;
@ -31,7 +53,7 @@ public class TomcatInfoModel extends BaseModel {
if (path == null) {
return null;
}
return FileUtil.normalize(path + "/");
return FileUtil.normalize(path + StrUtil.SLASH);
}
/**
@ -74,7 +96,7 @@ public class TomcatInfoModel extends BaseModel {
if (StrUtil.isEmpty(appBase)) {
return FileUtil.normalize(path + "/webapps/");
}
return FileUtil.normalize(appBase + "/");
return FileUtil.normalize(appBase + StrUtil.SLASH);
}
public void setAppBase(String appBase) {

View File

@ -1,6 +1,30 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.model.data;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import cn.jiangzeyin.common.DefaultSystemLog;
import io.jpom.model.BaseModel;
import java.io.File;
@ -11,62 +35,60 @@ import java.io.IOException;
* @author lf
*/
public class UploadFileModel extends BaseModel {
private long size = 0;
private long completeSize = 0;
private String savePath;
private String version;
private long size = 0;
private long completeSize = 0;
private String savePath;
private String version;
public long getSize() {
return size;
}
public long getSize() {
return size;
}
public void setSize(long size) {
this.size = size;
}
public void setSize(long size) {
this.size = size;
}
public long getCompleteSize() {
return completeSize;
}
public long getCompleteSize() {
return completeSize;
}
public void setCompleteSize(long completeSize) {
this.completeSize = completeSize;
}
public void setCompleteSize(long completeSize) {
this.completeSize = completeSize;
}
public String getSavePath() {
return savePath;
}
public String getSavePath() {
return savePath;
}
public void setSavePath(String savePath) {
this.savePath = savePath;
}
public void setSavePath(String savePath) {
this.savePath = savePath;
}
public String getVersion() {
return version;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public void setVersion(String version) {
this.version = version;
}
public void save(byte[] data) {
this.completeSize += data.length;
File file = new File(this.getFilePath());
FileUtil.mkParentDirs(file);
try {
FileOutputStream fileOutputStream = new FileOutputStream(file, true);
fileOutputStream.write(data);
fileOutputStream.flush();
fileOutputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public void save(byte[] data) {
this.completeSize += data.length;
File file = new File(this.getFilePath());
FileUtil.mkParentDirs(file);
try (FileOutputStream fileOutputStream = new FileOutputStream(file, true)) {
fileOutputStream.write(data);
fileOutputStream.flush();
} catch (IOException e) {
DefaultSystemLog.getLog().error(e.getMessage(), e);
}
}
public String getFilePath() {
return savePath + "/" + getName();
}
public String getFilePath() {
return savePath + StrUtil.SLASH + getName();
}
public void remove() {
FileUtil.del(this.getFilePath());
}
public void remove() {
FileUtil.del(this.getFilePath());
}
}

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.model.system;
import cn.hutool.core.util.StrUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.model.system;
import cn.hutool.core.util.StrUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.service;
import cn.jiangzeyin.common.DefaultSystemLog;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.service.manage;
import cn.hutool.core.date.DateUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.service.manage;
import cn.hutool.core.io.FileUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.service.manage;
import cn.hutool.core.date.DateUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.service.manage;
import cn.hutool.core.date.DateUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.service.manage;
import cn.hutool.core.date.DateUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.service.manage;
import cn.hutool.core.util.StrUtil;
@ -70,7 +92,7 @@ public class TomcatManageService {
continue;
}
jsonObject.put("path", "/".equals(strs[0]) ? "/ROOT" : strs[0]);
jsonObject.put("path", StrUtil.SLASH.equals(strs[0]) ? "/ROOT" : strs[0]);
jsonObject.put("status", strs[1]);
jsonObject.put("session", strs[2]);

View File

@ -1,28 +1,23 @@
/**
* 节点项目管理
* <p>
* The MIT License(MIT)
* <p>
* Copyright(c) 2019 码之科技工作室
* <p>
* Permission is hereby granted,free of charge,to any person obtaining a copy of
* this software and associated documentation files(the"Software"),to deal in
* the Software without restriction,including without limitation the rights to
* use,copy,modify,merge,publish,distribute,sublicense,and/or sell copies of
* the Software,and to permit persons to whom the Software is furnished to do so,
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* <p>
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* <p>
* THE SOFTWARE IS PROVIDED"AS IS",WITHOUT WARRANTY OF ANY KIND,EXPRESS OR
* IMPLIED,INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER LIABILITY,WHETHER
* IN AN ACTION OF CONTRACT,TORT OR OTHERWISE,ARISING FROM,OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* <p>
*
* @author jiangzeyin
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.service.manage;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.service.script;
import cn.hutool.core.io.FileUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.service.system;
import cn.hutool.core.io.FileUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.service.system;
import cn.hutool.core.collection.CollUtil;
@ -56,7 +78,7 @@ public class NginxService extends BaseDataService {
long time = file.lastModified();
jsonObject.put("time", DateUtil.date(time).toString());
jsonObject.put("name", name);
jsonObject.put("relativePath", FileUtil.normalize(fileName + "/" + name));
jsonObject.put("relativePath", FileUtil.normalize(fileName + StrUtil.SLASH + name));
if (file.isDirectory()) {
continue;
// if (FileUtil.isEmpty(file)) {

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.socket;
import cn.hutool.core.io.FileUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.socket;
import org.springframework.context.annotation.Bean;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.socket;
import cn.hutool.core.exceptions.ExceptionUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.socket;
import cn.hutool.core.util.StrUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.socket;
import cn.hutool.core.exceptions.ExceptionUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.socket;
import cn.jiangzeyin.common.DefaultSystemLog;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.socket;
import cn.hutool.core.collection.CollUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.socket;
import cn.hutool.core.collection.CollUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//package io.jpom.socket.spring;
//
//import io.jpom.socket.spring.handler.NodeUpdateHandler;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//package io.jpom.socket.spring.handler;
//
//import cn.jiangzeyin.common.DefaultSystemLog;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//package io.jpom.socket.spring.interceptor;
//
//import cn.jiangzeyin.common.DefaultSystemLog;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.system;
import cn.hutool.core.io.FileUtil;
@ -31,7 +53,7 @@ public class AgentAuthorize {
/**
* 密码
*/
@Value("${" + ConfigBean.AUTHORIZE_PWD_KEY + ":}")
@Value("${" + ConfigBean.AUTHORIZE_AUTHORIZE_KEY + ":}")
private String agentPwd;
/**
* 授权加密字符串

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.system;
import cn.hutool.core.io.FileUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.system;
import cn.hutool.core.net.NetUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.system;
import cn.hutool.cache.impl.CacheObj;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.system.init;
import ch.qos.logback.core.util.FileSize;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.system.init;
import cn.hutool.core.date.DateTime;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.system.init;
import cn.hutool.core.io.FileUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.util;
import cn.hutool.core.io.FileUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.jpom.util;
import cn.hutool.core.date.DateUtil;

View File

@ -23,3 +23,4 @@ preload:
# 强制去掉空格
request:
trimAll: true
urlDecode: true

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import org.junit.Test;
import java.util.concurrent.TimeUnit;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//import cn.hutool.core.io.FileUtil;
//import org.apache.commons.codec.binary.Base64;
//import sun.misc.BASE64Decoder;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//import cn.hutool.core.util.StrUtil;
//import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
//import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.XmlUtil;
import org.w3c.dom.Document;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.ZipUtil;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import cn.hutool.core.net.NetUtil;
import org.junit.Test;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import cn.hutool.core.util.StrUtil;
import io.jpom.util.CommandUtil;
import io.jpom.util.FileUtils;

View File

@ -1,3 +1,25 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import cn.hutool.core.text.StrSplitter;
import cn.hutool.core.util.StrUtil;
import io.jpom.util.CommandUtil;

View File

@ -1,4 +1,27 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 码之科技工作室
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import cn.hutool.core.lang.RegexPool;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ReUtil;
import org.junit.Test;
@ -18,4 +41,10 @@ public class TestStr {
public void testFile(){
// String path = "/www/server/panel/"
}
@Test
public void test2(){
System.out.println(String.format("%.2f", (float)1 / (float)2 * 100));
System.out.println(NumberUtil.div(1,2));
}
}

Some files were not shown because too many files have changed in this diff Show More