Skip to content

Commit

Permalink
verified, improved logging
Browse files Browse the repository at this point in the history
Issue #40
  • Loading branch information
rsoika committed Aug 18, 2020
1 parent 6f32628 commit 4251356
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

/**
* The ExportService exports the workflow data stored in the cassandra cluster
* into a FTP storage. The service class runns a TimerService based on the given
* into a FTP storage. The service class runs a TimerService based on the given
* scheduler configuration.
* <p>
* The service automatially starts during deployment.
Expand Down Expand Up @@ -410,6 +410,7 @@ void onTimeout(javax.ejb.Timer timer) throws Exception {
if (latestSnapshot.equals(snapshotID)) {
// we did NOT find a later snapshot, so this is the one we should export
ItemCollection snapshot = dataService.loadSnapshot(snapshotID);
lastUniqueID=snapshot.getUniqueID();
// test if the $modified date is behind our current sync point....
Date snaptshotDate = snapshot.getItemValueDate("$modified");
if (snaptshotDate.getTime() > syncPoint) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ void onTimeout(javax.ejb.Timer timer) throws ArchiveException {
throw new ArchiveException(FTP_ERROR, "FTP file transfer failed: missing working directory '"
+ ftpWorkingPath + "' : " + ftpClient.getReplyString());
}
messageService.logMessage(MESSAGE_TOPIC, "......import path: " + ftpWorkingPath);
// now switch to Month....
FTPFile[] directoryListMonths = ftpClient.listDirectories();
for (FTPFile ftpFileMonth : directoryListMonths) {
Expand All @@ -225,14 +224,18 @@ void onTimeout(javax.ejb.Timer timer) throws ArchiveException {
"FTP file transfer failed: missing working directory '" + ftpWorkingPath
+ "' : " + ftpClient.getReplyString());
}
messageService.logMessage(MESSAGE_TOPIC, "......import path: " + ftpWorkingPath);

messageService.logMessage(MESSAGE_TOPIC,
"......import: " + ftpFileYear.getName() + "/" + ftpWorkingPath + " ...");
// read all files....
int count = 0;
int verified = 0;
FTPFile[] importFiles = ftpClient.listFiles();
for (FTPFile importFile : importFiles) {
if (importFile.isFile()) {
ItemCollection snapshot = ftpConnector.get(ftpClient, importFile.getName());
if (snapshot != null) {
verified++;
if (!dataService.existSnapshot(snapshot.getUniqueID())) {
// import!
dataService.saveSnapshot(snapshot);
Expand All @@ -253,7 +256,9 @@ void onTimeout(javax.ejb.Timer timer) throws ArchiveException {
}
}

messageService.logMessage(MESSAGE_TOPIC, "......" + count + " snapshots imported...");
messageService.logMessage(MESSAGE_TOPIC,
"......" + ftpFileYear.getName() + "/" + ftpWorkingPath + ": " + verified
+ " snapshots verified, " + count + " snapshots imported...");
metaData.setItemValue(ITEM_IMPORTPOINT, lastImportPoint);
metaData.setItemValue(ITEM_IMPORTCOUNT, totalCount);
metaData.setItemValue(ITEM_IMPORTSIZE, importSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public void put(ItemCollection snapshot) throws ArchiveException {
+ fileName + "' : " + ftpClient.getReplyString());
}

logger.info("...." + ftpWorkingPath + fileName + " transfered successfull to " + ftpServer);
logger.finest("...." + ftpWorkingPath + fileName + " transfered successfull to " + ftpServer);

} catch (IOException e) {
throw new ArchiveException(FTP_ERROR, "FTP file transfer failed: " + e.getMessage(), e);
Expand Down Expand Up @@ -185,7 +185,7 @@ public ItemCollection get(FTPClient ftpClient, String fileName) throws ArchiveEx
ftpClient.retrieveFile(fileName, bos);
byte[] result = bos.toByteArray();
ItemCollection snapshot = XMLDocumentAdapter.readItemCollection(result);
logger.info("......" + fileName + " transfered successfull from " + ftpServer + " in "
logger.finest("......" + fileName + " transfered successfull from " + ftpServer + " in "
+ (System.currentTimeMillis() - l) + "ms");
return snapshot;
} catch (IOException | JAXBException e) {
Expand Down

0 comments on commit 4251356

Please sign in to comment.