net.trajano.twiff.internal.token.dao
Class SessionTokenDao

java.lang.Object
  extended by net.trajano.twiff.internal.token.dao.SessionTokenDao

public final class SessionTokenDao
extends Object

DAO to manipate session token data.

Author:
Archimedes Trajano

Constructor Summary
SessionTokenDao(org.hibernate.Session session)
          Constructs the DAO.
 
Method Summary
 void addToken(String sessionId, String tokenId)
          Adds a token into the table.
 Serializable getPageBean(String sessionId, String tokenId)
          Gets the redirect URL based on the session and token ID.
 URL getRedirectUrl(String sessionId, String tokenId)
          Gets the redirect URL based on the session and token ID.
 int getRequestCount(String sessionId, String tokenId)
          Gets the request count of the object.
 boolean isTokenAvailable(String sessionId, String tokenId)
          This checks if a token is available in the database.
 boolean isTokenValid(String sessionId, String tokenId)
          Checks if the session token is valid.
 void removeSession(String sessionId)
          Removes all the token and session data for the session id.
 void updateTokenInfo(String sessionId, String tokenId, URL redirectURL, Serializable pageBean)
          Adds the token info.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionTokenDao

public SessionTokenDao(org.hibernate.Session session)
Constructs the DAO.

Parameters:
session - the hibernate session.
Method Detail

addToken

public void addToken(String sessionId,
                     String tokenId)
Adds a token into the table.

Parameters:
sessionId - the session ID
tokenId - the token ID

getPageBean

public Serializable getPageBean(String sessionId,
                                String tokenId)
Gets the redirect URL based on the session and token ID.

Parameters:
sessionId - the session ID
tokenId - the token ID
Returns:
the page bean data

getRedirectUrl

public URL getRedirectUrl(String sessionId,
                          String tokenId)
Gets the redirect URL based on the session and token ID.

Parameters:
sessionId - the session ID
tokenId - the token ID
Returns:
the redirect URL

isTokenAvailable

public boolean isTokenAvailable(String sessionId,
                                String tokenId)
This checks if a token is available in the database. It does not matter if it is valid or not.

Parameters:
sessionId - session Id
tokenId - token Id
Returns:
true if the token is in the database

isTokenValid

public boolean isTokenValid(String sessionId,
                            String tokenId)
Checks if the session token is valid.

Parameters:
sessionId - session id
tokenId - token id
Returns:
true if the session token is valid.

removeSession

public void removeSession(String sessionId)
Removes all the token and session data for the session id.

Parameters:
sessionId - session id

updateTokenInfo

public void updateTokenInfo(String sessionId,
                            String tokenId,
                            URL redirectURL,
                            Serializable pageBean)
Adds the token info.

Parameters:
sessionId - the session ID
tokenId - the token ID
redirectURL - the redirect URL
pageBean - the page bean data

getRequestCount

public int getRequestCount(String sessionId,
                           String tokenId)
Gets the request count of the object.

Parameters:
sessionId - the session ID
tokenId - the token ID
Returns:
the request count.


Copyright © 2004-2005 trajano.net. All Rights Reserved.