use of com.orion.ops.entity.vo.sftp.FileListVO in project orion-ops by lijiahangmax.
the class SftpServiceImpl method listDir.
@Override
public FileListVO listDir(FileListRequest request) {
SftpExecutor executor = sftpBasicExecutorHolder.getBasicExecutor(request.getSessionToken());
synchronized (executor) {
String path = request.getPath();
List<SftpFile> fileList = executor.listDirs(path);
// 返回
FileListVO fileListVO = new FileListVO();
List<FileDetailVO> files = Converts.toList(fileList, FileDetailVO.class);
fileListVO.setPath(path);
fileListVO.setFiles(files);
return fileListVO;
}
}
use of com.orion.ops.entity.vo.sftp.FileListVO in project orion-ops by lijiahangmax.
the class SftpServiceImpl method list.
private FileListVO list(String path, Boolean all, SftpExecutor executor) {
synchronized (executor) {
List<SftpFile> fileList;
if (all == null || !all) {
// 不查询隐藏文件
fileList = executor.listFilesFilter(path, f -> !f.getName().startsWith("."), false, true);
} else {
// 查询隐藏文件
fileList = executor.ll(path);
}
// 返回
FileListVO fileListVO = new FileListVO();
List<FileDetailVO> files = Converts.toList(fileList, FileDetailVO.class);
fileListVO.setPath(path);
fileListVO.setFiles(files);
return fileListVO;
}
}
use of com.orion.ops.entity.vo.sftp.FileListVO in project orion-ops by lijiahangmax.
the class SftpServiceImpl method open.
@Override
public FileOpenVO open(Long machineId) {
// 获取当前用户
Long userId = Currents.getUserId();
// 生成token
String sessionToken = this.generatorSessionToken(userId, machineId);
SftpExecutor executor = sftpBasicExecutorHolder.getBasicExecutor(sessionToken);
// 查询列表
String path = executor.getHome();
FileListVO list = this.list(path, false, executor);
// 返回数据
FileOpenVO openVO = new FileOpenVO();
openVO.setSessionToken(sessionToken);
openVO.setHome(path);
openVO.setCharset(executor.getCharset());
openVO.setPath(list.getPath());
openVO.setFiles(list.getFiles());
// 设置日志参数
EventParamsHolder.addParam(EventKeys.MACHINE_NAME, machineInfoService.getMachineName(machineId));
return openVO;
}
Aggregations