Coverage Report - org.apache.maven.plugin.assembly.archive.archiver.PrefixedArchivedFileSet
 
Classes in this File Line Coverage Branch Coverage Complexity
PrefixedArchivedFileSet
0%
0/29
0%
0/16
1,889
 
 1  
 package org.apache.maven.plugin.assembly.archive.archiver;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import org.codehaus.plexus.archiver.ArchivedFileSet;
 23  
 import org.codehaus.plexus.components.io.fileselectors.FileSelector;
 24  
 
 25  
 import java.io.File;
 26  
 
 27  
 /**
 28  
  * @version $Id: PrefixedArchivedFileSet.java 727431 2008-12-17 16:38:37Z jdcasey $
 29  
  */
 30  
 public class PrefixedArchivedFileSet
 31  
     implements ArchivedFileSet
 32  
 {
 33  
 
 34  
     private final String rootPrefix;
 35  
     private final ArchivedFileSet fileSet;
 36  
     private final FileSelector[] selectors;
 37  
 
 38  
     public PrefixedArchivedFileSet( ArchivedFileSet fileSet, String rootPrefix, FileSelector[] selectors )
 39  0
     {
 40  0
         this.fileSet = fileSet;
 41  0
         this.selectors = selectors;
 42  
 
 43  0
         if ( rootPrefix.length() > 0 && ! rootPrefix.endsWith( "/" ) )
 44  
         {
 45  0
             this.rootPrefix = rootPrefix + "/";
 46  
         }
 47  
         else
 48  
         {
 49  0
             this.rootPrefix = rootPrefix;
 50  
         }
 51  0
     }
 52  
 
 53  
     public File getArchive()
 54  
     {
 55  0
         return fileSet.getArchive();
 56  
     }
 57  
 
 58  
     public String[] getExcludes()
 59  
     {
 60  0
         return fileSet.getExcludes();
 61  
     }
 62  
 
 63  
     public FileSelector[] getFileSelectors()
 64  
     {
 65  0
         FileSelector[] sel = fileSet.getFileSelectors();
 66  0
         if ( ( sel != null ) && ( selectors != null ) )
 67  
         {
 68  0
             FileSelector[] temp = new FileSelector[ sel.length + selectors.length ];
 69  
 
 70  0
             System.arraycopy( sel, 0, temp, 0, sel.length );
 71  0
             System.arraycopy( selectors, 0, temp, sel.length, selectors.length );
 72  
 
 73  0
             sel = temp;
 74  0
         }
 75  0
         else if ( ( sel == null ) && ( selectors != null ) )
 76  
         {
 77  0
             sel = selectors;
 78  
         }
 79  
 
 80  0
         return sel;
 81  
     }
 82  
 
 83  
     public String[] getIncludes()
 84  
     {
 85  0
         return fileSet.getIncludes();
 86  
     }
 87  
 
 88  
     public String getPrefix()
 89  
     {
 90  0
         String prefix = fileSet.getPrefix();
 91  0
         if ( prefix.startsWith( "/" ) )
 92  
         {
 93  0
             if ( prefix.length() > 1 )
 94  
             {
 95  0
                 prefix = prefix.substring( 1 );
 96  
             }
 97  
             else
 98  
             {
 99  0
                 prefix = "";
 100  
             }
 101  
         }
 102  
 
 103  0
         return rootPrefix + prefix;
 104  
     }
 105  
 
 106  
     public boolean isCaseSensitive()
 107  
     {
 108  0
         return fileSet.isCaseSensitive();
 109  
     }
 110  
 
 111  
     public boolean isIncludingEmptyDirectories()
 112  
     {
 113  0
         return fileSet.isIncludingEmptyDirectories();
 114  
     }
 115  
 
 116  
     public boolean isUsingDefaultExcludes()
 117  
     {
 118  0
         return fileSet.isUsingDefaultExcludes();
 119  
     }
 120  
 
 121  
 }