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