001    package org.apache.maven.artifact;
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 java.io.File;
023    import java.util.Collection;
024    import java.util.List;
025    import java.util.regex.Pattern;
026    
027    import org.apache.maven.artifact.handler.ArtifactHandler;
028    import org.apache.maven.artifact.metadata.ArtifactMetadata;
029    import org.apache.maven.artifact.repository.ArtifactRepository;
030    import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
031    import org.apache.maven.artifact.versioning.ArtifactVersion;
032    import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
033    import org.apache.maven.artifact.versioning.VersionRange;
034    
035    public interface Artifact
036        extends Comparable<Artifact>
037    {
038    
039        String RELEASE_VERSION = "RELEASE";
040    
041        String LATEST_VERSION = "LATEST";
042    
043        String SNAPSHOT_VERSION = "SNAPSHOT";
044    
045        Pattern VERSION_FILE_PATTERN = Pattern.compile( "^(.*)-([0-9]{8}.[0-9]{6})-([0-9]+)$" );
046    
047        // TODO: into artifactScope handler
048    
049        String SCOPE_COMPILE = "compile";
050    
051        String SCOPE_COMPILE_PLUS_RUNTIME = "compile+runtime";
052    
053        String SCOPE_TEST = "test";
054    
055        String SCOPE_RUNTIME = "runtime";
056    
057        String SCOPE_RUNTIME_PLUS_SYSTEM = "runtime+system";
058    
059        String SCOPE_PROVIDED = "provided";
060    
061        String SCOPE_SYSTEM = "system";
062    
063        String SCOPE_IMPORT = "import";   // Used to import dependencyManagement dependencies
064    
065        String getGroupId();
066    
067        String getArtifactId();
068    
069        String getVersion();
070    
071        void setVersion( String version );
072    
073        String getScope();
074    
075        String getType();
076    
077        String getClassifier();
078    
079        boolean hasClassifier();
080    
081        File getFile();
082    
083        void setFile( File destination );
084    
085        String getBaseVersion();
086    
087        void setBaseVersion( String baseVersion );
088    
089        String getId();
090    
091        String getDependencyConflictId();
092    
093        void addMetadata( ArtifactMetadata metadata );
094    
095        Collection<ArtifactMetadata> getMetadataList();
096    
097        void setRepository( ArtifactRepository remoteRepository );
098    
099        ArtifactRepository getRepository();
100    
101        void updateVersion( String version, ArtifactRepository localRepository );
102    
103        String getDownloadUrl();
104    
105        void setDownloadUrl( String downloadUrl );
106    
107        ArtifactFilter getDependencyFilter();
108    
109        void setDependencyFilter( ArtifactFilter artifactFilter );
110    
111        ArtifactHandler getArtifactHandler();
112    
113        List<String> getDependencyTrail();
114    
115        void setDependencyTrail( List<String> dependencyTrail );
116    
117        void setScope( String scope );
118    
119        VersionRange getVersionRange();
120    
121        void setVersionRange( VersionRange newRange );
122    
123        void selectVersion( String version );
124    
125        void setGroupId( String groupId );
126    
127        void setArtifactId( String artifactId );
128    
129        boolean isSnapshot();
130    
131        void setResolved( boolean resolved );
132    
133        boolean isResolved();
134    
135        void setResolvedVersion( String version );
136    
137        void setArtifactHandler( ArtifactHandler handler );
138    
139        boolean isRelease();
140    
141        void setRelease( boolean release );
142    
143        List<ArtifactVersion> getAvailableVersions();
144    
145        void setAvailableVersions( List<ArtifactVersion> versions );
146    
147        boolean isOptional();
148    
149        void setOptional( boolean optional );
150    
151        ArtifactVersion getSelectedVersion()
152            throws OverConstrainedVersionException;
153    
154        boolean isSelectedVersionKnown()
155            throws OverConstrainedVersionException;
156    
157    }