public FileTransferMethod GetFileTransferMethod(long submittedJobInfoId, AdaptorUser loggedUser) { log.Info("Getting file transfer method for submitted job info ID " + submittedJobInfoId + " with user " + loggedUser.GetLogIdentification()); SubmittedJobInfo jobInfo = LogicFactory.GetLogicFactory().CreateJobManagementLogic(unitOfWork).GetSubmittedJobInfoById(submittedJobInfoId, loggedUser); var certificateGenerator = new CertificateGenerator.CertificateGenerator(); certificateGenerator.GenerateKey(2048); string publicKey = certificateGenerator.DhiPublicKey(); string jobDir = FileSystemUtils.GetJobClusterDirectoryPath(jobInfo.Specification.FileTransferMethod.Cluster.LocalBasepath, jobInfo.Specification); var transferMethod = new FileTransferMethod { Protocol = jobInfo.Specification.FileTransferMethod.Protocol, ServerHostname = jobInfo.Specification.FileTransferMethod.ServerHostname, SharedBasePath = jobDir, Credentials = new AsymmetricKeyCredentials { Username = jobInfo.Specification.ClusterUser.Username, PrivateKey = certificateGenerator.DhiPrivateKey(), PublicKey = publicKey } }; SchedulerFactory.GetInstance(jobInfo.Specification.Cluster.SchedulerType).CreateScheduler(jobInfo.Specification.Cluster).AllowDirectFileTransferAccessForUserToJob(publicKey, jobInfo); return(transferMethod); }
public AbstractFileSystemManager(ILogger logger, FileTransferMethod configuration, FileSystemFactory synchronizerFactory) { _logger = logger; _fileSystem = configuration; _synchronizerFactory = synchronizerFactory; _fileSynchronizers = new Dictionary <SynchronizableFiles, Dictionary <string, IFileSynchronizer> >(); }
public override IRexFileSystemManager CreateFileSystemManager(FileTransferMethod configuration) { if (!_managerSingletons.TryGetValue(configuration.ServerHostname, out IRexFileSystemManager fileManager)) { fileManager = new SftpFileSystemManager(_logger, configuration, this, GetSchedulerConnectionPool(configuration)); _managerSingletons.Add(configuration.ServerHostname, fileManager); } return(fileManager); }
public virtual FileTransferMethod GetFileTransferMethodById(long fileTransferMethodById) { FileTransferMethod fileTransferMethod = unitOfWork.FileTransferMethodRepository.GetById(fileTransferMethodById); if (fileTransferMethod == null) { log.Error("Requested FileTransferMethod with Id=" + fileTransferMethodById + " does not exist in the system."); throw new RequestedObjectDoesNotExistException("Requested FileTransferMethod with Id=" + fileTransferMethodById + " does not exist in the system."); } return(fileTransferMethod); }
public static FileTransferMethod ConvertFileTransferMethodExtToIn(FileTransferMethodExt usedTransferMethod) { FileTransferMethod convert = new FileTransferMethod { Credentials = usedTransferMethod.Credentials.ConvertExtToInt(), Protocol = ConvertFileTransferProtocolExtToIn(usedTransferMethod.Protocol), ServerHostname = usedTransferMethod.ServerHostname, SharedBasePath = usedTransferMethod.SharedBasepath }; return(convert); }
public static FileTransferMethodExt ConvertIntToExt(this FileTransferMethod fileTransferMethod) { FileTransferMethodExt convert = new FileTransferMethodExt() { ServerHostname = fileTransferMethod.ServerHostname, SharedBasepath = fileTransferMethod.SharedBasePath, Protocol = ConvertFileTransferProtocolIntToExt(fileTransferMethod.Protocol), Credentials = fileTransferMethod.Credentials.ConvertIntToExt() }; return(convert); }
public FileTransferMethodExt GetFileTransferMethod(long submittedJobInfoId, string sessionCode) { try { using (IUnitOfWork unitOfWork = UnitOfWorkFactory.GetUnitOfWorkFactory().CreateUnitOfWork()) { AdaptorUser loggedUser = UserAndLimitationManagementService.GetValidatedUserForSessionCode(sessionCode, unitOfWork, UserRoleType.Submitter); IFileTransferLogic fileTransferLogic = LogicFactory.GetLogicFactory().CreateFileTransferLogic(unitOfWork); FileTransferMethod fileTransferMethod = fileTransferLogic.GetFileTransferMethod(submittedJobInfoId, loggedUser); return(fileTransferMethod.ConvertIntToExt()); } } catch (Exception exc) { ExceptionHandler.ThrowProperExternalException(exc); return(null); } }
public void EndFileTransfer(long submittedJobInfoId, FileTransferMethod transferMethod, AdaptorUser loggedUser) { log.Info("Removing file transfer method for submitted job info ID " + submittedJobInfoId + " with user " + loggedUser.GetLogIdentification()); SubmittedJobInfo jobInfo = LogicFactory.GetLogicFactory().CreateJobManagementLogic(unitOfWork).GetSubmittedJobInfoById(submittedJobInfoId, loggedUser); AsymmetricKeyCredentials asymmetricKeyCredentials = transferMethod.Credentials as AsymmetricKeyCredentials; if (asymmetricKeyCredentials != null) { SchedulerFactory.GetInstance(jobInfo.Specification.Cluster.SchedulerType).CreateScheduler(jobInfo.Specification.Cluster). RemoveDirectFileTransferAccessForUserToJob(asymmetricKeyCredentials.PublicKey, jobInfo); } else { log.Error("Credentials of class " + transferMethod.Credentials.GetType().Name + " are not supported. Change the HaaSMiddleware.BusinessLogicTier.FileTransfer.FileTransferLogic.EndFileTransfer() method to add support for additional credential types."); throw new ArgumentException("Credentials of class " + transferMethod.Credentials.GetType().Name + " are not supported. Change the HaaSMiddleware.BusinessLogicTier.FileTransfer.FileTransferLogic.EndFileTransfer() method to add support for additional credential types."); } }
public override IRexFileSystemManager CreateFileSystemManager(FileTransferMethod configuration) { return(new NetworkShareFileSystemManager(_logger, configuration, this)); }
protected abstract IPoolableAdapter CreateFileSystemConnector(FileTransferMethod configuration);
public abstract IRexFileSystemManager CreateFileSystemManager(FileTransferMethod configuration);
public SftpFileSystemManager(ILogger logger, FileTransferMethod configuration, FileSystemFactory synchronizerFactory, IConnectionPool connectionPool) : base(logger, configuration, synchronizerFactory) { _connectionPool = connectionPool; }
public NetworkShareFileSystemManager(ILogger logger, FileTransferMethod configuration, FileSystemFactory synchronizerFactory) : base(logger, configuration, synchronizerFactory) { }