View Javadoc

1   package org.apache.maven.repository;
2   
3   /* ====================================================================
4    *   Licensed to the Apache Software Foundation (ASF) under one or more
5    *   contributor license agreements.  See the NOTICE file distributed with
6    *   this work for additional information regarding copyright ownership.
7    *   The ASF licenses this file to You under the Apache License, Version 2.0
8    *   (the "License"); you may not use this file except in compliance with
9    *   the License.  You may obtain a copy of the License at
10   *
11   *       http://www.apache.org/licenses/LICENSE-2.0
12   *
13   *   Unless required by applicable law or agreed to in writing, software
14   *   distributed under the License is distributed on an "AS IS" BASIS,
15   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   *   See the License for the specific language governing permissions and
17   *   limitations under the License.
18   * ====================================================================
19   */
20  
21  import java.io.File;
22  
23  import org.apache.maven.project.Dependency;
24  import org.apache.maven.verifier.ChecksumVerificationException;
25  
26  /**
27   * The interface defining an artifact (which probably lives in the
28   * repository).
29   *
30   * @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
31   * @version $Id: Artifact.java 517014 2007-03-11 21:15:50Z ltheussl $
32   */
33  public interface Artifact
34  {
35      public static final String OVERRIDE_NONE = null;
36  
37      public static final String OVERRIDE_VERSION = "version";
38  
39      public static final String OVERRIDE_PATH = "path";
40  
41      /**
42       * Set the dependency for this JAR artifact.
43       *
44       * @param dependency Dependency this artifact is based on.
45       */
46      void setDependency( Dependency dependency );
47  
48      /**
49       * Get the dependency.
50       *
51       * @return The dependency this artifact is based on.
52       */
53      Dependency getDependency();
54  
55      /**
56       * Set the path to the artifact. The maven jar override facilty can be
57       * used to change the path to the artifact if the user specifies the
58       * use of a specific version.
59       *
60       * @param path Path to the artifact.
61       */
62      void setPath( String path );
63  
64      /**
65       * Return the path of the artifact using platform specific naming
66       * conventions.
67       *
68       * @return Path to the artifact.
69       */
70      String getPath();
71  
72      /**
73       * Generate the path for this artifact given its dependency attributes.
74       *
75       * @return The generated path of the artifact based on the dependency attributes.
76       */
77      String generatePath();
78  
79      /**
80       * Return an URL path that is platform agnostic.
81       *
82       * @return URL of the artifact.
83       */
84      String getUrlPath();
85  
86      /**
87       * Return the url to the checksum file for this artifact.
88       *
89       * @return URL of the checksum file for this artifact.
90       */
91      String getChecksumUrl();
92  
93      /**
94       * Return the name of the artifact.
95       *
96       * @return Name of the underlying dependency.
97       */
98      String getName();
99  
100     /**
101      * Boolean flag indicating whether this artifact is a snapshot.
102      *
103      * @return Flag indicating whether this artifact is a snapshot.
104      */
105     boolean isSnapshot();
106 
107     /**
108      * Boolean flag indicating whether this artifact exists.
109      *
110      * @return Flag indicating the existance of the artifact in the local repository.
111      */
112     boolean exists();
113 
114     /**
115      * Get the location of the artifact in the local file system.
116      *
117      * @return The location of the artifact in the local file system.
118      */
119     File getFile();
120 
121     /**
122      * Verify the artifact.
123      *
124      * @throws ChecksumVerificationException if verification fails
125      */
126     void verify()
127         throws ChecksumVerificationException;
128 
129     public void setOverrideType( String overrideType );
130 
131     public String getOverrideType();
132     
133     public String getDescription();
134 }