View Javadoc

1   package org.apache.tomcat.maven.common.config;
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.commons.lang.StringUtils;
23  import org.apache.maven.artifact.Artifact;
24  
25  import java.io.File;
26  
27  /**
28   * @since 2.0
29   */
30  public abstract class AbstractWebapp
31  {
32  
33      /**
34       *
35       */
36      private String groupId;
37  
38      /**
39       *
40       */
41      private String artifactId;
42  
43      /**
44       *
45       */
46      private String version = null;
47  
48      /**
49       *
50       */
51      private String type = "war";
52  
53      /**
54       *
55       */
56      private String classifier;
57  
58      /**
59       * @parameter
60       */
61      private String contextPath;
62  
63      private Artifact artifact;
64  
65      private File contextFile;
66  
67      private boolean asWebapp = false;
68  
69      public AbstractWebapp()
70      {
71          super();
72      }
73  
74      public AbstractWebapp( Artifact artifact )
75      {
76          this.setArtifact( artifact );
77          this.setGroupId( artifact.getGroupId() );
78          this.setArtifactId( artifact.getArtifactId() );
79          this.setVersion( artifact.getVersion() );
80          this.setClassifier( artifact.getClassifier() );
81          this.setType( artifact.getType() );
82      }
83  
84      public String getGroupId()
85      {
86          return groupId;
87      }
88  
89      public void setGroupId( String groupId )
90      {
91          this.groupId = groupId;
92      }
93  
94      public String getArtifactId()
95      {
96          return artifactId;
97      }
98  
99      public void setArtifactId( String artifactId )
100     {
101         this.artifactId = artifactId;
102     }
103 
104     public String getVersion()
105     {
106         return version;
107     }
108 
109     public void setVersion( String version )
110     {
111         this.version = version;
112     }
113 
114     public String getType()
115     {
116         return type;
117     }
118 
119     public void setType( String type )
120     {
121         this.type = type;
122     }
123 
124     public String getClassifier()
125     {
126         return classifier;
127     }
128 
129     public void setClassifier( String classifier )
130     {
131         this.classifier = classifier;
132     }
133 
134     public String getContextPath()
135     {
136         if ( StringUtils.isEmpty( contextPath ) )
137         {
138             return this.artifactId;
139         }
140         return contextPath;
141     }
142 
143     public void setContextPath( String contextPath )
144     {
145         this.contextPath = contextPath;
146     }
147 
148     public Artifact getArtifact()
149     {
150         return artifact;
151     }
152 
153     public void setArtifact( Artifact artifact )
154     {
155         this.artifact = artifact;
156     }
157 
158     public void setContextFile( File contextFile )
159     {
160         this.contextFile = contextFile;
161     }
162 
163     public File getContextFile()
164     {
165         return contextFile;
166     }
167 
168     public boolean isAsWebapp()
169     {
170         return asWebapp;
171     }
172 
173     public void setAsWebapp( boolean asWebapp )
174     {
175         this.asWebapp = asWebapp;
176     }
177 }