/** Copyright(c) 2012 Orzota, Inc. All Rights Reserved. **/
package com.orzota.bookx;

import java.io.IOException;
import java.util.Iterator;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.MapReduceBase;
import org.apache.hadoop.mapred.OutputCollector;
import org.apache.hadoop.mapred.Reporter;

/**
 * @organisaion Orzota, Inc.
 * @author varadmeru
 */
public class BookXReducer extends MapReduceBase implements org.apache.hadoop.mapred.Reducer<Text, IntWritable, Text, IntWritable> {

	/* (non-Javadoc)
	 * @see org.apache.hadoop.mapred.Reducer#reduce(java.lang.Object, java.util.Iterator, org.apache.hadoop.mapred.OutputCollector, org.apache.hadoop.mapred.Reporter)
	 */
	@Override
	public void reduce(Text _key,
			Iterator<IntWritable> values,
			OutputCollector<Text,IntWritable> output, 
			Reporter reporter)
			throws IOException {
		Text key = _key;
		int frequencyForYear = 0;
		while (values.hasNext()) {
			// replace ValueType with the real type of your value
			IntWritable value = (IntWritable) values.next();
			frequencyForYear += value.get();
			// process value
		}
		output.collect(key, new IntWritable(frequencyForYear));
	}
}

@@ -111,35 +111,8 @@
 ion;
-%0Aimport java.util.Iterator;
 %0A%0Aim
@@ -219,116 +219,23 @@
 pred
-.MapReduceBase;%0Aimport org.apache.hadoop.mapred.OutputCollector;%0Aimport org.apache.hadoop.mapred.Report
+uce.Reduc
 er;%0A%0A
+%0A
 /**%0A
@@ -292,92 +292,77 @@
  */%0A
-public class BookXReducer extends MapReduceBase implements org.apache.hadoop.mapred.
+ %0A /*%0A Updating for new MR API%0A */%0Apublic class BookXReducer extends 
 Redu
@@ -406,15 +406,19 @@
 ble%3E
- 
+%0A
 %7B%0A%0A%09/*
+%0A%09 *
  (no
@@ -428,16 +428,21 @@
 avadoc)%0A
+%09 * %0A
 %09 * @see
@@ -499,16 +499,20 @@
 .Object,
+%0A%09 *
  java.ut
@@ -561,24 +561,28 @@
 utCollector,
+%0A%09 *
  org.apache.
@@ -655,20 +655,17 @@
 key,
-%0A%09%09%09
+ 
 Itera
-tor
+ble
 %3CInt
@@ -689,95 +689,70 @@
 %0A%09%09%09
-OutputCollector%3CText,IntWritable%3E output, %0A%09%09%09Reporter reporter)%0A%09%09%09throws IOException 
+Context context)%0A%09%09%09throws IOException, InterruptedException%0A%09
 %7B%0A%09%09
@@ -802,33 +802,42 @@
 ;%0A%09%09
-whi
+for(IntWritab
 le 
-(
 value
-s.hasNext()) 
+ : values)%0A%09%09
 %7B%0A%09%09
@@ -895,60 +895,8 @@
 lue%0A
-%09%09%09IntWritable value = (IntWritable) values.next();%0A
 %09%09%09f
@@ -957,22 +957,21 @@
 %7D%0A%09%09
-output.collect
+context.write
 (key

Update BookXReducer.java