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