KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > teamkonzept > webman > mainint > events > DefaultEventHandler


1 package com.teamkonzept.webman.mainint.events;
2
3 import java.util.*;
4
5 import com.teamkonzept.web.*;
6 import com.teamkonzept.lib.DatabaseErrorCodes;
7 import com.teamkonzept.lib.ErrorCodes;
8 import com.teamkonzept.lib.TKException;
9 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, DatabaseErrorCodes, UserCodes, ContextConstants
16 {
17
18     public abstract void handleEvent(TKEvent evt) throws com.teamkonzept.lib.TKException;
19
20     public abstract boolean isHandler(TKEvent evt);
21
22     public void addEventHandler(TKEventHandler handler)
23     {
24     }
25
26     public void removeEventHandler(TKEventHandler handler)
27     {
28     }
29
30     /** setzt die zu behandelnden Events*/
31     public void setHandleEvents(TKEvent[] events)
32     {}
33
34     /** liefert die zu behandelnden Events zurueck */
35     public TKEvent[] getHandleEvents()
36     {
37         return null;
38     }
39
40     /**
41      * Creates an event object.
42      *
43      * @param http the responsible HTTP interface.
44      * @return an event object.
45      */

46     public TKEvent createEvent (TKHttpInterface http)
47     {
48         return null;
49     }
50
51     /**
52      * Checks the given parameter value on emptyness.
53      *
54      * @param value the value of the parameter.
55      * @param name the name of the parameter.
56      * @exception com.teamkonzept.lib.TKException if the given
57      * parameter value is <CODE>null</CODE> or empty.
58      */

59     public final void checkParameter (String JavaDoc value, String JavaDoc name)
60         throws TKException
61     {
62         if (value == null ||
63             value.trim().length() == 0)
64         {
65             throw new TKUserException("The field '" + name + "' requires input.",
66                                       UserCodes.FIELD_VALUE_REQUIRED,
67                                       ErrorCodes.USER_SEVERITY,
68                                       true,
69                                       new Object JavaDoc[]{name},
70                                       null);
71         }
72     }
73
74 }
75
Popular Tags