View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  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,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.repository.legacy.metadata;
20  
21  import org.apache.maven.artifact.repository.ArtifactRepository;
22  import org.apache.maven.artifact.repository.metadata.RepositoryMetadataStoreException;
23  
24  /**
25   * Contains metadata about an artifact, and methods to retrieve/store it from an artifact repository.
26   * TODO merge with artifactmetadatasource
27   * TODO retrieval exception not appropriate for store
28   *
29   * @author <a href="mailto:brett@apache.org">Brett Porter</a>
30   */
31  public interface ArtifactMetadata {
32      /**
33       * Whether this metadata should be stored alongside the artifact.
34       *
35       * @return whether this metadata should be stored alongside the artifact
36       */
37      boolean storedInArtifactVersionDirectory();
38  
39      /**
40       * Whether this metadata should be stored alongside the group.
41       *
42       * @return whether this metadata should be stored alongside the group
43       */
44      boolean storedInGroupDirectory();
45  
46      String getGroupId();
47  
48      String getArtifactId();
49  
50      String getBaseVersion();
51  
52      Object getKey();
53  
54      /**
55       * Get the filename of this metadata on the local repository.
56       *
57       * @param repository the remote repository it came from
58       * @return the filename
59       */
60      String getLocalFilename(ArtifactRepository repository);
61  
62      /**
63       * Get the filename of this metadata on the remote repository.
64       *
65       * @return the filename
66       */
67      String getRemoteFilename();
68  
69      /**
70       * Merge a new metadata set into this piece of metadata.
71       * TODO this should only be needed on the repository metadata {@link org.apache.maven.artifact.metadata.ArtifactMetadata}
72       *
73       * @param metadata the new metadata
74       */
75      void merge(ArtifactMetadata metadata);
76  
77      /**
78       * Store the metadata in the local repository.
79       * TODO this should only be needed on the repository metadata {@link org.apache.maven.artifact.metadata.ArtifactMetadata}
80       *
81       * @param localRepository  the local repository
82       * @param remoteRepository the remote repository it came from
83       * @throws RepositoryMetadataStoreException in case of issue
84       */
85      void storeInLocalRepository(ArtifactRepository localRepository, ArtifactRepository remoteRepository)
86              throws RepositoryMetadataStoreException;
87  
88      String extendedToString();
89  }