Changeset 1082


Ignore:
Timestamp:
08/29/11 21:40:24 (9 years ago)
Author:
philsmart
Message:

changed statistic registry to own implementation

Location:
raptor-mua/trunk/src/main
Files:
3 added
18 edited
3 moved

Legend:

Unmodified
Added
Removed
  • raptor-mua/trunk/src/main/conf-default/statistical-units.xml

    r1052 r1082  
    2222        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> 
    2323 
    24         <!-- ALL statistical units defined must be added to the registrar of statistical units --> 
    25         <bean id="statisticalUnits" class="uk.ac.cardiff.raptormua.engine.statistics.StatisticsHandler"> 
    26                 <property name ="statisticalUnits"> 
    27                         <list> 
    28                                 <ref bean="authTimeBuckets" /> 
    29                                 <ref bean="groupBy" /> 
    30                                 <ref bean="authTimeBucketsCount"/> 
    31                                 <ref bean="authsPerSchool"/> 
    32                                 <ref bean="numberOfAuthenticationsPer"/> 
    33                                 <ref bean="numberOfUniqueUsersPer"/> 
    34                                 <ref bean="top5Resources"/> 
    35                                 <ref bean="bottom5Resources"/> 
    36                                 <ref bean="numberOfAuthenticationsPerIntervalNumber"/> 
    37                                 <ref bean="authenticationsForOneSP"/> 
    38                                 <ref bean="numberOfUniqueAuthenticationsPerSP"/> 
    39                 <ref bean="authsPerPersonAffiliation"/> 
    40                         </list> 
    41                 </property> 
    42         </bean> 
     24         <bean id="statisticalUnits" class="uk.ac.cardiff.raptormua.engine.statistics.StatisticHandler"> 
     25        <property name="statisticRegistry"><ref bean="statisticRegistry"/></property> 
     26    </bean> 
     27     
     28    <!-- Handles all statistical units defined--> 
     29    <bean id="statisticRegistry" class="uk.ac.cardiff.raptormua.engine.statistics.ContextAwareStatisticRegistry"> 
     30        <property name="automaticallyFindStatsiticsToLoad" value="true"/> 
     31    </bean> 
    4332 
    4433 
  • raptor-mua/trunk/src/main/config/statistical-units.xml

    r1052 r1082  
    2121        xsi:schemaLocation=" 
    2222        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> 
    23  
    24         <!-- ALL statistical units defined must be added to the registrar of statistical units --> 
    25         <bean id="statisticalUnits" class="uk.ac.cardiff.raptormua.engine.statistics.StatisticsHandler"> 
    26                 <property name ="statisticalUnits"> 
    27                         <list> 
    28                                 <ref bean="authTimeBuckets" /> 
    29                                 <ref bean="groupBy" /> 
    30                                 <ref bean="authTimeBucketsCount"/> 
    31                                 <ref bean="authsPerSchool"/> 
    32                                 <ref bean="numberOfAuthenticationsPer"/> 
    33                                 <ref bean="numberOfUniqueUsersPer"/> 
    34                                 <ref bean="top5Resources"/> 
    35                                 <ref bean="bottom5Resources"/> 
    36                                 <ref bean="numberOfAuthenticationsPerIntervalNumber"/> 
    37                                 <ref bean="authenticationsForOneSP"/> 
    38                                 <ref bean="numberOfUniqueAuthenticationsPerSP"/> 
    39                 <ref bean="authsPerPersonAffiliation"/> 
    40                         </list> 
    41                 </property> 
    42         </bean> 
     23     
     24 
     25 
     26        <bean id="statisticalUnits" class="uk.ac.cardiff.raptormua.engine.statistics.StatisticHandler"> 
     27        <property name="statisticRegistry"><ref bean="statisticRegistry"/></property> 
     28    </bean> 
     29     
     30    <!-- Handles all statistical units defined --> 
     31    <bean id="statisticRegistry" class="uk.ac.cardiff.raptormua.engine.statistics.ContextAwareStatisticRegistry"> 
     32        <property name="automaticallyFindStatsiticsToLoad" value="true"/> 
     33    </bean> 
    4334 
    4435 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/CapabilitiesConstructor.java

    r1040 r1082  
    2525import uk.ac.cardiff.raptor.store.StorageEngine; 
    2626import uk.ac.cardiff.raptormua.engine.statistics.Statistic; 
    27 import uk.ac.cardiff.raptormua.engine.statistics.StatisticsHandler; 
    28 import uk.ac.cardiff.raptormua.engine.statistics.StatisticsPostProcessor; 
     27import uk.ac.cardiff.raptormua.engine.statistics.StatisticHandler; 
     28import uk.ac.cardiff.raptormua.engine.statistics.StatisticPostProcessor; 
    2929import uk.ac.cardiff.raptormua.runtimeutils.ResourceMetadataComparator; 
    3030 
     
    5858     * @return 
    5959     */ 
    60     public Capabilities constructCapabilities(StatisticsHandler statisticsHandler, StorageEngine storageEngine, ServiceMetadata metadata) { 
     60    public Capabilities constructCapabilities(StatisticHandler statisticsHandler, StorageEngine storageEngine, ServiceMetadata metadata) { 
    6161        log.info("Capabilities Constructor Called"); 
    6262        long startTime = System.currentTimeMillis(); 
     
    118118                ArrayList<ProcessorInformation> postprocessors = new ArrayList<ProcessorInformation>(); 
    119119                if (entry.getPostprocessor() != null) { 
    120                     for (StatisticsPostProcessor postprocessor : entry.getPostprocessor()) { 
     120                    for (StatisticPostProcessor postprocessor : entry.getPostprocessor()) { 
    121121                        ProcessorInformation processorInformation = new ProcessorInformation(); 
    122122                        processorInformation.setBeanName(postprocessor.getClass().getSimpleName()); 
     
    141141     
    142142    private List<Suggestion> findPostProcessors(){ 
    143         String[] postProcessors = applicationContext.getBeanNamesForType(StatisticsPostProcessor.class); 
     143        String[] postProcessors = applicationContext.getBeanNamesForType(StatisticPostProcessor.class); 
    144144        ArrayList<Suggestion> postProcessorSuggestions = new ArrayList<Suggestion>(); 
    145145        for (String processor : postProcessors){ 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/MUAEngine.java

    r1078 r1082  
    4747import uk.ac.cardiff.raptor.store.TransactionInProgressException; 
    4848import uk.ac.cardiff.raptormua.engine.classification.ResourceClassificationBackgroundService; 
    49 import uk.ac.cardiff.raptormua.engine.statistics.StatisticsHandler; 
     49import uk.ac.cardiff.raptormua.engine.statistics.StatisticHandler; 
    5050import uk.ac.cardiff.raptormua.model.Users; 
    5151import uk.ac.cardiff.raptormua.upload.BatchFile; 
     
    6161 
    6262    /** Performs all statistics. */ 
    63     private StatisticsHandler statisticsHandler; 
     63    private StatisticHandler statisticsHandler; 
    6464 
    6565    /** 
     
    100100     * @param statisticsHandler the statistichandler to set 
    101101     */ 
    102     public final void setStatisticsHandler(final StatisticsHandler statisticsHandler) { 
     102    public final void setStatisticsHandler(final StatisticHandler statisticsHandler) { 
    103103        this.statisticsHandler = statisticsHandler; 
    104104    } 
    105105 
    106     public final StatisticsHandler getStatisticsHandler() { 
     106    public final StatisticHandler getStatisticsHandler() { 
    107107        return statisticsHandler; 
    108108    } 
     
    113113    public final AggregatorGraphModel performStatistic(final String statisticName) { 
    114114        // TODO we do not need to set this each time 
    115         statisticsHandler.setEntryHandler(storageEngine.getEntryHandler()); 
    116         return statisticsHandler.peformStatistic(statisticName); 
     115        statisticsHandler.setEventHandler(storageEngine.getEntryHandler()); 
     116        return statisticsHandler.performStatistic(statisticName); 
    117117 
    118118    } 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/Statistic.java

    r1080 r1082  
    3939import uk.ac.cardiff.raptormua.engine.statistics.records.Group; 
    4040import uk.ac.cardiff.raptormua.engine.statistics.records.Observation; 
     41import uk.ac.cardiff.raptormua.engine.statistics.records.ObservationSeries; 
    4142 
    4243/** 
     
    6061 
    6162    /** add a postprocessing module to the statistical method */ 
    62     private List<StatisticsPostProcessor> postprocessor; 
     63    private List<StatisticPostProcessor> postprocessor; 
    6364 
    6465    /** 
     
    218219            if (getPostprocessor() != null) { 
    219220                log.info("There are {} post processors to apply, these are {}", getPostprocessor().size(), 
    220                         Arrays.toString(getPostprocessor().toArray(new StatisticsPostProcessor[0]))); 
    221                 for (StatisticsPostProcessor post : postprocessor) { 
     221                        Arrays.toString(getPostprocessor().toArray(new StatisticPostProcessor[0]))); 
     222                for (StatisticPostProcessor post : postprocessor) { 
    222223                    // perform the same post process on each observationseries 
    223224                    for (ObservationSeries obsSeries : getObservationSeries()) { 
     
    259260    } 
    260261 
    261     public List<StatisticsPostProcessor> getPostprocessor() { 
     262    public List<StatisticPostProcessor> getPostprocessor() { 
    262263        return postprocessor; 
    263264    } 
    264265 
    265     public void setPostprocessor(List<StatisticsPostProcessor> postprocessor) { 
     266    public void setPostprocessor(List<StatisticPostProcessor> postprocessor) { 
    266267        this.postprocessor = postprocessor; 
    267268    } 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/StatisticHandler.java

    r1080 r1082  
    2828import uk.ac.cardiff.model.report.Series; 
    2929import uk.ac.cardiff.model.wsmodel.MethodParameter; 
    30 import uk.ac.cardiff.model.wsmodel.ProcessorInformation; 
    3130import uk.ac.cardiff.model.wsmodel.StatisticalUnitInformation; 
    3231import uk.ac.cardiff.raptor.store.EventHandler; 
    3332 
    3433/** 
    35  * @author philsmart Allows the storage and invocation of statistical units 
     34 * Allows the storage and invocation of statistical units 
     35 *  
     36 * @author philsmart 
    3637 */ 
    37 public class StatisticsHandler { 
     38public class StatisticHandler { 
    3839 
    3940    /** Class Logger */ 
    40     private final Logger log = LoggerFactory.getLogger(StatisticsHandler.class); 
     41    private final Logger log = LoggerFactory.getLogger(StatisticHandler.class); 
    4142 
    42     /** 
    43      * List of {@link uk.ac.cardiff.raptormua.engine.statistics.Statistic} that have been registered with this handler 
    44      */ 
    45     private List<Statistic> statisticalUnits; 
     43    /** Registry for managing statistics **/ 
     44    private StatisticRegistry statisticRegistry; 
    4645 
    4746    /** A reference to the event handler that is used to access all underlying events */ 
    48     private EventHandler entryHandler; 
    49  
    50     /** 
    51      * Registers a List of statistics with this StatisticsHandler 
    52      */ 
    53     public void setStatisticalUnits(List<Statistic> statisticalUnits) { 
    54         for (Statistic stat : statisticalUnits) { 
    55             log.info("Registering statistic [{}], role {}", stat.getStatisticParameters().getUnitName(), stat 
    56                     .getStatisticParameters().getType()); 
    57         } 
    58         this.statisticalUnits = statisticalUnits; 
    59     } 
    60  
    61     public List<Statistic> getStatisticalUnits() { 
    62         return statisticalUnits; 
    63     } 
     47    private EventHandler eventHandler; 
    6448 
    6549    /** 
    6650     * @param statisticName 
    6751     */ 
    68     public AggregatorGraphModel peformStatistic(String statisticName) { 
    69         for (Statistic statistic : statisticalUnits) { 
    70             if (statistic.getStatisticParameters().getUnitName().equals(statisticName)) { 
     52    public AggregatorGraphModel performStatistic(String statisticName) { 
     53        if (statisticRegistry != null) { 
     54            Statistic statistic = statisticRegistry.getStatistic(statisticName); 
     55            if (statistic != null) { 
    7156                return performStatiticalPipeline(statistic); 
    7257            } 
     58        } else { 
     59            log.error("No statistical registry has been defined or attached to this statistic handler, no statistics to perform"); 
    7360        } 
    7461        return null; 
     
    7663 
    7764    private AggregatorGraphModel performStatiticalPipeline(Statistic statistic) { 
    78         statistic.setEntryHandler(entryHandler); 
     65        statistic.setEntryHandler(getEventHandler()); 
    7966        Boolean success = invoke(statistic); 
    8067        log.info("Statistic [{}] succedded {}", statistic.getStatisticParameters().getUnitName(), success); 
     
    10693     */ 
    10794    private Boolean invoke(Statistic statistic) { 
    108         if (this.getEntryHandler() != null) 
    109             log.debug("Invoking statistic [{}], working off {} entries", statistic.getStatisticParameters() 
    110                     .getUnitName(), this.getEntryHandler().getNumberOfEvents()); 
     95        if (getEventHandler() != null) 
     96            log.debug("Invoking statistic [{}], working off {} events", statistic.getStatisticParameters() 
     97                    .getUnitName(), getEventHandler().getNumberOfEvents()); 
    11198 
    11299        /* stop processing if there are no valid entries */ 
    113         if (this.getEntryHandler() == null || this.getEntryHandler().getNumberOfEvents() == 0) { 
    114             log.error("Not enough entries to perform statistic countEntryPerInterval"); 
     100        if (getEventHandler() == null || getEventHandler().getNumberOfEvents() == 0) { 
     101            log.error("Not enough events to perform statistic {}", statistic.getStatisticParameters().getUnitName()); 
    115102            return false; 
    116103        } 
     
    137124 
    138125    /** 
    139      * updates a statistical unit based on the values in the <code>statisticalUnitInformation</code> parameter Not a 
    140      * very good primary key (unit name) should be something else 
     126     * Delegates to the statisticRegistry to update a <code>Statistic</code> 
    141127     *  
    142128     * @param statisticalUnitInformation 
    143129     */ 
    144130    public void updateStatisticalUnit(StatisticalUnitInformation statisticalUnitInformation) { 
    145         Statistic toUpdate = null; 
    146         for (Statistic statistic : statisticalUnits) { 
    147             if (statistic.getStatisticParameters().getUnitName() 
    148                     .equals(statisticalUnitInformation.getStatisticParameters().getUnitName())) 
    149                 toUpdate = statistic; 
    150         } 
    151         log.debug("Found statistic [{}] to update", toUpdate.getStatisticParameters().getUnitName()); 
    152         update(toUpdate, statisticalUnitInformation); 
    153         log.debug("Finished updating statistic [{}]", toUpdate.getStatisticParameters().getUnitName()); 
     131        statisticRegistry.updateStatisticalUnit(statisticalUnitInformation); 
    154132 
    155133    } 
    156134 
    157     /** 
    158      * Updates the statistical parameters of the passed statistic, does not yet handle the post processors 
    159      *  
    160      * @param statistic - the statistic to update 
    161      * @param statisticalUnitInformation - the statistical unit information to used update the <code>statistic</code> 
    162      */ 
    163     private void update(Statistic statistic, StatisticalUnitInformation statisticalUnitInformation) { 
    164         statistic.setStatisticParameters(statisticalUnitInformation.getStatisticParameters()); 
    165         // now deal with the post processors 
    166         List<StatisticsPostProcessor> postProcessors = 
    167                 initialisePostProcessors(statisticalUnitInformation.getPostprocessors()); 
    168         statistic.setPostprocessor(postProcessors); 
     135    public List<Statistic> getStatisticalUnits() { 
     136        return statisticRegistry.getStatisticalUnits(); 
    169137    } 
    170138 
    171139    /** 
    172      *  
    173      * @param postProcessorsInformation 
    174      * @return 
     140     * @param eventHandler the eventHandler to set 
    175141     */ 
    176     private List<StatisticsPostProcessor> 
    177             initialisePostProcessors(List<ProcessorInformation> postProcessorsInformation) { 
    178         // TODO could be factory method, need to acquire the bean implementation now. 
    179         List<StatisticsPostProcessor> postprocessors = null; 
    180  
    181         return postprocessors; 
     142    public void setEventHandler(EventHandler eventHandler) { 
     143        this.eventHandler = eventHandler; 
    182144    } 
    183145 
    184146    /** 
    185      *  
    186      * @param entryHandler 
     147     * @return the eventHandler 
    187148     */ 
    188     public void setEntryHandler(EventHandler entryHandler) { 
    189         this.entryHandler = entryHandler; 
     149    public EventHandler getEventHandler() { 
     150        return eventHandler; 
    190151    } 
    191152 
    192153    /** 
     154     * Method that maintains compatibility with older configuration files that specify the list of statistical units 
     155     * directly on the statistics handler. 
    193156     *  
    194      * @return 
     157     * @param statisticalUnits 
    195158     */ 
    196     public EventHandler getEntryHandler() { 
    197         return entryHandler; 
     159    @Deprecated 
     160    public void setStatisticalUnits(List<Statistic> statisticalUnits) { 
     161        if (statisticRegistry == null) { 
     162            statisticRegistry = new ContextAwareStatisticRegistry(); 
     163        } 
     164        statisticRegistry.setStatisticalUnits(statisticalUnits); 
     165    } 
     166 
     167    /** 
     168     * @param statisticRegistry the statisticRegistry to set 
     169     */ 
     170    public void setStatisticRegistry(StatisticRegistry statisticRegistry) { 
     171        this.statisticRegistry = statisticRegistry; 
     172    } 
     173 
     174    /** 
     175     * @return the statisticRegistry 
     176     */ 
     177    public StatisticRegistry getStatisticRegistry() { 
     178        return statisticRegistry; 
    198179    } 
    199180 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/StatisticPostProcessor.java

    r1077 r1082  
    3030 * 
    3131 */ 
    32 public interface StatisticsPostProcessor { 
     32public interface StatisticPostProcessor { 
    3333 
    3434        public Observation[] postProcess(Observation[] observations) throws PostprocessorException; 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/functions/CountEntry.java

    r1040 r1082  
    2525import uk.ac.cardiff.model.wsmodel.MethodParameter; 
    2626import uk.ac.cardiff.model.wsmodel.StatisticParameters; 
    27 import uk.ac.cardiff.raptormua.engine.statistics.ObservationSeries; 
    2827import uk.ac.cardiff.raptormua.engine.statistics.Statistic; 
    2928import uk.ac.cardiff.raptormua.engine.statistics.StatisticalUnitException; 
    3029import uk.ac.cardiff.raptormua.engine.statistics.records.Bucket; 
     30import uk.ac.cardiff.raptormua.engine.statistics.records.ObservationSeries; 
    3131 
    3232public class CountEntry extends Statistic{ 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/functions/CountEntryPerInterval.java

    r1040 r1082  
    2626import uk.ac.cardiff.model.wsmodel.StatisticParameters; 
    2727import uk.ac.cardiff.model.wsmodel.MethodParameter.ParameterType; 
    28 import uk.ac.cardiff.raptormua.engine.statistics.ObservationSeries; 
    2928import uk.ac.cardiff.raptormua.engine.statistics.Statistic; 
    3029import uk.ac.cardiff.raptormua.engine.statistics.StatisticalUnitException; 
    3130import uk.ac.cardiff.raptormua.engine.statistics.records.Bucket; 
     31import uk.ac.cardiff.raptormua.engine.statistics.records.ObservationSeries; 
    3232 
    3333public class CountEntryPerInterval extends Statistic{ 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/functions/GroupBy.java

    r1020 r1082  
    2727import uk.ac.cardiff.model.wsmodel.MethodParameter.ParameterType; 
    2828import uk.ac.cardiff.raptor.runtimeutils.ReflectionHelper; 
    29 import uk.ac.cardiff.raptormua.engine.statistics.ObservationSeries; 
    3029import uk.ac.cardiff.raptormua.engine.statistics.Statistic; 
    3130import uk.ac.cardiff.raptormua.engine.statistics.StatisticalUnitException; 
    3231import uk.ac.cardiff.raptormua.engine.statistics.records.Group; 
     32import uk.ac.cardiff.raptormua.engine.statistics.records.ObservationSeries; 
    3333 
    3434public class GroupBy extends Statistic{ 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/functions/GroupByCountDistinct.java

    r1040 r1082  
    2828import uk.ac.cardiff.raptor.runtimeutils.ReflectionException; 
    2929import uk.ac.cardiff.raptor.runtimeutils.ReflectionHelper; 
    30 import uk.ac.cardiff.raptormua.engine.statistics.ObservationSeries; 
    3130import uk.ac.cardiff.raptormua.engine.statistics.Statistic; 
    3231import uk.ac.cardiff.raptormua.engine.statistics.StatisticalUnitException; 
    3332import uk.ac.cardiff.raptormua.engine.statistics.records.Group; 
     33import uk.ac.cardiff.raptormua.engine.statistics.records.ObservationSeries; 
    3434 
    3535public class GroupByCountDistinct extends Statistic { 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/functions/GroupByFrequency.java

    r1040 r1082  
    2727import uk.ac.cardiff.model.wsmodel.MethodParameter.ParameterType; 
    2828import uk.ac.cardiff.raptor.runtimeutils.ReflectionHelper; 
    29 import uk.ac.cardiff.raptormua.engine.statistics.ObservationSeries; 
    3029import uk.ac.cardiff.raptormua.engine.statistics.Statistic; 
    3130import uk.ac.cardiff.raptormua.engine.statistics.StatisticalUnitException; 
    3231import uk.ac.cardiff.raptormua.engine.statistics.records.Group; 
     32import uk.ac.cardiff.raptormua.engine.statistics.records.ObservationSeries; 
    3333 
    3434public class GroupByFrequency extends Statistic { 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/processor/CutRowsPostProcessor.java

    r1078 r1082  
    2323import org.slf4j.LoggerFactory; 
    2424 
    25 import uk.ac.cardiff.raptormua.engine.statistics.StatisticsPostProcessor; 
     25import uk.ac.cardiff.raptormua.engine.statistics.StatisticPostProcessor; 
    2626import uk.ac.cardiff.raptormua.engine.statistics.records.Bucket; 
    2727import uk.ac.cardiff.raptormua.engine.statistics.records.Group; 
     
    3232 *  
    3333 */ 
    34 public class CutRowsPostProcessor implements StatisticsPostProcessor { 
     34public class CutRowsPostProcessor implements StatisticPostProcessor { 
    3535 
    3636    /** class logger */ 
     
    4747     * (non-Javadoc) 
    4848     *  
    49      * @see uk.ac.cardiff.raptormua.engine.statistics.StatisticsPostProcessor#postProcess(uk.ac.cardiff.raptormua.engine.statistics.records.Observation[]) 
     49     * @see uk.ac.cardiff.raptormua.engine.statistics.StatisticPostProcessor#postProcess(uk.ac.cardiff.raptormua.engine.statistics.records.Observation[]) 
    5050     */ 
    5151 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/processor/NumberFormatterPostProcessor.java

    r1078 r1082  
    2626import org.slf4j.LoggerFactory; 
    2727 
    28 import uk.ac.cardiff.raptormua.engine.statistics.StatisticsPostProcessor; 
     28import uk.ac.cardiff.raptormua.engine.statistics.StatisticPostProcessor; 
    2929import uk.ac.cardiff.raptormua.engine.statistics.records.Observation; 
    3030 
     
    3333 *  
    3434 */ 
    35 public class NumberFormatterPostProcessor implements StatisticsPostProcessor { 
     35public class NumberFormatterPostProcessor implements StatisticPostProcessor { 
    3636 
    3737    /* class logger */ 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/processor/PercentagePostProcessor.java

    r1078 r1082  
    2323import org.slf4j.LoggerFactory; 
    2424 
    25 import uk.ac.cardiff.raptormua.engine.statistics.StatisticsPostProcessor; 
     25import uk.ac.cardiff.raptormua.engine.statistics.StatisticPostProcessor; 
    2626import uk.ac.cardiff.raptormua.engine.statistics.records.Observation; 
    2727 
     
    3030 *  
    3131 */ 
    32 public class PercentagePostProcessor implements StatisticsPostProcessor { 
     32public class PercentagePostProcessor implements StatisticPostProcessor { 
    3333 
    3434    /* class logger */ 
     
    4343     * (non-Javadoc) 
    4444     *  
    45      * @see uk.ac.cardiff.raptormua.engine.statistics.StatisticsPostProcessor#postProcess(uk.ac.cardiff.raptormua.engine.statistics.records.Observation[]) 
     45     * @see uk.ac.cardiff.raptormua.engine.statistics.StatisticPostProcessor#postProcess(uk.ac.cardiff.raptormua.engine.statistics.records.Observation[]) 
    4646     */ 
    4747    public Observation[] postProcess(Observation[] observations) throws PostprocessorException { 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/processor/RowSortPostProcessor.java

    r1078 r1082  
    2525import org.slf4j.LoggerFactory; 
    2626 
    27 import uk.ac.cardiff.raptormua.engine.statistics.StatisticsPostProcessor; 
     27import uk.ac.cardiff.raptormua.engine.statistics.StatisticPostProcessor; 
    2828import uk.ac.cardiff.raptormua.engine.statistics.helper.ObservationComparator; 
    2929import uk.ac.cardiff.raptormua.engine.statistics.records.Observation; 
     
    3333 *  
    3434 */ 
    35 public class RowSortPostProcessor implements StatisticsPostProcessor { 
     35public class RowSortPostProcessor implements StatisticPostProcessor { 
    3636 
    3737    /** class logger */ 
     
    5252     * (non-Javadoc) 
    5353     *  
    54      * @see uk.ac.cardiff.raptormua.engine.statistics.StatisticsPostProcessor#postProcess(uk.ac.cardiff.raptormua.engine.statistics.records.Observation[]) 
     54     * @see uk.ac.cardiff.raptormua.engine.statistics.StatisticPostProcessor#postProcess(uk.ac.cardiff.raptormua.engine.statistics.records.Observation[]) 
    5555     */ 
    5656    public Observation[] postProcess(Observation[] observations) throws PostprocessorException { 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/processor/SamlMetadataNameFormatter.java

    r1079 r1082  
    3636import org.slf4j.LoggerFactory; 
    3737 
    38 import uk.ac.cardiff.raptormua.engine.statistics.StatisticsPostProcessor; 
     38import uk.ac.cardiff.raptormua.engine.statistics.StatisticPostProcessor; 
    3939import uk.ac.cardiff.raptormua.engine.statistics.records.Group; 
    4040import uk.ac.cardiff.raptormua.engine.statistics.records.Observation; 
     
    4444 *  
    4545 */ 
    46 public class SamlMetadataNameFormatter implements StatisticsPostProcessor { 
     46public class SamlMetadataNameFormatter implements StatisticPostProcessor { 
    4747 
    4848    /** Parser manager used to parse XML. */ 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/processor/SortGroupsAlphabeticallyPostProcessor.java

    r1078 r1082  
    2525import org.slf4j.LoggerFactory; 
    2626 
    27 import uk.ac.cardiff.raptormua.engine.statistics.StatisticsPostProcessor; 
     27import uk.ac.cardiff.raptormua.engine.statistics.StatisticPostProcessor; 
    2828import uk.ac.cardiff.raptormua.engine.statistics.helper.StringGroupComparator; 
    2929import uk.ac.cardiff.raptormua.engine.statistics.records.Group; 
     
    3434 *  
    3535 */ 
    36 public class SortGroupsAlphabeticallyPostProcessor implements StatisticsPostProcessor { 
     36public class SortGroupsAlphabeticallyPostProcessor implements StatisticPostProcessor { 
    3737 
    3838    /** class logger */ 
     
    5353     * (non-Javadoc) 
    5454     *  
    55      * @see uk.ac.cardiff.raptormua.engine.statistics.StatisticsPostProcessor#postProcess(uk.ac.cardiff.raptormua.engine.statistics.records.Observation[]) 
     55     * @see uk.ac.cardiff.raptormua.engine.statistics.StatisticPostProcessor#postProcess(uk.ac.cardiff.raptormua.engine.statistics.records.Observation[]) 
    5656     */ 
    5757    public Observation[] postProcess(Observation[] observations) throws PostprocessorException { 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/records/ObservationSeries.java

    r1077 r1082  
    1414 * limitations under the License. 
    1515 */ 
    16 package uk.ac.cardiff.raptormua.engine.statistics; 
     16package uk.ac.cardiff.raptormua.engine.statistics.records; 
    1717 
    18 import uk.ac.cardiff.raptormua.engine.statistics.records.Observation; 
    1918 
    2019public class ObservationSeries { 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/service/impl/MUAProcessImpl.java

    r1044 r1082  
    1717 * 
    1818 */ 
     19 
    1920package uk.ac.cardiff.raptormua.service.impl; 
    2021 
    21 import java.io.File; 
    2222import java.util.ArrayList; 
    2323import java.util.List; 
     
    4141import uk.ac.cardiff.raptor.store.TransactionInProgressException; 
    4242import uk.ac.cardiff.raptormua.engine.MUAEngine; 
    43 import uk.ac.cardiff.raptormua.engine.classification.ResourceClassificationBackgroundService; 
    4443import uk.ac.cardiff.raptormua.service.MUAProcess; 
    4544import uk.ac.cardiff.raptormua.upload.BatchFile; 
     
    4746 
    4847/** 
    49  * All operations should go through this service class, so as to obey locks and synchronisation issues. Locks collisions are thrown use a <code>SoapFault</code> 
    50  * . Fault codes are: Client (if a malformed input e.g. statistic name is wrong) Server (we use for locks, as server side issue) VersionMismatch MustUnderstand 
     48 * All operations should go through this service class, so as to obey locks and synchronisation issues. Locks collisions 
     49 * are thrown use a <code>SoapFault</code> . Fault codes are: Client (if a malformed input e.g. statistic name is wrong) 
     50 * Server (we use for locks, as server side issue) VersionMismatch MustUnderstand 
    5151 *  
    5252 * @author philsmart 
     
    7474        if (lockR.tryLock()) { 
    7575            try { 
    76                 log.info("WebSservice call for perform statistic {} ", statisticName); 
     76                log.info("WebSservice call for perform statistic [{}] ", statisticName); 
    7777                return engine.performStatistic(statisticName); 
    7878            } catch (Exception e) { 
     
    111111        if (lockR.tryLock()) { 
    112112            try { 
    113                 log.info("Updating statistical unit {}", statisticalUnitInformation.getStatisticParameters().getUnitName()); 
     113                log.info("Updating statistical unit {}", statisticalUnitInformation.getStatisticParameters() 
     114                        .getUnitName()); 
    114115                engine.updateStatisticalUnit(statisticalUnitInformation); 
    115116                success = true; 
     
    130131        if (lockR.tryLock()) { 
    131132            try { 
    132                 log.info("Performing administrative function {}, request orginates from {}", function.getAdministrativeFunction(), function.getRequester()); 
     133                log.info("Performing administrative function {}, request orginates from {}", 
     134                        function.getAdministrativeFunction(), function.getRequester()); 
    133135                return engine.performAdministrativeFunction(function); 
    134136            } catch (Exception e) { 
     
    146148 
    147149    /** 
    148      * Because this is perform async, the lock is not useful (it will be released immediately), its the immediate exceptions that are. 
     150     * Because this is perform async, the lock is not useful (it will be released immediately), its the immediate 
     151     * exceptions that are. 
    149152     */ 
    150153    public void addAuthentications(EventPushMessage pushed) throws SoapFault { 
     
    152155        if (lockR.tryLock()) { 
    153156            try { 
    154                 log.info("MUA has received {} entries from {}", pushed.getEvents().size(), pushed.getClientMetadata().getServiceName()); 
     157                log.info("MUA has received {} entries from {}", pushed.getEvents().size(), pushed.getClientMetadata() 
     158                        .getServiceName()); 
    155159                engine.addAuthentications(pushed); 
    156160                success = true; 
    157161            } catch (TransactionInProgressException e) { 
    158                 log.warn("Error trying to add authentications to this MUA, {}, client should retry automatically", e.getMessage()); 
    159                 success = false; 
    160             } catch (Exception e){ 
    161                log.error("Error trying to add authentications to this MUA",e);  
    162                success = false; 
     162                log.warn("Error trying to add authentications to this MUA, {}, client should retry automatically", 
     163                        e.getMessage()); 
     164                success = false; 
     165            } catch (Exception e) { 
     166                log.error("Error trying to add authentications to this MUA", e); 
     167                success = false; 
    163168            } finally { 
    164169                lockR.unlock(); 
     
    168173            log.warn("Lock was hit for method [addAuthentications]"); 
    169174        if (!success) { 
    170             throw new SoapFault("Technical fault at the server, could not add events to MUA [" + this.getEngine().getMuaMetadata().getServiceName() + "]", new QName("Server")); 
    171         } 
    172  
    173     } 
    174  
    175     public AggregatorGraphModel updateAndInvokeStatisticalUnit(StatisticalUnitInformation statisticalUnitInformation) throws SoapFault { 
    176         if (lockR.tryLock()) { 
    177             try { 
    178                 log.info("Webservice call to update and perform statistic {}", statisticalUnitInformation.getStatisticParameters().getUnitName()); 
     175            throw new SoapFault("Technical fault at the server, could not add events to MUA [" 
     176                    + this.getEngine().getMuaMetadata().getServiceName() + "]", new QName("Server")); 
     177        } 
     178 
     179    } 
     180 
     181    public AggregatorGraphModel updateAndInvokeStatisticalUnit(StatisticalUnitInformation statisticalUnitInformation) 
     182            throws SoapFault { 
     183        if (lockR.tryLock()) { 
     184            try { 
     185                log.info("Webservice call to update and perform statistic {}", statisticalUnitInformation 
     186                        .getStatisticParameters().getUnitName()); 
    179187                engine.updateStatisticalUnit(statisticalUnitInformation); 
    180188                return engine.performStatistic(statisticalUnitInformation.getStatisticParameters().getUnitName()); 
     
    189197 
    190198    } 
    191  
    192199 
    193200    public List<LogFileUploadResult> batchUpload(List<LogFileUpload> uploadFiles) throws SoapFault { 
     
    199206 
    200207                for (LogFileUpload logfile : uploadFiles) { 
    201                     log.debug("Log File details: name [{}], MIME type [{}], Length [{}], ID [{}]", new Object[] { logfile.getName(), logfile.getMime(), logfile.getData().length, logfile.getId() }); 
     208                    log.debug("Log File details: name [{}], MIME type [{}], Length [{}], ID [{}]", new Object[] { 
     209                            logfile.getName(), logfile.getMime(), logfile.getData().length, logfile.getId()}); 
    202210                } 
    203211                result = engine.batchParse(uploadFiles); 
     
    220228 
    221229    } 
    222      
    223230 
    224231    public void uploadFromDirectory() { 
    225232        List<BatchFile> files = fileUploadEngine.scanDirectories(); 
    226         if (files!=null && files.size()>0){ 
     233        if (files != null && files.size() > 0) { 
    227234            if (lockR.tryLock()) { 
    228235                try { 
    229                     log.info("Uploading {} files from directory",files.size()); 
     236                    log.info("Uploading {} files from directory", files.size()); 
    230237                    engine.batchParseFiles(files); 
    231238                } catch (TransactionInProgressException e) { 
     
    240247        } 
    241248    } 
    242      
    243249 
    244250    public void resourceClassification() { 
     
    262268 
    263269    /** 
    264      * @param fileUploadEngine 
    265      *            the fileUploadEngine to set 
     270     * @param fileUploadEngine the fileUploadEngine to set 
    266271     */ 
    267272    public void setFileUploadEngine(FileUploadEngine fileUploadEngine) { 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/upload/FileUploadEngine.java

    r1050 r1082  
    5757                allBatchFiles.addAll(uploadDirectory.getNewFiles()); 
    5858            } catch (UploadFileException e) { 
    59                 log.warn("Problem uploading files from directory, {}", e.getMessage()); 
     59                log.warn("Problem trying to scan or upload files from directory, {}", e.getMessage()); 
    6060            } 
    6161        } 
Note: See TracChangeset for help on using the changeset viewer.