View Javadoc

1   package org.apache.maven.artifact.handler;
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  /**
23   * @author <a href="mailto:brett@apache.org">Brett Porter</a>
24   * @version $Id: DefaultArtifactHandler.java 640549 2008-03-24 20:05:11Z bentmann $
25   */
26  public class DefaultArtifactHandler
27      implements ArtifactHandler
28  {
29      private String extension;
30  
31      private String type;
32  
33      private String classifier;
34  
35      private String directory;
36  
37      private String packaging;
38  
39      private boolean includesDependencies;
40  
41      private String language;
42  
43      private boolean addedToClasspath;
44  
45      public DefaultArtifactHandler()
46      {
47      }
48  
49      public DefaultArtifactHandler( String type )
50      {
51          this.type = type;
52      }
53  
54      public String getExtension()
55      {
56          if ( extension == null )
57          {
58              extension = type;
59          }
60          return extension;
61      }
62  
63      public String getType()
64      {
65          return type;
66      }
67  
68      public String getClassifier()
69      {
70          return classifier;
71      }
72  
73      public String getDirectory()
74      {
75          if ( directory == null )
76          {
77              directory = getPackaging() + "s";
78          }
79          return directory;
80      }
81  
82      public String getPackaging()
83      {
84          if ( packaging == null )
85          {
86              packaging = type;
87          }
88          return packaging;
89      }
90  
91      public boolean isIncludesDependencies()
92      {
93          return includesDependencies;
94      }
95  
96      public String getLanguage()
97      {
98          if ( language == null )
99          {
100             language = "none";
101         }
102 
103         return language;
104     }
105 
106     public boolean isAddedToClasspath()
107     {
108         return addedToClasspath;
109     }
110 }