View Javadoc

1   package org.apache.maven.plugin.war.stub;
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  
24  /**
25   * Stub
26   */
27  public class WarArtifactStub
28      extends AbstractArtifactStub
29  {
30  
31      private String groupId;
32  
33      private String artifactId;
34  
35      private String classifier;
36  
37      private File file;
38  
39      public WarArtifactStub( String _basedir )
40      {
41          super( _basedir );
42      }
43  
44      public String getType()
45      {
46          return "war";
47      }
48  
49      public String getArtifactId()
50      {
51          if ( artifactId == null )
52          {
53              return "simple";
54          }
55          else
56          {
57              return artifactId;
58          }
59      }
60  
61      public void setArtifactId( String _artifactId )
62      {
63          artifactId = _artifactId;
64      }
65  
66  
67      public String getGroupId()
68      {
69          if ( groupId == null )
70          {
71              return "wartests";
72          }
73          else
74          {
75              return groupId;
76          }
77      }
78  
79      public void setGroupId( String groupId )
80      {
81          this.groupId = groupId;
82      }
83  
84      public File getFile()
85      {
86          if ( file == null )
87          {
88              return new File( basedir, "/target/test-classes/unit/sample_wars/simple.war" );
89          }
90          else
91          {
92              return file;
93          }
94      }
95  
96      public void setFile( File _file )
97      {
98          file = _file;
99      }
100 
101     public String getClassifier()
102     {
103         return classifier;
104     }
105 
106     public void setClassifier( String classifier )
107     {
108         this.classifier = classifier;
109     }
110 
111     public boolean hasClassifier()
112     {
113         return classifier != null;
114     }
115 }