001    package org.apache.archiva.metadata.model;
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    
022    import javax.xml.bind.annotation.XmlRootElement;
023    import java.io.Serializable;
024    
025    /**
026     * Information about a dependency that this project has on another project or artifact.
027     *
028     * @todo will be reviewing what is appropriate for the base here - rest should be in a maven dependency facet - avoid details on it externally
029     */
030    @XmlRootElement(name = "dependency")
031    public class Dependency
032        implements Serializable
033    {
034        /**
035         * The Maven classifier of the dependency.
036         */
037        private String classifier;
038    
039        /**
040         * Whether the dependency is optional or required.
041         */
042        private boolean optional;
043    
044        /**
045         * The Maven scope of the dependency - <tt>compile</tt> (default), <tt>runtime</tt>, etc.
046         */
047        private String scope;
048    
049        /**
050         * The system path of the file of the dependency artifact to use.
051         */
052        private String systemPath;
053    
054        /**
055         * The Maven type of the dependency.
056         */
057        private String type;
058    
059        /**
060         * The Maven artifact ID of the dependency.
061         */
062        private String artifactId;
063    
064        /**
065         * The Maven group ID of the dependency.
066         */
067        private String groupId;
068    
069        /**
070         * The version of the artifact to depend on. If this refers to a project version then the repository implementation
071         * may choose the most appropriate artifact version to use.
072         */
073        private String version;
074    
075        public void setClassifier( String classifier )
076        {
077            this.classifier = classifier;
078        }
079    
080        public String getClassifier()
081        {
082            return classifier;
083        }
084    
085        public void setOptional( boolean optional )
086        {
087            this.optional = optional;
088        }
089    
090        public boolean isOptional()
091        {
092            return optional;
093        }
094    
095        public void setScope( String scope )
096        {
097            this.scope = scope;
098        }
099    
100        public String getScope()
101        {
102            return scope;
103        }
104    
105        public void setSystemPath( String systemPath )
106        {
107            this.systemPath = systemPath;
108        }
109    
110        public String getSystemPath()
111        {
112            return systemPath;
113        }
114    
115        public void setType( String type )
116        {
117            this.type = type;
118        }
119    
120        public String getType()
121        {
122            return type;
123        }
124    
125        public void setArtifactId( String artifactId )
126        {
127            this.artifactId = artifactId;
128        }
129    
130        public void setGroupId( String groupId )
131        {
132            this.groupId = groupId;
133        }
134    
135        public void setVersion( String version )
136        {
137            this.version = version;
138        }
139    
140        public String getVersion()
141        {
142            return version;
143        }
144    
145        public String getArtifactId()
146        {
147            return artifactId;
148        }
149    
150        public String getGroupId()
151        {
152            return groupId;
153        }
154    
155        @Override
156        public String toString()
157        {
158            final StringBuilder sb = new StringBuilder();
159            sb.append( "Dependency" );
160            sb.append( "{classifier='" ).append( classifier ).append( '\'' );
161            sb.append( ", optional=" ).append( optional );
162            sb.append( ", scope='" ).append( scope ).append( '\'' );
163            sb.append( ", systemPath='" ).append( systemPath ).append( '\'' );
164            sb.append( ", type='" ).append( type ).append( '\'' );
165            sb.append( ", artifactId='" ).append( artifactId ).append( '\'' );
166            sb.append( ", groupId='" ).append( groupId ).append( '\'' );
167            sb.append( ", version='" ).append( version ).append( '\'' );
168            sb.append( '}' );
169            return sb.toString();
170        }
171    }