View Javadoc

1   /*
2    * JCaptcha, the open source java framework for captcha definition and integration
3    * Copyright (c)  2007 jcaptcha.net. All Rights Reserved.
4    * See the LICENSE.txt file distributed with this package.
5    */
6   
7   package com.octo.captcha.service.image;
8   
9   
10  import com.octo.captcha.engine.image.gimpy.DefaultGimpyEngine;
11  import com.octo.captcha.engine.CaptchaEngine;
12  import com.octo.captcha.service.captchastore.FastHashMapCaptchaStore;
13  import com.octo.captcha.service.captchastore.CaptchaStore;
14  
15  /***
16   * <p>Default service implementation : use a {@link FastHashMapCaptchaStore} as captcha store, and a DefaultGimpyEngine </p> It is initialized
17   * with thoses default values : <ul> <li>min guaranted delay : 180s </li> <li>max store size : 100000 captchas </li>
18   * <li>max store size before garbage collection : 75000 </li> </ul>
19   *
20   * @author <a href="mailto:mag@jcaptcha.net">Marc-Antoine Garrigue</a>
21   * @version 1.0
22   */
23  public class DefaultManageableImageCaptchaService extends AbstractManageableImageCaptchaService
24          implements ImageCaptchaService {
25      /***
26       * Construct a new ImageCaptchaService with a {@link FastHashMapCaptchaStore} and a {@link DefaultGimpyEngine}
27       *  minGuarantedStorageDelayInSeconds = 180s
28       *  maxCaptchaStoreSize = 100000
29       *  captchaStoreLoadBeforeGarbageCollection=75000
30       */
31      public DefaultManageableImageCaptchaService() {
32          super(new FastHashMapCaptchaStore(), new DefaultGimpyEngine(), 180,
33                  100000, 75000);
34      }
35  
36      /***
37       * Construct a new ImageCaptchaService with a {@link FastHashMapCaptchaStore} and a {@link DefaultGimpyEngine}
38       * @param minGuarantedStorageDelayInSeconds
39       * @param maxCaptchaStoreSize
40       * @param captchaStoreLoadBeforeGarbageCollection
41       */
42      public DefaultManageableImageCaptchaService( int minGuarantedStorageDelayInSeconds, int maxCaptchaStoreSize, int captchaStoreLoadBeforeGarbageCollection) {
43          super(new FastHashMapCaptchaStore(), new DefaultGimpyEngine(),minGuarantedStorageDelayInSeconds, maxCaptchaStoreSize, captchaStoreLoadBeforeGarbageCollection);
44      }
45  
46      /***
47       * @param captchaStore
48       * @param captchaEngine
49       * @param minGuarantedStorageDelayInSeconds
50       * @param maxCaptchaStoreSize
51       * @param captchaStoreLoadBeforeGarbageCollection
52       */
53      public DefaultManageableImageCaptchaService(CaptchaStore captchaStore, CaptchaEngine captchaEngine, int minGuarantedStorageDelayInSeconds, int maxCaptchaStoreSize, int captchaStoreLoadBeforeGarbageCollection) {
54          super(captchaStore, captchaEngine, minGuarantedStorageDelayInSeconds, maxCaptchaStoreSize, captchaStoreLoadBeforeGarbageCollection);
55      }
56  
57  
58  }