org.jasig.cas.ticket
Class AbstractTicket

java.lang.Object
  extended by org.jasig.cas.ticket.AbstractTicket
All Implemented Interfaces:
java.io.Serializable, Ticket, TicketState
Direct Known Subclasses:
ServiceTicketImpl, TicketGrantingTicketImpl

@MappedSuperclass
public abstract class AbstractTicket
extends java.lang.Object
implements Ticket, TicketState

Abstract implementation of a ticket that handles all ticket state for policies. Also incorporates properties common among all tickets. As this is an abstract class, it cannnot be instanciated. It is recommended that implementations of the Ticket interface extend the AbstractTicket as it handles common functionality amongst different ticket types (such as state updating).

Since:
3.0
Version:
$Revision: 43356 $ $Date: 2008-03-07 15:29:18 -0500 (Fri, 07 Mar 2008) $
Author:
Scott Battaglia
See Also:
Serialized Form

Constructor Summary
protected AbstractTicket()
           
  AbstractTicket(java.lang.String id, TicketGrantingTicketImpl ticket, ExpirationPolicy expirationPolicy)
          Constructs a new Ticket with a unique id, a possible parent Ticket (can be null) and a specified Expiration Policy.
 
Method Summary
 int getCountOfUses()
          Returns the number of times this ticket was used.
 long getCreationTime()
          Method to return the time the Ticket was created.
 TicketGrantingTicket getGrantingTicket()
          Method to retrive the TicketGrantingTicket that granted this ticket.
 java.lang.String getId()
          Method to retrieve the id.
 long getLastTimeUsed()
          Returns the last time the ticket was used.
 long getPreviousTimeUsed()
          Get the second to last time used.
 int hashCode()
           
 boolean isExpired()
          Determines if the ticket is expired.
protected  boolean isExpiredInternal()
           
 java.lang.String toString()
           
protected  void updateState()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jasig.cas.ticket.TicketState
getAuthentication
 

Constructor Detail

AbstractTicket

protected AbstractTicket()

AbstractTicket

public AbstractTicket(java.lang.String id,
                      TicketGrantingTicketImpl ticket,
                      ExpirationPolicy expirationPolicy)
Constructs a new Ticket with a unique id, a possible parent Ticket (can be null) and a specified Expiration Policy.

Parameters:
id - the unique identifier for the ticket
ticket - the parent TicketGrantingTicket
expirationPolicy - the expiration policy for the ticket.
Throws:
java.lang.IllegalArgumentException - if the id or expiration policy is null.
Method Detail

getId

public final java.lang.String getId()
Description copied from interface: Ticket
Method to retrieve the id.

Specified by:
getId in interface Ticket
Returns:
the id

updateState

protected final void updateState()

getCountOfUses

public final int getCountOfUses()
Description copied from interface: Ticket
Returns the number of times this ticket was used.

Specified by:
getCountOfUses in interface Ticket
Specified by:
getCountOfUses in interface TicketState
Returns:
the number of times the ticket was used.

getCreationTime

public final long getCreationTime()
Description copied from interface: Ticket
Method to return the time the Ticket was created.

Specified by:
getCreationTime in interface Ticket
Specified by:
getCreationTime in interface TicketState
Returns:
the time the ticket was created.

getGrantingTicket

public final TicketGrantingTicket getGrantingTicket()
Description copied from interface: Ticket
Method to retrive the TicketGrantingTicket that granted this ticket.

Specified by:
getGrantingTicket in interface Ticket
Returns:
the ticket or null if it has no parent

getLastTimeUsed

public final long getLastTimeUsed()
Description copied from interface: TicketState
Returns the last time the ticket was used.

Specified by:
getLastTimeUsed in interface TicketState
Returns:
the last time the ticket was used.

getPreviousTimeUsed

public final long getPreviousTimeUsed()
Description copied from interface: TicketState
Get the second to last time used.

Specified by:
getPreviousTimeUsed in interface TicketState
Returns:
the previous time used.

isExpired

public final boolean isExpired()
Description copied from interface: Ticket
Determines if the ticket is expired. Most common implementations might collaborate with ExpirationPolicy strategy.

Specified by:
isExpired in interface Ticket
See Also:
ExpirationPolicy

isExpiredInternal

protected boolean isExpiredInternal()

hashCode

public final int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public final java.lang.String toString()
Overrides:
toString in class java.lang.Object


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