Coverage Report - org.apache.maven.archetype.ArchetypeGenerationRequest
 
Classes in this File Line Coverage Branch Coverage Complexity
ArchetypeGenerationRequest
65%
49/75
N/A
1
 
 1  
 package org.apache.maven.archetype;
 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.apache.maven.archetype.catalog.Archetype;
 23  
 import org.apache.maven.artifact.repository.ArtifactRepository;
 24  
 import org.apache.maven.settings.Mirror;
 25  
 import org.apache.maven.settings.Proxy;
 26  
 import org.apache.maven.settings.Server;
 27  
 import org.apache.maven.wagon.events.TransferListener;
 28  
 
 29  
 import java.util.ArrayList;
 30  
 import java.util.List;
 31  
 import java.util.Properties;
 32  
 
 33  
 /** @author Jason van Zyl */
 34  
 public class ArchetypeGenerationRequest
 35  
 {
 36  
     private boolean offline;
 37  
 
 38  
     private boolean interactiveMode;
 39  
 
 40  
     private TransferListener transferListener;
 41  
 
 42  
     private String outputDirectory;
 43  
 
 44  
     private ArtifactRepository localRepository;
 45  
 
 46  
     private List<ArtifactRepository> remoteArtifactRepositories;
 47  
 
 48  
     private Proxy activeProxy;
 49  
 
 50  32
     private List<Server> servers = new ArrayList<Server>();
 51  
 
 52  32
     private List<Mirror> mirrors = new ArrayList<Mirror>();
 53  
 
 54  
     // Archetype definition
 55  
     private String archetypeName;
 56  
 
 57  
     private String archetypeGroupId;
 58  
 
 59  
     private String archetypeArtifactId;
 60  
 
 61  
     private String archetypeVersion;
 62  
 
 63  32
     private String archetypeGoals = "";
 64  
 
 65  
     private String archetypeRepository;
 66  
 
 67  
     // Archetype configuration
 68  
     private String groupId;
 69  
 
 70  
     private String artifactId;
 71  
 
 72  
     private String version;
 73  
 
 74  
     private String packageName;
 75  
 
 76  32
     private Properties properties = new Properties();
 77  
 
 78  
     /**
 79  
      *  @since 2.1
 80  
      */
 81  
     private String filter;
 82  
 
 83  
     public ArchetypeGenerationRequest()
 84  30
     {
 85  
         // no op
 86  30
     }
 87  
 
 88  
     public ArchetypeGenerationRequest( Archetype archetype )
 89  2
     {
 90  2
         this.archetypeGroupId = archetype.getGroupId();
 91  
 
 92  2
         this.archetypeArtifactId = archetype.getArtifactId();
 93  
 
 94  2
         this.archetypeVersion = archetype.getVersion();
 95  
 
 96  2
         this.archetypeRepository = archetype.getRepository();
 97  2
     }
 98  
 
 99  
     public String getArchetypeGroupId()
 100  
     {
 101  92
         return archetypeGroupId;
 102  
     }
 103  
 
 104  
     public ArchetypeGenerationRequest setArchetypeGroupId( String archetypeGroupId )
 105  
     {
 106  30
         this.archetypeGroupId = archetypeGroupId;
 107  
 
 108  30
         return this;
 109  
     }
 110  
 
 111  
     public String getArchetypeArtifactId()
 112  
     {
 113  148
         return archetypeArtifactId;
 114  
     }
 115  
 
 116  
     public ArchetypeGenerationRequest setArchetypeArtifactId( String archetypeArtifactId )
 117  
     {
 118  30
         this.archetypeArtifactId = archetypeArtifactId;
 119  
 
 120  30
         return this;
 121  
     }
 122  
 
 123  
     public String getArchetypeVersion()
 124  
     {
 125  118
         return archetypeVersion;
 126  
     }
 127  
 
 128  
     public ArchetypeGenerationRequest setArchetypeVersion( String archetypeVersion )
 129  
     {
 130  30
         this.archetypeVersion = archetypeVersion;
 131  
 
 132  30
         return this;
 133  
     }
 134  
 
 135  
     public String getArchetypeGoals()
 136  
     {
 137  0
         return archetypeGoals;
 138  
     }
 139  
 
 140  
     public ArchetypeGenerationRequest setArchetypeGoals( String archetypeGoals )
 141  
     {
 142  0
         this.archetypeGoals = archetypeGoals;
 143  
 
 144  0
         return this;
 145  
     }
 146  
 
 147  
     public String getArchetypeName()
 148  
     {
 149  0
         return archetypeName;
 150  
     }
 151  
 
 152  
     public ArchetypeGenerationRequest setArchetypeName( String archetypeName )
 153  
     {
 154  0
         this.archetypeName = archetypeName;
 155  
 
 156  0
         return this;
 157  
     }
 158  
 
 159  
     public String getArchetypeRepository()
 160  
     {
 161  56
         return archetypeRepository;
 162  
     }
 163  
 
 164  
     public ArchetypeGenerationRequest setArchetypeRepository( String archetypeRepository )
 165  
     {
 166  28
         this.archetypeRepository = archetypeRepository;
 167  
 
 168  28
         return this;
 169  
     }
 170  
 
 171  
     public String getArtifactId()
 172  
     {
 173  82
         return artifactId;
 174  
     }
 175  
 
 176  
     public ArchetypeGenerationRequest setArtifactId( String artifactId )
 177  
     {
 178  32
         this.artifactId = artifactId;
 179  
 
 180  32
         return this;
 181  
     }
 182  
 
 183  
     public String getGroupId()
 184  
     {
 185  58
         return groupId;
 186  
     }
 187  
 
 188  
     public ArchetypeGenerationRequest setGroupId( String groupId )
 189  
     {
 190  32
         this.groupId = groupId;
 191  
 
 192  32
         return this;
 193  
     }
 194  
 
 195  
     public String getVersion()
 196  
     {
 197  58
         return version;
 198  
     }
 199  
 
 200  
     public ArchetypeGenerationRequest setVersion( String version )
 201  
     {
 202  32
         this.version = version;
 203  
 
 204  32
         return this;
 205  
     }
 206  
 
 207  
     public String getPackage()
 208  
     {
 209  112
         return packageName;
 210  
     }
 211  
 
 212  
     public ArchetypeGenerationRequest setPackage( String packageName )
 213  
     {
 214  32
         this.packageName = packageName;
 215  
 
 216  32
         return this;
 217  
     }
 218  
 
 219  
     public Properties getProperties()
 220  
     {
 221  270
         return properties;
 222  
     }
 223  
 
 224  
     public ArchetypeGenerationRequest setProperties( Properties additionalProperties )
 225  
     {
 226  28
         this.properties = additionalProperties;
 227  
 
 228  28
         return this;
 229  
     }
 230  
 
 231  
     public ArtifactRepository getLocalRepository()
 232  
     {
 233  32
         return localRepository;
 234  
     }
 235  
 
 236  
     public ArchetypeGenerationRequest setLocalRepository( ArtifactRepository localRepository )
 237  
     {
 238  32
         this.localRepository = localRepository;
 239  
 
 240  32
         return this;
 241  
     }
 242  
 
 243  
     public String getOutputDirectory()
 244  
     {
 245  64
         return outputDirectory;
 246  
     }
 247  
 
 248  
     public ArchetypeGenerationRequest setOutputDirectory( String outputDirectory )
 249  
     {
 250  32
         this.outputDirectory = outputDirectory;
 251  
 
 252  32
         return this;
 253  
     }
 254  
 
 255  
     public boolean isInteractiveMode()
 256  
     {
 257  2
         return interactiveMode;
 258  
     }
 259  
 
 260  
     public ArchetypeGenerationRequest setInteractiveMode( boolean interactiveMode )
 261  
     {
 262  0
         this.interactiveMode = interactiveMode;
 263  
 
 264  0
         return this;
 265  
     }
 266  
 
 267  
     public boolean isOffline()
 268  
     {
 269  0
         return offline;
 270  
     }
 271  
 
 272  
     public ArchetypeGenerationRequest setOffline( boolean offline )
 273  
     {
 274  0
         this.offline = offline;
 275  
 
 276  0
         return this;
 277  
     }
 278  
 
 279  
     public TransferListener getTransferListener()
 280  
     {
 281  0
         return transferListener;
 282  
     }
 283  
 
 284  
     public ArchetypeGenerationRequest setTransferListener( TransferListener transferListener )
 285  
     {
 286  0
         this.transferListener = transferListener;
 287  
 
 288  0
         return this;
 289  
     }
 290  
 
 291  
     public Proxy getActiveProxy()
 292  
     {
 293  0
         return activeProxy;
 294  
     }
 295  
 
 296  
     public ArchetypeGenerationRequest setActiveProxy( Proxy activeProxy )
 297  
     {
 298  0
         this.activeProxy = activeProxy;
 299  
 
 300  0
         return this;
 301  
     }
 302  
 
 303  
     public ArchetypeGenerationRequest addMirror( Mirror mirror )
 304  
     {
 305  0
         mirrors.add( mirror );
 306  
 
 307  0
         return this;
 308  
     }
 309  
 
 310  
     public List<Mirror> getMirrors()
 311  
     {
 312  0
         return mirrors;
 313  
     }
 314  
 
 315  
     public ArchetypeGenerationRequest addMirror( Server server )
 316  
     {
 317  0
         servers.add( server );
 318  
 
 319  0
         return this;
 320  
     }
 321  
 
 322  
     public List<Server> getServers()
 323  
     {
 324  0
         return servers;
 325  
     }
 326  
 
 327  
     public List<ArtifactRepository> getRemoteArtifactRepositories()
 328  
     {
 329  2
         return remoteArtifactRepositories;
 330  
     }
 331  
 
 332  
     public ArchetypeGenerationRequest setRemoteArtifactRepositories( List<ArtifactRepository>  remoteArtifactRepositories )
 333  
     {
 334  2
         this.remoteArtifactRepositories = remoteArtifactRepositories;
 335  
 
 336  2
         return this;
 337  
     }
 338  
 
 339  
     public String getFilter()
 340  
     {
 341  0
         return filter;
 342  
     }
 343  
 
 344  
     public ArchetypeGenerationRequest setFilter( String filter )
 345  
     {
 346  0
         this.filter = filter;
 347  
 
 348  0
         return this;
 349  
     }
 350  
 }