Author: bfoster
Date: Fri Oct 10 06:35:41 2014
New Revision: 1630656

URL: http://svn.apache.org/r1630656
Log:
- Allow for pushpull fileretriction parsers to support metadata parsing

-----------
OODT-760

Modified:
    
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/Parser.java
    
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/ClassNoaaEmailParser.java
    
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/DirStructXmlParser.java
    
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/FileListParser.java
    
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/GenericEmailParser.java
    
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/ListRetriever.java
    
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/RemoteCrawler.java
    
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java
    
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RemoteFile.java
    
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RetrievalSetup.java
    
oodt/trunk/pushpull/src/test/org/apache/oodt/cas/pushpull/filerestrictions/parsers/GenericEmailParserTest.java
    oodt/trunk/pushpull/src/test/resources/TestEmail.txt

Modified: 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/Parser.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/Parser.java?rev=1630656&r1=1630655&r2=1630656&view=diff
==============================================================================
--- 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/Parser.java
 (original)
+++ 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/Parser.java
 Fri Oct 10 06:35:41 2014
@@ -21,6 +21,8 @@ package org.apache.oodt.cas.pushpull.fil
 //JDK imports
 import java.io.FileInputStream;
 
+
+import org.apache.oodt.cas.metadata.Metadata;
 //OODT imports
 import org.apache.oodt.cas.pushpull.exceptions.ParserException;
 
@@ -35,7 +37,7 @@ import org.apache.oodt.cas.pushpull.exce
  */
 public interface Parser {
 
-    public VirtualFileStructure parse(FileInputStream inputFile)
+    public VirtualFileStructure parse(FileInputStream inputFile, Metadata 
metadata)
             throws ParserException;
 
 }

Modified: 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/ClassNoaaEmailParser.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/ClassNoaaEmailParser.java?rev=1630656&r1=1630655&r2=1630656&view=diff
==============================================================================
--- 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/ClassNoaaEmailParser.java
 (original)
+++ 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/ClassNoaaEmailParser.java
 Fri Oct 10 06:35:41 2014
@@ -19,12 +19,14 @@
 package org.apache.oodt.cas.pushpull.filerestrictions.parsers;
 
 //OODT imports
+import org.apache.oodt.cas.metadata.Metadata;
 import org.apache.oodt.cas.pushpull.filerestrictions.Parser;
 import org.apache.oodt.cas.pushpull.filerestrictions.VirtualFile;
 import org.apache.oodt.cas.pushpull.filerestrictions.VirtualFileStructure;
 import org.apache.oodt.cas.pushpull.protocol.RemoteSite;
 import org.apache.oodt.cas.pushpull.exceptions.ParserException;
 
+
 //JDK imports
 import java.io.FileInputStream;
 import java.net.URL;
@@ -43,7 +45,7 @@ public class ClassNoaaEmailParser implem
 
     public ClassNoaaEmailParser() {}
 
-    public VirtualFileStructure parse(FileInputStream emailFile)
+    public VirtualFileStructure parse(FileInputStream emailFile, Metadata 
metadata)
             throws ParserException {
         try {
             VirtualFile root = VirtualFile.createRootDir();

Modified: 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/DirStructXmlParser.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/DirStructXmlParser.java?rev=1630656&r1=1630655&r2=1630656&view=diff
==============================================================================
--- 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/DirStructXmlParser.java
 (original)
+++ 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/DirStructXmlParser.java
 Fri Oct 10 06:35:41 2014
@@ -19,6 +19,7 @@
 package org.apache.oodt.cas.pushpull.filerestrictions.parsers;
 
 //OODT imports
+import org.apache.oodt.cas.metadata.Metadata;
 import org.apache.oodt.cas.metadata.util.PathUtils;
 import org.apache.oodt.cas.pushpull.filerestrictions.Parser;
 import org.apache.oodt.cas.pushpull.filerestrictions.VirtualFile;
@@ -29,12 +30,14 @@ import org.apache.oodt.cas.pushpull.expr
 import org.apache.oodt.cas.pushpull.expressions.Variable;
 import org.apache.oodt.commons.xml.XMLUtils;
 
+
 //JDK imports
 import java.io.FileInputStream;
 import java.util.HashMap;
 import java.util.StringTokenizer;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+
 import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.w3c.dom.DOMException;
@@ -61,7 +64,7 @@ public class DirStructXmlParser implemen
 
     public DirStructXmlParser() {}
 
-    public VirtualFileStructure parse(FileInputStream xmlFile)
+    public VirtualFileStructure parse(FileInputStream xmlFile, Metadata 
metadata)
             throws ParserException {
         try {
             String initialCdDir = "/";

Modified: 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/FileListParser.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/FileListParser.java?rev=1630656&r1=1630655&r2=1630656&view=diff
==============================================================================
--- 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/FileListParser.java
 (original)
+++ 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/FileListParser.java
 Fri Oct 10 06:35:41 2014
@@ -22,6 +22,8 @@ package org.apache.oodt.cas.pushpull.fil
 import java.io.FileInputStream;
 import java.util.Scanner;
 
+
+import org.apache.oodt.cas.metadata.Metadata;
 //OODT imports
 import org.apache.oodt.cas.pushpull.exceptions.ParserException;
 import org.apache.oodt.cas.pushpull.filerestrictions.Parser;
@@ -39,7 +41,7 @@ public class FileListParser implements P
 
        public FileListParser() {}
        
-    public VirtualFileStructure parse(FileInputStream inputFile)
+    public VirtualFileStructure parse(FileInputStream inputFile, Metadata 
metadata)
             throws ParserException {
         Scanner scanner = new Scanner(inputFile);
         VirtualFile root = VirtualFile.createRootDir();

Modified: 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/GenericEmailParser.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/GenericEmailParser.java?rev=1630656&r1=1630655&r2=1630656&view=diff
==============================================================================
--- 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/GenericEmailParser.java
 (original)
+++ 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/GenericEmailParser.java
 Fri Oct 10 06:35:41 2014
@@ -17,20 +17,25 @@
 package org.apache.oodt.cas.pushpull.filerestrictions.parsers;
 
 //OODT imports
-import org.apache.log4j.Logger;
+import org.apache.oodt.cas.metadata.Metadata;
 import org.apache.oodt.cas.pushpull.filerestrictions.Parser;
 import org.apache.oodt.cas.pushpull.filerestrictions.VirtualFile;
 import org.apache.oodt.cas.pushpull.filerestrictions.VirtualFileStructure;
 import org.apache.oodt.cas.pushpull.exceptions.ParserException;
 
 //Google imports
+import com.google.common.base.Splitter;
 import com.google.common.base.Strings;
 import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
 
 //JDK imports
 import java.io.FileInputStream;
 import java.util.List;
 import java.util.Scanner;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -43,7 +48,7 @@ import java.util.regex.Pattern;
  */
 public class GenericEmailParser implements Parser {
 
-  private static final Logger log = Logger.getLogger(GenericEmailParser.class);
+  private static final Logger log = 
Logger.getLogger(GenericEmailParser.class.getCanonicalName());
 
   public static final String FILE_PATTERNS_PROPERTY_NAME =
       "org.apache.oodt.cas.pushpull.generic.email.parser.file.pattern";
@@ -51,7 +56,11 @@ public class GenericEmailParser implemen
       "org.apache.oodt.cas.pushpull.generic.email.parser.check.for.pattern";
   public static final String PATH_TO_ROOT_PROPERTY_NAME =
       "org.apache.oodt.cas.pushpull.generic.email.parser.path.to.root";
-
+  public static final String METADATA_KEYS =
+      "org.apache.oodt.cas.pushpull.generic.email.parser.metadata.keys";
+  public static final String METADATA_KEY_PREFIX =
+      "org.apache.oodt.cas.pushpull.generic.email.parser.metadata.";      
+  
   private final String filePattern;
   private final String checkForPattern;
   private final String pathToRoot;
@@ -69,7 +78,8 @@ public class GenericEmailParser implemen
   }
 
   @Override
-  public VirtualFileStructure parse(FileInputStream emailFile) throws 
ParserException {
+  public VirtualFileStructure parse(FileInputStream emailFile, Metadata 
metadata)
+      throws ParserException {
     log.info("GenericEmailParser is parsing email: " + emailFile);
 
     VirtualFile root = VirtualFile.createRootDir();
@@ -79,6 +89,7 @@ public class GenericEmailParser implemen
       throw new ParserException("Failed to find check for pattern in email: " 
+ checkForPattern);
     }
     List<String> filePaths = generateFilePaths(emailText);
+    readMetadata(emailText, metadata);
 
     for (String filePath : filePaths) {
       new VirtualFile(root, pathToRoot + filePath, false);
@@ -110,6 +121,24 @@ public class GenericEmailParser implemen
     return filePaths;
   }
 
+  private void readMetadata(String emailText, Metadata metadata) {
+    Set<String> metadataKeys = loadMetadataKeys();
+    for (String metadataKey : metadataKeys) {
+      String metadataPattern = loadMetadataKey(metadataKey);
+      if (metadataPattern == null) {
+        log.log(Level.SEVERE, "Failed to load metadata pattern for key: " + 
metadataKey);
+      } else {
+        Pattern pattern = Pattern.compile(metadataPattern);
+        Matcher m = pattern.matcher(emailText);
+        if (m.find()) {
+          // Ignore index 0, as that is the matching string for pattern.
+          String metadatValue = m.group(1);
+          metadata.replaceMetadata(metadataKey, metadatValue);
+        }
+      }
+    }
+  }
+
   private boolean isValidEmail(String emailText) {
     Pattern pattern = Pattern.compile(checkForPattern);
     Matcher m = pattern.matcher(emailText.replaceAll("\n", " "));
@@ -127,4 +156,13 @@ public class GenericEmailParser implemen
   private String loadPathToRoot() {
     return Strings.nullToEmpty(System.getProperty(PATH_TO_ROOT_PROPERTY_NAME));
   }
+
+  private Set<String> loadMetadataKeys() {
+    return Sets.newHashSet(Splitter.on(",").split(
+        Strings.nullToEmpty(System.getProperty(METADATA_KEYS))));
+  }
+
+  private String loadMetadataKey(String key) {
+    return System.getProperty(METADATA_KEYS);
+  }
 }

Modified: 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/ListRetriever.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/ListRetriever.java?rev=1630656&r1=1630655&r2=1630656&view=diff
==============================================================================
--- 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/ListRetriever.java
 (original)
+++ 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/ListRetriever.java
 Fri Oct 10 06:35:41 2014
@@ -20,6 +20,7 @@ package org.apache.oodt.cas.pushpull.ret
 
 //OODT imports
 import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
+import org.apache.oodt.cas.metadata.Metadata;
 import org.apache.oodt.cas.pushpull.config.DataFilesInfo;
 import org.apache.oodt.cas.pushpull.config.DownloadInfo;
 import org.apache.oodt.cas.pushpull.exceptions.AlreadyInDatabaseException;
@@ -33,6 +34,7 @@ import org.apache.oodt.cas.pushpull.prot
 import org.apache.oodt.cas.pushpull.retrievalsystem.DataFileToPropFileLinker;
 import org.apache.oodt.cas.pushpull.retrievalsystem.FileRetrievalSystem;
 
+
 //JDK imports
 import java.io.File;
 import java.io.FileInputStream;
@@ -61,8 +63,9 @@ public class ListRetriever implements Re
         RemoteSite remoteSite = null;
 
         // parse property file
+        Metadata fileMetadata = new Metadata();
         VirtualFileStructure vfs = propFileParser.parse(new FileInputStream(
-                propFile));
+                propFile), fileMetadata);
         DownloadInfo di = dfi.getDownloadInfo();
         if (!di.isAllowAliasOverride()
                 || (remoteSite = vfs.getRemoteSite()) == null)
@@ -76,7 +79,7 @@ public class ListRetriever implements Re
                 linker.addPropFileToDataFileLink(propFile, file);
                 if (!frs.addToDownloadQueue(remoteSite, file, di
                         .getRenamingConv(), di.getStagingArea(), dfi
-                        .getQueryMetadataElementName(), di.deleteFromServer()))
+                        .getQueryMetadataElementName(), di.deleteFromServer(), 
fileMetadata))
                     linker.eraseLinks(propFile);
             } catch (ToManyFailedDownloadsException e) {
                 throw new RetrievalMethodException(

Modified: 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/RemoteCrawler.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/RemoteCrawler.java?rev=1630656&r1=1630655&r2=1630656&view=diff
==============================================================================
--- 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/RemoteCrawler.java
 (original)
+++ 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/RemoteCrawler.java
 Fri Oct 10 06:35:41 2014
@@ -20,6 +20,7 @@ package org.apache.oodt.cas.pushpull.ret
 
 //OODT imports
 import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
+import org.apache.oodt.cas.metadata.Metadata;
 import org.apache.oodt.cas.pushpull.config.DataFilesInfo;
 import org.apache.oodt.cas.pushpull.config.DownloadInfo;
 import org.apache.oodt.cas.pushpull.exceptions.AlreadyInDatabaseException;
@@ -39,6 +40,7 @@ import org.apache.oodt.cas.pushpull.prot
 import org.apache.oodt.cas.pushpull.retrievalsystem.DataFileToPropFileLinker;
 import org.apache.oodt.cas.pushpull.retrievalsystem.FileRetrievalSystem;
 
+
 //JDK imports
 import java.io.File;
 import java.io.FileInputStream;
@@ -77,8 +79,9 @@ public class RemoteCrawler implements Re
         RemoteSite remoteSite;
 
         // parse property file
+        Metadata fileMetadata = new Metadata();
         VirtualFileStructure vfs = propFileParser.parse(new FileInputStream(
-                propFile));
+                propFile), fileMetadata);
 
         // determine RemoteSite
         DownloadInfo di = dfi.getDownloadInfo();
@@ -138,7 +141,7 @@ public class RemoteCrawler implements Re
                     if (!frs.addToDownloadQueue(files.pop(), di
                             .getRenamingConv(), di.getStagingArea(), dfi
                             .getQueryMetadataElementName(), di
-                            .deleteFromServer()))
+                            .deleteFromServer(), fileMetadata))
                         linker.eraseLinks(propFile);
                 }
 

Modified: 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java?rev=1630656&r1=1630655&r2=1630656&view=diff
==============================================================================
--- 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java
 (original)
+++ 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java
 Fri Oct 10 06:35:41 2014
@@ -37,8 +37,10 @@ import org.apache.oodt.cas.pushpull.prot
 import org.apache.oodt.cas.pushpull.protocol.RemoteSite;
 import org.apache.oodt.cas.pushpull.protocol.RemoteSiteFile;
 import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
+import org.apache.oodt.cas.metadata.Metadata;
 import org.apache.oodt.cas.metadata.util.MimeTypeUtils;
 
+
 //JDK imports
 import java.io.File;
 import java.io.FileFilter;
@@ -351,7 +353,7 @@ public class FileRetrievalSystem {
     // returns true if download was added to queue. . .false otherwise
     public boolean addToDownloadQueue(RemoteSite remoteSite, String file,
             String renamingString, File downloadToDir,
-            String uniqueMetadataElement, boolean deleteAfterDownload)
+            String uniqueMetadataElement, boolean deleteAfterDownload, 
Metadata fileMetadata)
             throws ToManyFailedDownloadsException, RemoteConnectionException,
             ProtocolFileException, ProtocolException,
             AlreadyInDatabaseException, UndefinedTypeException,
@@ -362,7 +364,7 @@ public class FileRetrievalSystem {
             return 
addToDownloadQueue(protocolHandler.getProtocolFileFor(remoteSite,
                     protocolHandler.getAppropriateProtocolBySite(remoteSite,
                             true), file, false), renamingString, downloadToDir,
-                    uniqueMetadataElement, deleteAfterDownload);
+                    uniqueMetadataElement, deleteAfterDownload, fileMetadata);
         } else
             throw new ProtocolException("Not a valid remote site " + 
remoteSite);
     }
@@ -398,11 +400,17 @@ public class FileRetrievalSystem {
         }
     }
 
-    public boolean addToDownloadQueue(RemoteSiteFile file, String 
renamingString,
-            File downloadToDir, String uniqueMetadataElement,
-            boolean deleteAfterDownload) throws ToManyFailedDownloadsException,
-            RemoteConnectionException, AlreadyInDatabaseException,
-            UndefinedTypeException, CatalogException, IOException {
+  public boolean addToDownloadQueue(RemoteSiteFile file,
+                                    String renamingString,
+                                    File downloadToDir,
+                                    String uniqueMetadataElement,
+                                    boolean deleteAfterDownload,
+                                    Metadata fileMetadata) throws 
ToManyFailedDownloadsException,
+                                                                  
RemoteConnectionException,
+                                                                  
AlreadyInDatabaseException,
+                                                                  
UndefinedTypeException,
+                                                                  
CatalogException,
+                                                                  IOException {
         if (this.failedDownloadList.size() > max_allowed_failed_downloads)
             throw new ToManyFailedDownloadsException(
                     "Number of failed downloads exceeds "
@@ -416,6 +424,7 @@ public class FileRetrievalSystem {
         }
 
         RemoteFile remoteFile = new RemoteFile(file);
+        remoteFile.addMetadata(fileMetadata);
         remoteFile.addMetadata(RemoteFile.RENAMING_STRING, renamingString);
         remoteFile.addMetadata(RemoteFile.DELETE_AFTER_DOWNLOAD,
                 deleteAfterDownload + "");

Modified: 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RemoteFile.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RemoteFile.java?rev=1630656&r1=1630655&r2=1630656&view=diff
==============================================================================
--- 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RemoteFile.java
 (original)
+++ 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RemoteFile.java
 Fri Oct 10 06:35:41 2014
@@ -59,6 +59,10 @@ public class RemoteFile implements Remot
         this.metadata.addMetadata(key, value);
     }
 
+    public void addMetadata(Metadata metadata) {
+        this.metadata.addMetadata(metadata);
+    }
+
     public String getMetadata(String key) {
         return this.metadata.getMetadata(key);
     }

Modified: 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RetrievalSetup.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RetrievalSetup.java?rev=1630656&r1=1630655&r2=1630656&view=diff
==============================================================================
--- 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RetrievalSetup.java
 (original)
+++ 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RetrievalSetup.java
 Fri Oct 10 06:35:41 2014
@@ -19,6 +19,8 @@
 package org.apache.oodt.cas.pushpull.retrievalsystem;
 
 //JDK imports
+import static org.apache.oodt.cas.metadata.util.PathUtils.doDynamicReplacement;
+
 import java.io.File;
 import java.io.FileFilter;
 import java.io.FileOutputStream;
@@ -30,6 +32,7 @@ import java.util.LinkedList;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+
 //OODT imports
 import org.apache.oodt.cas.pushpull.config.Config;
 import org.apache.oodt.cas.pushpull.config.DataFilesInfo;
@@ -42,6 +45,7 @@ import org.apache.oodt.cas.pushpull.file
 import org.apache.oodt.cas.pushpull.objectfactory.PushPullObjectFactory;
 import org.apache.oodt.cas.pushpull.retrievalmethod.RetrievalMethod;
 import org.apache.oodt.cas.pushpull.retrievalsystem.FileRetrievalSystem;
+import org.apache.oodt.commons.exec.ExecUtils;
 
 /**
  *
@@ -262,6 +266,7 @@ public class RetrievalSetup {
                     .getName()
                     + ".errors");
             errorFile.createNewFile();
+            
             PrintStream ps = new PrintStream(new FileOutputStream(errorFile));
             ps.print(errorMsgs);
             ps.println();

Modified: 
oodt/trunk/pushpull/src/test/org/apache/oodt/cas/pushpull/filerestrictions/parsers/GenericEmailParserTest.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/pushpull/src/test/org/apache/oodt/cas/pushpull/filerestrictions/parsers/GenericEmailParserTest.java?rev=1630656&r1=1630655&r2=1630656&view=diff
==============================================================================
--- 
oodt/trunk/pushpull/src/test/org/apache/oodt/cas/pushpull/filerestrictions/parsers/GenericEmailParserTest.java
 (original)
+++ 
oodt/trunk/pushpull/src/test/org/apache/oodt/cas/pushpull/filerestrictions/parsers/GenericEmailParserTest.java
 Fri Oct 10 06:35:41 2014
@@ -19,6 +19,7 @@ package org.apache.oodt.cas.pushpull.fil
 // JUnit static imports
 import static org.junit.Assert.assertThat;
 
+
 // JDK imports
 import java.io.File;
 import java.io.FileInputStream;
@@ -26,6 +27,8 @@ import java.io.FileNotFoundException;
 import java.net.URISyntaxException;
 import java.util.List;
 
+
+import org.apache.oodt.cas.metadata.Metadata;
 // OODT imports
 import org.apache.oodt.cas.pushpull.exceptions.ParserException;
 import org.apache.oodt.cas.pushpull.filerestrictions.FileRestrictions;
@@ -57,7 +60,7 @@ public class GenericEmailParserTest {
   public void testGenericEmailParser() throws ParserException, 
FileNotFoundException {
     GenericEmailParser parser = new GenericEmailParser(
         "Wav File: ([^\\s]+)", "Dear Lousy Customer,", null);
-    VirtualFileStructure vfs = parser.parse(new FileInputStream(emailFile));
+    VirtualFileStructure vfs = parser.parse(new FileInputStream(emailFile), 
new Metadata());
     List<String> filePaths = 
FileRestrictions.toStringList(vfs.getRootVirtualFile());
     assertThat(filePaths.size(), Matchers.is(1));
     assertThat(filePaths.get(0), Matchers.is("/some/path/to/a/wav/file.wav"));
@@ -67,6 +70,6 @@ public class GenericEmailParserTest {
   public void testFailedValidEmailCheck() throws ParserException, 
FileNotFoundException {
     GenericEmailParser parser = new GenericEmailParser(
         "Wav File: ([^\\s]+)", "Phrase Not Found", null);
-    parser.parse(new FileInputStream(emailFile));
+    parser.parse(new FileInputStream(emailFile), new Metadata());
   }
 }

Modified: oodt/trunk/pushpull/src/test/resources/TestEmail.txt
URL: 
http://svn.apache.org/viewvc/oodt/trunk/pushpull/src/test/resources/TestEmail.txt?rev=1630656&r1=1630655&r2=1630656&view=diff
==============================================================================
--- oodt/trunk/pushpull/src/test/resources/TestEmail.txt (original)
+++ oodt/trunk/pushpull/src/test/resources/TestEmail.txt Fri Oct 10 06:35:41 
2014
@@ -3,6 +3,8 @@ Dear Lousy Customer,
 
 Your file is ready to download.
 
+File size: 12345
+
 Wav File: /some/path/to/a/wav/file.wav
 
 MDB Hash File: /some/path/to/a/md5/file.md5


Reply via email to