org.jasig.cas.ticket.registry
Class DefaultTicketRegistry

java.lang.Object
  extended by org.jasig.cas.ticket.registry.AbstractTicketRegistry
      extended by org.jasig.cas.ticket.registry.DefaultTicketRegistry
All Implemented Interfaces:
TicketRegistryState, TicketRegistry

public final class DefaultTicketRegistry
extends AbstractTicketRegistry

Implementation of the TicketRegistry that is backed by a ConcurrentHashMap.

Since:
3.0
Version:
$Revision$ $Date$
Author:
Scott Battaglia

Field Summary
 
Fields inherited from class org.jasig.cas.ticket.registry.AbstractTicketRegistry
log
 
Constructor Summary
DefaultTicketRegistry()
           
DefaultTicketRegistry(int initialCapacity, float loadFactor, int concurrencyLevel)
          Creates a new, empty registry with the specified initial capacity, load factor, and concurrency level.
 
Method Summary
 void addTicket(Ticket ticket)
          Add a ticket to the registry.
 boolean deleteTicket(String ticketId)
          Remove a specific ticket from the registry.
 Ticket getTicket(String ticketId)
          Retrieve a ticket from the registry.
 Collection<Ticket> getTickets()
          Retrieve all tickets from the registry.
 int serviceTicketCount()
          Computes the number of service tickets stored in the ticket registry.
 int sessionCount()
          Computes the number of SSO sessions stored in the ticket registry.
 
Methods inherited from class org.jasig.cas.ticket.registry.AbstractTicketRegistry
getTicket
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTicketRegistry

public DefaultTicketRegistry()

DefaultTicketRegistry

public DefaultTicketRegistry(int initialCapacity,
                             float loadFactor,
                             int concurrencyLevel)
Creates a new, empty registry with the specified initial capacity, load factor, and concurrency level.

Parameters:
initialCapacity - - the initial capacity. The implementation performs internal sizing to accommodate this many elements.
loadFactor - - the load factor threshold, used to control resizing. Resizing may be performed when the average number of elements per bin exceeds this threshold.
concurrencyLevel - - the estimated number of concurrently updating threads. The implementation performs internal sizing to try to accommodate this many threads.
Method Detail

addTicket

public void addTicket(Ticket ticket)
Description copied from interface: TicketRegistry
Add a ticket to the registry. Ticket storage is based on the ticket id.

Parameters:
ticket - The ticket we wish to add to the cache.
Throws:
IllegalArgumentException - if the Ticket is null.

getTicket

public Ticket getTicket(String ticketId)
Description copied from interface: TicketRegistry
Retrieve a ticket from the registry.

Parameters:
ticketId - the id of the ticket we wish to retrieve
Returns:
the requested ticket.

deleteTicket

public boolean deleteTicket(String ticketId)
Description copied from interface: TicketRegistry
Remove a specific ticket from the registry.

Parameters:
ticketId - The id of the ticket to delete.
Returns:
true if the ticket was removed and false if the ticket did not exist.

getTickets

public Collection<Ticket> getTickets()
Description copied from interface: TicketRegistry
Retrieve all tickets from the registry.

Returns:
collection of tickets currently stored in the registry. Tickets might or might not be valid i.e. expired.

sessionCount

public int sessionCount()
Description copied from interface: TicketRegistryState
Computes the number of SSO sessions stored in the ticket registry.

Specified by:
sessionCount in interface TicketRegistryState
Overrides:
sessionCount in class AbstractTicketRegistry
Returns:
Number of ticket-granting tickets in the registry at time of invocation or Integer.MIN_VALUE if unknown.

serviceTicketCount

public int serviceTicketCount()
Description copied from interface: TicketRegistryState
Computes the number of service tickets stored in the ticket registry.

Specified by:
serviceTicketCount in interface TicketRegistryState
Overrides:
serviceTicketCount in class AbstractTicketRegistry
Returns:
Number of service tickets in the registry at time of invocation or Integer.MIN_VALUE if unknown.


Copyright © 2004-2013 Jasig. All Rights Reserved.