Coverage Report - org.codehaus.plexus.component.repository.ComponentSetDescriptor
 
Classes in this File Line Coverage Branch Coverage Complexity
ComponentSetDescriptor
38 %
12/31
0 %
0/2
1,077
 
 1  
 package org.codehaus.plexus.component.repository;
 2  
 
 3  
 /*
 4  
  * Copyright 2001-2006 Codehaus Foundation.
 5  
  *
 6  
  * Licensed under the Apache License, Version 2.0 (the "License");
 7  
  * you may not use this file except in compliance with the License.
 8  
  * You may obtain a copy of the License at
 9  
  *
 10  
  *      http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 
 19  
 import java.util.ArrayList;
 20  
 import java.util.List;
 21  
 
 22  
 /**
 23  
  * Contains a set of ComponentDescriptors and the set's dependencies.
 24  
  *
 25  
  * @author Jason van Zyl
 26  
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
 27  
  * @version $Id: ComponentSetDescriptor.java 7828 2008-11-14 22:07:56Z dain $
 28  
  */
 29  29
 public class ComponentSetDescriptor
 30  
 {
 31  
     // This field is not currently used in Maven, or Plexus
 32  
     private String id;
 33  
 
 34  
     /** The source location of this component source descriptor */
 35  
     private String source;
 36  
 
 37  
     /** Flag to indicate whether this component should be loaded in a realm/classloader of its own. */
 38  
     private boolean isolatedRealm;
 39  
     
 40  
     /** The component descriptors that can be found within this component set descriptor. */
 41  29
     private final List<ComponentDescriptor<?>> components = new ArrayList<ComponentDescriptor<?>>();
 42  
 
 43  
     /** The dependencies that are required by the set of components found in this component set descriptor. */
 44  29
     private final List<ComponentDependency> dependencies = new ArrayList<ComponentDependency>();
 45  
     
 46  
     /**
 47  
      * Returns a list of components in this set.
 48  
      * @return a list of components
 49  
      */
 50  
     public List<ComponentDescriptor<?>> getComponents()
 51  
     {
 52  29
         return components;
 53  
     }
 54  
 
 55  
     /**
 56  
      * Add a new ComponentDescriptor to this set.
 57  
      * @param cd the ComponentDescriptor to add
 58  
      */
 59  
     public void addComponentDescriptor( ComponentDescriptor<?> cd )
 60  
     {
 61  2
         components.add( cd );
 62  2
     }
 63  
 
 64  
     /**
 65  
      * Sets a List of components as this set's contents.
 66  
      * @param components the List of components to set
 67  
      */
 68  
     public void setComponents( List<ComponentDescriptor<?>> components )
 69  
     {
 70  27
         this.components.clear();
 71  27
         this.components.addAll(components);
 72  27
     }
 73  
 
 74  
     /**
 75  
      * Returns a List of dependencies of this set of components.
 76  
      * @return a List of dependencies of this set of components
 77  
      */
 78  
     public List<ComponentDependency> getDependencies()
 79  
     {
 80  1
         return dependencies;
 81  
     }
 82  
 
 83  
     /**
 84  
      * Add a depenency to this set's contents.
 85  
      * @param cd the ComponentDependency to add
 86  
      */
 87  
     public void addDependency( ComponentDependency cd )
 88  
     {
 89  0
         dependencies.add( cd );
 90  0
     }
 91  
 
 92  
     /**
 93  
      * Sets a List of dependencies as this set's component dependencies.
 94  
      * @param dependencies the List of components to set
 95  
      */
 96  
     public void setDependencies( List<ComponentDependency> dependencies )
 97  
     {
 98  0
         this.dependencies.clear();
 99  0
         this.dependencies.addAll(dependencies);
 100  0
     }
 101  
 
 102  
     /**
 103  
      * Sets that this set of components may be in an isolated classrealm.
 104  
      * @param isolatedRealm true if this set of components may be in an
 105  
      *  isolated classrealm
 106  
      */
 107  
     public void setIsolatedRealm( boolean isolatedRealm )
 108  
     {
 109  0
         this.isolatedRealm = isolatedRealm;
 110  0
     }
 111  
 
 112  
     /**
 113  
      * Returns true if this set may be in an isolated classrealm.
 114  
      * @return true if this set may be in an isolated classrealm
 115  
      */
 116  
     public boolean isIsolatedRealm()
 117  
     {
 118  0
         return isolatedRealm;
 119  
     }
 120  
 
 121  
     /**
 122  
      * Returns the identifier of this set.
 123  
      * @return the identifier of this set
 124  
      */
 125  
     public String getId()
 126  
     {
 127  0
         return id;
 128  
     }
 129  
 
 130  
     /**
 131  
      * Sets the identifier of this set.
 132  
      * @param id the identifier to set
 133  
      */
 134  
     public void setId( String id )
 135  
     {
 136  0
         this.id = id;
 137  0
     }
 138  
 
 139  
     public String toString()
 140  
     {
 141  0
         StringBuilder sb = new StringBuilder();
 142  
 
 143  0
         sb.append( "Component Descriptor: " );
 144  
 
 145  0
         for ( ComponentDescriptor<?> cd : components )
 146  
         {
 147  0
             sb.append( cd.getHumanReadableKey() ).append( "\n" );
 148  0
         }
 149  
 
 150  0
         sb.append( "---" );
 151  
 
 152  0
         return sb.toString();
 153  
     }
 154  
 
 155  
     public String getSource()
 156  
     {
 157  0
         return source;
 158  
     }
 159  
 
 160  
     public void setSource( String source )
 161  
     {
 162  27
         this.source = source;
 163  27
     }
 164  
 }