Skip to content
Browse files

Temporary files for processes are now stored in WorkSpace rather than…

… tmpdir.

* also removed auto-generated licence header
  • Loading branch information...
1 parent ddea73d commit 508e8f7895ee67333cd8892f4cdafe52bc49a41f @jiwalker-usgs committed Feb 21, 2014
View
3 ...rc/main/java/gov/usgs/cida/gdp/wps/algorithm/FeatureCategoricalGridCoverageAlgorithm.java
@@ -1,5 +1,6 @@
package gov.usgs.cida.gdp.wps.algorithm;
+import gov.usgs.cida.gdp.constants.AppConstant;
import gov.usgs.cida.gdp.coreprocessing.Delimiter;
import gov.usgs.cida.gdp.coreprocessing.analysis.grid.FeatureCategoricalGridCoverage;
import gov.usgs.cida.gdp.wps.binding.CSVFileBinding;
@@ -110,7 +111,7 @@ public void process() {
try {
- output = File.createTempFile(getClass().getSimpleName(), delimiter.extension);
+ output = File.createTempFile(getClass().getSimpleName(), delimiter.extension, new File(AppConstant.WORK_LOCATION.getValue()));
writer = new BufferedWriter(new FileWriter(output));
for (String currentDatasetId : datasetId) {
View
3 ...ain/java/gov/usgs/cida/gdp/wps/algorithm/FeatureCoverageOPeNDAPIntersectionAlgorithm.java
@@ -1,5 +1,6 @@
package gov.usgs.cida.gdp.wps.algorithm;
+import gov.usgs.cida.gdp.constants.AppConstant;
import gov.usgs.cida.gdp.wps.binding.GMLStreamingFeatureCollectionBinding;
import gov.usgs.cida.gdp.wps.binding.NetCDFFileBinding;
import java.io.File;
@@ -104,7 +105,7 @@ public void process() {
GridDataset gridDataSet = null;
try {
gridDataSet = GDPAlgorithmUtil.generateGridDataSet(datasetURI);
- output = File.createTempFile(getClass().getSimpleName(), ".nc");
+ output = File.createTempFile(getClass().getSimpleName(), ".nc", new File(AppConstant.WORK_LOCATION.getValue()));
NetCDFGridWriter.makeFile(
output.getAbsolutePath(),
gridDataSet,
View
3 ...ess-wps/src/main/java/gov/usgs/cida/gdp/wps/algorithm/FeatureGridStatisticsAlgorithm.java
@@ -1,5 +1,6 @@
package gov.usgs.cida.gdp.wps.algorithm;
+import gov.usgs.cida.gdp.constants.AppConstant;
import gov.usgs.cida.gdp.coreprocessing.Delimiter;
import gov.usgs.cida.gdp.coreprocessing.analysis.grid.FeatureCoverageGridStatistics;
import gov.usgs.cida.gdp.coreprocessing.analysis.grid.Statistics1DWriter.GroupBy;
@@ -182,7 +183,7 @@ public void process() {
return;
}
- output = File.createTempFile(getClass().getSimpleName(), delimiter.extension);
+ output = File.createTempFile(getClass().getSimpleName(), delimiter.extension, new File(AppConstant.WORK_LOCATION.getValue()));
writer = new BufferedWriter(new FileWriter(output));
for (String currentDatasetId : datasetId) {
View
3 ...src/main/java/gov/usgs/cida/gdp/wps/algorithm/FeatureWeightedGridStatisticsAlgorithm.java
@@ -1,5 +1,6 @@
package gov.usgs.cida.gdp.wps.algorithm;
+import gov.usgs.cida.gdp.constants.AppConstant;
import gov.usgs.cida.gdp.coreprocessing.Delimiter;
import gov.usgs.cida.gdp.coreprocessing.analysis.grid.FeatureCoverageWeightedGridStatistics;
import gov.usgs.cida.gdp.coreprocessing.analysis.grid.Statistics1DWriter.GroupBy;
@@ -181,7 +182,7 @@ public void process() {
addError("Attribute " + featureAttributeName + " not found in feature collection");
return;
}
- output = File.createTempFile(getClass().getSimpleName(), delimiter.extension);
+ output = File.createTempFile(getClass().getSimpleName(), delimiter.extension, new File(AppConstant.WORK_LOCATION.getValue()));
writer = new BufferedWriter(new FileWriter(output));
for (String currentDatasetId : datasetId) {
View
4 gdp-process-wps/src/main/java/gov/usgs/cida/gdp/wps/algorithm/GDPAlgorithmConstants.java
@@ -1,7 +1,3 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
package gov.usgs.cida.gdp.wps.algorithm;
/**
View
9 ...ss-wps/src/main/java/gov/usgs/cida/gdp/wps/algorithm/PRMSParameterGeneratorAlgorithm.java
@@ -1,6 +1,7 @@
package gov.usgs.cida.gdp.wps.algorithm;
import com.google.common.base.Joiner;
+import gov.usgs.cida.gdp.constants.AppConstant;
import gov.usgs.cida.gdp.coreprocessing.Delimiter;
import gov.usgs.cida.gdp.coreprocessing.analysis.grid.FeatureCoverageWeightedGridStatistics;
import gov.usgs.cida.gdp.coreprocessing.analysis.grid.Statistics1DWriter.GroupBy;
@@ -244,8 +245,8 @@ public void process() {
addError("Attribute " + featureAttributeName + " is not Numeric type, unable to properly index HRU");
}
- prmsParamFile = File.createTempFile(getClass().getSimpleName(), ".param");
- prmsDataFile = File.createTempFile(getClass().getSimpleName(), ".data");
+ prmsParamFile = File.createTempFile(getClass().getSimpleName(), ".param", new File(AppConstant.WORK_LOCATION.getValue()));
+ prmsDataFile = File.createTempFile(getClass().getSimpleName(), ".data", new File(AppConstant.WORK_LOCATION.getValue()));
prmsParamWriter = new BufferedWriter(new FileWriter(prmsParamFile));
prmsDataWriter = new BufferedWriter(new FileWriter(prmsDataFile));
@@ -267,7 +268,7 @@ public void process() {
timeEnd);
// TODO: all I/O instances need try/finally cleanup
- csvFileList.add(File.createTempFile(getClass().getSimpleName(), ".temp.csv"));
+ csvFileList.add(File.createTempFile(getClass().getSimpleName(), ".temp.csv", new File(AppConstant.WORK_LOCATION.getValue())));
BufferedWriter csvWriter = null;
try {
csvWriter = new BufferedWriter(new FileWriter(csvFileList.get(inputIndex)));
@@ -320,7 +321,7 @@ public void process() {
FileInputStream prmsParamsInputStream = null;
FileInputStream prmsDataInputStream = null;
try {
- output = File.createTempFile(getClass().getName(), ".zip");
+ output = File.createTempFile(getClass().getName(), ".zip", new File(AppConstant.WORK_LOCATION.getValue()));
zipOutputStream = new ZipOutputStream(
new FileOutputStream(output));
prmsParamsInputStream = new FileInputStream(prmsParamFile);
View
3 gdp-process-wps/src/main/java/gov/usgs/cida/gdp/wps/parser/GMLStreamingParser.java
@@ -1,5 +1,6 @@
package gov.usgs.cida.gdp.wps.parser;
+import gov.usgs.cida.gdp.constants.AppConstant;
import gov.usgs.cida.gdp.wps.binding.GMLStreamingFeatureCollectionBinding;
import java.io.File;
import java.io.IOException;
@@ -16,7 +17,7 @@ public GMLStreamingParser() {
@Override
public GMLStreamingFeatureCollectionBinding parse(InputStream input, String mimeType, String schema) {
try {
- File tempFile = File.createTempFile(getClass().getSimpleName(), ".xml");
+ File tempFile = File.createTempFile(getClass().getSimpleName(), ".xml", new File(AppConstant.WORK_LOCATION.getValue()));
FileUtils.copyInputStreamToFile(input, tempFile);
return new GMLStreamingFeatureCollectionBinding(new GMLStreamingFeatureCollection(tempFile));
} catch (IOException e) {
View
3 gdp-process-wps/src/main/java/gov/usgs/cida/gdp/wps/parser/GeoTIFFParser.java
@@ -1,5 +1,6 @@
package gov.usgs.cida.gdp.wps.parser;
+import gov.usgs.cida.gdp.constants.AppConstant;
import gov.usgs.cida.gdp.wps.binding.GeoTIFFFileBinding;
import gov.usgs.cida.gdp.wps.util.GeoTIFFUtil;
import gov.usgs.cida.gdp.wps.util.MIMEMultipartStream;
@@ -35,7 +36,7 @@ public GeoTIFFFileBinding parse(InputStream inputStream, String mimeType, String
try {
- tempFile = File.createTempFile(getClass().getSimpleName(), ".tmp");
+ tempFile = File.createTempFile(getClass().getSimpleName(), ".tmp", new File(AppConstant.WORK_LOCATION.getValue()));
FileUtils.copyInputStreamToFile(inputStream, tempFile);
ByteBuffer buffer = ByteBuffer.allocate(4 + MIMEMultipartStream.MAX_BOUNDARY_LENGTH);
View
3 gdp-process-wps/src/main/java/gov/usgs/cida/gdp/wps/util/WCSUtil.java
@@ -1,5 +1,6 @@
package gov.usgs.cida.gdp.wps.util;
+import gov.usgs.cida.gdp.constants.AppConstant;
import gov.usgs.cida.gdp.dataaccess.CoverageMetaData;
import java.io.BufferedOutputStream;
import java.io.File;
@@ -309,7 +310,7 @@ public static File generateTIFFFile(URI wcsURI, String wcsIdentifier, Referenced
if (GeoTIFFUtil.isAllowedMimeType(contentType)) {
String contentTransferEncoding = headerMap.get("Content-Transfer-Encoding");
if (contentTransferEncoding != null) {
- tiffFile = File.createTempFile("gdp", ".tiff");
+ tiffFile = File.createTempFile("gdp", ".tiff", new File(AppConstant.WORK_LOCATION.getValue()));
OutputStream tiffOutputStream = new BufferedOutputStream(new FileOutputStream(tiffFile));
mimeMultipartStream.readBodyData(tiffOutputStream, contentTransferEncoding);
tiffOutputStream.close();

0 comments on commit 508e8f7

Please sign in to comment.
Something went wrong with that request. Please try again.