Revision 5680
Added by berkley about 14 years ago
src/edu/ucsb/nceas/metacat/dataone/CrudService.java | ||
---|---|---|
996 | 996 |
tmpDir = new File("/tmp"); |
997 | 997 |
} |
998 | 998 |
Date d = new Date(); |
999 |
File outputFile = new File(tmpDir, "metacat.output." + d.getTime()); |
|
999 |
final File outputFile = new File(tmpDir, "metacat.output." + d.getTime());
|
|
1000 | 1000 |
FileOutputStream dataSink = new FileOutputStream(outputFile); |
1001 | 1001 |
|
1002 | 1002 |
handler.readFromMetacat(metacatUrl, null, |
... | ... | |
1004 | 1004 |
username, |
1005 | 1005 |
groups, true, params); |
1006 | 1006 |
|
1007 |
//set a timer to clean up the temp files |
|
1008 |
Timer t = new Timer(); |
|
1009 |
TimerTask tt = new TimerTask() { |
|
1010 |
@Override |
|
1011 |
public void run() |
|
1012 |
{ |
|
1013 |
outputFile.delete(); |
|
1014 |
} |
|
1015 |
}; |
|
1016 |
t.schedule(tt, 20000); //schedule after 20 secs |
|
1017 |
|
|
1007 | 1018 |
objectStream = new FileInputStream(outputFile); |
1008 | 1019 |
|
1009 | 1020 |
} catch (PropertyNotFoundException e) { |
... | ... | |
1040 | 1051 |
username, im.getLocalId(guid.getValue()), "read"); |
1041 | 1052 |
logCrud.info("get D1GUID:" + guid.getValue() + ":D1SCIMETADATA:" + localId + |
1042 | 1053 |
":"); |
1054 |
|
|
1043 | 1055 |
return objectStream; |
1044 | 1056 |
} |
1045 | 1057 |
catch (McdbDocNotFoundException e) |
Also available in: Unified diff
add a timer to delete the temp file