1   package org.apache.tomcat.maven.common.config;
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
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  
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  
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 }