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.artifact.repository.metadata;
20  
21  import org.apache.maven.artifact.repository.ArtifactRepository;
22  import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
23  
24  /**
25   * Describes repository directory metadata.
26   *
27   * @author <a href="mailto:brett@apache.org">Brett Porter</a>
28   * TODO not happy about the store method - they use "this"
29   */
30  public interface RepositoryMetadata extends org.apache.maven.artifact.metadata.ArtifactMetadata {
31  
32      int RELEASE = 1;
33  
34      int SNAPSHOT = 2;
35  
36      int RELEASE_OR_SNAPSHOT = RELEASE | SNAPSHOT;
37  
38      /**
39       * Get the repository the metadata was located in.
40       *
41       * @return the repository
42       */
43      ArtifactRepository getRepository();
44  
45      /**
46       * Set the repository the metadata was located in.
47       *
48       * @param remoteRepository the repository
49       */
50      void setRepository(ArtifactRepository remoteRepository);
51  
52      /**
53       * Get the repository metadata associated with this marker.
54       *
55       * @return the metadata, or <code>null</code> if none loaded
56       */
57      Metadata getMetadata();
58  
59      /**
60       * Set the metadata contents.
61       *
62       * @param metadata the metadata
63       */
64      void setMetadata(Metadata metadata);
65  
66      /**
67       * Whether this represents a snapshot.
68       *
69       * @return if it is a snapshot
70       */
71      boolean isSnapshot();
72  
73      /**
74       * Gets the artifact quality this metadata refers to. One of {@link #RELEASE}, {@link #SNAPSHOT} or
75       * {@link #RELEASE_OR_SNAPSHOT}.
76       *
77       * @return The artifact quality this metadata refers to.
78       */
79      int getNature();
80  
81      /**
82       * Gets the policy that applies to this metadata regarding the specified repository.
83       *
84       * @param repository The repository for which to determine the policy, must not be {@code null}.
85       * @return The policy, never {@code null}.
86       */
87      ArtifactRepositoryPolicy getPolicy(ArtifactRepository repository);
88  }