Coverage Report - org.apache.maven.artifact.Artifact
 
Classes in this File Line Coverage Branch Coverage Complexity
Artifact
N/A
N/A
1
 
 1  
 package org.apache.maven.artifact;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *  http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import org.apache.maven.artifact.handler.ArtifactHandler;
 23  
 import org.apache.maven.artifact.metadata.ArtifactMetadata;
 24  
 import org.apache.maven.artifact.repository.ArtifactRepository;
 25  
 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
 26  
 import org.apache.maven.artifact.versioning.ArtifactVersion;
 27  
 import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
 28  
 import org.apache.maven.artifact.versioning.VersionRange;
 29  
 
 30  
 import java.io.File;
 31  
 import java.util.Collection;
 32  
 import java.util.List;
 33  
 import java.util.regex.Pattern;
 34  
 
 35  
 /**
 36  
  * Description of an artifact.
 37  
  *
 38  
  * @todo do we really need an interface here?
 39  
  * @todo get rid of the multiple states we can have (project, parent, etc artifacts, file == null, snapshot, etc) - construct subclasses and use accordingly?
 40  
  */
 41  
 public interface Artifact
 42  
     extends Comparable
 43  
 {
 44  
     String LATEST_VERSION = "LATEST";
 45  
 
 46  
     String SNAPSHOT_VERSION = "SNAPSHOT";
 47  
 
 48  
     Pattern VERSION_FILE_PATTERN = Pattern.compile( "^(.*)-([0-9]{8}.[0-9]{6})-([0-9]+)$" );
 49  
 
 50  
     // TODO: into scope handler
 51  
     String SCOPE_COMPILE = "compile";
 52  
 
 53  
     String SCOPE_TEST = "test";
 54  
 
 55  
     String SCOPE_RUNTIME = "runtime";
 56  
 
 57  
     String SCOPE_PROVIDED = "provided";
 58  
 
 59  
     String SCOPE_SYSTEM = "system";
 60  
 
 61  
     String SCOPE_IMPORT = "import";   // Used to import dependencyManagement dependencies
 62  
 
 63  
     String RELEASE_VERSION = "RELEASE";
 64  
 
 65  
     String getGroupId();
 66  
 
 67  
     String getArtifactId();
 68  
 
 69  
     String getVersion();
 70  
 
 71  
     void setVersion( String version );
 72  
 
 73  
     /**
 74  
      * Get the scope of the artifact. If the artifact is a standalone rather than a dependency, it's scope will be
 75  
      * <code>null</code>. The scope may not be the same as it was declared on the original dependency, as this is the
 76  
      * result of combining it with the main project scope.
 77  
      *
 78  
      * @return the scope
 79  
      */
 80  
     String getScope();
 81  
 
 82  
     String getType();
 83  
 
 84  
     String getClassifier();
 85  
 
 86  
     // only providing this since classifier is *very* optional...
 87  
     boolean hasClassifier();
 88  
 
 89  
     File getFile();
 90  
 
 91  
     void setFile( File destination );
 92  
 
 93  
     String getBaseVersion();
 94  
 
 95  
     /**
 96  
      * @todo would like to get rid of this - or at least only have one. Base version should be immutable.
 97  
      */
 98  
     void setBaseVersion( String baseVersion );
 99  
 
 100  
     // ----------------------------------------------------------------------
 101  
 
 102  
     String getId();
 103  
 
 104  
     String getDependencyConflictId();
 105  
 
 106  
     void addMetadata( ArtifactMetadata metadata );
 107  
 
 108  
     Collection getMetadataList();
 109  
 
 110  
     void setRepository( ArtifactRepository remoteRepository );
 111  
 
 112  
     ArtifactRepository getRepository();
 113  
 
 114  
     void updateVersion( String version, ArtifactRepository localRepository );
 115  
 
 116  
     String getDownloadUrl();
 117  
 
 118  
     void setDownloadUrl( String downloadUrl );
 119  
 
 120  
     ArtifactFilter getDependencyFilter();
 121  
 
 122  
     void setDependencyFilter( ArtifactFilter artifactFilter );
 123  
 
 124  
     ArtifactHandler getArtifactHandler();
 125  
 
 126  
     /**
 127  
      * @return {@link List} &lt; {@link String} > with artifact ids
 128  
      */
 129  
     List getDependencyTrail();
 130  
 
 131  
     /**
 132  
      * @param dependencyTrail {@link List} &lt; {@link String} > with artifact ids
 133  
      */
 134  
     void setDependencyTrail( List dependencyTrail );
 135  
 
 136  
     void setScope( String scope );
 137  
 
 138  
     VersionRange getVersionRange();
 139  
 
 140  
     void setVersionRange( VersionRange newRange );
 141  
 
 142  
     void selectVersion( String version );
 143  
 
 144  
     void setGroupId( String groupId );
 145  
 
 146  
     void setArtifactId( String artifactId );
 147  
 
 148  
     boolean isSnapshot();
 149  
 
 150  
     void setResolved( boolean resolved );
 151  
 
 152  
     boolean isResolved();
 153  
 
 154  
     void setResolvedVersion( String version );
 155  
 
 156  
     /**
 157  
      * @todo remove, a quick hack for the lifecycle executor
 158  
      */
 159  
     void setArtifactHandler( ArtifactHandler handler );
 160  
 
 161  
     boolean isRelease();
 162  
 
 163  
     void setRelease( boolean release );
 164  
 
 165  
     List getAvailableVersions();
 166  
 
 167  
     void setAvailableVersions( List versions );
 168  
 
 169  
     boolean isOptional();
 170  
     
 171  
     void setOptional( boolean optional );
 172  
 
 173  
     ArtifactVersion getSelectedVersion()
 174  
         throws OverConstrainedVersionException;
 175  
 
 176  
     boolean isSelectedVersionKnown()
 177  
         throws OverConstrainedVersionException;
 178  
 }