db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r917531 - /db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/file/Fileset.java
Date Mon, 01 Mar 2010 13:58:33 GMT
Author: tfischer
Date: Mon Mar  1 13:58:32 2010
New Revision: 917531

URL: http://svn.apache.org/viewvc?rev=917531&view=rev
Log:
added trace logs for Fileset

Modified:
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/file/Fileset.java

Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/file/Fileset.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/file/Fileset.java?rev=917531&r1=917530&r2=917531&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/file/Fileset.java
(original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/file/Fileset.java
Mon Mar  1 13:58:32 2010
@@ -30,6 +30,8 @@
 import org.apache.commons.io.FilenameUtils;
 import org.apache.commons.io.IOCase;
 import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * Selects Files in a directory and the subdirectories of the directory.
@@ -40,6 +42,9 @@
  */
 public class Fileset 
 {
+    /** The class logger. */
+    private static Log log = LogFactory.getLog(Fileset.class);
+    
 	/** The base directory of the fileset. */
 	private File basedir;
 
@@ -151,11 +156,19 @@
 		{
 	        int wildcardFreeSeparatorPos 
 	        		= getWildcardFreeSeparatorPos(includePattern);
+	        String wildcardFreeIncludePart = getPathPartBefore(
+                    includePattern, 
+                    wildcardFreeSeparatorPos);
+	        if (log.isTraceEnabled())
+	        {
+	            log.trace("getFiles() : traversing directory " 
+	                    + wildcardFreeIncludePart
+	                    + " in base dir "
+	                    + basedir);
+	        }
 	        File wildcardFreeBaseDir = new File(
 	        		basedir,
-	        		getPathPartBefore(
-	        				includePattern, 
-	        				wildcardFreeSeparatorPos));
+	        		wildcardFreeIncludePart);
 	        String wildcardPattern 
 	            = getPathPartAfter(includePattern, wildcardFreeSeparatorPos);
 	        String[] wildcardParts = StringUtils.split(wildcardPattern, "\\/");
@@ -196,6 +209,11 @@
 	static void getAllFiles(File currentBaseDir, List<File> toAddTo)
 			throws IOException
 	{
+	    if (log.isTraceEnabled())
+	    {
+	        log.trace("getAllFiles() : traversing directory " 
+	                +  currentBaseDir.getAbsolutePath());
+	    }
 		File[] filesInDir = currentBaseDir.listFiles(
 				new WildcardFilter("*", false, true));
 	    if (filesInDir == null)
@@ -205,6 +223,12 @@
 	                    + "while reading the sources: "
 	                    + currentBaseDir.getAbsolutePath());
 	    }
+	    if (log.isTraceEnabled())
+	    {
+	        log.trace("getAllFiles() : Adding files " 
+	                + filesInDir 
+	                + " to candidate list");
+	    }
 		toAddTo.addAll(Arrays.asList(filesInDir));
 		
 		File[] dirsInDir = currentBaseDir.listFiles(
@@ -220,20 +244,33 @@
     		    File currentBaseDir, List<String> pathPartList)
     		throws IOException
 	{
+        if (log.isTraceEnabled())
+        {
+            log.trace("getFiles(File, List) : traversing directory " 
+                    +  currentBaseDir.getAbsolutePath()
+                    + ", current path parts: " 
+                    + pathPartList);
+        }
 		List<String> partsCopy = new ArrayList<String>(pathPartList);
 		String includeToProcess = partsCopy.remove(0);
 		if (partsCopy.size() == 0)
 		{
-		    File[] result = currentBaseDir.listFiles(
+		    File[] matches = currentBaseDir.listFiles(
 		            new WildcardFilter(includeToProcess, false, true));
-		    if (result == null)
+		    if (matches == null)
 		    {
 		        throw new IOException(
 		                "Could not list files in the following Directory "
 		                    + "while reading the sources: "
 		                    + currentBaseDir.getAbsolutePath());
 		    }
-		    return Arrays.asList(result);
+		    List<File> result = Arrays.asList(matches);
+		    if (log.isTraceEnabled())
+	        {
+	            log.trace("getFiles(File, List) : Returning files " 
+	                    + result);
+	        }
+		    return result;
 		}
 		if ("..".equals(includeToProcess))
 		{



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message