View Javadoc
1   package org.apache.maven.repository.legacy.metadata;
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.repository.ArtifactRepository;
23  import org.apache.maven.artifact.repository.metadata.RepositoryMetadataStoreException;
24  
25  /**
26   * Contains metadata about an artifact, and methods to retrieve/store it from an artifact repository.
27   * TODO merge with artifactmetadatasource
28   * TODO retrieval exception not appropriate for store
29   *
30   * @author <a href="mailto:brett@apache.org">Brett Porter</a>
31   */
32  public interface ArtifactMetadata
33  {
34      /**
35       * Whether this metadata should be stored alongside the artifact.
36       *
37       * @return whether this metadata should be stored alongside the artifact
38       */
39      boolean storedInArtifactVersionDirectory();
40  
41      /**
42       * Whether this metadata should be stored alongside the group.
43       *
44       * @return whether this metadata should be stored alongside the group
45       */
46      boolean storedInGroupDirectory();
47  
48      String getGroupId();
49  
50      String getArtifactId();
51  
52      String getBaseVersion();
53  
54      Object getKey();
55  
56      /**
57       * Get the filename of this metadata on the local repository.
58       *
59       * @param repository the remote repository it came from
60       * @return the filename
61       */
62      String getLocalFilename( ArtifactRepository repository );
63  
64      /**
65       * Get the filename of this metadata on the remote repository.
66       *
67       * @return the filename
68       */
69      String getRemoteFilename();
70  
71      /**
72       * Merge a new metadata set into this piece of metadata.
73       * TODO this should only be needed on the repository metadata {@link org.apache.maven.artifact.metadata.ArtifactMetadata}
74       *
75       * @param metadata the new metadata
76       */
77      void merge( ArtifactMetadata metadata );
78  
79      /**
80       * Store the metadata in the local repository.
81       * TODO this should only be needed on the repository metadata {@link org.apache.maven.artifact.metadata.ArtifactMetadata}
82       *
83       * @param localRepository  the local repository
84       * @param remoteRepository the remote repository it came from
85       * @throws RepositoryMetadataStoreException in case of issue
86       */
87      void storeInLocalRepository( ArtifactRepository localRepository,
88                                   ArtifactRepository remoteRepository )
89          throws RepositoryMetadataStoreException;
90  
91      String extendedToString();
92  }