Update googlecode upload

This commit is contained in:
Victor Shcherb 2012-05-19 13:46:00 +02:00
parent 54b0632b80
commit 1ab69c055a

View file

@ -259,6 +259,10 @@ public class IndexUploader {
if (!fileFilter.fileCanBeUploaded(f)) {
continue;
}
if(!uploadCredentials.checkIfUploadNeededByTimestamp(f.getName(), f.lastModified())) {
log.info("File skipped because timestamp was not changed " + f.getName() );
continue;
}
log.info("Process file " + f.getName());
File unzipped = unzip(f);
String description = getDescription(unzipped);
@ -336,6 +340,9 @@ public class IndexUploader {
try {
raf = new RandomAccessFile(f, "r");
BinaryMapIndexReader reader = new BinaryMapIndexReader(raf);
if(reader.getVersion() != IndexConstants.BINARY_MAP_VERSION) {
throw new OneFileException("Uploader version is not compatible " + reader.getVersion() + " to current " + IndexConstants.BINARY_MAP_VERSION);
}
summary = " index for ";
boolean fir = true;
if (reader.containsAddressData()) {
@ -502,6 +509,10 @@ public class IndexUploader {
path = param.substring("--path=".length());
}
}
public boolean checkIfUploadNeededByTimestamp(String filename, long time) {
return true;
}
public void disconnect() {
//if the uploading needs to close a session
@ -591,6 +602,15 @@ public class IndexUploader {
}
}
@Override
public boolean checkIfUploadNeededByTimestamp(String filename, long time) {
String date = new MessageFormat("{0,date,dd.MM.yyyy}", Locale.US).format(new Date(time));
if (uploaded.containsKey(filename) && date.equals(uploaded.get(filename))) {
return false;
}
return true;
}
@Override
public void upload(IndexUploader uploader, File toUpload,
String summary, String size, String date) throws IOException,