Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: recoinx/clef/irs/lucene/LuceneSpanishAdapter.java


1   /*
2    * Created on 20.08.2003
3    *
4    */
5   package recoinx.clef.irs.lucene;
6   
7   import java.util.Vector;
8   
9   import org.apache.log4j.Logger;
10  
11  import recoin.container.RetrievalContainer;
12  import recoin.exception.InitiationException;
13  import recoin.group.ComponentRunnable;
14  import recoin.group.ComponentSupport;
15  
16  import recoinx.clef.CLEFConstants;
17  
18  /**
19   * This class is a simple extension of the abstract CLEFLuceneAdapter that searches
20   * the indexes of the spanish CLEF collections. 
21   * @author Jan H. Scheufen
22   * @version 0.2.9
23   */
24  public class LuceneSpanishAdapter extends CLEFLuceneAdapter
25  {
26    /**
27     * The logger for this class.
28     */
29    static Logger logger;
30    
31    /**
32     * Creates a new LuceneSpanishAdapter.
33     */
34    public LuceneSpanishAdapter()
35    {
36      super();
37      // Initialize the logger for this class.
38      logger = Logger.getLogger( LuceneSpanishAdapter.class.getName() );
39    }
40  
41    /**
42     * Creates and returns a LuceneRunnable that searches the spanish collections.
43     * @see recoin.group.ComponentWorker#createComponentRunnable(recoin.container.RetrievalContainer)
44     */
45    public ComponentRunnable createComponentRunnable(RetrievalContainer container)
46    {
47      if( !component.isInitiated() )
48      {
49        try
50        {
51          initiate(component);
52        }
53        catch (InitiationException e)
54        {
55          logger.error(e);
56          return null;
57        }
58      }
59      logger.debug("Returning new LuceneRunnable.");
60      return new LuceneRunnable(container, this, CLEFConstants.SPANISH);
61    }
62  
63    /**
64     * Creates and returns a LuceneRunnable that searches the spanish collections.
65     * @see recoin.group.ComponentWorker#createComponentRunnable(recoin.container.RetrievalContainer, java.util.Vector)
66     */
67    public ComponentRunnable createComponentRunnable( RetrievalContainer container, Vector supports)
68    {
69      if( !component.isInitiated() )
70      {
71        logger.warn("ComponentWorker '"+component.getClassname()+"' was not initiated. Initiating now ...");
72        try
73        {
74          initiate(component);
75        }
76        catch (InitiationException e)
77        {
78          logger.error("Unable to initiate ComponentWorker.");
79          return null;
80        }
81      }
82      logger.debug("Returning new LuceneRunnable.");
83      return new LuceneRunnable( container, (ComponentSupport)supports.firstElement(), this, CLEFConstants.SPANISH );
84    }
85  
86    /**
87     * Creates and returns a LuceneRunnable that searches the spanish collections.
88     * @see recoin.group.ComponentWorker#createComponentRunnable(recoin.container.RetrievalContainer, java.util.Vector, recoin.group.ComponentRunnable)
89     */
90    public ComponentRunnable createComponentRunnable( RetrievalContainer container, Vector supports, ComponentRunnable runnable)
91    {
92      if( !component.isInitiated() )
93      {
94        try
95        {
96          initiate(component);
97        }
98        catch (InitiationException e)
99        {
100         return null;
101       }
102     }
103     logger.debug("Returning new LuceneRunnable.");
104     return new LuceneRunnable(container, (ComponentSupport)supports.firstElement(), runnable, this, CLEFConstants.SPANISH);
105   }
106   
107 }