Coverage report

  %line %branch
net.sf.infrared.web.util.DataFetchUtil
0% 
0% 

 1  
 /*
 2  
  *
 3  
  * Copyright 2005 Tavant Technologies and Contributors
 4  
  * 
 5  
  * Licensed under the Apache License, Version 2.0 (the "License")
 6  
  * you may not use this file except in compliance with the License.
 7  
  * You may obtain a copy of the License at
 8  
  *
 9  
  *     http://www.apache.org/licenses/LICENSE-2.0
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  *
 17  
  *
 18  
  *
 19  
  * Original Author:  prashant.nair (Tavant Technologies)
 20  
  * Contributor(s):   -;
 21  
  *
 22  
  */
 23  
 package net.sf.infrared.web.util;
 24  
 
 25  
 import java.util.Date;
 26  
 import java.util.Set;
 27  
 import net.sf.infrared.base.model.StatisticsSnapshot;
 28  
 
 29  
 import org.apache.log4j.Logger;
 30  
 
 31  
 import net.sf.infrared.base.model.ApplicationStatistics;
 32  
 import net.sf.infrared.base.util.LoggingFactory;
 33  
 import net.sf.infrared.collector.Collector;
 34  
 
 35  0
 public class DataFetchUtil {
 36  
         
 37  
     static Collector collector;
 38  
     static final String SEPERATOR = "#";
 39  0
     private static final Logger logger = LoggingFactory.getLogger(DataFetchUtil.class);
 40  
 
 41  
         
 42  
     public static PerformanceDataSnapshot getPerfData(Set appNameSet, Set instNameSet){
 43  
         //[BINIL] ApplicationStatistics mergedStats = getCollector().fetchStats(appNameSet, instNameSet);
 44  0
         StatisticsSnapshot mergedStats = getCollector().fetchStats(appNameSet, instNameSet);
 45  0
         PerformanceDataSnapshot snapShot = new PerformanceDataSnapshot();
 46  0
         snapShot.setApplicationNames(appNameSet);
 47  0
         snapShot.setInstanceNames(instNameSet);
 48  0
         snapShot.setStats(mergedStats);
 49  
         
 50  0
         return snapShot;
 51  
     }
 52  
 
 53  
     public static PerformanceDataSnapshot reset(){
 54  0
     	getCollector().clearStats();
 55  
         
 56  0
         PerformanceDataSnapshot snapShot = new PerformanceDataSnapshot();
 57  0
         return snapShot;
 58  
     }
 59  
     
 60  
     public static PerformanceDataSnapshot getDataFromDB(Set applications, Set instances,
 61  
     											Date fromDate, Date toDate){
 62  0
     	StatisticsSnapshot stats = getCollector().fetchStatsFromDB(applications, instances,
 63  
     											fromDate, toDate);
 64  0
         PerformanceDataSnapshot snapShot = new PerformanceDataSnapshot();
 65  0
         snapShot.setApplicationNames(applications);
 66  0
         snapShot.setInstanceNames(instances);
 67  0
         snapShot.setStats(stats);
 68  
         
 69  0
         return snapShot;
 70  
     	
 71  
     }
 72  
 
 73  
     public static Set getApplicationNames(){
 74  0
         return getCollector().getApplicationNames();
 75  
     }
 76  
     
 77  
     public static Set getInstanceNames(Set applicationNames){
 78  0
         return getCollector().getInstanceNames(applicationNames);
 79  
     }
 80  
     
 81  
     public static void setCollector(Collector collectorImpl){
 82  0
         collector = collectorImpl;
 83  0
     }
 84  
     
 85  
     public static Collector getCollector(){
 86  0
         if(collector == null){
 87  0
             logger.error("Collector has not been initialized.");
 88  0
             throw new RuntimeException("Collector has not been initialized");
 89  
         }
 90  0
         return collector;
 91  
     }
 92  
     
 93  
 
 94  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.