package com.architecting.ch09;


import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.mapreduce.HFileOutputFormat2;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;


public class ConvertToHFiles extends Configured implements Tool {

  private static final Log LOG = LogFactory.getLog(ConvertToHFiles.class);

  public static void main(String[] args) throws Exception {
    int res = ToolRunner.run(new Configuration(), new ConvertToHFiles(), args);
    System.exit(res);
  }

  @Override
  public int run(String[] args) throws Exception {
    try {
      Configuration conf = HBaseConfiguration.create();
      Connection connection = ConnectionFactory.createConnection(conf);

      String inputPath = args[0];
      String outputPath = args[1];
      final TableName tableName = TableName.valueOf(args[2]);

      // tag::SETUP[]
      Table table = connection.getTable(tableName);

      Job job = Job.getInstance(conf, "ConvertToHFiles: Convert CSV to HFiles");

      HFileOutputFormat2.configureIncrementalLoad(job, table,
                                        connection.getRegionLocator(tableName)); // <1>
      job.setInputFormatClass(TextInputFormat.class); // <2>

      job.setSpeculativeExecution(false); // <3>
      job.setReduceSpeculativeExecution(false); // <3>

      job.setJarByClass(ConvertToHFiles.class);

      // Since we might be running directly from Eclipse,
      // let's hard code the jar path too. 
      job.setJar("/home/cloudera/ahae/target/ahae.jar");

      job.setMapperClass(ConvertToHFilesMapper.class); // <4>
      job.setMapOutputKeyClass(ImmutableBytesWritable.class); // <5>
      job.setMapOutputValueClass(KeyValue.class); // <6>

      FileInputFormat.setInputPaths(job, inputPath);
      HFileOutputFormat2.setOutputPath(job, new Path(outputPath));
      // end::SETUP[]

      if (!job.waitForCompletion(true)) {
        LOG.error("Failure");
      } else {
        LOG.info("Success");
        return 0;
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    return 1;
  }
}

@@ -2050,111 +2050,15 @@
 ss);
-%0A%0A      // Since we might be running directly from Eclipse,%0A      // let's hard code the jar path too. 
+ // %3C4%3E
 %0A   
@@ -2110,16 +2110,23 @@
 e.jar%22);
+ // %3C4%3E
 %0A%0A      
@@ -2170,33 +2170,33 @@
 per.class); // %3C
-4
+5
 %3E%0A      job.setM
@@ -2239,33 +2239,33 @@
 ble.class); // %3C
-5
+6
 %3E%0A      job.setM
@@ -2304,17 +2304,17 @@
 s); // %3C
-6
+7
 %3E%0A%0A     

Add a callout for te setJar part.