1
2
3
4
5
6
7 package com.octo.captcha.service;
8
9 import com.octo.captcha.engine.CaptchaEngine;
10
11 /***
12 * Management interface for the {@link CaptchaService} interface.
13 */
14 public interface ManageableCaptchaService extends CaptchaService {
15 /***
16 * Get the fully qualified class name of the concrete CaptchaEngine used by the service.
17 *
18 * @return the fully qualified class name of the concrete CaptchaEngine used by the service.
19 */
20 String getCaptchaEngineClass();
21
22 /***
23 * Set the fully qualified class name of the concrete CaptchaEngine used by the service
24 *
25 * @param theClassName the fully qualified class name of the CaptchaEngine used by the service
26 *
27 * @throws IllegalArgumentException if className can't be used as the service CaptchaEngine, either because it can't
28 * be instanciated by the service or it is not a ImageCaptchaEngine concrete
29 * class.
30 */
31 void setCaptchaEngineClass(String theClassName)
32 throws IllegalArgumentException;
33
34 /***
35 * @return the engine served by this service
36 */
37 CaptchaEngine getEngine();
38
39 /***
40 * Updates the engine served by this service
41 * @param engine
42 */
43 void setCaptchaEngine(CaptchaEngine engine);
44
45 /***
46 * Get the minimum delay (in seconds) a client can be assured that a captcha generated by the service can be
47 * retrieved and a response to its challenge tested
48 *
49 * @return the maximum delay in seconds
50 */
51 int getMinGuarantedStorageDelayInSeconds();
52
53 /***
54 * set the minimum delay (in seconds)a client can be assured that a captcha generated by the service can be
55 * retrieved and a response to its challenge tested
56 *
57 * @param theMinGuarantedStorageDelayInSeconds
58 * the minimum guaranted delay
59 */
60 void setMinGuarantedStorageDelayInSeconds(int theMinGuarantedStorageDelayInSeconds);
61
62 /***
63 * Get the number of captcha generated since the service is up WARNING : this value won't be significant if the real
64 * number is > Long.MAX_VALUE
65 *
66 * @return the number of captcha generated since the service is up
67 */
68 long getNumberOfGeneratedCaptchas();
69
70 /***
71 * Get the number of correct responses to captcha challenges since the service is up. WARNING : this value won't be
72 * significant if the real number is > Long.MAX_VALUE
73 *
74 * @return the number of correct responses since the service is up
75 */
76 long getNumberOfCorrectResponses();
77
78 /***
79 * Get the number of uncorrect responses to captcha challenges since the service is up. WARNING : this value won't
80 * be significant if the real number is > Long.MAX_VALUE
81 *
82 * @return the number of uncorrect responses since the service is up
83 */
84 long getNumberOfUncorrectResponses();
85
86 /***
87 * Get the curent size of the captcha store
88 *
89 * @return the size of the captcha store
90 */
91 int getCaptchaStoreSize();
92
93 /***
94 * Get the number of captchas that can be garbage collected in the captcha store
95 *
96 * @return the number of captchas that can be garbage collected in the captcha store
97 */
98 int getNumberOfGarbageCollectableCaptchas();
99
100 /***
101 * Get the number of captcha garbage collected since the service is up WARNING : this value won't be significant if
102 * the real number is > Long.MAX_VALUE
103 *
104 * @return the number of captcha garbage collected since the service is up
105 */
106 long getNumberOfGarbageCollectedCaptcha();
107
108 /***
109 * This max size is used by the service : it will throw a CaptchaServiceException if the store is full when a client
110 * ask for a captcha.
111 */
112 void setCaptchaStoreMaxSize(int size);
113
114 /***
115 * @return the desired max size of the captcha store
116 */
117 int getCaptchaStoreMaxSize();
118
119 /***
120 * Garbage collect the captcha store, means all old capthca (captcha in the store wich has been stored more than the
121 * MinGuarantedStorageDelayInSecond
122 */
123 void garbageCollectCaptchaStore();
124
125 /***
126 * Empty the Store
127 */
128 void emptyCaptchaStore();
129
130 /***
131 * @return the max captchaStore load before garbage collection of the store
132 */
133 int getCaptchaStoreSizeBeforeGarbageCollection();
134
135 /***
136 * max captchaStore size before garbage collection of the store
137 */
138 void setCaptchaStoreSizeBeforeGarbageCollection(int captchaStoreSizeBeforeGarbageCollection);
139 }