Search in sources :

Example 1 with FileOpenVO

use of com.orion.ops.entity.vo.sftp.FileOpenVO 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;
}
Also used : SftpExecutor(com.orion.remote.channel.sftp.SftpExecutor) FileListVO(com.orion.ops.entity.vo.sftp.FileListVO) FileOpenVO(com.orion.ops.entity.vo.sftp.FileOpenVO)

Aggregations

FileListVO (com.orion.ops.entity.vo.sftp.FileListVO)1 FileOpenVO (com.orion.ops.entity.vo.sftp.FileOpenVO)1 SftpExecutor (com.orion.remote.channel.sftp.SftpExecutor)1