1 package org.apache.archiva.metadata.repository;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import org.apache.archiva.metadata.model.ArtifactMetadata;
23 import org.apache.archiva.metadata.model.MetadataFacet;
24 import org.apache.archiva.metadata.model.ProjectMetadata;
25 import org.apache.archiva.metadata.model.ProjectVersionMetadata;
26 import org.apache.archiva.metadata.model.ProjectVersionReference;
28 import java.util.Collection;
29 import java.util.Date;
30 import java.util.List;
32 public interface MetadataRepository
35 * Update metadata for a particular project in the metadata repository, or create it if it does not already exist.
37 * @param repositoryId the repository the project is in
38 * @param project the project metadata to create or update
40 void updateProject( String repositoryId, ProjectMetadata project )
41 throws MetadataRepositoryException;
43 void updateArtifact( String repositoryId, String namespace, String projectId, String projectVersion,
44 ArtifactMetadata artifactMeta )
45 throws MetadataRepositoryException;
47 void updateProjectVersion( String repositoryId, String namespace, String projectId,
48 ProjectVersionMetadata versionMetadata )
49 throws MetadataRepositoryException;
51 void updateNamespace( String repositoryId, String namespace )
52 throws MetadataRepositoryException;
54 List<String> getMetadataFacets( String repositoryId, String facetId )
55 throws MetadataRepositoryException;
57 MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
58 throws MetadataRepositoryException;
60 void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
61 throws MetadataRepositoryException;
63 void removeMetadataFacets( String repositoryId, String facetId )
64 throws MetadataRepositoryException;
66 void removeMetadataFacet( String repositoryId, String facetId, String name )
67 throws MetadataRepositoryException;
69 List<ArtifactMetadata> getArtifactsByDateRange( String repositoryId, Date startTime, Date endTime )
70 throws MetadataRepositoryException;
72 // TODO: remove from API, just use configuration
73 Collection<String> getRepositories()
74 throws MetadataRepositoryException;
76 List<ArtifactMetadata> getArtifactsByChecksum( String repositoryId, String checksum )
77 throws MetadataRepositoryException;
79 void removeArtifact( String repositoryId, String namespace, String project, String version, String id )
80 throws MetadataRepositoryException;
82 void removeArtifact( ArtifactMetadata artifactMetadata, String baseVersion )
83 throws MetadataRepositoryException;
90 * @param metadataFacet will remove artifacts which have this {@link MetadataFacet} using equals
91 * @throws MetadataRepositoryException
94 void removeArtifact( String repositoryId, String namespace, String project, String version,
95 MetadataFacet metadataFacet )
96 throws MetadataRepositoryException;
99 * Delete a repository's metadata. This includes all associated metadata facets.
101 * @param repositoryId the repository to delete
103 void removeRepository( String repositoryId )
104 throws MetadataRepositoryException;
106 List<ArtifactMetadata> getArtifacts( String repositoryId )
107 throws MetadataRepositoryException;
109 ProjectMetadata getProject( String repoId, String namespace, String projectId )
110 throws MetadataResolutionException;
112 ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId, String projectVersion )
113 throws MetadataResolutionException;
115 Collection<String> getArtifactVersions( String repoId, String namespace, String projectId, String projectVersion )
116 throws MetadataResolutionException;
119 * Retrieve project references from the metadata repository. Note that this is not built into the content model for
120 * a project version as a reference may be present (due to reverse-lookup of dependencies) before the actual
121 * project is, and we want to avoid adding a stub model to the content repository.
123 * @param repoId the repository ID to look within
124 * @param namespace the namespace of the project to get references to
125 * @param projectId the identifier of the project to get references to
126 * @param projectVersion the version of the project to get references to
127 * @return a list of project references
129 Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, String projectId,
130 String projectVersion )
131 throws MetadataResolutionException;
133 Collection<String> getRootNamespaces( String repoId )
134 throws MetadataResolutionException;
136 Collection<String> getNamespaces( String repoId, String namespace )
137 throws MetadataResolutionException;
139 Collection<String> getProjects( String repoId, String namespace )
140 throws MetadataResolutionException;
142 Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
143 throws MetadataResolutionException;
145 Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
146 String projectVersion )
147 throws MetadataResolutionException;
152 throws MetadataRepositoryException;
156 boolean canObtainAccess( Class<?> aClass );
158 Object obtainAccess( Class<?> aClass )
159 throws MetadataRepositoryException;