01: package com.teamkonzept.webman.mainint.events;
02:
03: import java.util.*;
04:
05: import com.teamkonzept.web.*;
06: import com.teamkonzept.lib.DatabaseErrorCodes;
07: import com.teamkonzept.lib.ErrorCodes;
08: import com.teamkonzept.lib.TKException;
09: import com.teamkonzept.webman.mainint.ContextConstants;
10:
11: /**
12: Defaultimplementierung eines EventVerteilers, nur isHandler ist noch
13: abstrakt, verteilt die Events dynamisch und an alle, die sich interessieren
14: */
15: public abstract class DefaultEventHandler implements TKEventHandler,
16: DatabaseErrorCodes, UserCodes, ContextConstants {
17:
18: public abstract void handleEvent(TKEvent evt)
19: throws com.teamkonzept.lib.TKException;
20:
21: public abstract boolean isHandler(TKEvent evt);
22:
23: public void addEventHandler(TKEventHandler handler) {
24: }
25:
26: public void removeEventHandler(TKEventHandler handler) {
27: }
28:
29: /** setzt die zu behandelnden Events*/
30: public void setHandleEvents(TKEvent[] events) {
31: }
32:
33: /** liefert die zu behandelnden Events zurueck */
34: public TKEvent[] getHandleEvents() {
35: return null;
36: }
37:
38: /**
39: * Creates an event object.
40: *
41: * @param http the responsible HTTP interface.
42: * @return an event object.
43: */
44: public TKEvent createEvent(TKHttpInterface http) {
45: return null;
46: }
47:
48: /**
49: * Checks the given parameter value on emptyness.
50: *
51: * @param value the value of the parameter.
52: * @param name the name of the parameter.
53: * @exception com.teamkonzept.lib.TKException if the given
54: * parameter value is <CODE>null</CODE> or empty.
55: */
56: public final void checkParameter(String value, String name)
57: throws TKException {
58: if (value == null || value.trim().length() == 0) {
59: throw new TKUserException("The field '" + name
60: + "' requires input.",
61: UserCodes.FIELD_VALUE_REQUIRED,
62: ErrorCodes.USER_SEVERITY, true,
63: new Object[] { name }, null);
64: }
65: }
66:
67: }
|