1
2 package org.galagosearch.core.store;
3
4 import java.io.IOException;
5 import java.sql.SQLException;
6 import org.galagosearch.core.parse.Document;
7 import org.galagosearch.tupleflow.Processor;
8 import org.galagosearch.tupleflow.TupleFlowParameters;
9
10 /***
11 *
12 * @author trevor
13 */
14 public class SQLDocumentStoreWriter implements Processor<Document> {
15 SQLDocumentStore documentStore;
16
17 public SQLDocumentStoreWriter(TupleFlowParameters parameters) throws SQLException, ClassNotFoundException {
18 documentStore = new SQLDocumentStore(parameters);
19 }
20
21 public void process(Document document) throws IOException {
22 documentStore.add(document);
23 }
24
25 public void close() throws IOException {
26 documentStore.close();
27 }
28
29 public Class<Document> getInputClass() {
30 return Document.class;
31 }
32 }