001package org.apache.maven.artifact.handler;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *  http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import org.codehaus.plexus.component.annotations.Component;
023
024/**
025 * @author <a href="mailto:brett@apache.org">Brett Porter</a>
026 * @author Jason van Zyl
027 */
028@Component( role = ArtifactHandler.class )
029public class DefaultArtifactHandler
030    implements ArtifactHandler
031{
032    private String extension;
033
034    private String type;
035
036    private String classifier;
037
038    private String directory;
039
040    private String packaging;
041
042    private boolean includesDependencies;
043
044    private String language;
045
046    private boolean addedToClasspath;
047
048    public DefaultArtifactHandler()
049    {
050    }
051
052    public DefaultArtifactHandler( String type )
053    {
054        this.type = type;
055    }
056
057    public String getExtension()
058    {
059        if ( extension == null )
060        {
061            extension = type;
062        }
063        return extension;
064    }
065
066    public void setExtension( String extension )
067    {
068        this.extension = extension;
069    }
070
071    public String getType()
072    {
073        return type;
074    }
075
076    public String getClassifier()
077    {
078        return classifier;
079    }
080
081    public String getDirectory()
082    {
083        if ( directory == null )
084        {
085            directory = getPackaging() + "s";
086        }
087        return directory;
088    }
089
090    public String getPackaging()
091    {
092        if ( packaging == null )
093        {
094            packaging = type;
095        }
096        return packaging;
097    }
098
099    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}