33 lines
772 B
Java
33 lines
772 B
Java
package eu.dnetlib.apps.oai2ftp.utils;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
@Component
|
|
public class FtpClientFactory {
|
|
|
|
@Value("${oai2ftp.conf.ftp.server}")
|
|
private String ftpServer;
|
|
|
|
@Value("${oai2ftp.conf.ftp.user}")
|
|
private String ftpUser;
|
|
|
|
@Value("${oai2ftp.conf.ftp.password}")
|
|
private String ftpPassword;
|
|
|
|
@Value("${oai2ftp.conf.ftp.basedir}")
|
|
private String ftpBaseDir;
|
|
|
|
@Value("${oai2ftp.conf.ftp.secure}")
|
|
private boolean ftpSecure;
|
|
|
|
public FtpClientWrapper newClientForJob(final String jobId) {
|
|
final FtpClientWrapper ftp = new FtpClientWrapper(ftpServer, ftpSecure);
|
|
ftp.login(ftpUser, ftpPassword);
|
|
ftp.changeDir(ftpBaseDir);
|
|
ftp.changeDir(jobId);
|
|
return ftp;
|
|
}
|
|
|
|
}
|