Coverage Report - org.apache.maven.shared.model.fileset.SetBase
 
Classes in this File Line Coverage Branch Coverage Complexity
SetBase
54%
37/68
44%
14/32
1.583
 
 1  
 /*
 2  
  * $Id: org.apache.maven.shared.model.fileset.SetBase.html 886882 2013-11-16 21:55:43Z hboutemy $
 3  
  */
 4  
 
 5  
 package org.apache.maven.shared.model.fileset;
 6  
 
 7  
   //---------------------------------/
 8  
  //- Imported classes and packages -/
 9  
 //---------------------------------/
 10  
 
 11  
 import java.util.Date;
 12  
 
 13  
 /**
 14  
  * Class SetBase.
 15  
  * 
 16  
  * @version $Revision: 886882 $ $Date: 2013-11-16 21:55:43 +0000 (Sat, 16 Nov 2013) $
 17  
  */
 18  10
 public class SetBase implements java.io.Serializable {
 19  
 
 20  
 
 21  
       //--------------------------/
 22  
      //- Class/Member Variables -/
 23  
     //--------------------------/
 24  
 
 25  
     /**
 26  
      * 
 27  
      *             Specifies whether symbolic links should be
 28  
      * traversed, or handled as-is.
 29  
      *           
 30  
      */
 31  10
     private boolean followSymlinks = false;
 32  
 
 33  
     /**
 34  
      * 
 35  
      *             Specifies the output directory relative to the
 36  
      * root
 37  
      *             of the root directory of the assembly.  For
 38  
      * example,
 39  
      *             "log" will put the specified files in the log
 40  
      * directory.
 41  
      *           
 42  
      */
 43  
     private String outputDirectory;
 44  
 
 45  
     /**
 46  
      * 
 47  
      *             Whether to include exclusion patterns for common
 48  
      * temporary and SCM control
 49  
      *             files (true by default).
 50  
      *           
 51  
      */
 52  10
     private boolean useDefaultExcludes = false;
 53  
 
 54  
     /**
 55  
      * Field includes.
 56  
      */
 57  
     private java.util.List includes;
 58  
 
 59  
     /**
 60  
      * Field excludes.
 61  
      */
 62  
     private java.util.List excludes;
 63  
 
 64  
     /**
 65  
      * 
 66  
      *             
 67  
      *             Similar to a UNIX permission.  Format:
 68  
      * (User)(Group)(Other) where each
 69  
      *             component is a sum of Read = 4, Write = 2, and
 70  
      * Execute = 1.  For example,
 71  
      *             the default value of 0644 translates to User
 72  
      * read-write, Group and Other
 73  
      *             read-only.
 74  
      *             <a
 75  
      * href="http://www.onlamp.com/pub/a/bsd/2000/09/06/FreeBSD_Basics.html">(more
 76  
      * on unix-style
 77  
      *             permissions)</a>
 78  
      *             
 79  
      *           
 80  
      */
 81  10
     private String fileMode = "0644";
 82  
 
 83  
     /**
 84  
      * 
 85  
      *             
 86  
      *             Similar to a UNIX permission.  Format:
 87  
      * (User)(Group)(Other) where each
 88  
      *             component is a sum of Read = 4, Write = 2, and
 89  
      * Execute = 1.  For example,
 90  
      *             the default value of 0755 translates to User
 91  
      * read-write, Group and Other
 92  
      *             read-only.
 93  
      *             <a
 94  
      * href="http://www.onlamp.com/pub/a/bsd/2000/09/06/FreeBSD_Basics.html">(more
 95  
      * on unix-style
 96  
      *             permissions)</a>
 97  
      *             
 98  
      *           
 99  
      */
 100  10
     private String directoryMode = "0755";
 101  
 
 102  
     /**
 103  
      * 
 104  
      *             Specifies the mapper used.
 105  
      *           
 106  
      */
 107  10
     private Mapper mapper = new Mapper();
 108  
 
 109  
 
 110  
       //-----------/
 111  
      //- Methods -/
 112  
     //-----------/
 113  
 
 114  
     /**
 115  
      * Method addExclude.
 116  
      * 
 117  
      * @param string
 118  
      */
 119  
     public void addExclude(String string)
 120  
     {
 121  5
         if ( !(string instanceof String) )
 122  
         {
 123  0
             throw new ClassCastException( "SetBase.addExcludes(string) parameter must be instanceof " + String.class.getName() );
 124  
         }
 125  5
         getExcludes().add( string );
 126  5
     } //-- void addExclude(String) 
 127  
 
 128  
     /**
 129  
      * Method addInclude.
 130  
      * 
 131  
      * @param string
 132  
      */
 133  
     public void addInclude(String string)
 134  
     {
 135  7
         if ( !(string instanceof String) )
 136  
         {
 137  0
             throw new ClassCastException( "SetBase.addIncludes(string) parameter must be instanceof " + String.class.getName() );
 138  
         }
 139  7
         getIncludes().add( string );
 140  7
     } //-- void addInclude(String) 
 141  
 
 142  
     /**
 143  
      * Get 
 144  
      *             
 145  
      *             Similar to a UNIX permission.  Format:
 146  
      * (User)(Group)(Other) where each
 147  
      *             component is a sum of Read = 4, Write = 2, and
 148  
      * Execute = 1.  For example,
 149  
      *             the default value of 0755 translates to User
 150  
      * read-write, Group and Other
 151  
      *             read-only.
 152  
      *             <a
 153  
      * href="http://www.onlamp.com/pub/a/bsd/2000/09/06/FreeBSD_Basics.html">(more
 154  
      * on unix-style
 155  
      *             permissions)</a>
 156  
      *             
 157  
      *           
 158  
      * 
 159  
      * @return String
 160  
      */
 161  
     public String getDirectoryMode()
 162  
     {
 163  0
         return this.directoryMode;
 164  
     } //-- String getDirectoryMode() 
 165  
 
 166  
     /**
 167  
      * Method getExcludes.
 168  
      * 
 169  
      * @return java.util.List
 170  
      */
 171  
     public java.util.List getExcludes()
 172  
     {
 173  23
         if ( this.excludes == null )
 174  
         {
 175  10
             this.excludes = new java.util.ArrayList();
 176  
         }
 177  
         
 178  23
         return this.excludes;
 179  
     } //-- java.util.List getExcludes() 
 180  
 
 181  
     /**
 182  
      * Get 
 183  
      *             
 184  
      *             Similar to a UNIX permission.  Format:
 185  
      * (User)(Group)(Other) where each
 186  
      *             component is a sum of Read = 4, Write = 2, and
 187  
      * Execute = 1.  For example,
 188  
      *             the default value of 0644 translates to User
 189  
      * read-write, Group and Other
 190  
      *             read-only.
 191  
      *             <a
 192  
      * href="http://www.onlamp.com/pub/a/bsd/2000/09/06/FreeBSD_Basics.html">(more
 193  
      * on unix-style
 194  
      *             permissions)</a>
 195  
      *             
 196  
      *           
 197  
      * 
 198  
      * @return String
 199  
      */
 200  
     public String getFileMode()
 201  
     {
 202  0
         return this.fileMode;
 203  
     } //-- String getFileMode() 
 204  
 
 205  
     /**
 206  
      * Method getIncludes.
 207  
      * 
 208  
      * @return java.util.List
 209  
      */
 210  
     public java.util.List getIncludes()
 211  
     {
 212  25
         if ( this.includes == null )
 213  
         {
 214  10
             this.includes = new java.util.ArrayList();
 215  
         }
 216  
         
 217  25
         return this.includes;
 218  
     } //-- java.util.List getIncludes() 
 219  
 
 220  
     /**
 221  
      * Get 
 222  
      *             Specifies the mapper used.
 223  
      *           
 224  
      * 
 225  
      * @return Mapper
 226  
      */
 227  
     public Mapper getMapper()
 228  
     {
 229  0
         return this.mapper;
 230  
     } //-- Mapper getMapper() 
 231  
 
 232  
     /**
 233  
      * Get 
 234  
      *             Specifies the output directory relative to the
 235  
      * root
 236  
      *             of the root directory of the assembly.  For
 237  
      * example,
 238  
      *             "log" will put the specified files in the log
 239  
      * directory.
 240  
      *           
 241  
      * 
 242  
      * @return String
 243  
      */
 244  
     public String getOutputDirectory()
 245  
     {
 246  0
         return this.outputDirectory;
 247  
     } //-- String getOutputDirectory() 
 248  
 
 249  
     /**
 250  
      * Get 
 251  
      *             Specifies whether symbolic links should be
 252  
      * traversed, or handled as-is.
 253  
      *           
 254  
      * 
 255  
      * @return boolean
 256  
      */
 257  
     public boolean isFollowSymlinks()
 258  
     {
 259  42
         return this.followSymlinks;
 260  
     } //-- boolean isFollowSymlinks() 
 261  
 
 262  
     /**
 263  
      * Get 
 264  
      *             Whether to include exclusion patterns for common
 265  
      * temporary and SCM control
 266  
      *             files (true by default).
 267  
      *           
 268  
      * 
 269  
      * @return boolean
 270  
      */
 271  
     public boolean isUseDefaultExcludes()
 272  
     {
 273  18
         return this.useDefaultExcludes;
 274  
     } //-- boolean isUseDefaultExcludes() 
 275  
 
 276  
     /**
 277  
      * Method removeExclude.
 278  
      * 
 279  
      * @param string
 280  
      */
 281  
     public void removeExclude(String string)
 282  
     {
 283  0
         if ( !(string instanceof String) )
 284  
         {
 285  0
             throw new ClassCastException( "SetBase.removeExcludes(string) parameter must be instanceof " + String.class.getName() );
 286  
         }
 287  0
         getExcludes().remove( string );
 288  0
     } //-- void removeExclude(String) 
 289  
 
 290  
     /**
 291  
      * Method removeInclude.
 292  
      * 
 293  
      * @param string
 294  
      */
 295  
     public void removeInclude(String string)
 296  
     {
 297  0
         if ( !(string instanceof String) )
 298  
         {
 299  0
             throw new ClassCastException( "SetBase.removeIncludes(string) parameter must be instanceof " + String.class.getName() );
 300  
         }
 301  0
         getIncludes().remove( string );
 302  0
     } //-- void removeInclude(String) 
 303  
 
 304  
     /**
 305  
      * Set 
 306  
      *             
 307  
      *             Similar to a UNIX permission.  Format:
 308  
      * (User)(Group)(Other) where each
 309  
      *             component is a sum of Read = 4, Write = 2, and
 310  
      * Execute = 1.  For example,
 311  
      *             the default value of 0755 translates to User
 312  
      * read-write, Group and Other
 313  
      *             read-only.
 314  
      *             <a
 315  
      * href="http://www.onlamp.com/pub/a/bsd/2000/09/06/FreeBSD_Basics.html">(more
 316  
      * on unix-style
 317  
      *             permissions)</a>
 318  
      *             
 319  
      *           
 320  
      * 
 321  
      * @param directoryMode
 322  
      */
 323  
     public void setDirectoryMode(String directoryMode)
 324  
     {
 325  0
         this.directoryMode = directoryMode;
 326  0
     } //-- void setDirectoryMode(String) 
 327  
 
 328  
     /**
 329  
      * Set 
 330  
      *             
 331  
      *             When &lt;exclude&gt; subelements are present,
 332  
      * they define
 333  
      *             a set of files and directory to exclude.
 334  
      *             
 335  
      *           
 336  
      * 
 337  
      * @param excludes
 338  
      */
 339  
     public void setExcludes(java.util.List excludes)
 340  
     {
 341  0
         this.excludes = excludes;
 342  0
     } //-- void setExcludes(java.util.List) 
 343  
 
 344  
     /**
 345  
      * Set 
 346  
      *             
 347  
      *             Similar to a UNIX permission.  Format:
 348  
      * (User)(Group)(Other) where each
 349  
      *             component is a sum of Read = 4, Write = 2, and
 350  
      * Execute = 1.  For example,
 351  
      *             the default value of 0644 translates to User
 352  
      * read-write, Group and Other
 353  
      *             read-only.
 354  
      *             <a
 355  
      * href="http://www.onlamp.com/pub/a/bsd/2000/09/06/FreeBSD_Basics.html">(more
 356  
      * on unix-style
 357  
      *             permissions)</a>
 358  
      *             
 359  
      *           
 360  
      * 
 361  
      * @param fileMode
 362  
      */
 363  
     public void setFileMode(String fileMode)
 364  
     {
 365  0
         this.fileMode = fileMode;
 366  0
     } //-- void setFileMode(String) 
 367  
 
 368  
     /**
 369  
      * Set 
 370  
      *             Specifies whether symbolic links should be
 371  
      * traversed, or handled as-is.
 372  
      *           
 373  
      * 
 374  
      * @param followSymlinks
 375  
      */
 376  
     public void setFollowSymlinks(boolean followSymlinks)
 377  
     {
 378  7
         this.followSymlinks = followSymlinks;
 379  7
     } //-- void setFollowSymlinks(boolean) 
 380  
 
 381  
     /**
 382  
      * Set 
 383  
      *             
 384  
      *             When &lt;include&gt; subelements are present,
 385  
      * they define
 386  
      *             a set of files and directory to include.
 387  
      *             
 388  
      *           
 389  
      * 
 390  
      * @param includes
 391  
      */
 392  
     public void setIncludes(java.util.List includes)
 393  
     {
 394  0
         this.includes = includes;
 395  0
     } //-- void setIncludes(java.util.List) 
 396  
 
 397  
     /**
 398  
      * Set 
 399  
      *             Specifies the mapper used.
 400  
      *           
 401  
      * 
 402  
      * @param mapper
 403  
      */
 404  
     public void setMapper(Mapper mapper)
 405  
     {
 406  0
         this.mapper = mapper;
 407  0
     } //-- void setMapper(Mapper) 
 408  
 
 409  
     /**
 410  
      * Set 
 411  
      *             Specifies the output directory relative to the
 412  
      * root
 413  
      *             of the root directory of the assembly.  For
 414  
      * example,
 415  
      *             "log" will put the specified files in the log
 416  
      * directory.
 417  
      *           
 418  
      * 
 419  
      * @param outputDirectory
 420  
      */
 421  
     public void setOutputDirectory(String outputDirectory)
 422  
     {
 423  0
         this.outputDirectory = outputDirectory;
 424  0
     } //-- void setOutputDirectory(String) 
 425  
 
 426  
     /**
 427  
      * Set 
 428  
      *             Whether to include exclusion patterns for common
 429  
      * temporary and SCM control
 430  
      *             files (true by default).
 431  
      *           
 432  
      * 
 433  
      * @param useDefaultExcludes
 434  
      */
 435  
     public void setUseDefaultExcludes(boolean useDefaultExcludes)
 436  
     {
 437  0
         this.useDefaultExcludes = useDefaultExcludes;
 438  0
     } //-- void setUseDefaultExcludes(boolean) 
 439  
 
 440  
 
 441  
     /**
 442  
      * @return the file-set inclusion rules in array form.
 443  
      */
 444  
     public String[] getIncludesArray()
 445  
     {
 446  18
         String[] includesArry = null;
 447  18
         java.util.Collection includes = getIncludes();
 448  18
         if ( includes != null && !includes.isEmpty() )
 449  
         {
 450  8
             includesArry = (String[]) includes.toArray( new String[0] );
 451  
         }
 452  10
         else if ( includes != null )
 453  
         {
 454  10
             includesArry = new String[0];
 455  
         }
 456  
 
 457  18
         return includesArry;
 458  
     }
 459  
 
 460  
     /**
 461  
      * @return the file-set exclusion rules in array form.
 462  
      */
 463  
     public String[] getExcludesArray()
 464  
     {
 465  18
         String[] excludesArry = null;
 466  18
         java.util.Collection excludes = getExcludes();
 467  18
         if ( excludes != null && !excludes.isEmpty() )
 468  
         {
 469  10
             excludesArry = (String[]) excludes.toArray( new String[0] );
 470  
         }
 471  8
         else if ( excludes != null )
 472  
         {
 473  8
             excludesArry = new String[0];
 474  
         }
 475  
 
 476  18
         return excludesArry;
 477  
     }
 478  
 
 479  
           
 480  10
     private String modelEncoding = "UTF-8";
 481  
 
 482  
     /**
 483  
      * Set an encoding used for reading/writing the model.
 484  
      *
 485  
      * @param modelEncoding the encoding used when reading/writing the model.
 486  
      */
 487  
     public void setModelEncoding( String modelEncoding )
 488  
     {
 489  0
         this.modelEncoding = modelEncoding;
 490  0
     }
 491  
 
 492  
     /**
 493  
      * @return the current encoding used when reading/writing this model.
 494  
      */
 495  
     public String getModelEncoding()
 496  
     {
 497  0
         return modelEncoding;
 498  
     }
 499  
 }