Search in sources :

Example 1 with FileDetailVO

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

Example 2 with FileDetailVO

use of com.orion.ops.entity.vo.sftp.FileDetailVO 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;
    }
}
Also used : SftpFile(com.orion.remote.channel.sftp.SftpFile) EventKeys(com.orion.ops.consts.event.EventKeys) IFileTransferProcessor(com.orion.ops.handler.sftp.IFileTransferProcessor) MessageConst(com.orion.ops.consts.MessageConst) EventParamsHolder(com.orion.ops.consts.event.EventParamsHolder) LambdaQueryWrapper(com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper) ObjectIds(com.orion.id.ObjectIds) Function(java.util.function.Function) TransferProcessorManager(com.orion.ops.handler.sftp.TransferProcessorManager) FileTransferHint(com.orion.ops.handler.sftp.hint.FileTransferHint) PathBuilders(com.orion.ops.utils.PathBuilders) FileTransferLogVO(com.orion.ops.entity.vo.FileTransferLogVO) SftpBasicExecutorHolder(com.orion.ops.handler.sftp.SftpBasicExecutorHolder) Service(org.springframework.stereotype.Service) Arrays1(com.orion.utils.Arrays1) RedisTemplate(org.springframework.data.redis.core.RedisTemplate) FileOpenVO(com.orion.ops.entity.vo.sftp.FileOpenVO) KeyConst(com.orion.ops.consts.KeyConst) Const(com.orion.ops.consts.Const) SftpFile(com.orion.remote.channel.sftp.SftpFile) FileDetailVO(com.orion.ops.entity.vo.sftp.FileDetailVO) SftpTransferType(com.orion.ops.consts.sftp.SftpTransferType) SftpTransferStatus(com.orion.ops.consts.sftp.SftpTransferStatus) com.orion.ops.entity.request.sftp(com.orion.ops.entity.request.sftp) UUIds(com.orion.id.UUIds) Resource(javax.annotation.Resource) SftpService(com.orion.ops.service.api.SftpService) Valid(com.orion.ops.utils.Valid) Collectors(java.util.stream.Collectors) UserDTO(com.orion.ops.entity.dto.UserDTO) Files1(com.orion.utils.io.Files1) Objects(java.util.Objects) TimeUnit(java.util.concurrent.TimeUnit) Converts(com.orion.utils.convert.Converts) List(java.util.List) SftpPackageType(com.orion.ops.consts.sftp.SftpPackageType) SystemEnvAttr(com.orion.ops.consts.system.SystemEnvAttr) FileTransferLogDAO(com.orion.ops.dao.FileTransferLogDAO) FileListVO(com.orion.ops.entity.vo.sftp.FileListVO) FileTransferLogDO(com.orion.ops.entity.domain.FileTransferLogDO) Lists(com.orion.utils.collect.Lists) MachineInfoService(com.orion.ops.service.api.MachineInfoService) Currents(com.orion.ops.utils.Currents) FileTransferNotifyDTO(com.orion.ops.entity.dto.FileTransferNotifyDTO) SftpExecutor(com.orion.remote.channel.sftp.SftpExecutor) Strings(com.orion.utils.Strings) FileListVO(com.orion.ops.entity.vo.sftp.FileListVO) FileDetailVO(com.orion.ops.entity.vo.sftp.FileDetailVO)

Aggregations

FileDetailVO (com.orion.ops.entity.vo.sftp.FileDetailVO)2 FileListVO (com.orion.ops.entity.vo.sftp.FileListVO)2 SftpExecutor (com.orion.remote.channel.sftp.SftpExecutor)2 SftpFile (com.orion.remote.channel.sftp.SftpFile)2 LambdaQueryWrapper (com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)1 ObjectIds (com.orion.id.ObjectIds)1 UUIds (com.orion.id.UUIds)1 Const (com.orion.ops.consts.Const)1 KeyConst (com.orion.ops.consts.KeyConst)1 MessageConst (com.orion.ops.consts.MessageConst)1 EventKeys (com.orion.ops.consts.event.EventKeys)1 EventParamsHolder (com.orion.ops.consts.event.EventParamsHolder)1 SftpPackageType (com.orion.ops.consts.sftp.SftpPackageType)1 SftpTransferStatus (com.orion.ops.consts.sftp.SftpTransferStatus)1 SftpTransferType (com.orion.ops.consts.sftp.SftpTransferType)1 SystemEnvAttr (com.orion.ops.consts.system.SystemEnvAttr)1 FileTransferLogDAO (com.orion.ops.dao.FileTransferLogDAO)1 FileTransferLogDO (com.orion.ops.entity.domain.FileTransferLogDO)1 FileTransferNotifyDTO (com.orion.ops.entity.dto.FileTransferNotifyDTO)1 UserDTO (com.orion.ops.entity.dto.UserDTO)1