Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
InstallDeployTaskSupport |
|
| 1.75;1.75 |
1 | package org.apache.maven.artifact.ant; | |
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.util.Iterator; | |
24 | import java.util.List; | |
25 | import java.util.ArrayList; | |
26 | ||
27 | import org.apache.maven.artifact.repository.ArtifactRepository; | |
28 | ||
29 | /** | |
30 | * Support for install/deploy tasks. | |
31 | * | |
32 | * @author <a href="mailto:jdillon@apache.org">Jason Dillon</a> | |
33 | * @version $Id: InstallDeployTaskSupport.java 649861 2008-04-19 23:03:55Z hboutemy $ | |
34 | */ | |
35 | 0 | public abstract class InstallDeployTaskSupport |
36 | extends AbstractArtifactTask | |
37 | { | |
38 | protected File file; | |
39 | ||
40 | protected List attachedArtifacts; | |
41 | ||
42 | public File getFile() | |
43 | { | |
44 | 0 | return file; |
45 | } | |
46 | ||
47 | public void setFile( File file ) | |
48 | { | |
49 | 0 | this.file = file; |
50 | 0 | } |
51 | ||
52 | public Pom buildPom( ArtifactRepository localArtifactRepository ) | |
53 | { | |
54 | 0 | Pom pom = super.buildPom( localArtifactRepository ); |
55 | ||
56 | // attach artifacts | |
57 | 0 | if ( attachedArtifacts != null ) |
58 | { | |
59 | 0 | Iterator iter = attachedArtifacts.iterator(); |
60 | ||
61 | 0 | while ( iter.hasNext() ) |
62 | { | |
63 | 0 | AttachedArtifact attached = (AttachedArtifact) iter.next(); |
64 | 0 | pom.attach( attached ); |
65 | 0 | } |
66 | } | |
67 | ||
68 | 0 | return pom; |
69 | } | |
70 | ||
71 | public AttachedArtifact createAttach() | |
72 | { | |
73 | 0 | if ( attachedArtifacts == null ) |
74 | { | |
75 | 0 | attachedArtifacts = new ArrayList(); |
76 | } | |
77 | ||
78 | 0 | AttachedArtifact attach = new AttachedArtifact(); |
79 | 0 | attachedArtifacts.add( attach ); |
80 | ||
81 | 0 | return attach; |
82 | } | |
83 | } |