com.octo.captcha.service.captchastore
Class JBossCacheCaptchaStore

java.lang.Object
  extended by com.octo.captcha.service.captchastore.JBossCacheCaptchaStore
All Implemented Interfaces:
CaptchaStore

public class JBossCacheCaptchaStore
extends java.lang.Object
implements CaptchaStore

JBossCache 2.0.0 implementation of the captcha store. Needs JDK 5.0

See Also:
http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossCache

Field Summary
static java.lang.String JCAPTCHA_JBOSSCACHE_CONFIG
           
 
Constructor Summary
JBossCacheCaptchaStore()
           
JBossCacheCaptchaStore(java.lang.String cacheQualifiedName)
           
 
Method Summary
 void cleanAndShutdown()
          Called by the service in order to clean and shutdown the store.
 void empty()
          Empty the store
 Captcha getCaptcha(java.lang.String s)
          Retrieve the captcha for this key from the store.
 java.util.Collection getKeys()
          Return all the contained keys
 java.util.Locale getLocale(java.lang.String s)
          Retrieve the locale for this key from the store.
 int getSize()
          get the size of this store
 boolean hasCaptcha(java.lang.String s)
          Check if a captcha is stored for this id
 void initAndStart()
          Called by the service in order to initialize and start the Store.
 boolean removeCaptcha(java.lang.String s)
          Remove the captcha with the provided id as key.
 void storeCaptcha(java.lang.String s, Captcha captcha)
          Store the captcha with the provided id as key.
 void storeCaptcha(java.lang.String s, Captcha captcha, java.util.Locale locale)
          Store the captcha with the provided id as key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JCAPTCHA_JBOSSCACHE_CONFIG

public static final java.lang.String JCAPTCHA_JBOSSCACHE_CONFIG
See Also:
Constant Field Values
Constructor Detail

JBossCacheCaptchaStore

public JBossCacheCaptchaStore()

JBossCacheCaptchaStore

public JBossCacheCaptchaStore(java.lang.String cacheQualifiedName)
Method Detail

hasCaptcha

public boolean hasCaptcha(java.lang.String s)
Description copied from interface: CaptchaStore
Check if a captcha is stored for this id

Specified by:
hasCaptcha in interface CaptchaStore
Returns:
true if a captcha for this id is stored, false otherwise

storeCaptcha

public void storeCaptcha(java.lang.String s,
                         Captcha captcha)
                  throws CaptchaServiceException
Description copied from interface: CaptchaStore
Store the captcha with the provided id as key. The key is assumed to be unique, so if the same key is used twice to store a captcha, the store will return an exception

Specified by:
storeCaptcha in interface CaptchaStore
Parameters:
s - the key
captcha - the captcha
Throws:
CaptchaServiceException - if the captcha already exists, or if an error occurs during storing routine.

storeCaptcha

public void storeCaptcha(java.lang.String s,
                         Captcha captcha,
                         java.util.Locale locale)
                  throws CaptchaServiceException
Description copied from interface: CaptchaStore
Store the captcha with the provided id as key. The key is assumed to be unique, so if the same key is used twice to store a captcha, the store will return an exception

Specified by:
storeCaptcha in interface CaptchaStore
Parameters:
s - the key
captcha - the captcha
locale - the locale used that triggers the captcha generation
Throws:
CaptchaServiceException - if the captcha already exists, or if an error occurs during storing routine.

removeCaptcha

public boolean removeCaptcha(java.lang.String s)
Description copied from interface: CaptchaStore
Remove the captcha with the provided id as key.

Specified by:
removeCaptcha in interface CaptchaStore
Parameters:
s - the key
Returns:
true if found, false otherwise

getCaptcha

public Captcha getCaptcha(java.lang.String s)
                   throws CaptchaServiceException
Description copied from interface: CaptchaStore
Retrieve the captcha for this key from the store.

Specified by:
getCaptcha in interface CaptchaStore
Returns:
the captcha for this id, null if not found
Throws:
CaptchaServiceException - if an error occurs during retrieving routine.

getLocale

public java.util.Locale getLocale(java.lang.String s)
                           throws CaptchaServiceException
Description copied from interface: CaptchaStore
Retrieve the locale for this key from the store.

Specified by:
getLocale in interface CaptchaStore
Returns:
the locale for this id, null if not found
Throws:
CaptchaServiceException - if an error occurs during retrieving routine.

getSize

public int getSize()
Description copied from interface: CaptchaStore
get the size of this store

Specified by:
getSize in interface CaptchaStore

getKeys

public java.util.Collection getKeys()
Description copied from interface: CaptchaStore
Return all the contained keys

Specified by:
getKeys in interface CaptchaStore

empty

public void empty()
Description copied from interface: CaptchaStore
Empty the store

Specified by:
empty in interface CaptchaStore

initAndStart

public void initAndStart()
Description copied from interface: CaptchaStore
Called by the service in order to initialize and start the Store.

Specified by:
initAndStart in interface CaptchaStore

cleanAndShutdown

public void cleanAndShutdown()
Description copied from interface: CaptchaStore
Called by the service in order to clean and shutdown the store.

Specified by:
cleanAndShutdown in interface CaptchaStore


Copyright 2003-2009 JCaptcha. All Rights Reserved.