You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by ri...@apache.org on 2013/10/24 01:13:09 UTC
svn commit: r1535207 -
/oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/
Author: riverma
Date: Wed Oct 23 23:13:08 2013
New Revision: 1535207
URL: http://svn.apache.org/r1535207
Log:
OODT-657 : patch 2 applied to better use existing architecture
Modified:
oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/DirListNonRecursiveHandler.java
oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/DirListRecursiveHandler.java
oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/FileListNonRecursiveHandler.java
oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/FileListRecursiveHandler.java
oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/MD5GetHandler.java
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/RawSizeListHandler.java
oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/SingleFileListHandler.java
oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/SingleZipFileListHandler.java
oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/StdOFSNGetHandler.java
oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/URLGetHandler.java
Modified: oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/DirListNonRecursiveHandler.java
URL: http://svn.apache.org/viewvc/oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/DirListNonRecursiveHandler.java?rev=1535207&r1=1535206&r2=1535207&view=diff
==============================================================================
--- oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/DirListNonRecursiveHandler.java (original)
+++ oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/DirListNonRecursiveHandler.java Wed Oct 23 23:13:08 2013
@@ -24,7 +24,6 @@ import java.util.Properties;
//OODT imports
import org.apache.oodt.product.ProductException;
-import org.apache.oodt.product.handlers.ofsn.util.OFSNUtils;
/**
*
@@ -44,10 +43,7 @@ public class DirListNonRecursiveHandler
* .lang.String)
*/
public File[] getListing(String ofsn) throws ProductException {
- if (OFSNUtils.validateOFSN(ofsn))
- return crawlFiles(new File(ofsn), false, true);
- else
- throw new ProductException("OFSN is invalid");
+ return crawlFiles(new File(ofsn), false, true);
}
/*
Modified: oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/DirListRecursiveHandler.java
URL: http://svn.apache.org/viewvc/oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/DirListRecursiveHandler.java?rev=1535207&r1=1535206&r2=1535207&view=diff
==============================================================================
--- oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/DirListRecursiveHandler.java (original)
+++ oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/DirListRecursiveHandler.java Wed Oct 23 23:13:08 2013
@@ -24,7 +24,6 @@ import java.util.Properties;
//OODT imports
import org.apache.oodt.product.ProductException;
-import org.apache.oodt.product.handlers.ofsn.util.OFSNUtils;
/**
*
@@ -58,10 +57,7 @@ public class DirListRecursiveHandler ext
*/
@Override
public File[] getListing(String ofsn) throws ProductException {
- if (OFSNUtils.validateOFSN(ofsn))
- return crawlFiles(new File(ofsn), true, true);
- else
- throw new ProductException("OFSN is invalid");
+ return crawlFiles(new File(ofsn), true, true);
}
}
Modified: oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/FileListNonRecursiveHandler.java
URL: http://svn.apache.org/viewvc/oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/FileListNonRecursiveHandler.java?rev=1535207&r1=1535206&r2=1535207&view=diff
==============================================================================
--- oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/FileListNonRecursiveHandler.java (original)
+++ oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/FileListNonRecursiveHandler.java Wed Oct 23 23:13:08 2013
@@ -24,7 +24,6 @@ import java.util.Properties;
//OODT imports
import org.apache.oodt.product.ProductException;
-import org.apache.oodt.product.handlers.ofsn.util.OFSNUtils;
/**
*
@@ -51,10 +50,7 @@ public class FileListNonRecursiveHandler
*/
@Override
public File[] getListing(String ofsn) throws ProductException {
- if (OFSNUtils.validateOFSN(ofsn))
- return crawlFiles(new File(ofsn), false, false);
- else
- throw new ProductException("OFSN is invalid");
+ return crawlFiles(new File(ofsn), false, false);
}
}
Modified: oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/FileListRecursiveHandler.java
URL: http://svn.apache.org/viewvc/oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/FileListRecursiveHandler.java?rev=1535207&r1=1535206&r2=1535207&view=diff
==============================================================================
--- oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/FileListRecursiveHandler.java (original)
+++ oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/FileListRecursiveHandler.java Wed Oct 23 23:13:08 2013
@@ -24,7 +24,6 @@ import java.util.Properties;
//OODT imports
import org.apache.oodt.product.ProductException;
-import org.apache.oodt.product.handlers.ofsn.util.OFSNUtils;
/**
*
@@ -50,10 +49,7 @@ public class FileListRecursiveHandler ex
*/
@Override
public File[] getListing(String ofsn) throws ProductException {
- if (OFSNUtils.validateOFSN(ofsn))
- return crawlFiles(new File(ofsn), true, false);
- else
- throw new ProductException("OFSN is invalid");
+ return crawlFiles(new File(ofsn), true, false);
}
}
Modified: oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/MD5GetHandler.java
URL: http://svn.apache.org/viewvc/oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/MD5GetHandler.java?rev=1535207&r1=1535206&r2=1535207&view=diff
==============================================================================
--- oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/MD5GetHandler.java (original)
+++ oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/MD5GetHandler.java Wed Oct 23 23:13:08 2013
@@ -32,7 +32,6 @@ import org.apache.commons.io.FileUtils;
//OODT imports
import org.apache.oodt.product.ProductException;
-import org.apache.oodt.product.handlers.ofsn.util.OFSNUtils;
/**
*
@@ -76,11 +75,6 @@ public class MD5GetHandler implements OF
*/
public byte[] retrieveChunk(String filepath, long offset, int length)
throws ProductException {
-
- if (!OFSNUtils.validateOFSN(filepath)) {
- throw new ProductException("OFSN is invalid");
- }
-
try {
String hash = this.hashData(FileUtils.readFileToByteArray(new File(
filepath)));
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=1535207&r1=1535206&r2=1535207&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 Wed Oct 23 23:13:08 2013
@@ -187,6 +187,7 @@ public class OFSNFileHandler implements
OFSNGetHandler handler = getGetHandler(rtType, this.conf
.getHandlerClass(rtType));
+
return handler.retrieveChunk(filepath, offset, length);
}
@@ -201,6 +202,8 @@ public class OFSNFileHandler implements
if (ofsn == null || cmd == null || (ofsn != null && ofsn.equals(""))
|| (cmd != null && cmd.equals(""))) {
throw new ProductException("must specify OFSN and RT parameters!");
+ } else if (!OFSNUtils.validateOFSN(ofsn)) {
+ throw new ProductException("OFSN is invalid");
}
}
Modified: oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/RawSizeListHandler.java
URL: http://svn.apache.org/viewvc/oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/RawSizeListHandler.java?rev=1535207&r1=1535206&r2=1535207&view=diff
==============================================================================
--- oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/RawSizeListHandler.java (original)
+++ oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/RawSizeListHandler.java Wed Oct 23 23:13:08 2013
@@ -24,7 +24,6 @@ import java.util.Properties;
//OODT imports
import org.apache.oodt.product.ProductException;
-import org.apache.oodt.product.handlers.ofsn.util.OFSNUtils;
/**
*
@@ -52,14 +51,10 @@ public class RawSizeListHandler implemen
*/
public File[] getListing(String ofsn) throws ProductException {
if (!new File(ofsn).exists()) {
- throw new ProductException("file: [" + ofsn
+ throw new ProductException("file: [" + ofsn
+ "] does not exist!");
- } else if (!OFSNUtils.validateOFSN(ofsn)) {
- throw new ProductException("OFSN is invalid");
- } else {
- return new File[] { new File(ofsn) };
- }
-
+ }
+ return new File[] { new File(ofsn) };
}
}
Modified: oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/SingleFileListHandler.java
URL: http://svn.apache.org/viewvc/oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/SingleFileListHandler.java?rev=1535207&r1=1535206&r2=1535207&view=diff
==============================================================================
--- oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/SingleFileListHandler.java (original)
+++ oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/SingleFileListHandler.java Wed Oct 23 23:13:08 2013
@@ -23,7 +23,6 @@ import java.io.File;
import java.util.Properties;
import org.apache.oodt.product.ProductException;
-import org.apache.oodt.product.handlers.ofsn.util.OFSNUtils;
/**
*
@@ -58,11 +57,8 @@ public class SingleFileListHandler imple
public File[] getListing(String ofsn) throws ProductException {
if (!new File(ofsn).exists()) {
throw new ProductException("file: [" + ofsn + "] does not exist!");
- } else if (!OFSNUtils.validateOFSN(ofsn)) {
- throw new ProductException("OFSN is invalid");
- } else {
- return new File[] { new File(ofsn) };
}
+ return new File[] { new File(ofsn) };
}
}
Modified: oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/SingleZipFileListHandler.java
URL: http://svn.apache.org/viewvc/oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/SingleZipFileListHandler.java?rev=1535207&r1=1535206&r2=1535207&view=diff
==============================================================================
--- oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/SingleZipFileListHandler.java (original)
+++ oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/SingleZipFileListHandler.java Wed Oct 23 23:13:08 2013
@@ -72,8 +72,6 @@ public class SingleZipFileListHandler im
public File[] getListing(String ofsn) throws ProductException {
if (!new File(ofsn).exists()) {
throw new ProductException("file: [" + ofsn + "] does not exist!");
- } else if (!OFSNUtils.validateOFSN(ofsn)) {
- throw new ProductException("OFSN is invalid");
}
String zipFilePath = this.cacheRoot + new File(ofsn).getName() + ".zip";
Modified: oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/StdOFSNGetHandler.java
URL: http://svn.apache.org/viewvc/oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/StdOFSNGetHandler.java?rev=1535207&r1=1535206&r2=1535207&view=diff
==============================================================================
--- oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/StdOFSNGetHandler.java (original)
+++ oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/StdOFSNGetHandler.java Wed Oct 23 23:13:08 2013
@@ -27,7 +27,6 @@ import java.util.Properties;
//OODT imports
import org.apache.oodt.product.ProductException;
-import org.apache.oodt.product.handlers.ofsn.util.OFSNUtils;
/**
*
@@ -49,11 +48,6 @@ public class StdOFSNGetHandler implement
*/
public byte[] retrieveChunk(String filepath, long offset, int length)
throws ProductException {
-
- if (!OFSNUtils.validateOFSN(filepath)) {
- throw new ProductException("OFSN is invalid");
- }
-
InputStream in = null;
byte[] buf = null;
Modified: oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/URLGetHandler.java
URL: http://svn.apache.org/viewvc/oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/URLGetHandler.java?rev=1535207&r1=1535206&r2=1535207&view=diff
==============================================================================
--- oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/URLGetHandler.java (original)
+++ oodt/trunk/product/src/main/java/org/apache/oodt/product/handlers/ofsn/URLGetHandler.java Wed Oct 23 23:13:08 2013
@@ -30,7 +30,6 @@ import java.util.logging.Logger;
import org.apache.oodt.product.ProductException;
import org.apache.oodt.product.handlers.ofsn.AbstractCrawlLister;
import org.apache.oodt.product.handlers.ofsn.OFSNGetHandler;
-import org.apache.oodt.product.handlers.ofsn.util.OFSNUtils;
/**
* A {@link OFSNGetHandler} for returning a URL listing pointing to files within an OFSN
@@ -131,10 +130,6 @@ public class URLGetHandler extends Abstr
public byte[] retrieveChunk(String filepath, long offset, int length)
throws ProductException {
- if (!OFSNUtils.validateOFSN(filepath)) {
- throw new ProductException("OFSN is invalid");
- }
-
LOG.info("Retrieving chunk of URL listing for path: ["+filepath+"] at offset "
+ offset+" for "+length+" bytes");