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