Index: other-projects/hathitrust/solr-extracted-features/trunk/RUN-PD-CLUSTER.bash
===================================================================
--- other-projects/hathitrust/solr-extracted-features/trunk/RUN-PD-CLUSTER.bash	(revision 30974)
+++ other-projects/hathitrust/solr-extracted-features/trunk/RUN-PD-CLUSTER.bash	(revision 30975)
@@ -7,6 +7,6 @@
 #input_dir="hdfs://10.10.0.52:9000/user/htrc/pd-ef-json-files"
 
-output_dir=hdfs://master:9000/user/htrc/pd-solr-json-files
-
+#output_dir=hdfs://master:9000/user/htrc/pd-solr-json-files
+solr_url="http://10.11.0.53:8983/solr/htrc-pd-ef/update"
 
 master_opt="--master spark://10.10.0.52:7077"
Index: other-projects/hathitrust/solr-extracted-features/trunk/_RUN.bash
===================================================================
--- other-projects/hathitrust/solr-extracted-features/trunk/_RUN.bash	(revision 30974)
+++ other-projects/hathitrust/solr-extracted-features/trunk/_RUN.bash	(revision 30975)
@@ -19,8 +19,8 @@
 fi
 
-if [ "x$output_dir" = "x" ] ; then
-    echo "_RUN.bash: Failed to set 'output_dir'" 1>&2
-    exit
-fi
+#if [ "x$output_dir" = "x" ] ; then
+#    echo "_RUN.bash: Failed to set 'output_dir'" 1>&2
+#    exit
+#fi
 
 run_jps=0
@@ -71,7 +71,16 @@
     
 self_contained_jar=target/htrc-ef-ingest-0.9-jar-with-dependencies.jar
-base_cmd="spark-submit --class org.hathitrust.PrepareForIngest $master_opt $self_contained_jar"
+cmd="spark-submit --class org.hathitrust.PrepareForIngest $master_opt $self_contained_jar"
 
-cmd="$base_cmd --verbosity 1 $json_filelist $input_dir $output_dir $*"
+if [ "x$solr_url" != "x" ] ; then
+    cmd="$cmd --solr-url $solr_url"
+fi
+
+if [ "x$output_dir" != "x" ] ; then
+    cmd="$cmd --output-dir $output_dir"
+fi
+
+
+cmd="$cmd --verbosity 1 $input_dir $json_filelist $*"
 
 echo "****"
@@ -79,4 +88,5 @@
 echo "*   $cmd"
 echo "****"
+
 if [ "$run_jps" = "1" ] ; then
   echo "* Monitor progress on Spark cluster through:"
Index: other-projects/hathitrust/solr-extracted-features/trunk/src/main/java/org/hathitrust/PagedJSON.java
===================================================================
--- other-projects/hathitrust/solr-extracted-features/trunk/src/main/java/org/hathitrust/PagedJSON.java	(revision 30974)
+++ other-projects/hathitrust/solr-extracted-features/trunk/src/main/java/org/hathitrust/PagedJSON.java	(revision 30975)
@@ -31,10 +31,12 @@
 
 	protected String _input_dir;
+	protected String _solr_url;
 	protected String _output_dir;
 	protected int    _verbosity;
 	
-	public PagedJSON(String input_dir, String output_dir, int verbosity)
+	public PagedJSON(String input_dir, String solr_url, String output_dir, int verbosity)
 	{
 		_input_dir  = input_dir;
+		_solr_url   = solr_url;
 		_output_dir = output_dir;
 		_verbosity  = verbosity;
@@ -170,5 +172,4 @@
 		*/
 		
-		//return solr_doc_json;
 		return solr_update_json;
 	}
@@ -288,7 +289,11 @@
 				*/
 							
-				saveSolrDoc(solr_add_doc_json,output_json_bz2);
-				//postSolrDoc(solr_add_doc_json);
-			
+				if (_solr_url != null) {
+					postSolrDoc(solr_add_doc_json);
+				}
+
+				if (_output_dir != null) {
+					saveSolrDoc(solr_add_doc_json,output_json_bz2);
+				}
 			}
 			else {
Index: other-projects/hathitrust/solr-extracted-features/trunk/src/main/java/org/hathitrust/PrepareForIngest.java
===================================================================
--- other-projects/hathitrust/solr-extracted-features/trunk/src/main/java/org/hathitrust/PrepareForIngest.java	(revision 30974)
+++ other-projects/hathitrust/solr-extracted-features/trunk/src/main/java/org/hathitrust/PrepareForIngest.java	(revision 30975)
@@ -15,9 +15,11 @@
 	protected String _input_dir;
 	protected String _json_list_filename;
+	protected String _solr_url;
 	protected String _output_dir;
 	
 	protected int    _verbosity;
 
-	public PrepareForIngest(String input_dir, String json_list_filename, String output_dir, int verbosity)
+	public PrepareForIngest(String input_dir, String json_list_filename, 
+							String solr_url, String output_dir, int verbosity)
 	{
 		_input_dir = input_dir;
@@ -42,5 +44,5 @@
 		JavaRDD<String> json_list_data = jsc.textFile(_json_list_filename,NUM_PARTITIONS).cache();
 
-		PagedJSON paged_json = new PagedJSON(_input_dir,_output_dir,_verbosity);
+		PagedJSON paged_json = new PagedJSON(_input_dir,_solr_url, _output_dir,_verbosity);
 		JavaRDD<String> json_ids = json_list_data.flatMap(paged_json).cache();
 
@@ -52,7 +54,7 @@
 		System.out.println("");
 
-		System.out.println("############");
 		String rdd_save_file = "rdd-solr-json-page-files";
 		json_ids.saveAsTextFile(rdd_save_file);
+		System.out.println("############");
 		System.out.println("# Saved RDD of Solr JSON page files, top-level, as:");
 		System.out.println("#  " + rdd_save_file);
@@ -63,4 +65,8 @@
 	}
 
+	public static void print_usage(HelpFormatter formatter, Options options)
+	{
+		formatter.printHelp("RUN.bash [options] input-dir json-filelist.txt", options);
+	}
 	public static void main(String[] args) {
 
@@ -86,10 +92,25 @@
 		options.addOption(verbosity_opt);
 		
-		//CommandLineParser parser = new DefaultParser(); // 1.3 and above
+		Option output_dir_opt = new Option("o", "output-dir", true, 
+				"If specified, save BZipped Solr JSON files to this directory");
+		output_dir_opt.setRequired(false);
+		options.addOption(output_dir_opt);
+		
+		Option solr_url_opt = new Option("u", "solr-url", true, 
+				"If specified, the URL to post the Solr JSON data to");
+		solr_url_opt.setRequired(false);
+		options.addOption(solr_url_opt);
+		
+		Option dry_run_opt = new Option("r", "dry-run", false, 
+				"Used to initiate a 'dry-run' where the files are all read in, but nothing is ingested/saved");
+		dry_run_opt.setRequired(false);
+		options.addOption(dry_run_opt);
 		
 		// need to work with CLI v1.2 as this is the JAR that is bundled with Hadoop/Spark 
 		CommandLineParser parser = new GnuParser(); 
+		//CommandLineParser parser = new DefaultParser(); // if working with CLI v1.3 and above
+		
 		HelpFormatter formatter = new HelpFormatter();
-		CommandLine cmd;
+		CommandLine cmd = null;
 
 		try {
@@ -98,7 +119,7 @@
 		catch (ParseException e) {
 			System.err.println(e.getMessage());
-			formatter.printHelp("RUN.bash [options] json-file-list.txt input-dir output-dir", options);
+			print_usage(formatter,options);
 			System.exit(1);
-			return;
+			//return;  // prevents 'cmd may not be assigned' compiler error in Eclipse
 		}
 
@@ -111,15 +132,25 @@
 		int verbosity = Integer.parseInt(verbosity_str);
 
+		String output_dir = cmd.getOptionValue("output-dir",null);
+		String solr_url   = cmd.getOptionValue("solr-url",null);
+		boolean dry_run   = cmd.hasOption("dry-run");
+		
 		String[] filtered_args = cmd.getArgs();
 
-		if (filtered_args.length != 3) {
-			formatter.printHelp("RUN.bash [options] json-filelist.txt input-dir output-dir", options);
+		if (filtered_args.length != 2) {
+			print_usage(formatter,options);
 			System.exit(1);
+		}
+		
+		if (!dry_run && ((output_dir == null) && (solr_url==null))) {
+			System.err.println("Need to specify either --solr-url or --output-dir otherwise generated files are not ingested/saved");
+			print_usage(formatter,options);
 		}
 		String json_list_filename = filtered_args[0];
 		String input_dir  = filtered_args[1];
-		String output_dir = filtered_args[2];
+		//String output_dir = filtered_args[2];
 
-		PrepareForIngest prep_for_ingest = new PrepareForIngest(input_dir,json_list_filename,output_dir,verbosity);
+		PrepareForIngest prep_for_ingest 
+			= new PrepareForIngest(input_dir,json_list_filename,solr_url,output_dir,verbosity);
 		prep_for_ingest.exec();
 
