KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tomcat > util > handler > HandlerManager


1
2
3 /*
4  * The contents of this file are subject to the terms
5  * of the Common Development and Distribution License
6  * (the "License"). You may not use this file except
7  * in compliance with the License.
8  *
9  * You can obtain a copy of the license at
10  * glassfish/bootstrap/legal/CDDLv1.0.txt or
11  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
12  * See the License for the specific language governing
13  * permissions and limitations under the License.
14  *
15  * When distributing Covered Code, include this CDDL
16  * HEADER in each file and include the License file at
17  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
18  * add the following below this CDDL HEADER, with the
19  * fields enclosed by brackets "[]" replaced with your
20  * own identifying information: Portions Copyright [yyyy]
21  * [name of copyright owner]
22  *
23  * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24  *
25  * Portions Copyright Apache Software Foundation.
26  */

27
28 package org.apache.tomcat.util.handler;
29
30 import java.io.*;
31 import java.net.*;
32 import java.util.*;
33 import org.apache.tomcat.util.IntrospectionUtils;
34
35 /** Hooks support. Hooks implement a chain-of-command pattern, and
36  * are commonly used in most web servers as a mechanism of extensibility.
37  *
38  * The HandlerManager class will provide support for registering and maintaining
39  * a list of modules implementing each hook.
40  *
41  * Each hook will have a name and an id. Name-based operations are slower, it is
42  * recomended you use them only in non-critical code. The name-id association is
43  * handled by NoteManager.
44  *
45  *
46  * @todo Merging. It is possible to have different hooks on different contexts
47  * ( server, context, servlet ), we need to merge them.
48  */

49 public class HandlerManager {
50     // hook name -> hook[]
51
private Hashtable hookMap;
52     private TcHandler hooks[][];
53
54     public HandlerManager() {
55     }
56
57     /** Add a new handler.
58      */

59     public void addHandler( String JavaDoc name, TcHandler hook ) {
60         
61     }
62
63     public TcHandler[] getHandlers( int hookId ) {
64         return hooks[hookId];
65     }
66
67     public TcHandler[] getHandlers( String JavaDoc name ) {
68         return getHandlers( 0 );
69     }
70
71     public Hashtable getHookMap() {
72         return hookMap;
73     }
74 }
75
Popular Tags