Coverage Report - org.apache.maven.settings.RuntimeInfo
 
Classes in this File Line Coverage Branch Coverage Complexity
RuntimeInfo
40 %
12/30
0 %
0/4
1,308
 
 1  
 package org.apache.maven.settings;
 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.io.File;
 23  
 import java.util.HashMap;
 24  
 import java.util.Map;
 25  
 
 26  
 /**
 27  
  * To handle runtime informations like local repository or profiles.
 28  
  *
 29  
  * @version $Id: RuntimeInfo.java 638306 2008-03-18 10:20:28Z bentmann $
 30  
  */
 31  
 public class RuntimeInfo
 32  
 {
 33  
     private File file;
 34  
 
 35  
     // using Boolean for 3VL (null for not-set, otherwise override with value)
 36  
     private Boolean pluginUpdateForced;
 37  
 
 38  
     // using Boolean for 3VL (null, true-to-all, false-to-all)
 39  
     private Boolean applyToAllPluginUpdates;
 40  
 
 41  
 //    private boolean pluginRegistryActive = true;
 42  
 
 43  
     // using Boolean for 3VL (null for not-set, otherwise override with value)
 44  
 //    private Boolean checkLatest;
 45  
 
 46  5
     private Map activeProfileToSourceLevel = new HashMap();
 47  
 
 48  5
     private String localRepositorySourceLevel = TrackableBase.USER_LEVEL;
 49  
 
 50  5
     private Map pluginGroupIdSourceLevels = new HashMap();
 51  
 
 52  
     private final Settings settings;
 53  
 
 54  
     /**
 55  
      * @param settings
 56  
      */
 57  
     public RuntimeInfo( Settings settings )
 58  5
     {
 59  5
         this.settings = settings;
 60  5
     }
 61  
 
 62  
     /**
 63  
      * @param file
 64  
      */
 65  
     public void setFile( File file )
 66  
     {
 67  3
         this.file = file;
 68  3
     }
 69  
 
 70  
     /**
 71  
      * @return
 72  
      */
 73  
     public File getFile()
 74  
     {
 75  0
         return file;
 76  
     }
 77  
 
 78  
     /**
 79  
      * @param pluginUpdateForced
 80  
      */
 81  
     public void setPluginUpdateOverride( Boolean pluginUpdateForced )
 82  
     {
 83  0
         this.pluginUpdateForced = pluginUpdateForced;
 84  0
     }
 85  
 
 86  
     /**
 87  
      * @return
 88  
      */
 89  
     public Boolean getPluginUpdateOverride()
 90  
     {
 91  0
         return pluginUpdateForced;
 92  
     }
 93  
 
 94  
     /**
 95  
      * @return
 96  
      */
 97  
     public Boolean getApplyToAllPluginUpdates()
 98  
     {
 99  0
         return applyToAllPluginUpdates;
 100  
     }
 101  
 
 102  
     /**
 103  
      * @param applyToAll
 104  
      */
 105  
     public void setApplyToAllPluginUpdates( Boolean applyToAll )
 106  
     {
 107  0
         this.applyToAllPluginUpdates = applyToAll;
 108  0
     }
 109  
 
 110  
     /**
 111  
      * @param activeProfile
 112  
      * @param sourceLevel
 113  
      */
 114  
     public void setActiveProfileSourceLevel( String activeProfile, String sourceLevel )
 115  
     {
 116  0
         activeProfileToSourceLevel.put( activeProfile, sourceLevel );
 117  0
     }
 118  
 
 119  
     /**
 120  
      * @param activeProfile
 121  
      * @return
 122  
      */
 123  
     public String getSourceLevelForActiveProfile( String activeProfile )
 124  
     {
 125  0
         String sourceLevel = (String) activeProfileToSourceLevel.get( activeProfile );
 126  
 
 127  0
         if ( sourceLevel != null )
 128  
         {
 129  0
             return sourceLevel;
 130  
         }
 131  
         else
 132  
         {
 133  0
             return settings.getSourceLevel();
 134  
         }
 135  
     }
 136  
 
 137  
     /**
 138  
      * @param pluginGroupId
 139  
      * @param sourceLevel
 140  
      */
 141  
     public void setPluginGroupIdSourceLevel( String pluginGroupId, String sourceLevel )
 142  
     {
 143  1
         pluginGroupIdSourceLevels.put( pluginGroupId, sourceLevel );
 144  1
     }
 145  
 
 146  
     /**
 147  
      * @param pluginGroupId
 148  
      * @return
 149  
      */
 150  
     public String getSourceLevelForPluginGroupId( String pluginGroupId )
 151  
     {
 152  0
         String sourceLevel = (String) pluginGroupIdSourceLevels.get( pluginGroupId );
 153  
 
 154  0
         if ( sourceLevel != null )
 155  
         {
 156  0
             return sourceLevel;
 157  
         }
 158  
         else
 159  
         {
 160  0
             return settings.getSourceLevel();
 161  
         }
 162  
     }
 163  
 
 164  
     /**
 165  
      * @param localRepoSourceLevel
 166  
      */
 167  
     public void setLocalRepositorySourceLevel( String localRepoSourceLevel )
 168  
     {
 169  4
         this.localRepositorySourceLevel = localRepoSourceLevel;
 170  4
     }
 171  
 
 172  
     /**
 173  
      * @return
 174  
      */
 175  
     public String getLocalRepositorySourceLevel()
 176  
     {
 177  0
         return localRepositorySourceLevel;
 178  
     }
 179  
 }