Coverage Report - org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor
 
Classes in this File Line Coverage Branch Coverage Complexity
ArchetypeDescriptor
86 %
50/58
N/A
1
 
 1  
 package org.apache.maven.archetype.old.descriptor;
 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 java.util.ArrayList;
 23  
 import java.util.HashMap;
 24  
 import java.util.List;
 25  
 import java.util.Map;
 26  
 
 27  
 public class ArchetypeDescriptor
 28  
 {
 29  
     private String id;
 30  
 
 31  
     private List<String> sources;
 32  
 
 33  
     private List<String> testSources;
 34  
 
 35  
     private List<String> resources;
 36  
 
 37  
     private List<String> testResources;
 38  
 
 39  
     private List<String> siteResources;
 40  
 
 41  
     /**
 42  
      * <code>Map</code> that associates the items in the <code>List</code>
 43  
      * <code>sources</code> with their attributes (instances of
 44  
      * <code>TemplateDescriptor</code>.
 45  
      */
 46  
     private Map<String, TemplateDescriptor> sourcesDescriptors;
 47  
 
 48  
     /**
 49  
      * <code>Map</code> that associates the items in the <code>List</code>
 50  
      * <code>testSources</code> with their attributes (instances of
 51  
      * <code>TemplateDescriptor</code>.
 52  
      */
 53  
     private Map<String, TemplateDescriptor> testSourcesDescriptors;
 54  
 
 55  
     /**
 56  
      * <code>Map</code> that associates the items in the <code>List</code>
 57  
      * <code>resources</code> with their attributes (instances of
 58  
      * <code>TemplateDescriptor</code>.
 59  
      */
 60  
     private Map<String, TemplateDescriptor> resourcesDescriptors;
 61  
 
 62  
     /**
 63  
      * <code>Map</code> that associates the items in the <code>List</code>
 64  
      * <code>testResources</code> with their attributes (instances of
 65  
      * <code>TemplateDescriptor</code>.
 66  
      */
 67  
     private Map<String, TemplateDescriptor> testResourcesDescriptors;
 68  
 
 69  
     /**
 70  
      * <code>Map</code> that associates the items in the <code>List</code>
 71  
      * <code>siteResources</code> with their attributes (instances of
 72  
      * <code>TemplateDescriptor</code>.
 73  
      */
 74  
     private Map<String, TemplateDescriptor> siteResourcesDescriptors;
 75  
 
 76  
     /**
 77  
      * This indicates the archetype can be a whole project or can be part
 78  
      * of another project. An example is a site archetype where the POM and
 79  
      * directory structure may already exist and you simply want to generate
 80  
      * the site directory structure.
 81  
      */
 82  
     private boolean allowPartial;
 83  
 
 84  
     public ArchetypeDescriptor()
 85  5
     {
 86  5
         sources = new ArrayList<String>();
 87  
 
 88  5
         resources = new ArrayList<String>();
 89  
 
 90  5
         testSources = new ArrayList<String>();
 91  
 
 92  5
         testResources = new ArrayList<String>();
 93  
 
 94  5
         siteResources = new ArrayList<String>();
 95  
 
 96  5
         sourcesDescriptors = new HashMap<String, TemplateDescriptor>();
 97  
 
 98  5
         testSourcesDescriptors = new HashMap<String, TemplateDescriptor>();
 99  
 
 100  5
         resourcesDescriptors = new HashMap<String, TemplateDescriptor>();
 101  
 
 102  5
         testResourcesDescriptors = new HashMap<String, TemplateDescriptor>();
 103  
 
 104  5
         siteResourcesDescriptors = new HashMap<String, TemplateDescriptor>();
 105  5
     }
 106  
 
 107  
     // ----------------------------------------------------------------------
 108  
     //
 109  
     // ----------------------------------------------------------------------
 110  
 
 111  
     public String getId()
 112  
     {
 113  3
         return id;
 114  
     }
 115  
 
 116  
     public void setId( String id )
 117  
     {
 118  5
         this.id = id;
 119  5
     }
 120  
 
 121  
     public void addSource( String source )
 122  
     {
 123  7
         sources.add( source );
 124  
 
 125  7
         putSourceDescriptor( source, new TemplateDescriptor() );
 126  7
     }
 127  
 
 128  
     public List<String> getSources()
 129  
     {
 130  10
         return sources;
 131  
     }
 132  
 
 133  
     public void putSourceDescriptor( String source, TemplateDescriptor descriptor )
 134  
     {
 135  7
         sourcesDescriptors.put( source, descriptor );
 136  7
     }
 137  
 
 138  
     public TemplateDescriptor getSourceDescriptor( String source )
 139  
     {
 140  21
         return sourcesDescriptors.get( source );
 141  
     }
 142  
 
 143  
     public Map<String, TemplateDescriptor> getSourcesDescriptors()
 144  
     {
 145  0
         return sourcesDescriptors;
 146  
     }
 147  
 
 148  
     public void addTestSource( String testSource )
 149  
     {
 150  6
         testSources.add( testSource );
 151  
 
 152  6
         putTestSourceDescriptor( testSource, new TemplateDescriptor() );
 153  6
     }
 154  
 
 155  
     public List<String> getTestSources()
 156  
     {
 157  9
         return testSources;
 158  
     }
 159  
 
 160  
     public void putTestSourceDescriptor( String testSource, TemplateDescriptor descriptor )
 161  
     {
 162  6
         testSourcesDescriptors.put( testSource, descriptor );
 163  6
     }
 164  
 
 165  
     public TemplateDescriptor getTestSourceDescriptor( String testSource )
 166  
     {
 167  20
         return testSourcesDescriptors.get( testSource );
 168  
     }
 169  
 
 170  
     public Map<String, TemplateDescriptor> getTestSourcesDescriptors()
 171  
     {
 172  0
         return testSourcesDescriptors;
 173  
     }
 174  
 
 175  
     public void addResource( String resource )
 176  
     {
 177  6
         resources.add( resource );
 178  
 
 179  6
         putResourceDescriptor( resource, new TemplateDescriptor() );
 180  6
     }
 181  
 
 182  
     public List<String> getResources()
 183  
     {
 184  9
         return resources;
 185  
     }
 186  
 
 187  
     public void putResourceDescriptor( String resource, TemplateDescriptor descriptor )
 188  
     {
 189  6
         resourcesDescriptors.put( resource, descriptor );
 190  6
     }
 191  
 
 192  
     public TemplateDescriptor getResourceDescriptor( String resource )
 193  
     {
 194  17
         return resourcesDescriptors.get( resource );
 195  
     }
 196  
 
 197  
     public Map<String, TemplateDescriptor> getReourcesDescriptors()
 198  
     {
 199  0
         return resourcesDescriptors;
 200  
     }
 201  
 
 202  
     public void addTestResource( String testResource )
 203  
     {
 204  4
         testResources.add( testResource );
 205  4
         putTestResourceDescriptor( testResource, new TemplateDescriptor() );
 206  4
     }
 207  
 
 208  
     public List<String> getTestResources()
 209  
     {
 210  8
         return testResources;
 211  
     }
 212  
 
 213  
     public void putTestResourceDescriptor( String testResource, TemplateDescriptor descriptor )
 214  
     {
 215  4
         testResourcesDescriptors.put( testResource, descriptor );
 216  4
     }
 217  
 
 218  
     public TemplateDescriptor getTestResourceDescriptor( String testResource )
 219  
     {
 220  14
         return testResourcesDescriptors.get( testResource );
 221  
     }
 222  
 
 223  
     public Map<String, TemplateDescriptor> getTestReourcesDescriptors()
 224  
     {
 225  0
         return testResourcesDescriptors;
 226  
     }
 227  
 
 228  
     public void addSiteResource( String siteResource )
 229  
     {
 230  4
         siteResources.add( siteResource );
 231  
 
 232  4
         putSiteResourceDescriptor( siteResource, new TemplateDescriptor() );
 233  4
     }
 234  
 
 235  
     public List<String> getSiteResources()
 236  
     {
 237  6
         return siteResources;
 238  
     }
 239  
 
 240  
     public void putSiteResourceDescriptor( String siteResource, TemplateDescriptor descriptor )
 241  
     {
 242  4
         siteResourcesDescriptors.put( siteResource, descriptor );
 243  4
     }
 244  
 
 245  
     public TemplateDescriptor getSiteResourceDescriptor( String siteResource )
 246  
     {
 247  9
         return siteResourcesDescriptors.get( siteResource );
 248  
     }
 249  
 
 250  
     public Map<String, TemplateDescriptor> getSiteReourcesDescriptors()
 251  
     {
 252  0
         return siteResourcesDescriptors;
 253  
     }
 254  
 
 255  
     public boolean isAllowPartial()
 256  
     {
 257  0
         return allowPartial;
 258  
     }
 259  
 
 260  
     public void setAllowPartial( boolean allowPartial )
 261  
     {
 262  0
         this.allowPartial = allowPartial;
 263  0
     }
 264  
 }