use of io.jpom.model.system.WorkspaceEnvVarModel in project Jpom by dromara.
the class AgentWorkspaceEnvVarController method updateWorkspaceEnvVar.
/**
* 更新环境变量
*
* @param name 名称
* @param value 值
* @param description 描述
* @return json
*/
@PostMapping(value = "/update", produces = MediaType.APPLICATION_JSON_VALUE)
public String updateWorkspaceEnvVar(@ValidatorItem String name, @ValidatorItem String value, @ValidatorItem String description) {
String workspaceId = getWorkspaceId();
synchronized (AgentWorkspaceEnvVarController.class) {
WorkspaceEnvVarModel.WorkspaceEnvVarItemModel workspaceEnvVarModel = new WorkspaceEnvVarModel.WorkspaceEnvVarItemModel();
workspaceEnvVarModel.setName(name);
workspaceEnvVarModel.setValue(value);
workspaceEnvVarModel.setDescription(description);
//
WorkspaceEnvVarModel item = agentWorkspaceEnvVarService.getItem(workspaceId);
if (null == item) {
item = new WorkspaceEnvVarModel();
item.setVarData(MapUtil.of(name, workspaceEnvVarModel));
item.setName(workspaceId);
item.setId(workspaceId);
agentWorkspaceEnvVarService.addItem(item);
} else {
item.put(name, workspaceEnvVarModel);
agentWorkspaceEnvVarService.updateItem(item);
}
}
return JsonMessage.getString(200, "更新成功");
}
use of io.jpom.model.system.WorkspaceEnvVarModel in project Jpom by dromara.
the class AgentCacheManageController method cache.
/**
* 缓存信息
*
* @return json
*/
@PostMapping(value = "cache", produces = MediaType.APPLICATION_JSON_VALUE)
public String cache() {
JSONObject jsonObject = new JSONObject();
//
ConfigBean instance = ConfigBean.getInstance();
File file = instance.getTempPath();
String fileSize = FileUtil.readableFileSize(FileUtil.size(file));
jsonObject.put("fileSize", fileSize);
jsonObject.put("dataSize", FileUtil.readableFileSize(instance.dataSize()));
File oldJarsPath = JpomManifest.getOldJarsPath();
jsonObject.put("oldJarsSize", FileUtil.readableFileSize(FileUtil.size(oldJarsPath)));
//
jsonObject.put("pidName", AbstractProjectCommander.PID_JPOM_NAME.size());
jsonObject.put("pidPort", AbstractProjectCommander.PID_PORT.size());
int oneLineCount = AgentFileTailWatcher.getOneLineCount();
jsonObject.put("readFileOnLineCount", oneLineCount);
jsonObject.put("taskList", CronUtils.list());
jsonObject.put("pluginSize", PluginFactory.size());
//
WorkspaceEnvVarModel item = agentWorkspaceEnvVarService.getItem(getWorkspaceId());
if (item != null) {
Map<String, WorkspaceEnvVarModel.WorkspaceEnvVarItemModel> varData = item.getVarData();
if (varData != null) {
jsonObject.put("envVarKeys", varData.keySet());
}
}
//
return JsonMessage.getString(200, "ok", jsonObject);
}
use of io.jpom.model.system.WorkspaceEnvVarModel in project Jpom by dromara.
the class AgentWorkspaceEnvVarController method delete.
/**
* 删除环境变量
*
* @param name 名称
* @return json
*/
@PostMapping(value = "/delete", produces = MediaType.APPLICATION_JSON_VALUE)
public String delete(@ValidatorItem String name) {
String workspaceId = getWorkspaceId();
synchronized (AgentWorkspaceEnvVarController.class) {
//
WorkspaceEnvVarModel item = agentWorkspaceEnvVarService.getItem(workspaceId);
if (null != item) {
item.remove(name);
agentWorkspaceEnvVarService.updateItem(item);
}
}
return JsonMessage.getString(200, "删除成功");
}
Aggregations