KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > hivemind > servlet > HiveMindFilter


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

15 package org.apache.hivemind.servlet;
16
17 import javax.servlet.ServletContext JavaDoc;
18
19 import org.apache.hivemind.ClassResolver;
20 import org.apache.hivemind.impl.RegistryBuilder;
21 import org.apache.hivemind.impl.XmlModuleReader;
22 import org.apache.hivemind.util.ContextResource;
23
24 /**
25  * Specializations of {@link AutoloadingHiveMindFilter} that additionally loads a xml
26  * module from "/WEB-INF/hivemodule.xml".
27  * Actually should be called XmlHiveMindFilter but is not for sake of
28  * backward compatibility.
29  *
30  * @author Achim Huegen
31  */

32 public class HiveMindFilter extends AutoloadingHiveMindFilter
33 {
34     static final String JavaDoc HIVE_MODULE_XML = "/WEB-INF/hivemodule.xml";
35
36     protected void addWebInfDescriptor(ServletContext JavaDoc context, ClassResolver resolver,
37             RegistryBuilder builder)
38     {
39         ContextResource r = new ContextResource(context, HIVE_MODULE_XML);
40
41         if (r.getResourceURL() != null)
42         {
43             XmlModuleReader reader = new XmlModuleReader(builder.getRegistryDefinition(),
44                     resolver, builder.getErrorHandler());
45             reader.readModule(r);
46         }
47     }
48
49 }
Popular Tags