Coverage Report - org.apache.maven.shared.invoker.DefaultInvocationRequest
 
Classes in this File Line Coverage Branch Coverage Complexity
DefaultInvocationRequest
74%
66/89
43%
6/14
1,018
 
 1  
 package org.apache.maven.shared.invoker;
 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 java.io.File;
 23  
 import java.io.InputStream;
 24  
 import java.util.Collections;
 25  
 import java.util.HashMap;
 26  
 import java.util.List;
 27  
 import java.util.Map;
 28  
 import java.util.Properties;
 29  
 
 30  
 /**
 31  
  * Specifies the parameters used to control a Maven invocation.
 32  
  * 
 33  
  * @version $Id: DefaultInvocationRequest.java 807415 2009-08-24 22:32:16Z olamy $
 34  
  */
 35  42
 public class DefaultInvocationRequest
 36  
     implements InvocationRequest
 37  
 {
 38  
 
 39  
     private File basedir;
 40  
 
 41  
     private boolean debug;
 42  
 
 43  
     private InvocationOutputHandler errorHandler;
 44  
 
 45  42
     private String failureBehavior = REACTOR_FAIL_FAST;
 46  
 
 47  
     private List goals;
 48  
 
 49  
     private InputStream inputStream;
 50  
 
 51  
     private boolean interactive;
 52  
 
 53  
     private File localRepository;
 54  
 
 55  
     private boolean offline;
 56  
 
 57  42
     private boolean recursive = true;
 58  
 
 59  
     private InvocationOutputHandler outputHandler;
 60  
 
 61  
     private File pomFile;
 62  
 
 63  
     private Properties properties;
 64  
 
 65  
     private boolean showErrors;
 66  
 
 67  
     private boolean updateSnapshots;
 68  
 
 69  42
     private boolean shellEnvironmentInherited = true;
 70  
 
 71  
     private File userSettings;
 72  
 
 73  
     private String globalChecksumPolicy;
 74  
 
 75  
     private String pomFilename;
 76  
 
 77  
     private File javaHome;
 78  
 
 79  
     private List profiles;
 80  
 
 81  
     private boolean nonPluginUpdates;
 82  
 
 83  
     private Map shellEnvironments;
 84  
 
 85  
     private String mavenOpts;
 86  
     
 87  
     private boolean activatedReactor;
 88  
 
 89  
     private String[] activatedReactorIncludes, activatedReactorExcludes;
 90  
     
 91  
     private boolean showVersion;
 92  
 
 93  
     public InvocationRequest activateReactor( String[] includes, String[] excludes )
 94  
     {
 95  2
         activatedReactor = true;
 96  2
         activatedReactorIncludes = includes;
 97  2
         activatedReactorExcludes = excludes;
 98  2
         return this;
 99  
     }
 100  
 
 101  
     public File getBaseDirectory()
 102  
     {
 103  38
         return basedir;
 104  
     }
 105  
 
 106  
     public File getBaseDirectory( File defaultDirectory )
 107  
     {
 108  0
         return basedir == null ? defaultDirectory : basedir;
 109  
     }
 110  
 
 111  
     public InvocationOutputHandler getErrorHandler( InvocationOutputHandler defaultHandler )
 112  
     {
 113  6
         return errorHandler == null ? defaultHandler : errorHandler;
 114  
     }
 115  
 
 116  
     public String getFailureBehavior()
 117  
     {
 118  14
         return failureBehavior;
 119  
     }
 120  
 
 121  
     public List getGoals()
 122  
     {
 123  11
         return goals;
 124  
     }
 125  
 
 126  
     public InputStream getInputStream( InputStream defaultStream )
 127  
     {
 128  6
         return inputStream == null ? defaultStream : inputStream;
 129  
     }
 130  
 
 131  
     public File getLocalRepositoryDirectory( File defaultDirectory )
 132  
     {
 133  23
         return localRepository == null ? defaultDirectory : localRepository;
 134  
     }
 135  
 
 136  
     public InvocationOutputHandler getOutputHandler( InvocationOutputHandler defaultHandler )
 137  
     {
 138  6
         return outputHandler == null ? defaultHandler : outputHandler;
 139  
     }
 140  
 
 141  
     public File getPomFile()
 142  
     {
 143  24
         return pomFile;
 144  
     }
 145  
 
 146  
     public Properties getProperties()
 147  
     {
 148  12
         return properties;
 149  
     }
 150  
 
 151  
     public boolean isDebug()
 152  
     {
 153  17
         return debug;
 154  
     }
 155  
 
 156  
     public boolean isInteractive()
 157  
     {
 158  23
         return interactive;
 159  
     }
 160  
 
 161  
     public boolean isOffline()
 162  
     {
 163  17
         return offline;
 164  
     }
 165  
 
 166  
     public boolean isShowErrors()
 167  
     {
 168  9
         return showErrors;
 169  
     }
 170  
 
 171  
     public boolean isUpdateSnapshots()
 172  
     {
 173  17
         return updateSnapshots;
 174  
     }
 175  
 
 176  
     public boolean isRecursive()
 177  
     {
 178  17
         return recursive;
 179  
     }
 180  
 
 181  
     public InvocationRequest setRecursive( boolean recursive )
 182  
     {
 183  0
         this.recursive = recursive;
 184  0
         return this;
 185  
     }
 186  
 
 187  
     public InvocationRequest setBaseDirectory( File basedir )
 188  
     {
 189  14
         this.basedir = basedir;
 190  14
         return this;
 191  
     }
 192  
 
 193  
     public InvocationRequest setDebug( boolean debug )
 194  
     {
 195  8
         this.debug = debug;
 196  8
         return this;
 197  
     }
 198  
 
 199  
     public InvocationRequest setErrorHandler( InvocationOutputHandler errorHandler )
 200  
     {
 201  0
         this.errorHandler = errorHandler;
 202  0
         return this;
 203  
     }
 204  
 
 205  
     public InvocationRequest setFailureBehavior( String failureBehavior )
 206  
     {
 207  3
         this.failureBehavior = failureBehavior;
 208  3
         return this;
 209  
     }
 210  
 
 211  
     public InvocationRequest setGoals( List goals )
 212  
     {
 213  10
         this.goals = goals;
 214  10
         return this;
 215  
     }
 216  
 
 217  
     public InvocationRequest setInputStream( InputStream inputStream )
 218  
     {
 219  0
         this.inputStream = inputStream;
 220  0
         return this;
 221  
     }
 222  
 
 223  
     public InvocationRequest setInteractive( boolean interactive )
 224  
     {
 225  1
         this.interactive = interactive;
 226  1
         return this;
 227  
     }
 228  
 
 229  
     public InvocationRequest setLocalRepositoryDirectory( File localRepository )
 230  
     {
 231  4
         this.localRepository = localRepository;
 232  4
         return this;
 233  
     }
 234  
 
 235  
     public InvocationRequest setOffline( boolean offline )
 236  
     {
 237  2
         this.offline = offline;
 238  2
         return this;
 239  
     }
 240  
 
 241  
     public InvocationRequest setOutputHandler( InvocationOutputHandler outputHandler )
 242  
     {
 243  0
         this.outputHandler = outputHandler;
 244  0
         return this;
 245  
     }
 246  
 
 247  
     public InvocationRequest setPomFile( File pomFile )
 248  
     {
 249  2
         this.pomFile = pomFile;
 250  2
         return this;
 251  
     }
 252  
 
 253  
     public InvocationRequest setProperties( Properties properties )
 254  
     {
 255  5
         this.properties = properties;
 256  5
         return this;
 257  
     }
 258  
 
 259  
     public InvocationRequest setShowErrors( boolean showErrors )
 260  
     {
 261  2
         this.showErrors = showErrors;
 262  2
         return this;
 263  
     }
 264  
 
 265  
     public InvocationRequest setUpdateSnapshots( boolean updateSnapshots )
 266  
     {
 267  1
         this.updateSnapshots = updateSnapshots;
 268  1
         return this;
 269  
     }
 270  
 
 271  
     public boolean isShellEnvironmentInherited()
 272  
     {
 273  9
         return shellEnvironmentInherited;
 274  
     }
 275  
 
 276  
     public InvocationRequest setShellEnvironmentInherited( boolean shellEnvironmentInherited )
 277  
     {
 278  0
         this.shellEnvironmentInherited = shellEnvironmentInherited;
 279  0
         return this;
 280  
     }
 281  
 
 282  
     public File getJavaHome()
 283  
     {
 284  9
         return javaHome;
 285  
     }
 286  
 
 287  
     public InvocationRequest setJavaHome( File javaHome )
 288  
     {
 289  0
         this.javaHome = javaHome;
 290  0
         return this;
 291  
     }
 292  
 
 293  
     public File getUserSettingsFile()
 294  
     {
 295  10
         return userSettings;
 296  
     }
 297  
 
 298  
     public InvocationRequest setUserSettingsFile( File userSettings )
 299  
     {
 300  2
         this.userSettings = userSettings;
 301  2
         return this;
 302  
     }
 303  
 
 304  
     public String getGlobalChecksumPolicy()
 305  
     {
 306  17
         return globalChecksumPolicy;
 307  
     }
 308  
 
 309  
     public InvocationRequest setGlobalChecksumPolicy( String globalChecksumPolicy )
 310  
     {
 311  2
         this.globalChecksumPolicy = globalChecksumPolicy;
 312  2
         return this;
 313  
     }
 314  
 
 315  
     public String getPomFileName()
 316  
     {
 317  15
         return pomFilename;
 318  
     }
 319  
 
 320  
     public InvocationRequest setPomFileName( String pomFilename )
 321  
     {
 322  2
         this.pomFilename = pomFilename;
 323  2
         return this;
 324  
     }
 325  
 
 326  
     public List getProfiles()
 327  
     {
 328  9
         return profiles;
 329  
     }
 330  
 
 331  
     public InvocationRequest setProfiles( List profiles )
 332  
     {
 333  1
         this.profiles = profiles;
 334  1
         return this;
 335  
     }
 336  
 
 337  
     public boolean isNonPluginUpdates()
 338  
     {
 339  17
         return nonPluginUpdates;
 340  
     }
 341  
 
 342  
     public InvocationRequest setNonPluginUpdates( boolean nonPluginUpdates )
 343  
     {
 344  0
         this.nonPluginUpdates = nonPluginUpdates;
 345  0
         return this;
 346  
     }
 347  
 
 348  
     public InvocationRequest addShellEnvironment( String name, String value )
 349  
     {
 350  0
         if ( this.shellEnvironmentInherited )
 351  
         {
 352  0
             this.shellEnvironments = new HashMap();
 353  
         }
 354  0
         this.shellEnvironments.put( name, value );
 355  0
         return this;
 356  
     }
 357  
 
 358  
     public Map getShellEnvironments()
 359  
     {
 360  9
         return shellEnvironments == null ? Collections.EMPTY_MAP : shellEnvironments;
 361  
     }
 362  
 
 363  
     public String getMavenOpts()
 364  
     {
 365  9
         return mavenOpts;
 366  
     }
 367  
 
 368  
     public InvocationRequest setMavenOpts( String mavenOpts )
 369  
     {
 370  0
         this.mavenOpts = mavenOpts;
 371  0
         return this;
 372  
     }
 373  
     
 374  
     public boolean isActivatedReactor()
 375  
     {
 376  14
         return activatedReactor;
 377  
     }
 378  
 
 379  
     public String[] getActivatedReactorIncludes()
 380  
     {
 381  2
         return activatedReactorIncludes;
 382  
     }
 383  
 
 384  
     public String[] getActivatedReactorExcludes()
 385  
     {
 386  2
         return activatedReactorExcludes;
 387  
     }
 388  
 
 389  
     /**
 390  
      * @see org.apache.maven.shared.invoker.InvocationRequest#isShowVersion()
 391  
      */
 392  
     public boolean isShowVersion()
 393  
     {
 394  17
         return this.showVersion;
 395  
     }
 396  
 
 397  
     /**
 398  
      * @see org.apache.maven.shared.invoker.InvocationRequest#setShowVersion(boolean)
 399  
      */
 400  
     public InvocationRequest setShowVersion( boolean showVersion )
 401  
     {
 402  0
         this.showVersion = showVersion;
 403  0
         return this;
 404  
     }
 405  
 
 406  
 }