org.surfnet.cruncher.repository
Class StatisticsRepositoryImpl

java.lang.Object
  extended by org.surfnet.cruncher.repository.StatisticsRepositoryImpl
All Implemented Interfaces:
StatisticsRepository

@Named
public class StatisticsRepositoryImpl
extends Object
implements StatisticsRepository


Field Summary
static long AGGREGATION_DELAY
           
static long POINT_INTERVAL
           
 
Constructor Summary
StatisticsRepositoryImpl()
           
 
Method Summary
 boolean aggregatedExists(String idpEntityId, String spEntityId, Date loginDate)
           
 List<SpStatistic> getActiveServices(String userid, String idpEntityId)
          retrieve a list of service for which the user has been active (a login record must exist for this user)
 List<LoginData> getLogins(org.joda.time.LocalDate start, org.joda.time.LocalDate end, String idpEntityId, String spEntityId)
          Return aggregated logins based on IDP or SP per day.
 List<LoginEntry> getUnprocessedLoginEntries(int nrOfRecords)
          Get a list of records that have to be aggregated yet.
 void insertAggregated(LoginEntry le)
           
 void insertLastLogin(LoginEntry le)
           
 boolean lastLogonExists(String userId, String spEntityId)
           
 boolean lockForCrunching()
           
 void setLoginEntriesProcessed(List<LoginEntry> entries)
          Mark login-log entries as processed by aggregation
 void unlockForCrunching()
           
 void updateAggregated(String idpEntityId, String spEntityId, Date loginDate)
           
 void updateLastLogin(String userId, String spEntityId, Date loginDate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POINT_INTERVAL

public static final long POINT_INTERVAL
See Also:
Constant Field Values

AGGREGATION_DELAY

public static final long AGGREGATION_DELAY
See Also:
Constant Field Values
Constructor Detail

StatisticsRepositoryImpl

public StatisticsRepositoryImpl()
Method Detail

getLogins

public List<LoginData> getLogins(org.joda.time.LocalDate start,
                                 org.joda.time.LocalDate end,
                                 String idpEntityId,
                                 String spEntityId)
Return aggregated logins based on IDP or SP per day.

NOTE Either sp entity ID or idp entity ID is required!

Specified by:
getLogins in interface StatisticsRepository
Parameters:
start - start date
end - end date
idpEntityId - (optional) idpEntity ID
spEntityId - (optional) sp entity ID
Returns:
a list of LoginData

getActiveServices

public List<SpStatistic> getActiveServices(String userid,
                                           String idpEntityId)
Description copied from interface: StatisticsRepository
retrieve a list of service for which the user has been active (a login record must exist for this user)

Specified by:
getActiveServices in interface StatisticsRepository
Parameters:
userid - the user for the user
idpEntityId - the idp for which the user is currently logged in
Returns:
a list of SPs for which the user has been logged in

getUnprocessedLoginEntries

public List<LoginEntry> getUnprocessedLoginEntries(int nrOfRecords)
Description copied from interface: StatisticsRepository
Get a list of records that have to be aggregated yet.

Specified by:
getUnprocessedLoginEntries in interface StatisticsRepository
Parameters:
nrOfRecords - the number to get

setLoginEntriesProcessed

public void setLoginEntriesProcessed(List<LoginEntry> entries)
Description copied from interface: StatisticsRepository
Mark login-log entries as processed by aggregation

Specified by:
setLoginEntriesProcessed in interface StatisticsRepository
Parameters:
entries - the entries to mark

updateAggregated

public void updateAggregated(String idpEntityId,
                             String spEntityId,
                             Date loginDate)
Specified by:
updateAggregated in interface StatisticsRepository

insertAggregated

public void insertAggregated(LoginEntry le)
Specified by:
insertAggregated in interface StatisticsRepository

aggregatedExists

public boolean aggregatedExists(String idpEntityId,
                                String spEntityId,
                                Date loginDate)
Specified by:
aggregatedExists in interface StatisticsRepository

lockForCrunching

public boolean lockForCrunching()
Specified by:
lockForCrunching in interface StatisticsRepository

unlockForCrunching

public void unlockForCrunching()
Specified by:
unlockForCrunching in interface StatisticsRepository

lastLogonExists

public boolean lastLogonExists(String userId,
                               String spEntityId)
Specified by:
lastLogonExists in interface StatisticsRepository

insertLastLogin

public void insertLastLogin(LoginEntry le)
Specified by:
insertLastLogin in interface StatisticsRepository

updateLastLogin

public void updateLastLogin(String userId,
                            String spEntityId,
                            Date loginDate)
Specified by:
updateLastLogin in interface StatisticsRepository


Copyright © 2009-2013 SURFnet bv, The Netherlands. All Rights Reserved.