001package org.apache.archiva.metadata.repository;
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.archiva.metadata.model.ArtifactMetadata;
023import org.apache.archiva.metadata.model.ProjectVersionMetadata;
024import org.apache.archiva.metadata.model.ProjectVersionReference;
025
026import java.util.Collection;
027
028public interface MetadataResolver
029{
030    ProjectVersionMetadata resolveProjectVersion( RepositorySession session, String repoId, String namespace,
031                                                  String projectId, String projectVersion )
032        throws MetadataResolutionException;
033
034    /**
035     * Retrieve project references from the metadata repository. Note that this is not built into the content model for
036     * a project version as a reference may be present (due to reverse-lookup of dependencies) before the actual
037     * project is, and we want to avoid adding a stub model to the content repository.
038     *
039     * @param repoId         the repository ID to look within
040     * @param namespace      the namespace of the project to get references to
041     * @param projectId      the identifier of the project to get references to
042     * @param projectVersion the version of the project to get references to
043     * @return a list of project references
044     */
045    Collection<ProjectVersionReference> resolveProjectReferences( RepositorySession session, String repoId,
046                                                                  String namespace, String projectId,
047                                                                  String projectVersion )
048        throws MetadataResolutionException;
049
050    Collection<String> resolveRootNamespaces( RepositorySession session, String repoId )
051        throws MetadataResolutionException;
052
053    Collection<String> resolveNamespaces( RepositorySession session, String repoId, String namespace )
054        throws MetadataResolutionException;
055
056    Collection<String> resolveProjects( RepositorySession session, String repoId, String namespace )
057        throws MetadataResolutionException;
058
059    Collection<String> resolveProjectVersions( RepositorySession session, String repoId, String namespace,
060                                               String projectId )
061        throws MetadataResolutionException;
062
063    Collection<ArtifactMetadata> resolveArtifacts( RepositorySession session, String repoId, String namespace,
064                                                   String projectId, String projectVersion )
065        throws MetadataResolutionException;
066}