This is an automated email from the ASF dual-hosted git repository.
imesha pushed a commit to branch development
in repository https://gitbox.apache.org/repos/asf/oodt.git
The following commit(s) were added to refs/heads/development by this push:
new 6209f73 Update file manager module to create a workable zip and
fmprod service fixes
new f62d845 Merge branch 'development' of https://github.com/apache/oodt
into development
6209f73 is described below
commit 6209f733e740643c7675281d7733febf52f69a21
Author: Imesha Sudasingha <[email protected]>
AuthorDate: Mon Jun 28 21:22:55 2021 +0530
Update file manager module to create a workable zip and fmprod service fixes
---
filemgr/src/main/resources/filemgr.properties | 6 +++---
webapp/fmprod/README.md | 10 ++++++++++
.../cas/product/jaxrs/services/FileManagerJaxrsServiceV2.java | 9 +++++++--
3 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/filemgr/src/main/resources/filemgr.properties
b/filemgr/src/main/resources/filemgr.properties
index 2297555..8f9194d 100644
--- a/filemgr/src/main/resources/filemgr.properties
+++ b/filemgr/src/main/resources/filemgr.properties
@@ -94,12 +94,12 @@
org.apache.oodt.cas.filemgr.repositorymgr.science.jdbc.pass=pass
org.apache.oodt.cas.filemgr.repositorymgr.science.jdbc.driver=driver.class.name
# XML repository manager configuration
-org.apache.oodt.cas.filemgr.repositorymgr.dirs=file:///dir1,file:///dir2
+org.apache.oodt.cas.filemgr.repositorymgr.dirs=file:[FILEMGR_HOME]/policy/core,file:[FILEMGR_HOME]/policy/geo,file:[FILEMGR_HOME]/policy/trace
# uncomment the following line and set the value to true to recursively parse
policy directories
#org.apache.oodt.cas.filemgr.repositorymgr.dirs.recursive=false
# XML validation layer configuration
-org.apache.oodt.cas.filemgr.validation.dirs=file:///dir1,file:///dir2
+org.apache.oodt.cas.filemgr.validation.dirs=file:[FILEMGR_HOME]/policy/core,file:[FILEMGR_HOME]/policy/geo,file:[FILEMGR_HOME]/policy/trace
# uncomment the following line and set the value to true to recursively parse
validation directories
#org.apache.oodt.cas.filemgr.validation.dirs.recursive=false
@@ -134,7 +134,7 @@
org.apache.oodt.cas.filemgr.datatransfer.s3.secret.key=s3_secret_key
org.apache.oodt.cas.filemgr.datatransfer.s3.encrypt=false
# location of Mime-Type repository
-org.apache.oodt.cas.filemgr.mime.type.repository=/path/to/mime-types.xml
+org.apache.oodt.cas.filemgr.mime.type.repository=[FILEMGR_HOME]/etc/mime-types.xml
# tells the file manager system layer to include product instance metadata
# NOTE: here are the expected field mappings
diff --git a/webapp/fmprod/README.md b/webapp/fmprod/README.md
new file mode 100644
index 0000000..f1858b3
--- /dev/null
+++ b/webapp/fmprod/README.md
@@ -0,0 +1,10 @@
+# FM Prod
+
+Following environment variable are required to be set
+
+```bash
+FILEMGR_URL=http://localhost:9000
+WORKFLOW_URL=http://localhost:9001
+FILEMGR_WORKINGDIR=/tmp
+
+```
\ No newline at end of file
diff --git
a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/jaxrs/services/FileManagerJaxrsServiceV2.java
b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/jaxrs/services/FileManagerJaxrsServiceV2.java
index 41d0ff3..1424b9e 100644
---
a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/jaxrs/services/FileManagerJaxrsServiceV2.java
+++
b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/jaxrs/services/FileManagerJaxrsServiceV2.java
@@ -25,6 +25,8 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import javax.activation.DataHandler;
@@ -141,7 +143,7 @@ public class FileManagerJaxrsServiceV2 {
client.getNextPage(client.getProductTypeByName(productTypeName),
firstpage);
// Searching for the current page
- while (nextPage.getPageNum() != currentProductPage - 1) {
+ while (nextPage.getPageNum() < currentProductPage - 1) {
nextPage =
client.getNextPage(client.getProductTypeByName(productTypeName), nextPage);
}
@@ -408,7 +410,10 @@ public class FileManagerJaxrsServiceV2 {
OutputStream outputStream = null;
File file = new File("ingestedFiles/" + fileName);
try {
- outputStream = new FileOutputStream(file);
+ java.nio.file.Path ingestedDir = Paths.get("ingestedFiles");
+ Files.createDirectories(ingestedDir);
+ java.nio.file.Path ingestedFile = ingestedDir.resolve(fileName);
+ outputStream = new FileOutputStream(ingestedFile.toFile());
int read = 0;
byte[] bytes = new byte[1024];
while ((read = inputStream.read(bytes)) != -1) {