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