// Path: src/main/java/net/unicon/cas/addons/info/events/CasServiceTicketValidatedEvent.java
// public final class CasServiceTicketValidatedEvent extends AbstractCasServiceAccessEvent {
// 
// 	private final Assertion assertion;
// 
// 	public CasServiceTicketValidatedEvent(Object source, String serviceTicketId, Service service, Assertion assertion) {
// 		super(source, serviceTicketId, service);
// 		this.assertion = assertion;
// 	}
// 
// 	public Assertion getAssertion() {
// 		return assertion;
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return super.toString() + " -- {assertion=" + assertion + "}";
// 	}
// }
// 
// Path: src/main/java/net/unicon/cas/addons/info/events/CasSsoSessionEstablishedEvent.java
// public final class CasSsoSessionEstablishedEvent extends AbstractCasSsoEvent {
// 
// 	public CasSsoSessionEstablishedEvent(Object source, Authentication authentication, String ticketGrantingTicketId) {
// 		super(source, authentication, ticketGrantingTicketId);
// 	}
// }


import net.unicon.cas.addons.info.events.CasServiceTicketValidatedEvent;
import net.unicon.cas.addons.info.events.CasSsoSessionEstablishedEvent;
import net.unicon.cas.addons.support.ThreadSafe;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.data.redis.core.StringRedisTemplate;
package net.unicon.cas.addons.info.events.listeners;


/**
 * An event listener for <code>CasServiceTicketValidatedEvent</code>s that records daily counts for each event by atomically incrementing a value in
 * Redis server under a <i>cas:st-validated:yyyy-MM-dd</i> key.
 * <p/>
 * This class assumes a live Redis server running and depends on an instance of <code>org.springframework.data.redis.connection.jedis.JedisConnectionFactory</code>
 * of spring data redis module, from which it constructs an instance of <code>org.springframework.data.redis.core.StringRedisTemplate</code>.
 * <p/>
 * At runtime if a Redis server becomes unavailable or any other exceptions are thrown during server access, a WARN level log message logs the exception and execution path
 * of CAS server continues.
 *
 * @author Dmitriy Kopylenko
 * @author Unicon, inc.
 * @since 1.9
 */
@ThreadSafe
public class RedisStatsRecorderForServiceTicketValidatedEvents implements
// Path: src/main/java/net/unicon/cas/addons/info/events/CasServiceTicketValidatedEvent.java
// public final class CasServiceTicketValidatedEvent extends AbstractCasServiceAccessEvent {
// 
// 	private final Assertion assertion;
// 
// 	public CasServiceTicketValidatedEvent(Object source, String serviceTicketId, Service service, Assertion assertion) {
// 		super(source, serviceTicketId, service);
// 		this.assertion = assertion;
// 	}
// 
// 	public Assertion getAssertion() {
// 		return assertion;
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return super.toString() + " -- {assertion=" + assertion + "}";
// 	}
// }
// 
// Path: src/main/java/net/unicon/cas/addons/info/events/CasSsoSessionEstablishedEvent.java
// public final class CasSsoSessionEstablishedEvent extends AbstractCasSsoEvent {
// 
// 	public CasSsoSessionEstablishedEvent(Object source, Authentication authentication, String ticketGrantingTicketId) {
// 		super(source, authentication, ticketGrantingTicketId);
// 	}
// }


// Path: src/main/java/net/unicon/cas/addons/info/events/listeners/RedisStatsRecorderForServiceTicketValidatedEvents.java
import net.unicon.cas.addons.info.events.CasServiceTicketValidatedEvent;
import net.unicon.cas.addons.info.events.CasSsoSessionEstablishedEvent;
import net.unicon.cas.addons.support.ThreadSafe;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.data.redis.core.StringRedisTemplate;

package net.unicon.cas.addons.info.events.listeners;


/**
 * An event listener for <code>CasServiceTicketValidatedEvent</code>s that records daily counts for each event by atomically incrementing a value in
 * Redis server under a <i>cas:st-validated:yyyy-MM-dd</i> key.
 * <p/>
 * This class assumes a live Redis server running and depends on an instance of <code>org.springframework.data.redis.connection.jedis.JedisConnectionFactory</code>
 * of spring data redis module, from which it constructs an instance of <code>org.springframework.data.redis.core.StringRedisTemplate</code>.
 * <p/>
 * At runtime if a Redis server becomes unavailable or any other exceptions are thrown during server access, a WARN level log message logs the exception and execution path
 * of CAS server continues.
 *
 * @author Dmitriy Kopylenko
 * @author Unicon, inc.
 * @since 1.9
 */
@ThreadSafe
public class RedisStatsRecorderForServiceTicketValidatedEvents implements
        ApplicationListener<CasServiceTicketValidatedEvent> {