APDPlat?????????????????????
???????????? ???????[ 2014/2/11 9:39:54 ] ????????????? ???? ??? ???
?????????????????????????????????????HTTP??FTP??SOCKET?????????????????
???????????BackupServiceExecuter????????????????????????????????BackupFileSenderExecuter??send???????????????????£?
boolean result = backupService.backup();
//????????????????????????????
if(result){
backupFileSenderExecuter.send(getNewestBackupFile());
}
????BackupFileSenderExecuter??????BackupServiceExecuter???????????????????????????ж??Sender?????????????е?Sender??????ж????????????BackupFileSenderExecuter??????????log.backup.file.sender??????????????ЩSender???????ε??????Sender??send???????????????????????????
????log.backup.file.sender=localBackupFileSender;
???????? localBackupFileSender??LocalBackupFileSender??Spring Bean?????
/**
*??б????????????????????????????ж??????Щ??????????????????????????ε???
* @author ???д?
*/
@Service
public class BackupFileSenderExecuter implements BackupFileSender?? ApplicationListener{
protected final APDPlatLogger LOG = new APDPlatLogger(getClass());
private static final List<BackupFileSender> backupFileSenders = new LinkedList<>();
@Override
public void send(File file) {
for(BackupFileSender sender : backupFileSenders){
sender.send(file);
}
}
@Override
public void onApplicationEvent(ApplicationEvent event){
if(event instanceof ContextRefreshedEvent){
LOG.info("spring????????????????????BackupFileSender");
String senderstr = PropertyHolder.getProperty("log.backup.file.sender");
if(StringUtils.isBlank(senderstr)){
LOG.info("δ????log.backup.file.sender");
return;
}
LOG.info("log.backup.file.sender??"+senderstr);
String[] senders = senderstr.trim().split(";");
for(String sender : senders){
BackupFileSender backupFileSender = SpringContextUtils.getBean(sender.trim());
if(backupFileSender != null){
backupFileSenders.add(backupFileSender);
LOG.info("???BackupFileSender??"+sender);
}else{
LOG.info("δ???BackupFileSender??"+sender);
}
}
}
}
}
?????????????????????????LocalBackupFileSender??
/**
* ???????????????????????????????
* @author ???д?
*/
@Service
public class LocalBackupFileSender implements BackupFileSender{
protected final APDPlatLogger LOG = new APDPlatLogger(getClass());
@Override
public void send(File file) {
try {
String dist = PropertyHolder.getProperty("log.backup.file.local.dir");
LOG.info("?????????"+file.getAbsolutePath());
LOG.info("???????"+dist);
FileUtils.copyFile(file?? new File(dist??file.getName()));
} catch (IOException ex) {
LOG.info("LocalBackupFileSender???"?? ex);
}
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11