KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > maven > artifact > Artifact


1 package org.apache.maven.artifact;
2
3 /*
4  * Copyright 2001-2005 The Apache Software 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 import org.apache.maven.artifact.handler.ArtifactHandler;
20 import org.apache.maven.artifact.metadata.ArtifactMetadata;
21 import org.apache.maven.artifact.repository.ArtifactRepository;
22 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
23 import org.apache.maven.artifact.versioning.ArtifactVersion;
24 import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
25 import org.apache.maven.artifact.versioning.VersionRange;
26
27 import java.io.File JavaDoc;
28 import java.util.Collection JavaDoc;
29 import java.util.List JavaDoc;
30 import java.util.regex.Pattern JavaDoc;
31
32 /**
33  * Description of an artifact.
34  *
35  * @todo do we really need an interface here?
36  * @todo get rid of the multiple states we can have (project, parent, etc artifacts, file == null, snapshot, etc) - construct subclasses and use accordingly?
37  */

38 public interface Artifact
39     extends Comparable JavaDoc
40 {
41     String JavaDoc LATEST_VERSION = "LATEST";
42
43     String JavaDoc SNAPSHOT_VERSION = "SNAPSHOT";
44
45     Pattern JavaDoc VERSION_FILE_PATTERN = Pattern.compile( "^(.*)-([0-9]{8}.[0-9]{6})-([0-9]+)$" );
46
47     // TODO: into scope handler
48
String JavaDoc SCOPE_COMPILE = "compile";
49
50     String JavaDoc SCOPE_TEST = "test";
51
52     String JavaDoc SCOPE_RUNTIME = "runtime";
53
54     String JavaDoc SCOPE_PROVIDED = "provided";
55
56     String JavaDoc SCOPE_SYSTEM = "system";
57
58     String JavaDoc RELEASE_VERSION = "RELEASE";
59
60     String JavaDoc getGroupId();
61
62     String JavaDoc getArtifactId();
63
64     String JavaDoc getVersion();
65
66     void setVersion( String JavaDoc version );
67
68     /**
69      * Get the scope of the artifact. If the artifact is a standalone rather than a dependency, it's scope will be
70      * <code>null</code>. The scope may not be the same as it was declared on the original dependency, as this is the
71      * result of combining it with the main project scope.
72      *
73      * @return the scope
74      */

75     String JavaDoc getScope();
76
77     String JavaDoc getType();
78
79     String JavaDoc getClassifier();
80
81     // only providing this since classifier is *very* optional...
82
boolean hasClassifier();
83
84     File JavaDoc getFile();
85
86     void setFile( File JavaDoc destination );
87
88     String JavaDoc getBaseVersion();
89
90     /**
91      * @todo would like to get rid of this - or at least only have one. Base version should be immutable.
92      */

93     void setBaseVersion( String JavaDoc baseVersion );
94
95     // ----------------------------------------------------------------------
96

97     String JavaDoc getId();
98
99     String JavaDoc getDependencyConflictId();
100
101     void addMetadata( ArtifactMetadata metadata );
102
103     Collection JavaDoc getMetadataList();
104
105     void setRepository( ArtifactRepository remoteRepository );
106
107     ArtifactRepository getRepository();
108
109     void updateVersion( String JavaDoc version, ArtifactRepository localRepository );
110
111     String JavaDoc getDownloadUrl();
112
113     void setDownloadUrl( String JavaDoc downloadUrl );
114
115     ArtifactFilter getDependencyFilter();
116
117     void setDependencyFilter( ArtifactFilter artifactFilter );
118
119     ArtifactHandler getArtifactHandler();
120
121     List JavaDoc getDependencyTrail();
122
123     void setDependencyTrail( List JavaDoc dependencyTrail );
124
125     void setScope( String JavaDoc scope );
126
127     VersionRange getVersionRange();
128
129     void setVersionRange( VersionRange newRange );
130
131     void selectVersion( String JavaDoc version );
132
133     void setGroupId( String JavaDoc groupId );
134
135     void setArtifactId( String JavaDoc artifactId );
136
137     boolean isSnapshot();
138
139     void setResolved( boolean resolved );
140
141     boolean isResolved();
142
143     void setResolvedVersion( String JavaDoc version );
144
145     /**
146      * @todo remove, a quick hack for the lifecycle executor
147      */

148     void setArtifactHandler( ArtifactHandler handler );
149
150     boolean isRelease();
151
152     void setRelease( boolean release );
153
154     List JavaDoc getAvailableVersions();
155
156     void setAvailableVersions( List JavaDoc versions );
157
158     boolean isOptional();
159     
160     void setOptional( boolean optional );
161
162     ArtifactVersion getSelectedVersion()
163         throws OverConstrainedVersionException;
164
165     boolean isSelectedVersionKnown()
166         throws OverConstrainedVersionException;
167 }
Popular Tags