Changeset 1495


Ignore:
Timestamp:
04/15/13 16:13:31 (7 years ago)
Author:
philsmart
Message:
 
Location:
raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/StatisticHandler.java

    r1485 r1495  
    7474    public AggregatorGraphModel 
    7575            performStatisticDynamically(DynamicStatisticalUnitInformation statisticalUnitInformation) { 
    76         BaseStatistic statistic = StatisticTypeFactory.createNewBaseStatistic(statisticalUnitInformation); 
     76        BaseStatistic statistic = 
     77                StatisticTypeFactory.createNewBaseStatistic(statisticalUnitInformation, 
     78                        statisticRegistry.getStatisticProcessorRegistry()); 
    7779        return performStatiticalPipeline(statistic); 
    7880    } 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/StatisticTypeFactory.java

    r1485 r1495  
    1717package uk.ac.cardiff.raptormua.engine.statistics; 
    1818 
     19import java.util.ArrayList; 
     20import java.util.List; 
     21 
    1922import org.slf4j.Logger; 
    2023import org.slf4j.LoggerFactory; 
    2124 
    2225import uk.ac.cardiff.model.wsmodel.DynamicStatisticalUnitInformation; 
     26import uk.ac.cardiff.model.wsmodel.ProcessorInformation; 
    2327import uk.ac.cardiff.model.wsmodel.StatisticFunctionType; 
    2428import uk.ac.cardiff.model.wsmodel.StatisticParameters; 
     
    4347     *  
    4448     * @param statisticType an issues and null is returned. 
     49     * @param registry a {@link StatisticProcessorRegistry} used to initialise post processors. 
    4550     * @return 
    4651     */ 
     
    7681     * @return 
    7782     */ 
    78     public static BaseStatistic createNewBaseStatistic(DynamicStatisticalUnitInformation statisticalUnitInformation) { 
     83    public static BaseStatistic createNewBaseStatistic(DynamicStatisticalUnitInformation statisticalUnitInformation, 
     84            StatisticProcessorRegistry registry) { 
    7985        try { 
    8086            Class<?> statisticClass = Class.forName(statisticalUnitInformation.getFunction().getStatisticClass()); 
     
    8490                statistic.setStatisticParameters(statisticalUnitInformation.getStatisticUnitInformation() 
    8591                        .getStatisticParameters()); 
    86                 // statistic 
    87                 // .setPostprocessor(statisticalUnitInformation.getStatisticUnitInformation().getPostprocessors()); 
     92 
     93                statistic.setPostprocessor(null); 
     94 
     95                List<StatisticPostProcessor> postProcessors = 
     96                        initialisePostProcessors(statisticalUnitInformation.getStatisticUnitInformation() 
     97                                .getPostprocessors(), registry); 
     98                statistic.setPostprocessor(postProcessors); 
     99 
    88100                statistic.getStatisticParameters().setUnitName( 
    89101                        "DYNAMIC-" + statisticInstance.getClass().getSimpleName()); 
     
    108120    } 
    109121 
     122    private static List<StatisticPostProcessor> initialisePostProcessors( 
     123            List<ProcessorInformation> processorInformation, StatisticProcessorRegistry registry) { 
     124        if (processorInformation == null) { 
     125            return null; 
     126        } 
     127        ArrayList<StatisticPostProcessor> initlialisedPostProcessors = new ArrayList<StatisticPostProcessor>(); 
     128        for (ProcessorInformation information : processorInformation) { 
     129            try { 
     130                StatisticPostProcessor processor = registry.getProcessor(information); 
     131                log.debug("Initialise post processor with friendlyname [{}]", processor.getFriendlyName()); 
     132                initlialisedPostProcessors.add(processor); 
     133            } catch (StatisticPostProcessorFactoryException e) { 
     134                log.error("Could not set processor {} on statistic", information.getProcessorClass(), e); 
     135            } catch (ProcessorRegistryException e) { 
     136                log.error("Could not set processor {} on statistic", information.getProcessorClass(), e); 
     137            } 
     138        } 
     139 
     140        return initlialisedPostProcessors; 
     141    } 
     142 
    110143} 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/service/impl/MUAProcessImpl.java

    r1485 r1495  
    160160        log.info("Dynamically invoking the statistical function [{}]", statisticalUnitInformation.getFunction() 
    161161                .getStatisticClass()); 
     162        log.trace("Dynamic statistic has {} post processors", statisticalUnitInformation.getStatisticUnitInformation() 
     163                .getPostprocessors().size()); 
    162164        return engine.invokeStatisticDynamically(statisticalUnitInformation); 
    163165 
Note: See TracChangeset for help on using the changeset viewer.