-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/10611/
-----------------------------------------------------------

Review request for oodt and Chris Mattmann.


Description
-------

This change allows the RSSProductTransferServlet to be configured using an 
external XML configuration file, rather than using hard-coded properties within 
the class.

I added a default configuration file 'rss-transfer-conf.xml' to the 
webapp/fmprod/src/main/resources directory.  This contains configurations that 
were originally in the RSSProductTransferServlet class, such as the cas 
namespace and three 'cas' prefixed tags assigned to metadata fields 
(BytesTransferred, TotalBytes and PercentComplete).

I then modified the RSSProductTransferServlet class to read the data from this 
configuration file.  To allow the servlet to locate the file, I added a 
parameter named "filemgr.rss-transfer-conf.file" to the 
cas-product-tomcat-5.5.9.xml properties file and a constant 
RSS_TRANSFER_CONF_KEY (set to the same parameter name 
"filemgr.rss-transfer-conf.file") to the RSSConfigMetKeys interface.

In the RSSProductTransferServlet class, I removed the hard-coded NS_MAP HashMap 
for namespaces and I also removed the calls to XMLUtils.addNode() with 
hard-coded cas-prefixed tags.  I then added code to read this information from 
the configuration file as an RSSConfig object.  Two for-each loops are used - 
the first to read namespaces and the second to read tags from the configuration 
file.  The three properties - BytesTransferred, TotalBytes and PercentComplete 
- are computed for each product and stored as metadata for access by tags.


This addresses bug OODT-470.
    https://issues.apache.org/jira/browse/OODT-470


Diffs
-----

  
/trunk/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rss/RSSConfigMetKeys.java
 1468408 
  
/trunk/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rss/RSSProductTransferServlet.java
 1468408 
  /trunk/webapp/fmprod/src/main/resources/cas-product-tomcat-5.5.9.xml 1468408 
  /trunk/webapp/fmprod/src/main/resources/rss-transfer-conf.xml PRE-CREATION 

Diff: https://reviews.apache.org/r/10611/diff/


Testing
-------

To test this change I performed the following steps:


Set up the cas-product webapp:

1) cd webapp/fmprod and then mvn clean install to compile the cas-product webapp
2) cp target/cas-product-xx.war and target/classes/*.xml to 
/usr/local/oodt/webapp/fmprod
3) add a soft-link (ln -s) from $CATALINA_HOME/localhost/fmprod.xml to 
/usr/local/oodt/webapp/fmprod/cas-product-tomcat-5.5.9.xml
4) edit /usr/local/oodt/webapp/fmprod/cas-product-tomcat-5.5.9.xml to point to 
the right locations for config files, in particular:

  <Parameter name="filemgr.rss-transfer-conf.file" 
value="/usr/local/oodt/webapp/fmprod/rss-transfer-conf.xml" override="false"/>


Start File Manager, then start Tomcat:

1) cd oodt/filemgr/bin
    ./filemgr start

2) start tomcat


Ingest file with the File Manager Client and access the RSS product transfer 
servlet while the file is being transferred:

1) ingest large file(s) using the file manager client.
2) while the file is ingesting, in a separate terminal window run the following:

curl http://localhost:8080/fmprod/viewTransfers


Example output:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<rss xmlns:cas="http://oodt.apache.org/ns/cas"; version="2.0">
  <channel>
    <title>File Manager Transfers</title>
    <link>http://localhost:8080/fmprod/viewTransfers</link>
    <description>Current Files Being Transferred to the File 
Manager</description>
    <language>en-us</language>
    <copyright>Copyright 2010: Apache Software Foundation</copyright>
    <pubDate>Thu, 18 Apr 2013 21:47:11 BST</pubDate>
    <category>data transfer</category>
    <generator>CAS File Manager</generator>
    <lastBuildDate>Thu, 18 Apr 2013 21:47:11 BST</lastBuildDate>
    <item>
      <title>test2.txt</title>
      <description>GenericFile</description>
      
<link>http://localhost:8080/fmprod/viewTransfer?ref=file:///tmp/test2.txt&size=2278362129</link>
      <pubDate>Thu, 18 Apr 2013 22:46:50 BST</pubDate>
      <cas:bytesTransferred>202670080</cas:bytesTransferred>
      <cas:totalBytes>2278362129</cas:totalBytes>
      <cas:percentComplete>0.08895428756488077</cas:percentComplete>
    </item>
    <item>
      <title>test.txt</title>
      <description>GenericFile</description>
      
<link>http://localhost:8080/fmprod/viewTransfer?ref=file:///tmp/test.txt&size=2278362129</link>
      <pubDate>Thu, 18 Apr 2013 22:46:46 BST</pubDate>
      <cas:bytesTransferred>491655168</cas:bytesTransferred>
      <cas:totalBytes>2278362129</cas:totalBytes>
      <cas:percentComplete>0.2157932497832525</cas:percentComplete>
    </item>
  </channel>
</rss>


This showed that the namespace information 
(xmlns:cas="http://oodt.apache.org/ns/cas";) and the three cas-prefixed metadata 
tags (cas:bytesTransferred, cas:totalBytes and cas:percentComplete) were 
successfully read from the configuration file and inserted into the output RSS 
XML.


Thanks,

Ross Laidlaw

Reply via email to