1/*2 * Copyright 2000-2004 The Apache Software Foundation.3 * 4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */16packageorg.apache.jetspeed.services.search;
1718import java.io.BufferedReader;
19import java.io.FileReader;
20import java.net.URL;
2122import org.apache.turbine.util.TurbineConfig;
2324/***25 * Populate sample data for Search Portlet26 *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 */30publicclassPopulateSampleIndices31 {
32staticpublicfinal String SAMPLE_URLS = "./test/search-sample-urls.txt";
3334publicstaticvoid main(String args[])
35 {
36try37 {
38 TurbineConfig config = null;
3940 config = new TurbineConfig( "./webapp", "/WEB-INF/conf/TurbineResources.properties");
41 config.init();
4243 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("...");
4950while (null != (line = breader.readLine()))
51 {
52 System.out.println("Creating index for: " + line);
53 URL url = new URL(line);
5455 Search.add(url);
56 }
57 System.out.println("===========================================================");
5859 reader.close();
60 }
61catch (Exception e)
62 {
63 System.out.println("Exception reading URLS" + e);
64 }
65 }
6667 }