Issue #16 - data/manual now uses subdirectories
Change-Id: I19786d4a39b2f7363b9eccd3ef00cd2ddf7d46fb Former-commit-id:59c8cbf1f3
[formerly59c8cbf1f3
[formerly 3619411519db0fe5df90e47ca478f083931817ec]] Former-commit-id:24efc2ee93
Former-commit-id:5deccb8bf5
This commit is contained in:
parent
f3e97815fe
commit
e66ce50272
5 changed files with 28 additions and 12 deletions
|
@ -281,7 +281,7 @@ public class ScanTestDataPopulator {
|
|||
*/
|
||||
private void copyFile(File file) {
|
||||
|
||||
File outfile = new File(MANUAL_INGEST_DIR + "/" + file.getName());
|
||||
File outfile = new File(MANUAL_INGEST_DIR + "/scanTestDataPopulator/" + file.getName());
|
||||
InputStream in = null;
|
||||
try {
|
||||
in = new FileInputStream(file);
|
||||
|
|
|
@ -34,7 +34,6 @@ import ucar.unidata.io.RandomAccessFile;
|
|||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.grib.GribRecord;
|
||||
import com.raytheon.uf.common.dataplugin.grib.StatusConstants;
|
||||
import com.raytheon.uf.common.dataplugin.grib.exception.GribException;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
|
@ -109,7 +108,7 @@ public class GribDecoder {
|
|||
// manual ingest endpoint
|
||||
if (recordLengths.size() > 1) {
|
||||
raf.seek(0);
|
||||
splitFile(file.getName(), raf, recordLengths);
|
||||
splitFile(file.getName(), raf, recordLengths, edition);
|
||||
return new GribRecord[] {};
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +164,7 @@ public class GribDecoder {
|
|||
* @throws IOException
|
||||
*/
|
||||
private void splitFile(String fileName, RandomAccessFile raf,
|
||||
List<Long> sizes) throws IOException {
|
||||
List<Long> sizes, int edition) throws IOException {
|
||||
FileOutputStream out = null;
|
||||
byte[] transfer = null;
|
||||
for (int i = 0; i < sizes.size(); i++) {
|
||||
|
@ -175,7 +174,7 @@ public class GribDecoder {
|
|||
|
||||
try {
|
||||
out = new FileOutputStream(System.getProperty("edex.home")
|
||||
+ "/data/manual/" + fileName + "_record_" + (i + 1));
|
||||
+ "/data/manual/grib/grib" + edition + "LargeSplit/" + fileName + "_record_" + (i + 1));
|
||||
out.write(transfer);
|
||||
out.close();
|
||||
} finally {
|
||||
|
|
|
@ -229,7 +229,7 @@ public class ArealQpeGenSrv {
|
|||
}
|
||||
processSingleQpe(dd, hrap, subGrid);
|
||||
}
|
||||
if (gribout.equalsIgnoreCase("ON") && qpe_out == true) {
|
||||
if (gribout.equalsIgnoreCase("ON") && (qpe_out == true)) {
|
||||
gribTempFiles();
|
||||
}
|
||||
|
||||
|
@ -342,7 +342,8 @@ public class ArealQpeGenSrv {
|
|||
cc.setTime(dt);
|
||||
SimpleDateFormat ffn = new SimpleDateFormat("ddHHmmss");
|
||||
String dString = ffn.format(cc.getTime());
|
||||
File gribIngestFile = new File(d2d_input_dir + "/"
|
||||
File gribIngestFile = new File(d2d_input_dir + File.separator +
|
||||
"arealQpeGenSrv" + File.separator
|
||||
+ fr.getName() + "_" + dString + ".grib");
|
||||
log.info("Move and rename grib file " + goFile + " to "
|
||||
+ mvFile);
|
||||
|
@ -357,11 +358,13 @@ public class ArealQpeGenSrv {
|
|||
try {
|
||||
FileUtil.copyFile(mvFile, gribIngestFile);
|
||||
log.info("Copied grib file " + mvFile.getName()
|
||||
+ " to " + d2d_input_dir
|
||||
+ " to " + d2d_input_dir + File.separator +
|
||||
"arealQpeGenSrv"
|
||||
+ " for ingest to D2D. ");
|
||||
} catch (IOException e) {
|
||||
log.error("Copy grib file " + mvFile.getName() + " to "
|
||||
+ d2d_input_dir + " failed. ");
|
||||
+ d2d_input_dir + File.separator +
|
||||
"arealQpeGenSrv" + " failed. ");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler" autoStartup="false">
|
||||
<endpoint id="manualFileEndpoint"
|
||||
uri="file:${edex.home}/data/manual?delete=true&delay=5000&maxMessagesPerPoll=1000&exclusiveReadLockStrategy=#fileChangedStrategy" />
|
||||
uri="file:${edex.home}/data/manual?delete=true&delay=5000&maxMessagesPerPoll=1000&exclusiveReadLockStrategy=#fileChangedStrategy&recursive=true" />
|
||||
<endpoint id="ndmFileEndpoint"
|
||||
uri="file:${edex.home}/data/ndm?delete=true&delay=5000&maxMessagesPerPoll=1000&exclusiveReadLockStrategy=#ndmFileChangedStrategy" />
|
||||
|
||||
|
|
|
@ -132,14 +132,28 @@ public class MessageGenerator implements Processor {
|
|||
|
||||
public File copyFileToArchive(File inFile) {
|
||||
String path = DIR + File.separator;
|
||||
File dir = new File(path);
|
||||
if (!dir.exists())
|
||||
|
||||
// Determine the sub-directory
|
||||
String inputPath = inFile.getParent();
|
||||
|
||||
// Split on the manual directory to get the sub-directory
|
||||
String[] parts = inputPath.split("manual");
|
||||
File dir = null;
|
||||
if (parts.length > 1) {
|
||||
dir = new File(path + parts[1]);
|
||||
} else {
|
||||
dir = new File(path);
|
||||
}
|
||||
|
||||
if (!dir.exists()) {
|
||||
dir.mkdirs();
|
||||
}
|
||||
|
||||
File newFile = new File(dir, inFile.getName());
|
||||
|
||||
try {
|
||||
FileCopyUtils.copy(inFile, newFile);
|
||||
statusHandler.handle(Priority.INFO, "DataManual: " + inFile.getAbsolutePath());
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.ERROR, "Failed to copy file ["
|
||||
+ inFile.getAbsolutePath() + "] to archive dir", e);
|
||||
|
|
Loading…
Add table
Reference in a new issue