Skip to content

Commit

Permalink
Resume Support
Browse files Browse the repository at this point in the history
- Resume Support
  • Loading branch information
james2432 committed Aug 19, 2016
1 parent 3844377 commit ee41acf
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 3 deletions.
2 changes: 1 addition & 1 deletion OSVUploadr/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ca.osmcanada</groupId>
<artifactId>OSVUploadr</artifactId>
<version>0.1-ALPHA</version>
<version>0.1.1-ALPHA</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
Expand Down
46 changes: 44 additions & 2 deletions OSVUploadr/src/main/java/ca/osmcanada/osvuploadr/JPMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,45 @@ public int compare(File f1, File f2)
}
//TODO: Load count from file
int cnt =0;
File f_cnt = new File(dir+"/count_file.txt");
if(f_cnt.exists())
{
try
{
List<String> id = Files.readAllLines(Paths.get(f_cnt.getPath()));
if(id.size()>0)
{
cnt= Integer.parseInt(id.get(0));
}
}
catch(Exception ex)
{
cnt=0;
}
}
else
{
try{
f_cnt.createNewFile();
}
catch(Exception ex)
{
Logger.getLogger(JPMain.class.getName()).log(Level.SEVERE, null, ex);
}
}
if(cnt>0){
if(file_list.length>cnt){
File[] tmp = new File[file_list.length-cnt];
int local_cnt=0;
for(int i=cnt;i<file_list.length;i++)
{
tmp[local_cnt]=file_list[i];
local_cnt++;
}
file_list=tmp;
}
}

//Read file info
for(File f : file_list)
{
Expand All @@ -408,8 +447,11 @@ public int compare(File f1, File f2)
need_seq=false;
}
imp.setSequenceNumber(cnt);
cnt++; //TODO: Write count to file
Upload_Image(imp,usr_id,usr_name,sequence_id);
cnt++; //TODO: Write count to file
Upload_Image(imp,usr_id,usr_name,sequence_id);
String out =String.valueOf(cnt);
Files.write(Paths.get(f_cnt.getPath()),out.getBytes("UTF-8"), StandardOpenOption.TRUNCATE_EXISTING);

}
catch(Exception ex)
{
Expand Down

0 comments on commit ee41acf

Please sign in to comment.