This project has retired. For details please refer to its Attic page.
Source code
001package org.apache.archiva.metadata.repository.storage;
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.admin.model.beans.ManagedRepository;
023import org.apache.archiva.metadata.model.ArtifactMetadata;
024import org.apache.archiva.metadata.model.ProjectMetadata;
025import org.apache.archiva.metadata.model.ProjectVersionMetadata;
026import org.apache.archiva.metadata.repository.filter.Filter;
027import org.apache.archiva.model.ArtifactReference;
028import org.apache.archiva.policies.ProxyDownloadException;
029import org.apache.archiva.repository.ManagedRepositoryContent;
030import org.apache.archiva.xml.XMLException;
031
032import java.util.Collection;
033
034// FIXME: we should drop the repositoryId parameters and attach this to an instance of a repository storage
035public interface RepositoryStorage
036{
037    ProjectMetadata readProjectMetadata( String repoId, String namespace, String projectId );
038
039    ProjectVersionMetadata readProjectVersionMetadata( ReadMetadataRequest readMetadataRequest )
040        throws RepositoryStorageMetadataInvalidException, RepositoryStorageMetadataNotFoundException,
041        RepositoryStorageRuntimeException;
042
043    Collection<String> listRootNamespaces( String repoId, Filter<String> filter )
044        throws RepositoryStorageRuntimeException;
045
046    Collection<String> listNamespaces( String repoId, String namespace, Filter<String> filter )
047        throws RepositoryStorageRuntimeException;
048
049    Collection<String> listProjects( String repoId, String namespace, Filter<String> filter )
050        throws RepositoryStorageRuntimeException;
051
052    Collection<String> listProjectVersions( String repoId, String namespace, String projectId, Filter<String> filter )
053        throws RepositoryStorageRuntimeException;
054
055    Collection<ArtifactMetadata> readArtifactsMetadata( ReadMetadataRequest readMetadataRequest )
056        throws RepositoryStorageRuntimeException;
057
058    // FIXME: reconsider this API, do we want to expose storage format in the form of a path?
059    ArtifactMetadata readArtifactMetadataFromPath( String repoId, String path )
060        throws RepositoryStorageRuntimeException;
061    
062    /**
063     * A relocation capable client will request the POM prior to the artifact, and will then read meta-data and do
064     * client side relocation. A simplier client (like maven 1) will only request the artifact and not use the
065     * metadatas.
066     * <p>
067     * For such clients, archiva does server-side relocation by reading itself the &lt;relocation&gt; element in
068     * metadatas and serving the expected artifact.
069     * @param managedRepository the used managed repository
070     * @param artifact the artifact reference
071     * @throws org.apache.archiva.policies.ProxyDownloadException
072     */    
073    void applyServerSideRelocation( ManagedRepositoryContent managedRepository, ArtifactReference artifact )
074        throws ProxyDownloadException;
075
076    /**
077     * add an other method to evaluate real path as when receiving -SNAPSHOT (for maven storage)
078     * request redirect to the last build
079     * @param requestPath the web uri request
080     * @param managedRepository the used managed repository can be <code>null</code> so last version won't be resolved
081     * @return the file path
082     * @since 2.0.0
083     */
084    String getFilePath( String requestPath, ManagedRepository managedRepository );
085
086    String getFilePathWithVersion( final String requestPath, ManagedRepositoryContent managedRepositoryContent )
087        throws RelocationException, XMLException;
088
089
090}