1   /* Nutchwax
2    * 
3    * $Id: NutchwaxDistributedSearch.java 1372 2006-12-15 00:49:38Z stack-sf $
4    * 
5    * Created on November 14th, 2006
6    *
7    * Copyright (C) 2006 Internet Archive.
8    * 
9    * This file is part of the Heritrix web crawler (crawler.archive.org).
10   * 
11   * Heritrix is free software; you can redistribute it and/or modify
12   * it under the terms of the GNU Lesser Public License as published by
13   * the Free Software Foundation; either version 2.1 of the License, or
14   * any later version.
15   * 
16   * Heritrix 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 Lesser Public License for more details.
20   * 
21   * You should have received a copy of the GNU Lesser Public License
22   * along with Heritrix; if not, write to the Free Software
23   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24   */
25  package org.archive.access.nutch;
26  
27  import org.apache.hadoop.conf.Configuration;
28  import org.apache.hadoop.fs.Path;
29  import org.apache.hadoop.ipc.RPC;
30  import org.apache.nutch.searcher.NutchBean;
31  
32  /*** 
33   * Script to start up a Nutchwax Distributed Searcher.
34   * @author stack
35   * @version $Revision: 1372 $ $Date: 2006-12-15 00:49:38 +0000 (Fri, 15 Dec 2006) $
36   */
37  public class NutchwaxDistributedSearch {
38  	public static class Server {
39  		private Server() {
40  			super();
41  		}
42  
43  		/*** 
44  		 * Use to start org.apache.nutch.searcher.DistributedSearch$Server
45  		 * but with nutchwax configuration mixed in so nutchwax plugins
46  		 * can be found (and properly configured).
47  		 */
48  		public static void main(String[] args) throws Exception {
49  			String usage =
50  				"NutchwaxDistributedSearch$Server <port> <index dir>";
51  
52  			if (args.length == 0 || args.length > 2) {
53  				System.err.println(usage);
54  				System.exit(-1);
55  			}
56  
57  			int port = Integer.parseInt(args[0]);
58  			Path directory = new Path(args[1]);
59  
60  			Configuration conf = NutchwaxConfiguration.getConfiguration();
61  			NutchBean bean = new NutchBean(conf, directory);
62  
63  			org.apache.hadoop.ipc.Server server = RPC.getServer(bean,
64  					"0.0.0.0", port, 10, true, conf);
65  			server.start();
66  			server.join();
67  		}
68  	}
69  }