001 package org.apache.maven.repository.legacy.metadata;
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 org.apache.maven.artifact.repository.ArtifactRepository;
023 import org.apache.maven.artifact.repository.metadata.RepositoryMetadataStoreException;
024
025 /**
026 * Contains metadata about an artifact, and methods to retrieve/store it from an artifact repository.
027 *
028 * @author <a href="mailto:brett@apache.org">Brett Porter</a>
029 * @todo merge with artifactmetadatasource
030 * @todo retrieval exception not appropriate for store
031 */
032 public interface ArtifactMetadata
033 {
034 /** Whether this metadata should be stored alongside the artifact. */
035 boolean storedInArtifactVersionDirectory();
036
037 /** Whether this metadata should be stored alongside the group. */
038 boolean storedInGroupDirectory();
039
040 String getGroupId();
041
042 String getArtifactId();
043
044 String getBaseVersion();
045
046 Object getKey();
047
048 /**
049 * Get the filename of this metadata on the local repository.
050 *
051 * @param repository the remote repository it came from
052 * @return the filename
053 */
054 String getLocalFilename( ArtifactRepository repository );
055
056 /**
057 * Get the filename of this metadata on the remote repository.
058 *
059 * @return the filename
060 */
061 String getRemoteFilename();
062
063 /**
064 * Merge a new metadata set into this piece of metadata.
065 *
066 * @param metadata the new metadata
067 * @todo this should only be needed on the repository metadata
068 */
069 void merge( ArtifactMetadata metadata );
070
071 /**
072 * Store the metadata in the local repository.
073 *
074 * @param localRepository the local repository
075 * @param remoteRepository the remote repository it came from
076 * @todo this should only be needed on the repository metadata
077 */
078 void storeInLocalRepository( ArtifactRepository localRepository,
079 ArtifactRepository remoteRepository )
080 throws RepositoryMetadataStoreException;
081
082 String extendedToString();
083 }