source: trunk/gsdl/src/java/org/nzdl/gsdl/LuceneWrap/IndexXML.java@ 13555

Last change on this file since 13555 was 13555, checked in by kjdon, 17 years ago

added GPL license info

  • Property svn:keywords set to Author Date Id Revision
File size: 1.9 KB
Line 
1/**********************************************************************
2 *
3 * IndexXML.java
4 *
5 * Copyright 2004 The New Zealand Digital Library Project
6 *
7 * A component of the Greenstone digital library software
8 * from the New Zealand Digital Library Project at the
9 * University of Waikato, New Zealand.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 *
25 *********************************************************************/
26package org.nzdl.gsdl.LuceneWrap;
27
28
29import java.io.File;
30
31public class IndexXML extends Object {
32
33 String doc_tag_level_ = null;
34 File out_dir_ = null;
35 Indexer indexer_ = null;
36 boolean create_index_ = false;
37
38 public IndexXML(String doc_tag_level, File out_dir, boolean create)
39 {
40 doc_tag_level_ = doc_tag_level;
41 out_dir_ = out_dir;
42 create_index_ = create;
43 }
44
45 public void init()
46 {
47 indexer_ = new Indexer(doc_tag_level_, out_dir_, create_index_);
48 }
49
50 public void finish()
51 {
52 indexer_.finish();
53 }
54
55 public void indexFile(File file)
56 {
57 String name = file.getName();
58 name = name.substring(0, name.lastIndexOf('.'));
59 System.out.println("Indexing "+file.getPath()+" with id "+name);
60 indexer_.index(name, file);
61 }
62
63 public void indexFile(String xml_text)
64 {
65 indexer_.index(xml_text);
66 }
67
68}
Note: See TracBrowser for help on using the repository browser.