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  import org.codehaus.plexus.component.annotations.Component;
23  
24  /**
25   * @author <a href="mailto:brett@apache.org">Brett Porter</a>
26   * @author Jason van Zyl
27   * @version $Id: DefaultArtifactHandler.java 988749 2010-08-24 22:46:07Z bentmann $
28   */
29  @Component( role = ArtifactHandler.class )
30  public class DefaultArtifactHandler
31      implements ArtifactHandler
32  {
33      private String extension;
34  
35      private String type;
36  
37      private String classifier;
38  
39      private String directory;
40  
41      private String packaging;
42  
43      private boolean includesDependencies;
44  
45      private String language;
46  
47      private boolean addedToClasspath;
48  
49      public DefaultArtifactHandler()
50      {
51      }
52  
53      public DefaultArtifactHandler( String type )
54      {
55          this.type = type;
56      }
57  
58      public String getExtension()
59      {
60          if ( extension == null )
61          {
62              extension = type;
63          }
64          return extension;
65      }
66  
67      public void setExtension( String extension )
68      {
69          this.extension = extension;
70      }
71  
72      public String getType()
73      {
74          return type;
75      }
76  
77      public String getClassifier()
78      {
79          return classifier;
80      }
81  
82      public String getDirectory()
83      {
84          if ( directory == null )
85          {
86              directory = getPackaging() + "s";
87          }
88          return directory;
89      }
90  
91      public String getPackaging()
92      {
93          if ( packaging == null )
94          {
95              packaging = type;
96          }
97          return packaging;
98      }
99  
100     public boolean isIncludesDependencies()
101     {
102         return includesDependencies;
103     }
104 
105     public void setIncludesDependencies( boolean includesDependencies )
106     {
107         this.includesDependencies = includesDependencies;
108     }
109 
110     public String getLanguage()
111     {
112         if ( language == null )
113         {
114             language = "none";
115         }
116 
117         return language;
118     }
119 
120     public void setLanguage( String language )
121     {
122         this.language = language;
123     }
124 
125     public boolean isAddedToClasspath()
126     {
127         return addedToClasspath;
128     }
129 
130     public void setAddedToClasspath( boolean addedToClasspath )
131     {
132         this.addedToClasspath = addedToClasspath;
133     }
134 
135 }