Save This Page
Home » maven-ant-tasks-2.1.0-src » org.apache » maven » artifact » ant » [javadoc | source]
    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   public abstract class Repository
   31       extends ProjectComponent
   32   {
   33       private String id;
   34       
   35       private String refid;
   36   
   37       private String layout = "default";
   38       
   39       protected abstract String getDefaultId();
   40   
   41       public String getId()
   42       {
   43           if ( getInstance().id == null )
   44           {
   45               getInstance().setId( getDefaultId() );
   46           }
   47           return getInstance().id;
   48       }
   49       
   50       public void setId( String id )
   51       {
   52           this.id = id;
   53       }
   54       
   55       public String getRefid()
   56       {
   57           return refid;
   58       }
   59   
   60       public void setRefid( String refid )
   61       {
   62           this.refid = refid;
   63       }
   64   
   65       protected Repository getInstance()
   66       {
   67           Repository instance = this;
   68           if ( refid != null )
   69           {
   70               instance = (Repository) getProject().getReference( refid );
   71           }
   72           return instance;
   73       }
   74   
   75       public String getLayout()
   76       {
   77           return getInstance().layout;
   78       }
   79   
   80       public void setLayout( String layout )
   81       {
   82           this.layout = layout;
   83       }
   84   }

Save This Page
Home » maven-ant-tasks-2.1.0-src » org.apache » maven » artifact » ant » [javadoc | source]