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:
TicketRegistry

public final class DefaultTicketRegistry
extends AbstractTicketRegistry

Implementation of the TicketRegistry that is backed by a ConcurrentHashMap.

Since:
3.0
Version:
$Revision: 42053 $ $Date: 2007-06-10 09:17:55 -0400 (Sun, 10 Jun 2007) $
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(java.lang.String ticketId)
          Remove a specific ticket from the registry.
 Ticket getTicket(java.lang.String ticketId)
          Retrieve a ticket from the registry.
 java.util.Collection<Ticket> getTickets()
          Retrieve all tickets from the 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:
java.lang.IllegalArgumentException - if the Ticket is null.

getTicket

public Ticket getTicket(java.lang.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(java.lang.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 java.util.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.


Copyright © 2004-2010 Java Architectures Special Interest Group. All Rights Reserved.