Changeset 693


Ignore:
Timestamp:
04/23/11 16:49:02 (8 years ago)
Author:
philsmart
Message:

before startservice dashboard statistics are added

Location:
raptor-web/trunk
Files:
3 added
9 edited

Legend:

Unmodified
Added
Removed
  • raptor-web/trunk/pom.xml

    r626 r693  
    161161        <dependencies> 
    162162 
    163                 <!-- loggin --> 
    164                 <dependency> 
    165                         <groupId>org.slf4j</groupId> 
    166                         <artifactId>slf4j-log4j12</artifactId> 
    167                         <version>1.6.1</version> 
    168                 </dependency> 
     163                 
    169164                <!-- Myfaces <dependency> <groupId>org.apache.myfaces.core</groupId> <artifactId>myfaces-api</artifactId> 
    170165                        <version>${myfaces.version}</version> <scope>compile</scope> </dependency> 
     
    559554                                        <groupId>xerces</groupId> 
    560555                                </exclusion> 
     556                <exclusion> 
     557                    <groupId>org.slf4j</groupId> 
     558                    <artifactId>slf4j-api</artifactId> 
     559                </exclusion> 
    561560                        </exclusions> 
    562561                </dependency> 
     
    571570                                <exclusion> 
    572571                                        <artifactId>slf4j-api</artifactId> 
     572                                        <groupId>org.slf4j</groupId> 
     573                                </exclusion> 
     574                                <exclusion> 
     575                                        <artifactId>slf4j-log4j12</artifactId> 
    573576                                        <groupId>org.slf4j</groupId> 
    574577                                </exclusion> 
  • raptor-web/trunk/src/main/java/uk/ac/cardiff/raptorweb/model/CachedStartStatistics.java

    r485 r693  
    2525public class CachedStartStatistics{ 
    2626 
    27         static Logger log = LoggerFactory.getLogger(CachedStartStatistics.class); 
     27        /** Class logger */ 
     28        private final Logger log = LoggerFactory.getLogger(CachedStartStatistics.class); 
    2829 
     30        /** The cached statistic */ 
    2931        private StartStatistics cached; 
     32         
    3033         
    3134        public CachedStartStatistics(){ 
  • raptor-web/trunk/src/main/java/uk/ac/cardiff/raptorweb/model/StartModel.java

    r631 r693  
    1515 
    1616import uk.ac.cardiff.model.wsmodel.Capabilities; 
     17import uk.ac.cardiff.model.wsmodel.StatisticParameters.EventType; 
    1718 
    1819/** 
     
    3637 
    3738        public enum TimeRange{TODAY,LASTWEEK,LASTMONTH,LASTYEAR} 
     39         
     40        public enum EventType{ 
     41                /** A Shibboleth Authentication Event Type*/ 
     42                SHIBBOLETH_AUTHENTICATION, 
     43                /** An Ezproxy Authentication Event Type */ 
     44                EZPROXY_AUTHENTICATION;         
     45        } 
     46             
     47        private EventType eventType; 
    3848 
    3949        public StartModel(){ 
    4050            statsRangeSelector = TimeRange.TODAY; 
     51            eventType = EventType.SHIBBOLETH_AUTHENTICATION; 
    4152        } 
    4253 
     
    7687            return statsRangeSelector.toString(); 
    7788        } 
     89         
     90        public String getEventTypeString() { 
     91            return eventType.toString(); 
     92        } 
     93         
     94        public void setEventTypeString(String eventTypeString){ 
     95            for (EventType type : EventType.values()){ 
     96                if (type.toString().equals(eventTypeString)) 
     97                    eventType = type; 
     98            } 
     99        } 
    78100 
    79101        public void setStartStatistics(StartStatistics startStatistics) { 
     
    86108 
    87109 
     110    public void setEventType(EventType eventType) { 
     111        this.eventType = eventType; 
     112    } 
     113 
     114 
     115    public EventType getEventType() { 
     116        return eventType; 
     117    } 
     118 
     119 
    88120 
    89121 
  • raptor-web/trunk/src/main/java/uk/ac/cardiff/raptorweb/service/impl/StartServiceImpl.java

    r621 r693  
    2020import uk.ac.cardiff.raptorweb.model.ChartOptions.ChartType; 
    2121import uk.ac.cardiff.raptorweb.model.ChartOptions.GraphPresentation; 
     22import uk.ac.cardiff.raptorweb.model.DashboardStatistic; 
    2223import uk.ac.cardiff.raptorweb.model.RaptorGraphModel; 
    2324import uk.ac.cardiff.raptorweb.model.RaptorJFreeChartModel; 
     
    3435 */ 
    3536public class StartServiceImpl implements StartService { 
    36  
    37     static Logger log = LoggerFactory.getLogger(StartServiceImpl.class); 
    38  
     37    //TODO start or dashboard stats should not be hard coded 
     38     
     39    /** Class Logger */ 
     40    private final Logger log = LoggerFactory.getLogger(StartServiceImpl.class); 
     41 
     42    /** The engine that is delegated to for all common internal functions of RaptorWeb*/ 
    3943    private RaptorWebEngine webEngine; 
    40  
    41     /* holds the statistics for the front page gathered from the background worker thread */ 
    42     private CachedStartStatistics cachedStartModelToday; 
    43     private CachedStartStatistics cachedStartModelLastWeek; 
    44     private CachedStartStatistics cachedStartModelLastMonth; 
    45     private CachedStartStatistics cachedStartModelLastYear; 
    46  
    47     /* The chart processor which converts Aggregator Charts into RaptorWeb charts for outputting */ 
     44     
     45    private List<DashboardStatistic> dashboardStatistics; 
     46     
     47 
     48    /** holds the statistics for the front page gathered from the background worker thread */ 
     49    private CachedStartStatistics cachedStartModelTodayShib; 
     50    private CachedStartStatistics cachedStartModelLastWeekShib; 
     51    private CachedStartStatistics cachedStartModelLastMonthShib; 
     52    private CachedStartStatistics cachedStartModelLastYearShib; 
     53     
     54    private CachedStartStatistics cachedStartModelTodayEzproxy; 
     55    private CachedStartStatistics cachedStartModelLastWeekEzproxy; 
     56    private CachedStartStatistics cachedStartModelLastMonthEzproxy; 
     57    private CachedStartStatistics cachedStartModelLastYearEzproxy; 
     58 
     59    /** The chart processor which converts Aggregator Charts into RaptorWeb charts for outputting */ 
    4860    private ChartProcessor chartProcessor; 
    4961 
    5062    public StartServiceImpl() { 
    51         cachedStartModelToday = new CachedStartStatistics(); 
    52         cachedStartModelLastWeek = new CachedStartStatistics(); 
    53         cachedStartModelLastMonth = new CachedStartStatistics(); 
    54         cachedStartModelLastYear = new CachedStartStatistics(); 
     63        cachedStartModelTodayShib = new CachedStartStatistics(); 
     64        cachedStartModelLastWeekShib = new CachedStartStatistics(); 
     65        cachedStartModelLastMonthShib = new CachedStartStatistics(); 
     66        cachedStartModelLastYearShib = new CachedStartStatistics(); 
     67         
     68        cachedStartModelTodayEzproxy = new CachedStartStatistics(); 
     69        cachedStartModelLastWeekEzproxy = new CachedStartStatistics(); 
     70        cachedStartModelLastMonthEzproxy = new CachedStartStatistics(); 
     71        cachedStartModelLastYearEzproxy = new CachedStartStatistics(); 
    5572    } 
    5673 
     
    5976        CurrentTimeRange currentTimeRange = getTimeRanges(); 
    6077 
     78        StatisticParameters.EventType shibEventType = StatisticParameters.EventType.SHIBBOLETH_AUTHENTICATION; 
     79        StatisticParameters.EventType ezproxyEventType = StatisticParameters.EventType.EZPROXY_AUTHENTICATION; 
     80         
    6181        log.debug("Background start page worker getting today"); 
    62         generateStatistics(cachedStartModelToday.getCached(), currentTimeRange.currentTime, currentTimeRange.startToday); 
     82        generateStatistics(cachedStartModelTodayShib.getCached(), currentTimeRange.currentTime, currentTimeRange.startToday,shibEventType); 
     83        generateStatistics(cachedStartModelTodayEzproxy.getCached(), currentTimeRange.currentTime, currentTimeRange.startToday,ezproxyEventType); 
    6384        log.debug("Background start page worker getting last week"); 
    64         generateStatistics(cachedStartModelLastWeek.getCached(), currentTimeRange.currentTime, currentTimeRange.startWeek); 
     85        generateStatistics(cachedStartModelLastWeekShib.getCached(), currentTimeRange.currentTime, currentTimeRange.startWeek,shibEventType); 
     86        generateStatistics(cachedStartModelLastWeekEzproxy.getCached(), currentTimeRange.currentTime, currentTimeRange.startWeek,ezproxyEventType); 
    6587        log.debug("Background start page worker getting last month"); 
    66         generateStatistics(cachedStartModelLastMonth.getCached(), currentTimeRange.currentTime, currentTimeRange.startMonth); 
     88        generateStatistics(cachedStartModelLastMonthShib.getCached(), currentTimeRange.currentTime, currentTimeRange.startMonth,shibEventType); 
     89        generateStatistics(cachedStartModelLastMonthEzproxy.getCached(), currentTimeRange.currentTime, currentTimeRange.startMonth,ezproxyEventType); 
    6790        log.debug("Background start page worker getting last year"); 
    68         generateStatistics(cachedStartModelLastYear.getCached(), currentTimeRange.currentTime, currentTimeRange.startYear); 
     91        generateStatistics(cachedStartModelLastYearShib.getCached(), currentTimeRange.currentTime, currentTimeRange.startYear,shibEventType); 
     92        generateStatistics(cachedStartModelLastYearEzproxy.getCached(), currentTimeRange.currentTime, currentTimeRange.startYear,ezproxyEventType); 
    6993 
    7094        log.info("Generating background statistics for the start page...done"); 
     
    7599        log.debug("Getting start statistics for {} from {}", websession.getStartmodel().getStatsRangeSelector(), this); 
    76100 
    77         if (websession.getStartmodel().getStatsRangeSelector() == StartModel.TimeRange.LASTMONTH) 
    78             websession.getStartmodel().setStartStatistics(cachedStartModelLastMonth.getCached()); 
    79         if (websession.getStartmodel().getStatsRangeSelector() == StartModel.TimeRange.LASTWEEK) 
    80             websession.getStartmodel().setStartStatistics(cachedStartModelLastWeek.getCached()); 
    81         if (websession.getStartmodel().getStatsRangeSelector() == StartModel.TimeRange.TODAY) 
    82             websession.getStartmodel().setStartStatistics(cachedStartModelToday.getCached()); 
    83         if (websession.getStartmodel().getStatsRangeSelector() == StartModel.TimeRange.LASTYEAR) 
    84             websession.getStartmodel().setStartStatistics(cachedStartModelLastYear.getCached()); 
     101        if (websession.getStartmodel().getStatsRangeSelector() == StartModel.TimeRange.LASTMONTH &&  
     102                websession.getStartmodel().getEventType() == StartModel.EventType.SHIBBOLETH_AUTHENTICATION) 
     103            websession.getStartmodel().setStartStatistics(cachedStartModelLastMonthShib.getCached()); 
     104        if (websession.getStartmodel().getStatsRangeSelector() == StartModel.TimeRange.LASTWEEK &&  
     105                websession.getStartmodel().getEventType() == StartModel.EventType.SHIBBOLETH_AUTHENTICATION) 
     106            websession.getStartmodel().setStartStatistics(cachedStartModelLastWeekShib.getCached()); 
     107        if (websession.getStartmodel().getStatsRangeSelector() == StartModel.TimeRange.TODAY &&  
     108                websession.getStartmodel().getEventType() == StartModel.EventType.SHIBBOLETH_AUTHENTICATION) 
     109            websession.getStartmodel().setStartStatistics(cachedStartModelTodayShib.getCached()); 
     110        if (websession.getStartmodel().getStatsRangeSelector() == StartModel.TimeRange.LASTYEAR &&  
     111                websession.getStartmodel().getEventType() == StartModel.EventType.SHIBBOLETH_AUTHENTICATION) 
     112            websession.getStartmodel().setStartStatistics(cachedStartModelLastYearShib.getCached()); 
     113         
     114        if (websession.getStartmodel().getStatsRangeSelector() == StartModel.TimeRange.LASTMONTH &&  
     115                websession.getStartmodel().getEventType() == StartModel.EventType.EZPROXY_AUTHENTICATION) 
     116            websession.getStartmodel().setStartStatistics(cachedStartModelLastMonthEzproxy.getCached()); 
     117        if (websession.getStartmodel().getStatsRangeSelector() == StartModel.TimeRange.LASTWEEK &&  
     118                websession.getStartmodel().getEventType() == StartModel.EventType.EZPROXY_AUTHENTICATION) 
     119            websession.getStartmodel().setStartStatistics(cachedStartModelLastWeekEzproxy.getCached()); 
     120        if (websession.getStartmodel().getStatsRangeSelector() == StartModel.TimeRange.TODAY &&  
     121                websession.getStartmodel().getEventType() == StartModel.EventType.EZPROXY_AUTHENTICATION) 
     122            websession.getStartmodel().setStartStatistics(cachedStartModelTodayEzproxy.getCached()); 
     123        if (websession.getStartmodel().getStatsRangeSelector() == StartModel.TimeRange.LASTYEAR &&  
     124                websession.getStartmodel().getEventType() == StartModel.EventType.EZPROXY_AUTHENTICATION) 
     125            websession.getStartmodel().setStartStatistics(cachedStartModelLastYearEzproxy.getCached()); 
    85126 
    86127        // so we could output the name of the attached MUA 
     
    122163     * Adds the following statistical information from the attached MUA: 1. Number of authentications per <RANGE> 2. 
    123164     */ 
    124     private void generateStatistics(StartStatistics startstats, DateTime currentDateTime, DateTime chosenStartTime) { 
     165    private void generateStatistics(StartStatistics startstats, DateTime currentDateTime, DateTime chosenStartTime, StatisticParameters.EventType eventType) { 
    125166 
    126167        List<StatisticalUnitInformation> statisticalUnits = getStatisticalUnits(); 
     
    160201            numberOfAuthenticationsPerUnitInformation.getStatisticParameters().setEndTime(currentDateTime); 
    161202            numberOfAuthenticationsPerUnitInformation.getStatisticParameters().setStartTime(chosenStartTime); 
     203            numberOfAuthenticationsPerUnitInformation.getStatisticParameters().setEventType(eventType); 
    162204            numberOfAuthentications = webEngine.updateAndInvokeStatisticalUnit(numberOfAuthenticationsPerUnitInformation); 
    163205        } 
     
    167209            numberOfUniqueUsersPerUnitInformation.getStatisticParameters().setEndTime(currentDateTime); 
    168210            numberOfUniqueUsersPerUnitInformation.getStatisticParameters().setStartTime(chosenStartTime); 
     211            numberOfUniqueUsersPerUnitInformation.getStatisticParameters().setEventType(eventType); 
    169212            numberOfUniqueUsers = webEngine.updateAndInvokeStatisticalUnit(numberOfUniqueUsersPerUnitInformation); 
    170213 
     
    175218            topFiveResources.getStatisticParameters().setEndTime(currentDateTime); 
    176219            topFiveResources.getStatisticParameters().setStartTime(chosenStartTime); 
     220            topFiveResources.getStatisticParameters().setEventType(eventType); 
    177221            topFiveResourcesModel = webEngine.updateAndInvokeStatisticalUnit(topFiveResources); 
    178222        } 
    179223 
    180         AggregatorGraphModel bottomFiveResourcesModel = null; 
    181         if (bottomFiveResources != null) { 
    182             bottomFiveResources.getStatisticParameters().setEndTime(currentDateTime); 
    183             bottomFiveResources.getStatisticParameters().setStartTime(chosenStartTime); 
    184             bottomFiveResourcesModel = webEngine.updateAndInvokeStatisticalUnit(bottomFiveResources); 
    185         } 
    186224 
    187225        AggregatorGraphModel numberOfAuthenticationsPerIntervalNumberModel = null; 
     
    189227            numberOfAuthenticationsPerIntervalNumber.getStatisticParameters().setEndTime(currentDateTime); 
    190228            numberOfAuthenticationsPerIntervalNumber.getStatisticParameters().setStartTime(chosenStartTime); 
     229            numberOfAuthenticationsPerIntervalNumber.getStatisticParameters().setEventType(eventType); 
    191230            numberOfAuthenticationsPerIntervalNumberModel = webEngine.updateAndInvokeStatisticalUnit(numberOfAuthenticationsPerIntervalNumber); 
    192231        } 
     
    196235            numberOfUniqueAuthenticationsPerSP.getStatisticParameters().setEndTime(currentDateTime); 
    197236            numberOfUniqueAuthenticationsPerSP.getStatisticParameters().setStartTime(chosenStartTime); 
     237            numberOfUniqueAuthenticationsPerSP.getStatisticParameters().setEventType(eventType); 
    198238            uniqueAuthsPerSPModel = webEngine.updateAndInvokeStatisticalUnit(numberOfUniqueAuthenticationsPerSP); 
    199239        } 
     
    201241        // Now set the statistics values ------ 
    202242 
    203         if (numberOfAuthentications != null && numberOfUniqueUsers != null && topFiveResourcesModel != null && bottomFiveResourcesModel != null && numberOfAuthenticationsPerIntervalNumberModel != null && uniqueAuthsPerSPModel!=null) { 
     243        if (numberOfAuthentications != null && numberOfUniqueUsers != null && topFiveResourcesModel != null && numberOfAuthenticationsPerIntervalNumberModel != null && uniqueAuthsPerSPModel!=null) { 
    204244            if (numberOfAuthentications != null) { 
    205245                RaptorTableChartModel table = getChartProcessor().constructRaptorTableChartModel(numberOfAuthentications); 
     
    231271            } 
    232272 
    233             if (bottomFiveResourcesModel != null) { 
    234                 RaptorTableChartModel table = getChartProcessor().constructRaptorTableChartModel(bottomFiveResourcesModel); 
    235                 startstats.setBottomFiveResouces(table); 
    236             } 
    237273            if (numberOfAuthenticationsPerIntervalNumberModel != null) { 
    238274                RaptorJFreeChartModel jfreeChart = getChartProcessor().constructJFreeGraph(GraphPresentation.FRONT,ChartType.AREA,numberOfAuthenticationsPerIntervalNumberModel,1270,350,(chosenStartTime.toString("ddMMyyyHH-mm")+"-"+currentDateTime.toString("ddMMyyyHH-mm"))); 
     
    274310    public ChartProcessor getChartProcessor() { 
    275311        return chartProcessor; 
     312    } 
     313 
     314    public void setDashboardStatistics(List<DashboardStatistic> dashboardStatistics) { 
     315        this.dashboardStatistics = dashboardStatistics; 
     316    } 
     317 
     318    public List<DashboardStatistic> getDashboardStatistics() { 
     319        return dashboardStatistics; 
    276320    } 
    277321 
  • raptor-web/trunk/src/main/webapp/WEB-INF/config/raptorweb-servlet.xml

    r365 r693  
    1919        <!--  Import the setup for the web interface --> 
    2020         <import resource="web-setup.xml" /> 
     21      
     22     <!--  Import the setup of the front page dashboard statistics --> 
     23     <import resource="dashboard-statistics.xml"/> 
    2124 
    2225 
  • raptor-web/trunk/src/main/webapp/WEB-INF/config/web-setup.xml

    r659 r693  
    5656                <property name="webEngine"><ref bean="webEngine"/></property> 
    5757                <property name="chartProcessor"><ref bean="chartProcessor"/></property> 
     58        <property name="dashboardStatistics" ref="dashboardStatisticsList"/> 
    5859        </bean> 
    5960 
     
    9798                <property name="triggers"> 
    9899                        <list> 
    99                         <!--   <ref local="SystemStatsQuickTrigger"/>--> 
     100                          <ref local="SystemStatsQuickTrigger"/> 
    100101                        </list> 
    101102                </property> 
  • raptor-web/trunk/src/main/webapp/WEB-INF/flows/reports/startReport.xhtml

    r631 r693  
    3535                                                                action="refreshStartStats" reRender="statsSelectionForm, startTables, startGraph,shortStats" /> 
    3636                                                </rich:inplaceSelect> 
     37                                                 
     38                                                <h:outputText style="font-size:150%" 
     39                            value=" For" /> 
     40                                                 
     41                                                 
     42                                                <rich:inplaceSelect id="eventTypeSelector" 
     43                            value="#{flowScope.websession.startmodel.eventTypeString}" 
     44                            style="font-size:150%"> 
     45                            <f:selectItem itemLabel="Shibboleth" itemValue="SHIBBOLETH_AUTHENTICATION" /> 
     46                            <f:selectItem itemLabel="Ezproxy" itemValue="EZPROXY_AUTHENTICATION" /> 
     47                            <a4j:support ajaxSingle="true" event="onviewactivated" 
     48                                action="refreshStartStats" reRender="statsSelectionForm, startTables, startGraph,shortStats" /> 
     49                        </rich:inplaceSelect> 
    3750 
    3851 
  • raptor-web/trunk/src/main/webapp/WEB-INF/web.xml

    r521 r693  
    4141 
    4242 
    43         <!-- Use JSF view templates saved as *.jspx, for use with Facelets --> 
     43        <!-- Use xhtml view templates saved as *.xhtml, for use with Facelets --> 
    4444        <context-param> 
    4545                <param-name>javax.faces.DEFAULT_SUFFIX</param-name> 
  • raptor-web/trunk/src/main/webapp/login.html

    r497 r693  
    1616<div class="banner"> 
    1717<div id="logoContainer"><a href="http://www.cf.ac.uk/"><img 
    18         src="/RaptorWeb/templates/raptor/images/simple-logo.png" alt="Raptor" 
     18        src="/raptor-web/templates/raptor/images/simple-logo.png" alt="Raptor" 
    1919        border="0" /></a></div> 
    2020 
     
    4646 
    4747                <h3>Please login with your user name and password</h3> 
    48                 <form name='f' action='/RaptorWeb/j_spring_security_check' 
     48                <form name='f' action='/raptor-web/j_spring_security_check' 
    4949                        method="post"> 
    5050                <table> 
Note: See TracChangeset for help on using the changeset viewer.