Skip to content

Commit

Permalink
refactor API
Browse files Browse the repository at this point in the history
  • Loading branch information
pgdurand committed Feb 11, 2022
1 parent d01e38f commit 09f3514
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/bzh/plealog/dbmirror/fetcher/DBMSFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public long getEpochStamp() {
return fTimeStamp;
}

public File getFile() {
public File getRemoteFile() {
if (fRepr==null) {
fRepr = new File(EZFileUtils.terminatePath(remoteDir)+fName);
}
Expand Down
7 changes: 6 additions & 1 deletion src/bzh/plealog/dbmirror/fetcher/PAsperaLoader.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2019 Patrick G. Durand
/* Copyright (C) 2019-2022 Patrick G. Durand
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
Expand Down Expand Up @@ -60,6 +60,11 @@ public String getWorkerBaseName() {
return ASPC_WORKER;
}

@Override
public Log getLogger() {
return LOGGER;
}

@Override
public void closeLoader() {
//nothing to do
Expand Down
6 changes: 4 additions & 2 deletions src/bzh/plealog/dbmirror/fetcher/PFTPLoader.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2007-2020 Patrick G. Durand
/* Copyright (C) 2007-2022 Patrick G. Durand
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
Expand Down Expand Up @@ -87,7 +87,9 @@ public PFTPLoader(int id) {
public String getLoaderId() {
return _loaderId;
}

public Log getLogger() {
return LOGGER;
}
public String getWorkerBaseName() {
return FTP_WORKER;
}
Expand Down
5 changes: 5 additions & 0 deletions src/bzh/plealog/dbmirror/fetcher/PHTTPLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public boolean readyToDownload() {
return true;
}

@Override
public Log getLogger() {
return LOGGER;
}

@Override
public boolean prepareLoader(DBServerConfig fsc) {
url_base = fsc.getFTPAternativeProtocol();
Expand Down
4 changes: 2 additions & 2 deletions src/bzh/plealog/dbmirror/fetcher/PLocalLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ public int copyFiles(List<DBMSFile> files, String destDir, LoaderMonitor monitor
msg = "Skip already copyied file: " + fName;
}
else{
input = new FileInputStream(file.getFile());
input = new FileInputStream(file.getRemoteFile());
output = new FileOutputStream(destDir + file.getName());
fSize = file.getSize();
Util.copyStream(input, output, Util.DEFAULT_COPY_BUFFER_SIZE, fSize,
Expand All @@ -336,7 +336,7 @@ public int copyFiles(List<DBMSFile> files, String destDir, LoaderMonitor monitor
} catch (Exception e) {
result = 0;
LoggerCentral.error(LOGGER,
e.getMessage() + ": " + file.getFile().getAbsolutePath());
e.getMessage() + ": " + file.getRemoteFile().getAbsolutePath());
if (monitor != null)
monitor.doneLoading(fName, LoaderMonitor.STATUS_FAILURE);
if (_userMonitor != null) {
Expand Down

0 comments on commit 09f3514

Please sign in to comment.