Coverage Report - org.apache.maven.artifact.ant.Repository
 
Classes in this File Line Coverage Branch Coverage Complexity
Repository
29%
5/17
25%
1/4
1.25
 
 1  
 package org.apache.maven.artifact.ant;
 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.tools.ant.ProjectComponent;
 23  
 
 24  
 /**
 25  
  * Base class for a repository.
 26  
  *
 27  
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
 28  
  * @version $Id: Repository.java 586615 2007-10-19 21:04:45Z hboutemy $
 29  
  */
 30  1
 public abstract class Repository
 31  
     extends ProjectComponent
 32  
 {
 33  
     private String id;
 34  
     
 35  
     private String refid;
 36  
 
 37  1
     private String layout = "default";
 38  
     
 39  
     protected abstract String getDefaultId();
 40  
 
 41  
     public String getId()
 42  
     {
 43  0
         if ( getInstance().id == null )
 44  
         {
 45  0
             getInstance().setId( getDefaultId() );
 46  
         }
 47  0
         return getInstance().id;
 48  
     }
 49  
     
 50  
     public void setId( String id )
 51  
     {
 52  0
         this.id = id;
 53  0
     }
 54  
     
 55  
     public String getRefid()
 56  
     {
 57  0
         return refid;
 58  
     }
 59  
 
 60  
     public void setRefid( String refid )
 61  
     {
 62  0
         this.refid = refid;
 63  0
     }
 64  
 
 65  
     protected Repository getInstance()
 66  
     {
 67  2
         Repository instance = this;
 68  2
         if ( refid != null )
 69  
         {
 70  0
             instance = (Repository) getProject().getReference( refid );
 71  
         }
 72  2
         return instance;
 73  
     }
 74  
 
 75  
     public String getLayout()
 76  
     {
 77  0
         return getInstance().layout;
 78  
     }
 79  
 
 80  
     public void setLayout( String layout )
 81  
     {
 82  0
         this.layout = layout;
 83  0
     }
 84  
 }