Coverage Report - org.apache.maven.archiva.repository.ManagedRepositoryContent
 
Classes in this File Line Coverage Branch Coverage Complexity
ManagedRepositoryContent
N/A
N/A
0
 
 1  
 package org.apache.maven.archiva.repository;
 2  
 
 3  
 /*
 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
 11  
  *
 12  
  *  http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 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
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 23  
 import org.apache.maven.archiva.model.ArchivaArtifact;
 24  
 import org.apache.maven.archiva.model.ArtifactReference;
 25  
 import org.apache.maven.archiva.model.ProjectReference;
 26  
 import org.apache.maven.archiva.model.VersionedReference;
 27  
 import org.apache.maven.archiva.repository.layout.LayoutException;
 28  
 
 29  
 import java.io.File;
 30  
 import java.util.Set;
 31  
 
 32  
 /**
 33  
  * ManagedRepositoryContent interface for interacting with a managed repository in an abstract way, 
 34  
  * without the need for processing based on filesystem paths, or working with the database.
 35  
  *
 36  
  * @version $Id: ManagedRepositoryContent.java 751940 2009-03-10 01:35:35Z brett $
 37  
  */
 38  
 public interface ManagedRepositoryContent
 39  
 {
 40  
     /**
 41  
      * Delete from the managed repository all files / directories associated with the
 42  
      * provided version reference.
 43  
      * 
 44  
      * @param reference the version reference to delete.
 45  
      * @throws ContentNotFoundException 
 46  
      */
 47  
     public void deleteVersion( VersionedReference reference )
 48  
         throws ContentNotFoundException;
 49  
 
 50  
     /**
 51  
      * <p>
 52  
      * Convenience method to get the repository id.
 53  
      * </p>
 54  
      * 
 55  
      * <p>
 56  
      * Equivalent to calling <code>.getRepository().getId()</code>
 57  
      * </p>
 58  
      * 
 59  
      * @return the repository id.
 60  
      */
 61  
     public String getId();
 62  
 
 63  
     /**
 64  
      * <p>
 65  
      * Gather up the list of related artifacts to the ArtifactReference provided.
 66  
      * This typically inclues the pom files, and those things with 
 67  
      * classifiers (such as doc, source code, test libs, etc...)
 68  
      * </p>
 69  
      * 
 70  
      * <p>
 71  
      * <strong>NOTE:</strong> Some layouts (such as maven 1 "legacy") are not compatible with this query.
 72  
      * </p> 
 73  
      * 
 74  
      * @param reference the reference to work off of.
 75  
      * @return the set of ArtifactReferences for related artifacts.
 76  
      * @throws ContentNotFoundException if the initial artifact reference does not exist within the repository.
 77  
      * @throws LayoutException 
 78  
      */
 79  
     public Set<ArtifactReference> getRelatedArtifacts( ArtifactReference reference )
 80  
         throws ContentNotFoundException;
 81  
 
 82  
     /**
 83  
      * <p>
 84  
      * Convenience method to get the repository (on disk) root directory.
 85  
      * </p>
 86  
      * 
 87  
      * <p>
 88  
      * Equivalent to calling <code>.getRepository().getLocation()</code>
 89  
      * </p>
 90  
      * 
 91  
      * @return the repository (on disk) root directory.
 92  
      */
 93  
     public String getRepoRoot();
 94  
 
 95  
     /**
 96  
      * Get the repository configuration associated with this
 97  
      * repository content.
 98  
      * 
 99  
      * @return the repository that is associated with this repository content.
 100  
      */
 101  
     public ManagedRepositoryConfiguration getRepository();
 102  
 
 103  
     /**
 104  
      * Given a specific {@link ProjectReference}, return the list of available versions for
 105  
      * that project reference.
 106  
      * 
 107  
      * @param reference the project reference to work off of.
 108  
      * @return the list of versions found for that project reference.
 109  
      * @throws ContentNotFoundException if the project reference does nto exist within the repository.
 110  
      * @throws LayoutException 
 111  
      */
 112  
     public Set<String> getVersions( ProjectReference reference )
 113  
         throws ContentNotFoundException, LayoutException;
 114  
 
 115  
     /**
 116  
      * <p>
 117  
      * Given a specific {@link VersionedReference}, return the list of available versions for that
 118  
      * versioned reference.
 119  
      * </p>
 120  
      * 
 121  
      * <p>
 122  
      * <strong>NOTE:</strong> This is really only useful when working with SNAPSHOTs.
 123  
      * </p>
 124  
      * 
 125  
      * @param reference the versioned reference to work off of.
 126  
      * @return the set of versions found.
 127  
      * @throws ContentNotFoundException if the versioned reference does not exist within the repository.
 128  
      * @throws LayoutException 
 129  
      */
 130  
     public Set<String> getVersions( VersionedReference reference )
 131  
         throws ContentNotFoundException;
 132  
 
 133  
     /**
 134  
      * Determines if the artifact referenced exists in the repository.
 135  
      * 
 136  
      * @param reference the artifact reference to check for.
 137  
      * @return true if the artifact referenced exists.
 138  
      */
 139  
     public boolean hasContent( ArtifactReference reference );
 140  
 
 141  
     /**
 142  
      * Determines if the project referenced exists in the repository.
 143  
      * 
 144  
      * @param reference the project reference to check for.
 145  
      * @return true it the project referenced exists.
 146  
      */
 147  
     public boolean hasContent( ProjectReference reference );
 148  
 
 149  
     /**
 150  
      * Determines if the version reference exists in the repository.
 151  
      * 
 152  
      * @param reference the version reference to check for.
 153  
      * @return true if the version referenced exists.
 154  
      */
 155  
     public boolean hasContent( VersionedReference reference );
 156  
 
 157  
     /**
 158  
      * Set the repository configuration to associate with this
 159  
      * repository content.
 160  
      * 
 161  
      * @param repo the repository to associate with this repository content.
 162  
      */
 163  
     public void setRepository( ManagedRepositoryConfiguration repo );
 164  
 
 165  
     /**
 166  
      * Given a repository relative path to a filename, return the {@link VersionedReference} object suitable for the path.
 167  
      *
 168  
      * @param path the path relative to the repository base dir for the artifact.
 169  
      * @return the {@link ArtifactReference} representing the path.  (or null if path cannot be converted to
 170  
      *         a {@link ArtifactReference})
 171  
      * @throws LayoutException if there was a problem converting the path to an artifact.
 172  
      */
 173  
     public ArtifactReference toArtifactReference( String path )
 174  
         throws LayoutException;
 175  
 
 176  
     /**
 177  
      * Given an {@link ArtifactReference}, return the file reference to the artifact.
 178  
      *
 179  
      * @param reference the artifact reference to use.
 180  
      * @return the relative path to the artifact.
 181  
      */
 182  
     public File toFile( ArtifactReference reference );
 183  
     
 184  
     /**
 185  
      * Given an {@link ArchivaArtifact}, return the file reference to the artifact.
 186  
      *
 187  
      * @param reference the archiva artifact to use.
 188  
      * @return the relative path to the artifact.
 189  
      */
 190  
     public File toFile( ArchivaArtifact reference );
 191  
 
 192  
     /**
 193  
      * Given a {@link ProjectReference}, return the path to the metadata for
 194  
      * the project. 
 195  
      * 
 196  
      * @param reference the reference to use.
 197  
      * @return the path to the metadata file, or null if no metadata is appropriate.
 198  
      */
 199  
     public String toMetadataPath( ProjectReference reference );
 200  
 
 201  
     /**
 202  
      * Given a {@link VersionedReference}, return the path to the metadata for
 203  
      * the specific version of the project. 
 204  
      * 
 205  
      * @param reference the reference to use.
 206  
      * @return the path to the metadata file, or null if no metadata is appropriate.
 207  
      */
 208  
     public String toMetadataPath( VersionedReference reference );
 209  
 
 210  
     /**
 211  
      * Given an {@link ArtifactReference}, return the relative path to the artifact.
 212  
      *
 213  
      * @param reference the artifact reference to use.
 214  
      * @return the relative path to the artifact.
 215  
      */
 216  
     public String toPath( ArtifactReference reference );
 217  
     
 218  
     /**
 219  
      * Given an {@link ArchivaArtifact}, return the relative path to the artifact.
 220  
      *
 221  
      * @param reference the archiva artifact to use.
 222  
      * @return the relative path to the artifact.
 223  
      */
 224  
     public String toPath( ArchivaArtifact reference );
 225  
 }