You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by br...@apache.org on 2010/03/02 14:28:40 UTC

svn commit: r918027 - /archiva/sandbox/archiva-scanner-performance/src/main/java/org/apache/archiva/DirectoryWalker.java

Author: brett
Date: Tue Mar  2 13:28:40 2010
New Revision: 918027

URL: http://svn.apache.org/viewvc?rev=918027&view=rev
Log:
[MRM-589] trim unnecessary methods

Modified:
    archiva/sandbox/archiva-scanner-performance/src/main/java/org/apache/archiva/DirectoryWalker.java

Modified: archiva/sandbox/archiva-scanner-performance/src/main/java/org/apache/archiva/DirectoryWalker.java
URL: http://svn.apache.org/viewvc/archiva/sandbox/archiva-scanner-performance/src/main/java/org/apache/archiva/DirectoryWalker.java?rev=918027&r1=918026&r2=918027&view=diff
==============================================================================
--- archiva/sandbox/archiva-scanner-performance/src/main/java/org/apache/archiva/DirectoryWalker.java (original)
+++ archiva/sandbox/archiva-scanner-performance/src/main/java/org/apache/archiva/DirectoryWalker.java Tue Mar  2 13:28:40 2010
@@ -21,7 +21,6 @@
 
 import java.io.File;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -37,14 +36,10 @@
 
     private List<TokenizedPattern> excludes;
 
-    private List<TokenizedPattern> includes;
-
     private boolean isCaseSensitive = true;
 
     private List<DirectoryWalkListener> listeners;
 
-    private boolean debugEnabled = false;
-
     public static final String[] DEFAULTEXCLUDES = {
         // Miscellaneous typical temporary files
         "**/*~", "**/#*#", "**/.#*", "**/%*%", "**/._*",
@@ -75,7 +70,6 @@
 
     public DirectoryWalker()
     {
-        this.includes = new ArrayList<TokenizedPattern>();
         this.excludes = new ArrayList<TokenizedPattern>();
         this.listeners = new ArrayList<DirectoryWalkListener>();
     }
@@ -90,11 +84,6 @@
         this.excludes.add( fixPattern( exclude ) );
     }
 
-    public void addInclude( String include )
-    {
-        this.includes.add( fixPattern( include ) );
-    }
-
     /**
      * Add's to the Exclude List the default list of SCM excludes.
      */
@@ -131,14 +120,6 @@
         }
     }
 
-    private void fireDebugMessage( String message )
-    {
-        for ( DirectoryWalkListener listener : this.listeners )
-        {
-            listener.debug( message );
-        }
-    }
-
     private TokenizedPattern fixPattern( String pattern )
     {
         String cleanPattern = pattern;
@@ -156,11 +137,6 @@
         return new TokenizedPattern( cleanPattern );
     }
 
-    public void setDebugMode( boolean debugEnabled )
-    {
-        this.debugEnabled = debugEnabled;
-    }
-
     /**
      * @return Returns the baseDir.
      */
@@ -177,24 +153,11 @@
         return excludes;
     }
 
-    /**
-     * @return Returns the includes.
-     */
-    public List getIncludes()
-    {
-        return includes;
-    }
-
     private boolean isExcluded( String name )
     {
         return isMatch( this.excludes, name );
     }
 
-    private boolean isIncluded( String name )
-    {
-        return isMatch( this.includes, name );
-    }
-
     private boolean isMatch( List<TokenizedPattern> patterns, String name )
     {
         for ( TokenizedPattern pattern : patterns )
@@ -243,35 +206,6 @@
             throw new IllegalStateException( "Scan Failure.  BaseDir is not a directory." );
         }
 
-        if ( this.includes.isEmpty() )
-        {
-            // default to include all.
-            addInclude( "**" );
-        }
-
-        if ( debugEnabled )
-        {
-            Iterator it;
-            StringBuffer dbg = new StringBuffer();
-            dbg.append( "DirectoryWalker Scan" );
-            dbg.append( "\n  Base Dir: " ).append( this.baseDir.getAbsolutePath() );
-            dbg.append( "\n  Includes: " );
-            it = this.includes.iterator();
-            while ( it.hasNext() )
-            {
-                String include = (String) it.next();
-                dbg.append( "\n    - \"" ).append( include ).append( "\"" );
-            }
-            dbg.append( "\n  Excludes: " );
-            it = this.excludes.iterator();
-            while ( it.hasNext() )
-            {
-                String exclude = (String) it.next();
-                dbg.append( "\n    - \"" ).append( exclude ).append( "\"" );
-            }
-            fireDebugMessage( dbg.toString() );
-        }
-
         fireWalkStarting();
         scanDir( this.baseDir );
         fireWalkFinished();
@@ -292,7 +226,6 @@
 
             if ( isExcluded( name ) )
             {
-                fireDebugMessage( name + " is excluded." );
                 continue;
             }
 
@@ -302,10 +235,7 @@
             }
             else
             {
-                if ( isIncluded( name ) )
-                {
-                    fireStep( file );
-                }
+                fireStep( file );
             }
         }
     }
@@ -333,20 +263,4 @@
             }
         }
     }
-
-    /**
-     * @param entries The includes to set.
-     */
-    public void setIncludes( List<String> entries )
-    {
-        this.includes.clear();
-        if ( entries != null )
-        {
-            for ( String entry : entries )
-            {
-                this.includes.add( fixPattern( entry ) );
-            }
-        }
-    }
-
 }
\ No newline at end of file