This project has retired. For details please refer to its Attic page.
Source code
001package org.apache.archiva.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.admin.model.beans.RemoteRepository;
023import org.apache.archiva.model.ArtifactReference;
024import org.apache.archiva.model.RepositoryURL;
025import org.apache.archiva.repository.layout.LayoutException;
026
027/**
028 * RemoteRepositoryContent interface for interacting with a remote repository in an abstract way, 
029 * without the need for processing based on URLs, or working with the database. 
030 *
031 *
032 */
033public interface RemoteRepositoryContent
034{
035    /**
036     * <p>
037     * Convenience method to get the repository id.
038     * </p>
039     * 
040     * <p>
041     * Equivalent to calling <code>.getRepository().getId()</code>
042     * </p>
043     * 
044     * @return the repository id.
045     */
046    String getId();
047
048    /**
049     * Get the repository configuration associated with this
050     * repository content.
051     * 
052     * @return the repository that is associated with this repository content.
053     */
054    RemoteRepository getRepository();
055
056    /**
057     * <p>
058     * Convenience method to get the repository url.
059     * </p>
060     * 
061     * <p>
062     * Equivalent to calling <code>new RepositoryURL( this.getRepository().getUrl() )</code>
063     * </p>
064     * 
065     * @return the repository url.
066     */
067    RepositoryURL getURL();
068
069    /**
070     * Set the repository configuration to associate with this
071     * repository content.
072     * 
073     * @param repo the repository to associate with this repository content.
074     */
075    void setRepository( RemoteRepository repo );
076
077    /**
078     * Given a repository relative path to a filename, return the {@link org.apache.archiva.model.VersionedReference} object suitable for the path.
079     *
080     * @param path the path relative to the repository base dir for the artifact.
081     * @return the {@link ArtifactReference} representing the path.  (or null if path cannot be converted to
082     *         a {@link ArtifactReference})
083     * @throws LayoutException if there was a problem converting the path to an artifact.
084     */
085    ArtifactReference toArtifactReference( String path )
086        throws LayoutException;
087
088    /**
089     * Given an ArtifactReference, return the relative path to the artifact.
090     *
091     * @param reference the artifact reference to use.
092     * @return the relative path to the artifact.
093     */
094    String toPath( ArtifactReference reference );
095
096    /**
097     * Given an ArtifactReference, return the url to the artifact.
098     *
099     * @param reference the artifact reference to use.
100     * @return the relative path to the artifact.
101     */
102    RepositoryURL toURL( ArtifactReference reference );
103}