Coverage Report - org.apache.maven.archiva.repository.content.RemoteDefaultRepositoryContent
 
Classes in this File Line Coverage Branch Coverage Complexity
RemoteDefaultRepositoryContent
0%
0/11
0%
0/4
0
 
 1  
 package org.apache.maven.archiva.repository.content;
 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.RemoteRepositoryConfiguration;
 23  
 import org.apache.maven.archiva.model.ArtifactReference;
 24  
 import org.apache.maven.archiva.model.RepositoryURL;
 25  
 import org.apache.maven.archiva.repository.RemoteRepositoryContent;
 26  
 import org.apache.maven.archiva.repository.layout.LayoutException;
 27  
 
 28  
 /**
 29  
  * RemoteDefaultRepositoryContent 
 30  
  *
 31  
  * @version $Id: RemoteDefaultRepositoryContent.java 718864 2008-11-19 06:33:35Z brett $
 32  
  * 
 33  
  * @plexus.component 
 34  
  *      role="org.apache.maven.archiva.repository.RemoteRepositoryContent"
 35  
  *      role-hint="default"
 36  
  *      instantiation-strategy="per-lookup"
 37  
  */
 38  0
 public class RemoteDefaultRepositoryContent
 39  
     extends AbstractDefaultRepositoryContent
 40  
     implements RemoteRepositoryContent
 41  
 {
 42  
     private RemoteRepositoryConfiguration repository;
 43  
 
 44  
     public String getId()
 45  
     {
 46  0
         return repository.getId();
 47  
     }
 48  
 
 49  
     public RemoteRepositoryConfiguration getRepository()
 50  
     {
 51  0
         return repository;
 52  
     }
 53  
 
 54  
     public RepositoryURL getURL()
 55  
     {
 56  0
         return new RepositoryURL( repository.getUrl() );
 57  
     }
 58  
 
 59  
     public void setRepository( RemoteRepositoryConfiguration repository )
 60  
     {
 61  0
         this.repository = repository;
 62  0
     }
 63  
 
 64  
     /**
 65  
      * Convert a path to an artifact reference.
 66  
      * 
 67  
      * @param path the path to convert. (relative or full url path)
 68  
      * @throws LayoutException if the path cannot be converted to an artifact reference.
 69  
      */
 70  
     @Override
 71  
     public ArtifactReference toArtifactReference( String path )
 72  
         throws LayoutException
 73  
     {
 74  0
         if ( ( path != null ) && path.startsWith( repository.getUrl() ) )
 75  
         {
 76  0
             return super.toArtifactReference( path.substring( repository.getUrl().length() ) );
 77  
         }
 78  
 
 79  0
         return super.toArtifactReference( path );
 80  
     }
 81  
 
 82  
     public RepositoryURL toURL( ArtifactReference reference )
 83  
     {
 84  0
         String url = repository.getUrl() + toPath( reference );
 85  0
         return new RepositoryURL( url );
 86  
     }
 87  
 }