org.codehaus.mojo.wagon.shared
Class WagonDirectoryScanner

java.lang.Object
  extended by org.codehaus.mojo.wagon.shared.WagonDirectoryScanner

public class WagonDirectoryScanner
extends Object


Field Summary
static String[] DEFAULTEXCLUDES
          Patterns which should be excluded by default.
 
Constructor Summary
WagonDirectoryScanner()
           
 
Method Summary
 void addDefaultExcludes()
          Adds default exclusions to the current exclusions set.
protected  boolean couldHoldIncluded(String name)
          Tests whether or not a name matches the start of at least one include pattern.
 List<String> getFilesIncluded()
           
 org.apache.maven.plugin.logging.Log getLogger()
           
protected  boolean isExcluded(String name)
          Tests whether or not a name matches against at least one exclude pattern.
protected static boolean matchPatternStart(String pattern, String str, boolean isCaseSensitive)
          Tests whether or not a given path matches the start of a given pattern up to the first "**".
 void scan()
           
protected  void scandir(String dir)
          Scans the given directory for files and directories.
 void setCaseSensitive(boolean isCaseSensitive)
           
 void setDirectory(String basePath)
           
 void setExcludes(String[] excludes)
          Sets the list of exclude patterns to use.
 void setIncludes(String[] includes)
          Sets the list of include patterns to use.
 void setLogger(org.apache.maven.plugin.logging.Log logger)
           
 void setWagon(org.apache.maven.wagon.Wagon wagon)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULTEXCLUDES

public static final String[] DEFAULTEXCLUDES
Patterns which should be excluded by default.

See Also:
addDefaultExcludes()
Constructor Detail

WagonDirectoryScanner

public WagonDirectoryScanner()
Method Detail

setIncludes

public void setIncludes(String[] includes)
Sets the list of include patterns to use. All '/' and '\' characters are replaced by File.separatorChar, so the separator used need not match File.separatorChar.

When a pattern ends with a '/' or '\', "**" is appended.

Parameters:
includes - A list of include patterns. May be null, indicating that all files should be included. If a non-null list is given, all elements must be non-null.

setExcludes

public void setExcludes(String[] excludes)
Sets the list of exclude patterns to use. All '\' characters are replaced by '/'

When a pattern ends with a '/' or '\', "**" is appended.

Parameters:
excludes - A list of exclude patterns. May be null, indicating that no files should be excluded. If a non-null list is given, all elements must be non-null.

isExcluded

protected boolean isExcluded(String name)
Tests whether or not a name matches against at least one exclude pattern.

Parameters:
name - The name to match. Must not be null.
Returns:
true when the name matches against at least one exclude pattern, or false otherwise.

couldHoldIncluded

protected boolean couldHoldIncluded(String name)
Tests whether or not a name matches the start of at least one include pattern.

Parameters:
name - The name to match. Must not be null.
Returns:
true when the name matches against the start of at least one include pattern, or false otherwise.

matchPatternStart

protected static boolean matchPatternStart(String pattern,
                                           String str,
                                           boolean isCaseSensitive)
Tests whether or not a given path matches the start of a given pattern up to the first "**".

This is not a general purpose test and should only be used if you can live with false positives. For example, pattern=**\a and str=b will yield true.

Parameters:
pattern - The pattern to match against. Must not be null.
str - The path to match, as a String. Must not be null.
isCaseSensitive - Whether or not matching should be performed case sensitively.
Returns:
whether or not a given path matches the start of a given pattern up to the first "**".

scan

public void scan()
          throws org.apache.maven.wagon.WagonException
Throws:
org.apache.maven.wagon.WagonException

addDefaultExcludes

public void addDefaultExcludes()
Adds default exclusions to the current exclusions set.


scandir

protected void scandir(String dir)
                throws org.apache.maven.wagon.WagonException
Scans the given directory for files and directories. Files are placed in a collection, based on the matching of includes, excludes, and the selectors. When a directory is found, it is scanned recursively.

Throws:
org.apache.maven.wagon.WagonException
See Also:
filesIncluded

getFilesIncluded

public List<String> getFilesIncluded()

setWagon

public void setWagon(org.apache.maven.wagon.Wagon wagon)

setCaseSensitive

public void setCaseSensitive(boolean isCaseSensitive)

setDirectory

public void setDirectory(String basePath)

getLogger

public org.apache.maven.plugin.logging.Log getLogger()

setLogger

public void setLogger(org.apache.maven.plugin.logging.Log logger)


Copyright © 2008-2012 The Kuali Foundation. All Rights Reserved.