KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > pageflow > handler > BaseHandler


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * $Header:$
17  */

18 package org.apache.beehive.netui.pageflow.handler;
19
20 import javax.servlet.ServletContext JavaDoc;
21 import java.io.Serializable JavaDoc;
22
23
24 /**
25  * Default implementation of the base Handler interface. Simply stores a reference to the ServletContext.
26  */

27 public abstract class BaseHandler
28         implements Handler, Serializable JavaDoc
29 {
30     private transient ServletContext JavaDoc _servletContext;
31     private HandlerConfig _config;
32     private Handler _previousHandler;
33     
34     protected BaseHandler()
35     {
36     }
37     
38     /**
39      * Initialize.
40      *
41      * @param handlerConfig the configuration object for this Handler.
42      * @param previousHandler the previously-registered Handler, which this one can adapt.
43      * @param servletContext the ServletContext for the webapp that is creating this object.
44      */

45     public void init( HandlerConfig handlerConfig, Handler previousHandler, ServletContext JavaDoc servletContext )
46     {
47         _servletContext = servletContext;
48         _previousHandler = previousHandler;
49         _config = handlerConfig;
50     }
51     
52     protected final ServletContext JavaDoc getServletContext()
53     {
54         assert _servletContext != null;
55         return _servletContext;
56     }
57     
58     protected Handler getPreviousHandler()
59     {
60         return _previousHandler;
61     }
62     
63     protected HandlerConfig getConfig()
64     {
65         return _config;
66     }
67
68     public void reinit( ServletContext JavaDoc servletContext )
69     {
70         _servletContext = servletContext;
71     }
72 }
73
Popular Tags