You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by ma...@apache.org on 2011/01/08 06:40:36 UTC
svn commit: r1056627 - in /oodt/trunk: ./
product/src/main/java/org/apache/oodt/product/handlers/ofsn/
product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/
product/src/main/java/org/apache/oodt/product/handlers/ofsn/util/
Author: mattmann
Date: Sat Jan 8 05:40:36 2011
New Revision: 1056627
URL: http://svn.apache.org/viewvc?rev=1056627&view=rev
Log:
- fix for OODT-86 The Product Server Should Have the Capability to Turn Off Reporting of File Sizes For File Listing Functions
Modified:
oodt/trunk/CHANGES.txt
oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandler.java
oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/OFSNMetKeys.java
oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/util/OFSNUtils.java
Modified: oodt/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/oodt/trunk/CHANGES.txt?rev=1056627&r1=1056626&r2=1056627&view=diff
==============================================================================
--- oodt/trunk/CHANGES.txt (original)
+++ oodt/trunk/CHANGES.txt Sat Jan 8 05:40:36 2011
@@ -4,6 +4,9 @@ Apache OODT Change Log
Release 0.2 (Current Development)
--------------------------------------------
+* OODT-86 The Product Server Should Have the Capability to Turn Off
+ Reporting of File Sizes For File Listing Functions (Michael Cayanan via mattmann)
+
* OODT-41 Product Constructor does not set transfer status (mattmann)
* OODT-72 Unable to set Metadata based off Product Versioning during
Modified: oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandler.java
URL: http://svn.apache.org/viewvc/oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandler.java?rev=1056627&r1=1056626&r2=1056627&view=diff
==============================================================================
--- oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandler.java (original)
+++ oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandler.java Sat Jan 8 05:40:36 2011
@@ -66,6 +66,9 @@ public class OFSNFileHandler implements
// by default return dir size on listing commands
private boolean computeDirSize = true;
+
+ // by default return file size on listing commands
+ private boolean computeFileSize = true;
private OFSNFileHandlerConfiguration conf;
@@ -75,6 +78,8 @@ public class OFSNFileHandler implements
// init conf here
String xmlConfigFilePath = System.getProperty(OFSN_XML_CONF_FILE_KEY);
this.computeDirSize = Boolean.getBoolean(OFSN_COMPUTE_DIR_SIZE);
+ this.computeFileSize = Boolean.getBoolean(OFSN_COMPUTE_FILE_SIZE);
+
if (xmlConfigFilePath == null) {
throw new InstantiationException(
@@ -170,7 +175,8 @@ public class OFSNFileHandler implements
private void generateOFSNXml(File[] mlsFileList, OFSNHandlerConfig cfg,
OutputStream outStream) {
XMLUtils.writeXmlToStream(OFSNUtils.getOFSNDoc(Arrays.asList(mlsFileList),
- cfg, this.conf.getProductRoot(), this.computeDirSize), outStream);
+ cfg, this.conf.getProductRoot(), this.computeDirSize, this.computeFileSize),
+ outStream);
}
private void validate(String ofsn, String cmd) throws ProductException {
Modified: oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/OFSNMetKeys.java
URL: http://svn.apache.org/viewvc/oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/OFSNMetKeys.java?rev=1056627&r1=1056626&r2=1056627&view=diff
==============================================================================
--- oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/OFSNMetKeys.java (original)
+++ oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/OFSNMetKeys.java Sat Jan 8 05:40:36 2011
@@ -34,5 +34,8 @@ public interface OFSNMetKeys {
public static final String OFSN_XML_CONF_FILE_KEY = "org.apache.oodt.product.handlers.ofsn.xmlConfigFilePath";
public static final String OFSN_COMPUTE_DIR_SIZE = "org.apache.oodt.product.handlers.ofsn.computeDirSize";
+
+ public static final String OFSN_COMPUTE_FILE_SIZE = "org.apache.oodt.product.handlers.ofsn.computeFileSize";
+
}
Modified: oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/util/OFSNUtils.java
URL: http://svn.apache.org/viewvc/oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/util/OFSNUtils.java?rev=1056627&r1=1056626&r2=1056627&view=diff
==============================================================================
--- oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/util/OFSNUtils.java (original)
+++ oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/util/OFSNUtils.java Sat Jan 8 05:40:36 2011
@@ -73,7 +73,7 @@ public final class OFSNUtils implements
}
public static Document getOFSNDoc(List<File> fileList, OFSNHandlerConfig cfg,
- String productRoot, boolean showDirSize) {
+ String productRoot, boolean showDirSize, boolean showFileSize) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
Document document = null;
@@ -106,7 +106,9 @@ public final class OFSNUtils implements
size = FileUtils.sizeOfDirectory(file);
}
} else {
- size = file.length();
+ if (showFileSize) {
+ size = file.length();
+ }
}
if (size != Long.MIN_VALUE) {