Home » lucene-3.0.1-src » org.apache » lucene » xmlparser » [javadoc | source]

    1   /*
    2    * Created on 25-Jan-2006
    3    */
    4   package org.apache.lucene.xmlparser;
    5   
    6   import java.util.HashMap;
    7   
    8   import org.apache.lucene.search.Filter;
    9   import org.w3c.dom.Element;
   10   /**
   11    * Licensed to the Apache Software Foundation (ASF) under one or more
   12    * contributor license agreements.  See the NOTICE file distributed with
   13    * this work for additional information regarding copyright ownership.
   14    * The ASF licenses this file to You under the Apache License, Version 2.0
   15    * (the "License"); you may not use this file except in compliance with
   16    * the License.  You may obtain a copy of the License at
   17    *
   18    *     http://www.apache.org/licenses/LICENSE-2.0
   19    *
   20    * Unless required by applicable law or agreed to in writing, software
   21    * distributed under the License is distributed on an "AS IS" BASIS,
   22    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   23    * See the License for the specific language governing permissions and
   24    * limitations under the License.
   25    */
   26   
   27   /**
   28    * 
   29    */
   30   public class FilterBuilderFactory implements FilterBuilder {
   31   
   32   	HashMap<String,FilterBuilder> builders=new HashMap<String,FilterBuilder>();
   33   	
   34   	public Filter getFilter(Element n) throws ParserException {
   35   		FilterBuilder builder= builders.get(n.getNodeName());
   36   		if(builder==null)
   37   		{
   38   			throw new ParserException("No FilterBuilder defined for node "+n.getNodeName()); 
   39   		}
   40   		return builder.getFilter(n); 
   41   	}
   42   	public void addBuilder(String nodeName,FilterBuilder builder)
   43   	{
   44   		builders.put(nodeName,builder);
   45   	}
   46   	public FilterBuilder getFilterBuilder(String nodeName)
   47   	{
   48   		return builders.get(nodeName);		
   49   	}	
   50   }

Home » lucene-3.0.1-src » org.apache » lucene » xmlparser » [javadoc | source]