View Javadoc
1   package org.codehaus.plexus.component.repository;
2   
3   /*
4    * Copyright 2001-2006 Codehaus Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *      http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  /**
20   * This represents a project which this component depends upon to function
21   * properly, for example, a required jar file. See Apache Maven for an
22   * example of a dependency in action.
23   * 
24   * @author Jason van Zyl
25   * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
26   * @version $Id$
27   */
28  public class ComponentDependency
29  {
30      private static final String DEAULT_DEPENDENCY_TYPE = "jar";
31      
32      private String groupId;
33  
34      private String artifactId;
35  
36      private String type = DEAULT_DEPENDENCY_TYPE;
37  
38      private String version;
39  
40      /**
41       * Gets a key for an artifact, which is an alias for a specific
42       * project timeline in a group.
43       * @return a key for an artifact
44       */
45      public String getArtifactId()
46      {
47          return artifactId;
48      }
49  
50      /**
51       * Sets the dependency's artifact ID.
52       * @param artifactId the artifact ID
53       */
54      public void setArtifactId(String artifactId)
55      {
56          this.artifactId = artifactId;
57      }
58  
59      /**
60       * Gets a key for a group, which represents a set of artifacts timelines.
61       * @return a key for a group
62       */
63      public String getGroupId()
64      {
65          return groupId;
66      }
67  
68      /**
69       * Sets the dependency's group ID.
70       * @param groupId the group ID
71       */
72      public void setGroupId(String groupId)
73      {
74          this.groupId = groupId;
75      }
76  
77      /**
78       * Gets the type of dependency, for example a "jar".
79       * @return the type of dependency
80       */
81      public String getType()
82      {
83          return type;
84      }
85  
86      /**
87       * Sets the dependency project's type.
88       * @param type the dependency's type
89       */
90      public void setType(String type)
91      {
92          this.type = type;
93      }
94  
95      /**
96       * Returns a specific point in a project's timeline.
97       * i.e. version 1, or 2.1.4
98       * @return a specific point in a project's timeline
99       */
100     public String getVersion()
101     {
102         return version;
103     }
104 
105     /**
106      * Sets the point in a project's development timeline
107      * @param version the project's version
108      */
109     public void setVersion(String version)
110     {
111         this.version = version;
112     }
113 
114     public String toString()
115     {
116         StringBuilder sb = new StringBuilder();
117 
118         sb.append( "groupId = " ).append( groupId ).
119             append( ", artifactId = " ).append( artifactId ).
120             append( ", version = " ).append( version ).
121             append( ", type = " ).append( type );
122 
123         return sb.toString();
124     }
125 }