You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by rl...@apache.org on 2013/07/27 20:53:30 UTC

svn commit: r1507703 - in /oodt/trunk: ./ webapp/fmprod/src/main/java/org/apache/oodt/cas/product/service/resources/

Author: rlaidlaw
Date: Sat Jul 27 18:53:30 2013
New Revision: 1507703

URL: http://svn.apache.org/r1507703
Log:
OODT-649: Added PathUtils.replaceEnvVariables wrapper around calls to context.getInitParameter

Modified:
    oodt/trunk/CHANGES.txt
    oodt/trunk/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/service/resources/DatasetResource.java
    oodt/trunk/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/service/resources/ProductResource.java
    oodt/trunk/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/service/resources/ReferenceResource.java

Modified: oodt/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/oodt/trunk/CHANGES.txt?rev=1507703&r1=1507702&r2=1507703&view=diff
==============================================================================
--- oodt/trunk/CHANGES.txt (original)
+++ oodt/trunk/CHANGES.txt Sat Jul 27 18:53:30 2013
@@ -4,6 +4,9 @@ Apache OODT Change Log
 Release 0.7 - Current Development
 ---------------------------------
 
+* OODT-649 Add PathUtils.replaceEnvVariables wrapper around calls to
+  context.getInitParameter to process environment variables (rlaidlaw)
+
 * OODT-611 Implement JAX-RS services to access File Manager products as raw
   data (rlaidlaw)
 

Modified: oodt/trunk/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/service/resources/DatasetResource.java
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/service/resources/DatasetResource.java?rev=1507703&r1=1507702&r2=1507703&view=diff
==============================================================================
--- oodt/trunk/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/service/resources/DatasetResource.java (original)
+++ oodt/trunk/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/service/resources/DatasetResource.java Sat Jul 27 18:53:30 2013
@@ -31,6 +31,7 @@ import javax.ws.rs.core.Response;
 import org.apache.oodt.cas.filemgr.structs.Product;
 import org.apache.oodt.cas.filemgr.structs.ProductType;
 import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
+import org.apache.oodt.cas.metadata.util.PathUtils;
 import org.apache.oodt.cas.product.service.exceptions.BadRequestException;
 import org.apache.oodt.cas.product.service.exceptions.NotFoundException;
 import org.apache.oodt.cas.product.service.responders.Responder;
@@ -79,12 +80,14 @@ public class DatasetResource
 
     try
     {
-      XmlRpcFileManagerClient client = new XmlRpcFileManagerClient(new URL(
-        context.getInitParameter("filemgr.url")));
+      XmlRpcFileManagerClient client = new XmlRpcFileManagerClient(
+        new URL(PathUtils.replaceEnvVariables(
+          context.getInitParameter("filemgr.url"))));
       productType = client.getProductTypeById(typeID);
 
       // Set a working directory to store product files.
-      setWorkingDirPath(context.getInitParameter("filemgr.working.dir"));
+      setWorkingDirPath(PathUtils.replaceEnvVariables(
+        context.getInitParameter("filemgr.working.dir")));
       String productDirPath = getWorkingDirPath();
       productDirPath += productDirPath.endsWith("/") ? "" : "/";
       productDirPath += productType.getName();

Modified: oodt/trunk/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/service/resources/ProductResource.java
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/service/resources/ProductResource.java?rev=1507703&r1=1507702&r2=1507703&view=diff
==============================================================================
--- oodt/trunk/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/service/resources/ProductResource.java (original)
+++ oodt/trunk/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/service/resources/ProductResource.java Sat Jul 27 18:53:30 2013
@@ -29,6 +29,7 @@ import javax.ws.rs.core.Response;
 import org.apache.oodt.cas.filemgr.structs.Product;
 import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
 import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.metadata.util.PathUtils;
 import org.apache.oodt.cas.product.service.exceptions.NotFoundException;
 import org.apache.oodt.cas.product.service.responders.Responder;
 import org.apache.oodt.cas.product.service.responders.ResponderFactory;
@@ -98,9 +99,11 @@ public class ProductResource
   {
     try
     {
-      setWorkingDirPath(context.getInitParameter("filemgr.working.dir"));
-      XmlRpcFileManagerClient client = new XmlRpcFileManagerClient(new URL(
-        context.getInitParameter("filemgr.url")));
+      setWorkingDirPath(PathUtils.replaceEnvVariables(
+        context.getInitParameter("filemgr.working.dir")));
+      XmlRpcFileManagerClient client = new XmlRpcFileManagerClient(
+        new URL(PathUtils.replaceEnvVariables(
+          context.getInitParameter("filemgr.url"))));
       product = client.getProductById(productID);
       product.setProductReferences(client.getProductReferences(product));
       metadata = client.getMetadata(product);

Modified: oodt/trunk/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/service/resources/ReferenceResource.java
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/service/resources/ReferenceResource.java?rev=1507703&r1=1507702&r2=1507703&view=diff
==============================================================================
--- oodt/trunk/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/service/resources/ReferenceResource.java (original)
+++ oodt/trunk/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/service/resources/ReferenceResource.java Sat Jul 27 18:53:30 2013
@@ -30,6 +30,7 @@ import javax.ws.rs.core.Response;
 import org.apache.oodt.cas.filemgr.structs.Product;
 import org.apache.oodt.cas.filemgr.structs.Reference;
 import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
+import org.apache.oodt.cas.metadata.util.PathUtils;
 import org.apache.oodt.cas.product.service.exceptions.NotFoundException;
 import org.apache.oodt.cas.product.service.responders.Responder;
 import org.apache.oodt.cas.product.service.responders.ResponderFactory;
@@ -70,9 +71,11 @@ public class ReferenceResource
   {
     try
     {
-      setWorkingDirPath(context.getInitParameter("filemgr.working.dir"));
-      XmlRpcFileManagerClient client = new XmlRpcFileManagerClient(new URL(
-        context.getInitParameter("filemgr.url")));
+      setWorkingDirPath(PathUtils.replaceEnvVariables(
+        context.getInitParameter("filemgr.working.dir")));
+      XmlRpcFileManagerClient client = new XmlRpcFileManagerClient(
+        new URL(PathUtils.replaceEnvVariables(
+          context.getInitParameter("filemgr.url"))));
       Product product = client.getProductById(productID);
       List<Reference> references = client.getProductReferences(product);
       this.reference = references.get(refIndex);