1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.jetspeed.services.search;
17
18 import java.io.BufferedReader;
19 import java.io.FileReader;
20 import java.net.URL;
21
22 import org.apache.turbine.util.TurbineConfig;
23
24 /***
25 * Populate sample data for Search Portlet
26 *
27 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
28 * @version $Id: PopulateSampleIndices.java,v 1.2 2004/02/23 03:48:47 jford Exp $
29 */
30 public class PopulateSampleIndices
31 {
32 static public final String SAMPLE_URLS = "./test/search-sample-urls.txt";
33
34 public static void main(String args[])
35 {
36 try
37 {
38 TurbineConfig config = null;
39
40 config = new TurbineConfig( "./webapp", "/WEB-INF/conf/TurbineResources.properties");
41 config.init();
42
43 FileReader reader = new FileReader(SAMPLE_URLS);
44 BufferedReader breader = new BufferedReader(reader);
45 String line = null;
46 System.out.println("================= Populate Sample Indices =================");
47 System.out.println("... creates Search sample portlet test data from URLs provided in file: " + SAMPLE_URLS);
48 System.out.println("...");
49
50 while (null != (line = breader.readLine()))
51 {
52 System.out.println("Creating index for: " + line);
53 URL url = new URL(line);
54
55 Search.add(url);
56 }
57 System.out.println("===========================================================");
58
59 reader.close();
60 }
61 catch (Exception e)
62 {
63 System.out.println("Exception reading URLS" + e);
64 }
65 }
66
67 }