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.ArrayList;
24 import java.util.List;
25
26 import org.apache.maven.artifact.repository.ArtifactRepository;
27
28 /**
29 * Support for install/deploy tasks.
30 *
31 * @author <a href="mailto:jdillon@apache.org">Jason Dillon</a>
32 * @version $Id: InstallDeployTaskSupport.html 806929 2012-03-01 18:57:40Z hboutemy $
33 */
34 public abstract class InstallDeployTaskSupport
35 extends AbstractArtifactTask
36 {
37 /**
38 * The file to install/deploy.
39 */
40 protected File file;
41
42 /**
43 * Additional attached artifacts to install/deploy
44 */
45 protected List<AttachedArtifact> attachedArtifacts = new ArrayList<AttachedArtifact>();
46
47 public File getFile()
48 {
49 return file;
50 }
51
52 public void setFile( File file )
53 {
54 this.file = file;
55 }
56
57 public Pom initializePom( ArtifactRepository localArtifactRepository )
58 {
59 Pom pom = super.initializePom( localArtifactRepository );
60
61 // attach artifacts
62 if ( attachedArtifacts != null )
63 {
64 for ( AttachedArtifact attached : attachedArtifacts )
65 {
66 pom.attach( attached );
67 }
68 }
69
70 return pom;
71 }
72
73 public AttachedArtifact createAttach()
74 {
75 AttachedArtifact attach = new AttachedArtifact();
76 attachedArtifacts.add( attach );
77
78 return attach;
79 }
80 }