001package org.apache.maven.artifact.repository.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
022import org.apache.maven.artifact.repository.ArtifactRepository;
023import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
024
025/**
026 * Describes repository directory metadata.
027 *
028 * @author <a href="mailto:brett@apache.org">Brett Porter</a>
029 * @todo not happy about the store method - they use "this"
030 */
031public interface RepositoryMetadata
032    extends org.apache.maven.artifact.metadata.ArtifactMetadata
033{
034
035    int RELEASE = 1;
036
037    int SNAPSHOT = 2;
038
039    int RELEASE_OR_SNAPSHOT = RELEASE | SNAPSHOT;
040
041    /**
042     * Get the repository the metadata was located in.
043     *
044     * @return the repository
045     */
046    ArtifactRepository getRepository();
047
048    /**
049     * Set the repository the metadata was located in.
050     *
051     * @param remoteRepository the repository
052     */
053    void setRepository( ArtifactRepository remoteRepository );
054
055    /**
056     * Get the repository metadata associated with this marker.
057     *
058     * @return the metadata, or <code>null</code> if none loaded
059     */
060    Metadata getMetadata();
061
062    /**
063     * Set the metadata contents.
064     *
065     * @param metadata the metadata
066     */
067    void setMetadata( Metadata metadata );
068
069    /**
070     * Whether this represents a snapshot.
071     *
072     * @return if it is a snapshot
073     */
074    boolean isSnapshot();
075
076    /**
077     * Gets the artifact quality this metadata refers to. One of {@link #RELEASE}, {@link #SNAPSHOT} or
078     * {@link #RELEASE_OR_SNAPSHOT}.
079     *
080     * @return The artifact quality this metadata refers to.
081     */
082    int getNature();
083
084    /**
085     * Gets the policy that applies to this metadata regarding the specified repository.
086     *
087     * @param repository The repository for which to determine the policy, must not be {@code null}.
088     * @return The policy, never {@code null}.
089     */
090    ArtifactRepositoryPolicy getPolicy( ArtifactRepository repository );
091
092}