You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2006/08/15 06:32:07 UTC

svn commit: r431528 - in /maven/shared/trunk/file-management/src/main: java/org/apache/maven/shared/model/fileset/mappers/ java/org/apache/maven/shared/model/fileset/util/ resources/

Author: jdcasey
Date: Mon Aug 14 21:32:06 2006
New Revision: 431528

URL: http://svn.apache.org/viewvc?rev=431528&view=rev
Log:
Working on mapper stuff.

Added:
    maven/shared/trunk/file-management/src/main/java/org/apache/maven/shared/model/fileset/mappers/MapperException.java   (with props)
    maven/shared/trunk/file-management/src/main/resources/
    maven/shared/trunk/file-management/src/main/resources/mappers.properties   (with props)
Modified:
    maven/shared/trunk/file-management/src/main/java/org/apache/maven/shared/model/fileset/mappers/MapperUtil.java
    maven/shared/trunk/file-management/src/main/java/org/apache/maven/shared/model/fileset/util/FileSetManager.java

Added: maven/shared/trunk/file-management/src/main/java/org/apache/maven/shared/model/fileset/mappers/MapperException.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/file-management/src/main/java/org/apache/maven/shared/model/fileset/mappers/MapperException.java?rev=431528&view=auto
==============================================================================
--- maven/shared/trunk/file-management/src/main/java/org/apache/maven/shared/model/fileset/mappers/MapperException.java (added)
+++ maven/shared/trunk/file-management/src/main/java/org/apache/maven/shared/model/fileset/mappers/MapperException.java Mon Aug 14 21:32:06 2006
@@ -0,0 +1,17 @@
+package org.apache.maven.shared.model.fileset.mappers;
+
+public class MapperException
+    extends Exception
+{
+
+    public MapperException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+
+    public MapperException( String message )
+    {
+        super( message );
+    }
+
+}

Propchange: maven/shared/trunk/file-management/src/main/java/org/apache/maven/shared/model/fileset/mappers/MapperException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/shared/trunk/file-management/src/main/java/org/apache/maven/shared/model/fileset/mappers/MapperException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/shared/trunk/file-management/src/main/java/org/apache/maven/shared/model/fileset/mappers/MapperUtil.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/file-management/src/main/java/org/apache/maven/shared/model/fileset/mappers/MapperUtil.java?rev=431528&r1=431527&r2=431528&view=diff
==============================================================================
--- maven/shared/trunk/file-management/src/main/java/org/apache/maven/shared/model/fileset/mappers/MapperUtil.java (original)
+++ maven/shared/trunk/file-management/src/main/java/org/apache/maven/shared/model/fileset/mappers/MapperUtil.java Mon Aug 14 21:32:06 2006
@@ -17,72 +17,89 @@
 
 package org.apache.maven.shared.model.fileset.mappers;
 
-import java.util.Enumeration;
-import java.util.Properties;
-
 import org.apache.maven.shared.model.fileset.Mapper;
-import org.apache.maven.shared.model.fileset.mappers.FileNameMapper;
+import org.codehaus.plexus.util.IOUtil;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
 
 /**
  * Element to define a FileNameMapper.
  */
-public class MapperUtil
+public final class MapperUtil
 {
 
-    private Properties implementations;
-
-    protected String from = null;
-
-    protected String to = null;
+    private static final String MAPPER_PROPERTIES = "mapper.properties";
+    
+    private static Properties implementations;
 
-    protected String type = "identity";
-
-    protected String classname = null;
-
-    /**
-     * Construct a new <CODE>MapperUtil</CODE> element.
-     * 
-     * @param p
-     *            the owning Ant <CODE>Project</CODE>.
-     */
-    public MapperUtil( Mapper mapper )
+    private MapperUtil()
     {
-        initializeProperties();
-        this.type = mapper.getType();
-        this.from = mapper.getFrom();
-        this.to = mapper.getTo();
-        this.classname = mapper.getClassname();
     }
 
     /**
      * Initializes a properties object to store the built-in classnames.
      */
-    public void initializeProperties()
+    private static void initializeBuiltIns()
     {
-        implementations = new Properties();
-        implementations.setProperty( "identity", "org.apache.maven.plugin.assembly.mappers.IdentityMapper" );
-        implementations.setProperty( "flatten", "org.apache.maven.plugin.assembly.mappers.FlatFileNameMapper" );
-        implementations.setProperty( "glob", "org.apache.maven.plugin.assembly.mappers.GlobPatternMapper" );
-        implementations.setProperty( "merge", "org.apache.maven.plugin.assembly.mappers.MergingMapper" );
-        implementations.setProperty( "regexp", "org.apache.maven.plugin.assembly.mappers.RegexpPatternMapper" );
-        implementations.setProperty( "package", "org.apache.maven.plugin.assembly.mappers.PackageNameMapper" );
-        implementations.setProperty( "unpackage", "org.apache.maven.plugin.assembly.mappers.UnPackageNameMapper" );
+        if ( implementations == null )
+        {
+            Properties props = new Properties();
+            
+            ClassLoader cloader = Thread.currentThread().getContextClassLoader();
+            
+            InputStream stream = null;
+            
+            try
+            {
+                stream = cloader.getResourceAsStream( MAPPER_PROPERTIES );
+                
+                if ( stream == null )
+                {
+                    throw new IllegalStateException( "Cannot find classpath resource: " + MAPPER_PROPERTIES );
+                }
+                
+                try
+                {
+                    props.load( stream );
+                }
+                catch ( IOException e )
+                {
+                    throw new IllegalStateException( "Cannot find classpath resource: " + MAPPER_PROPERTIES );
+                }
+            }
+            finally
+            {
+                IOUtil.close( stream );
+            }
+        }
     }
 
     /**
      * Returns a fully configured FileNameMapper implementation.
      */
-    public FileNameMapper getImplementation()
-        throws Exception
+    public static FileNameMapper getFileNameMapper( Mapper mapper )
+        throws MapperException
     {
+        if ( mapper == null )
+        {
+            return null;
+        }
+        
+        initializeBuiltIns();
+        
+        String type = mapper.getType();
+        String classname = mapper.getClassname();
+        
         if ( type == null && classname == null )
         {
-            throw new Exception( "nested mapper or " + "one of the attributes type or classname is required" );
+            throw new MapperException( "nested mapper or " + "one of the attributes type or classname is required" );
         }
 
         if ( type != null && classname != null )
         {
-            throw new Exception( "must not specify both type and classname attribute" );
+            throw new MapperException( "must not specify both type and classname attribute" );
         }
         if ( type != null )
         {
@@ -93,29 +110,23 @@
         {
             FileNameMapper m = (FileNameMapper) Class.forName( classname ).newInstance();
 
-            m.setFrom( from );
-            m.setTo( to );
+            m.setFrom( mapper.getFrom() );
+            m.setTo( mapper.getTo() );
 
             return m;
         }
-        catch ( ClassNotFoundException cnfe )
+        catch ( ClassNotFoundException e )
         {
-            throw cnfe;
+            throw new MapperException( "Cannot find mapper implementation: " + classname, e );
         }
-        catch ( Throwable t )
+        catch ( InstantiationException e )
         {
-            throw new Exception( t );
+            throw new MapperException( "Cannot load mapper implementation: " + classname, e );
+        }
+        catch ( IllegalAccessException e )
+        {
+            throw new MapperException( "Cannot load mapper implementation: " + classname, e );
         }
-    }
-
-    public Enumeration getTypes()
-    {
-        return implementations.propertyNames();
-    }
-
-    public Properties getImplementations()
-    {
-        return this.implementations;
     }
 
 }

Modified: maven/shared/trunk/file-management/src/main/java/org/apache/maven/shared/model/fileset/util/FileSetManager.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/file-management/src/main/java/org/apache/maven/shared/model/fileset/util/FileSetManager.java?rev=431528&r1=431527&r2=431528&view=diff
==============================================================================
--- maven/shared/trunk/file-management/src/main/java/org/apache/maven/shared/model/fileset/util/FileSetManager.java (original)
+++ maven/shared/trunk/file-management/src/main/java/org/apache/maven/shared/model/fileset/util/FileSetManager.java Mon Aug 14 21:32:06 2006
@@ -16,16 +16,6 @@
  * limitations under the License.
  */
 
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.shared.io.logging.DefaultMessageHolder;
 import org.apache.maven.shared.io.logging.MessageHolder;
@@ -33,112 +23,172 @@
 import org.apache.maven.shared.io.logging.MojoLogSink;
 import org.apache.maven.shared.io.logging.PlexusLoggerSink;
 import org.apache.maven.shared.model.fileset.FileSet;
+import org.apache.maven.shared.model.fileset.mappers.FileNameMapper;
+import org.apache.maven.shared.model.fileset.mappers.MapperException;
+import org.apache.maven.shared.model.fileset.mappers.MapperUtil;
 import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.util.DirectoryScanner;
 
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 /**
- * Provides operations for use with FileSet instances, such as retrieving the included/excluded
- * files, deleting all matching entries, etc.
+ * Provides operations for use with FileSet instances, such as retrieving the included/excluded files, deleting all
+ * matching entries, etc.
  * 
  * @author jdcasey
- *
+ * 
  */
 public class FileSetManager
 {
-    
+
     private static final int DELETE_RETRY_SLEEP_MILLIS = 10;
+
     private static final String[] EMPTY_STRING_ARRAY = new String[0];
-    
+
     private final boolean verbose;
+
     private MessageHolder messages;
 
     /**
-     * Create a new manager instance with the supplied log instance and flag for whether to output
-     * verbose messages.
+     * Create a new manager instance with the supplied log instance and flag for whether to output verbose messages.
      * 
-     * @param log The mojo log instance
-     * @param verbose Whether to output verbose messages
+     * @param log
+     *            The mojo log instance
+     * @param verbose
+     *            Whether to output verbose messages
      */
     public FileSetManager( Log log, boolean verbose )
     {
         if ( verbose )
         {
-            this.messages = new DefaultMessageHolder( MessageLevels.LEVEL_DEBUG, MessageLevels.LEVEL_INFO, new MojoLogSink( log ) );
+            this.messages =
+                new DefaultMessageHolder( MessageLevels.LEVEL_DEBUG, MessageLevels.LEVEL_INFO, new MojoLogSink( log ) );
         }
         else
         {
-            this.messages = new DefaultMessageHolder( MessageLevels.LEVEL_INFO, MessageLevels.LEVEL_INFO, new MojoLogSink( log ) );
+            this.messages =
+                new DefaultMessageHolder( MessageLevels.LEVEL_INFO, MessageLevels.LEVEL_INFO, new MojoLogSink( log ) );
         }
-        
+
         this.verbose = verbose;
     }
-    
+
     /**
      * Create a new manager instance with the supplied log instance. Verbose flag is set to false.
      * 
-     * @param log The mojo log instance
+     * @param log
+     *            The mojo log instance
      */
     public FileSetManager( Log log )
     {
-        this.messages = new DefaultMessageHolder( MessageLevels.LEVEL_INFO, MessageLevels.LEVEL_INFO, new MojoLogSink( log ) );
+        this.messages =
+            new DefaultMessageHolder( MessageLevels.LEVEL_INFO, MessageLevels.LEVEL_INFO, new MojoLogSink( log ) );
         this.verbose = false;
     }
-    
+
     /**
-     * Create a new manager instance with the supplied log instance and flag for whether to output
-     * verbose messages.
+     * Create a new manager instance with the supplied log instance and flag for whether to output verbose messages.
      * 
-     * @param log The mojo log instance
-     * @param verbose Whether to output verbose messages
+     * @param log
+     *            The mojo log instance
+     * @param verbose
+     *            Whether to output verbose messages
      */
     public FileSetManager( Logger log, boolean verbose )
     {
         if ( verbose )
         {
-            this.messages = new DefaultMessageHolder( MessageLevels.LEVEL_DEBUG, MessageLevels.LEVEL_INFO, new PlexusLoggerSink( log ) );
+            this.messages =
+                new DefaultMessageHolder( MessageLevels.LEVEL_DEBUG, MessageLevels.LEVEL_INFO,
+                                          new PlexusLoggerSink( log ) );
         }
         else
         {
-            this.messages = new DefaultMessageHolder( MessageLevels.LEVEL_INFO, MessageLevels.LEVEL_INFO, new PlexusLoggerSink( log ) );
+            this.messages =
+                new DefaultMessageHolder( MessageLevels.LEVEL_INFO, MessageLevels.LEVEL_INFO,
+                                          new PlexusLoggerSink( log ) );
         }
-        
+
         this.verbose = verbose;
     }
-    
+
     /**
      * Create a new manager instance with the supplied log instance. Verbose flag is set to false.
      * 
-     * @param log The mojo log instance
+     * @param log
+     *            The mojo log instance
      */
     public FileSetManager( Logger log )
     {
-        this.messages = new DefaultMessageHolder( MessageLevels.LEVEL_INFO, MessageLevels.LEVEL_INFO, new PlexusLoggerSink( log ) );
+        this.messages =
+            new DefaultMessageHolder( MessageLevels.LEVEL_INFO, MessageLevels.LEVEL_INFO, new PlexusLoggerSink( log ) );
         this.verbose = false;
     }
-    
+
     /**
      * Create a new manager instance with an empty messages. Verbose flag is set to false.
      * 
-     * @param log The mojo log instance
+     * @param log
+     *            The mojo log instance
      */
     public FileSetManager()
     {
         this.verbose = false;
     }
-    
+
+    public Map mapIncludedFiles( FileSet fileSet )
+        throws MapperException
+    {
+        String[] sourcePaths = getIncludedFiles( fileSet );
+        Map mappedPaths = new LinkedHashMap();
+
+        FileNameMapper fileMapper = MapperUtil.getFileNameMapper( fileSet.getMapper() );
+
+        for ( int i = 0; i < sourcePaths.length; i++ )
+        {
+            String sourcePath = sourcePaths[i];
+            
+            String destPath;
+            if( fileMapper != null )
+            {
+                destPath = fileMapper.mapFileName( sourcePath );
+            }
+            else
+            {
+                destPath = sourcePath;
+            }
+            
+            mappedPaths.put( sourcePath, destPath );
+        }
+
+        return mappedPaths;
+    }
+
     /**
      * Get all the filenames which have been included by the rules in this fileset.
-     * @param fileSet The fileset defining rules for inclusion/exclusion, and base directory.
+     * 
+     * @param fileSet
+     *            The fileset defining rules for inclusion/exclusion, and base directory.
      * @return the array of matching filenames, relative to the basedir of the file-set.
      */
     public String[] getIncludedFiles( FileSet fileSet )
     {
         DirectoryScanner scanner = scan( fileSet );
-        
+
         if ( scanner != null )
         {
             return scanner.getIncludedFiles();
-        }        
+        }
         else
         {
             return EMPTY_STRING_ARRAY;
@@ -147,17 +197,19 @@
 
     /**
      * Get all the directory names which have been included by the rules in this fileset.
-     * @param fileSet The fileset defining rules for inclusion/exclusion, and base directory.
+     * 
+     * @param fileSet
+     *            The fileset defining rules for inclusion/exclusion, and base directory.
      * @return the array of matching dirnames, relative to the basedir of the file-set.
      */
     public String[] getIncludedDirectories( FileSet fileSet )
     {
         DirectoryScanner scanner = scan( fileSet );
-        
+
         if ( scanner != null )
         {
             return scanner.getIncludedDirectories();
-        }        
+        }
         else
         {
             return EMPTY_STRING_ARRAY;
@@ -166,17 +218,19 @@
 
     /**
      * Get all the filenames which have been excluded by the rules in this fileset.
-     * @param fileSet The fileset defining rules for inclusion/exclusion, and base directory.
+     * 
+     * @param fileSet
+     *            The fileset defining rules for inclusion/exclusion, and base directory.
      * @return the array of non-matching filenames, relative to the basedir of the file-set.
      */
     public String[] getExcludedFiles( FileSet fileSet )
     {
         DirectoryScanner scanner = scan( fileSet );
-        
+
         if ( scanner != null )
         {
             return scanner.getExcludedFiles();
-        }        
+        }
         else
         {
             return EMPTY_STRING_ARRAY;
@@ -185,43 +239,49 @@
 
     /**
      * Get all the directory names which have been excluded by the rules in this fileset.
-     * @param fileSet The fileset defining rules for inclusion/exclusion, and base directory.
+     * 
+     * @param fileSet
+     *            The fileset defining rules for inclusion/exclusion, and base directory.
      * @return the array of non-matching dirnames, relative to the basedir of the file-set.
      */
     public String[] getExcludedDirectories( FileSet fileSet )
     {
         DirectoryScanner scanner = scan( fileSet );
-        
+
         if ( scanner != null )
         {
             return scanner.getExcludedDirectories();
-        }        
+        }
         else
         {
             return EMPTY_STRING_ARRAY;
         }
     }
-    
+
     /**
      * Delete the matching files and directories for the given file-set definition.
-     * @param fileSet The file-set matching rules, along with search base directory
-     * @throws IOException If a matching file cannot be deleted
+     * 
+     * @param fileSet
+     *            The file-set matching rules, along with search base directory
+     * @throws IOException
+     *             If a matching file cannot be deleted
      */
-    public void delete( FileSet fileSet ) throws IOException
+    public void delete( FileSet fileSet )
+        throws IOException
     {
         Set deletablePaths = findDeletablePaths( fileSet );
-        
+
         if ( messages != null && messages.isDebugEnabled() )
         {
             messages.addDebugMessage( "Found deletable paths: " + String.valueOf( deletablePaths ).replace( ',', '\n' ) );
-        }        
-        
+        }
+
         for ( Iterator it = deletablePaths.iterator(); it.hasNext(); )
         {
-            String path = (String) it.next();
-            
+            String path = ( String ) it.next();
+
             File file = new File( fileSet.getDirectory(), path );
-            
+
             if ( file.exists() )
             {
                 if ( file.isDirectory() && ( fileSet.isFollowSymlinks() || !isSymlink( file ) ) )
@@ -230,7 +290,7 @@
                     {
                         messages.addInfoMessage( "Deleting directory: " + file );
                     }
-                    
+
                     removeDir( file, fileSet.isFollowSymlinks() );
                 }
                 else
@@ -239,34 +299,37 @@
                     {
                         messages.addInfoMessage( "Deleting file: " + file );
                     }
-                    
+
                     if ( !delete( file ) )
                     {
                         throw new IOException( "Failed to delete file: " + file + ". Reason is unknown." );
                     }
                 }
-            }            
+            }
         }
     }
-    
-    private boolean isSymlink( File file ) throws IOException
+
+    private boolean isSymlink( File file )
+        throws IOException
     {
         File parent = file.getParentFile();
         File canonicalFile = file.getCanonicalFile();
-        
+
         if ( messages != null && messages.isDebugEnabled() )
         {
-            messages.addDebugMessage( "Checking for symlink:\nParent file's canonical path: " + parent.getCanonicalPath()
-                + "\nMy canonical path: " + canonicalFile.getPath() );
-        }        
-        return parent != null && ( !canonicalFile.getName().equals( file.getName() ) || !canonicalFile.getPath().startsWith( parent.getCanonicalPath() ) );
+            messages.addDebugMessage( "Checking for symlink:\nParent file's canonical path: "
+                            + parent.getCanonicalPath() + "\nMy canonical path: " + canonicalFile.getPath() );
+        }
+        return parent != null
+                        && ( !canonicalFile.getName().equals( file.getName() ) || !canonicalFile.getPath().startsWith(
+                                                                                                                       parent.getCanonicalPath() ) );
     }
 
     private Set findDeletablePaths( FileSet fileSet )
     {
         Set includes = findDeletableDirectories( fileSet );
         includes.addAll( findDeletableFiles( fileSet, includes ) );
-        
+
         return includes;
     }
 
@@ -276,79 +339,80 @@
         {
             messages.addInfoMessage( "Scanning for deletable directories." );
         }
-        
+
         DirectoryScanner scanner = scan( fileSet );
-        
+
         if ( scanner == null )
         {
             return Collections.EMPTY_SET;
         }
-        
+
         String[] includedDirs = scanner.getIncludedDirectories();
         String[] excludedDirs = scanner.getExcludedDirectories();
-        
+
         Set includes = new HashSet( Arrays.asList( includedDirs ) );
         List excludes = new ArrayList( Arrays.asList( excludedDirs ) );
         List linksForDeletion = new ArrayList();
-        
+
         if ( !fileSet.isFollowSymlinks() )
         {
             if ( verbose && messages != null )
             {
                 messages.addInfoMessage( "Adding symbolic link dirs which were previously excluded to the list being deleted." );
             }
-            
+
             // we need to see which entries were excluded because they're symlinks...
             scanner.setFollowSymlinks( true );
             scanner.scan();
-            
+
             if ( messages != null && messages.isDebugEnabled() )
             {
                 messages.addDebugMessage( "Originally marked for delete: " + includes );
                 messages.addDebugMessage( "Marked for preserve (with followSymlinks == false): " + excludes );
             }
-            
+
             List notSymlinks = Arrays.asList( scanner.getIncludedDirectories() );
-            
+
             linksForDeletion.addAll( excludes );
             linksForDeletion.retainAll( notSymlinks );
-            
+
             if ( messages != null && messages.isDebugEnabled() )
             {
                 messages.addDebugMessage( "Symlinks marked for deletion (originally mismarked): " + linksForDeletion );
             }
-            
+
             excludes.removeAll( notSymlinks );
         }
-        
+
         for ( int i = 0; i < excludedDirs.length; i++ )
         {
             String path = excludedDirs[i];
-            
+
             File excluded = new File( path );
-            
+
             String parentPath = excluded.getParent();
-            
-            while( parentPath != null )
+
+            while ( parentPath != null )
             {
                 if ( messages != null && messages.isDebugEnabled() )
                 {
-                    messages.addDebugMessage( "Verifying path: " + parentPath + " is not present; contains file which is excluded." );
+                    messages.addDebugMessage( "Verifying path: " + parentPath
+                                    + " is not present; contains file which is excluded." );
                 }
-                
+
                 boolean removed = includes.remove( parentPath );
-                
+
                 if ( removed && messages != null && messages.isDebugEnabled() )
                 {
                     messages.addDebugMessage( "Path: " + parentPath + " was removed from delete list." );
                 }
-                
+
                 parentPath = new File( parentPath ).getParent();
             }
         }
-        
+
         includes.addAll( linksForDeletion );
-        
+
         return includes;
     }
 
@@ -358,98 +422,101 @@
         {
             messages.addInfoMessage( "Re-scanning for deletable files." );
         }
-        
+
         DirectoryScanner scanner = scan( fileSet );
-        
+
         if ( scanner == null )
         {
             return deletableDirectories;
         }
-        
+
         String[] includedFiles = scanner.getIncludedFiles();
         String[] excludedFiles = scanner.getExcludedFiles();
-        
+
         Set includes = deletableDirectories;
         includes.addAll( Arrays.asList( includedFiles ) );
         List excludes = new ArrayList( Arrays.asList( excludedFiles ) );
         List linksForDeletion = new ArrayList();
-        
+
         if ( !fileSet.isFollowSymlinks() )
         {
             if ( verbose && messages != null )
             {
                 messages.addInfoMessage( "Adding symbolic link files which were previously excluded to the list being deleted." );
             }
-            
+
             // we need to see which entries were excluded because they're symlinks...
             scanner.setFollowSymlinks( true );
             scanner.scan();
-            
+
             if ( messages != null && messages.isDebugEnabled() )
             {
                 messages.addDebugMessage( "Originally marked for delete: " + includes );
                 messages.addDebugMessage( "Marked for preserve (with followSymlinks == false): " + excludes );
             }
-            
+
             List notSymlinks = Arrays.asList( scanner.getExcludedFiles() );
-            
+
             linksForDeletion.addAll( excludes );
             linksForDeletion.retainAll( notSymlinks );
-            
+
             if ( messages != null && messages.isDebugEnabled() )
             {
                 messages.addDebugMessage( "Symlinks marked for deletion (originally mismarked): " + linksForDeletion );
             }
-            
+
             excludes.removeAll( notSymlinks );
         }
-        
+
         for ( int i = 0; i < excludedFiles.length; i++ )
         {
             String path = excludedFiles[i];
-            
+
             File excluded = new File( path );
-            
+
             String parentPath = excluded.getParent();
-            
-            while( parentPath != null )
+
+            while ( parentPath != null )
             {
                 if ( messages != null && messages.isDebugEnabled() )
                 {
-                    messages.addDebugMessage( "Verifying path: " + parentPath + " is not present; contains file which is excluded." );
+                    messages.addDebugMessage( "Verifying path: " + parentPath
+                                    + " is not present; contains file which is excluded." );
                 }
-                
+
                 boolean removed = includes.remove( parentPath );
-                
+
                 if ( removed && messages != null && messages.isDebugEnabled() )
                 {
                     messages.addDebugMessage( "Path: " + parentPath + " was removed from delete list." );
                 }
-                
+
                 parentPath = new File( parentPath ).getParent();
             }
         }
-        
+
         includes.addAll( linksForDeletion );
-        
-//        for ( Iterator it = includes.iterator(); it.hasNext(); )
-//        {
-//            String path = (String) it.next();
-//            
-//            if ( includes.contains( new File( path ).getParent() ) )
-//            {
-//                it.remove();
-//            }
-//        }
-        
+
+        // for ( Iterator it = includes.iterator(); it.hasNext(); )
+        // {
+        // String path = (String) it.next();
+        //            
+        // if ( includes.contains( new File( path ).getParent() ) )
+        // {
+        // it.remove();
+        // }
+        // }
+
         return includes;
     }
 
     /**
      * Delete a directory
-     *
-     * @param dir the directory to delete
-     * @param followSymlinks whether to follow symbolic links, or simply delete the link
+     * 
+     * @param dir
+     *            the directory to delete
+     * @param followSymlinks
+     *            whether to follow symbolic links, or simply delete the link
      */
     private void removeDir( File dir, boolean followSymlinks )
         throws IOException
@@ -472,15 +539,15 @@
                 if ( !delete( f ) )
                 {
                     String message = "Unable to delete file " + f.getAbsolutePath();
-// TODO:...
-//                    if ( failOnError )
-//                    {
-                        throw new IOException( message );
-//                    }
-//                    else
-//                    {
-//                        getLog().info( message );
-//                    }
+                    // TODO:...
+                    // if ( failOnError )
+                    // {
+                    throw new IOException( message );
+                    // }
+                    // else
+                    // {
+                    // getLog().info( message );
+                    // }
                 }
             }
         }
@@ -488,22 +555,21 @@
         if ( !delete( dir ) )
         {
             String message = "Unable to delete directory " + dir.getAbsolutePath();
-// TODO:...
-//            if ( failOnError )
-//            {
-                throw new IOException( message );
-//            }
-//            else
-//            {
-//                getLog().info( message );
-//            }
-        }
-    }
-    
-    /**
-     * Accommodate Windows bug encountered in both Sun and IBM JDKs.
-     * Others possible. If the delete does not work, call System.gc(),
-     * wait a little and try again.
+            // TODO:...
+            // if ( failOnError )
+            // {
+            throw new IOException( message );
+            // }
+            // else
+            // {
+            // getLog().info( message );
+            // }
+        }
+    }
+
+    /**
+     * Accommodate Windows bug encountered in both Sun and IBM JDKs. Others possible. If the delete does not work, call
+     * System.gc(), wait a little and try again.
      */
     private boolean delete( File f )
     {
@@ -523,7 +589,7 @@
                 return f.delete();
             }
         }
-        
+
         return true;
     }
 
@@ -534,32 +600,32 @@
         {
             return null;
         }
-        
+
         DirectoryScanner scanner = new DirectoryScanner();
-        
+
         String[] includesArray = fileSet.getIncludesArray();
         String[] excludesArray = fileSet.getExcludesArray();
-        
+
         if ( includesArray.length > 0 )
         {
             scanner.setIncludes( includesArray );
         }
-        
+
         if ( excludesArray.length > 0 )
         {
             scanner.setExcludes( excludesArray );
         }
-        
+
         if ( fileSet.isUseDefaultExcludes() )
         {
             scanner.addDefaultExcludes();
         }
-        
+
         scanner.setBasedir( basedir );
         scanner.setFollowSymlinks( fileSet.isFollowSymlinks() );
 
         scanner.scan();
-        
+
         return scanner;
     }
 

Added: maven/shared/trunk/file-management/src/main/resources/mappers.properties
URL: http://svn.apache.org/viewvc/maven/shared/trunk/file-management/src/main/resources/mappers.properties?rev=431528&view=auto
==============================================================================
--- maven/shared/trunk/file-management/src/main/resources/mappers.properties (added)
+++ maven/shared/trunk/file-management/src/main/resources/mappers.properties Mon Aug 14 21:32:06 2006
@@ -0,0 +1,7 @@
+identity=org.apache.maven.plugin.assembly.mappers.IdentityMapper
+flatten=org.apache.maven.plugin.assembly.mappers.FlatFileNameMapper
+glob=org.apache.maven.plugin.assembly.mappers.GlobPatternMapper
+merge=org.apache.maven.plugin.assembly.mappers.MergingMapper
+regexp=org.apache.maven.plugin.assembly.mappers.RegexpPatternMapper
+package=org.apache.maven.plugin.assembly.mappers.PackageNameMapper
+unpackage=org.apache.maven.plugin.assembly.mappers.UnPackageNameMapper

Propchange: maven/shared/trunk/file-management/src/main/resources/mappers.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/shared/trunk/file-management/src/main/resources/mappers.properties
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"