Package com.mapreduce

Source Code of com.mapreduce.DataGettingMapper

package com.mapreduce;

import java.io.IOException;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import com.commons.UrlData;
import com.utils.LoggerUtils;

public class DataGettingMapper extends Mapper<Object, Text, Text, Text> {
  protected void map(
      Object key,
      Text value,
      org.apache.hadoop.mapreduce.Mapper<Object, Text, Text, Text>.Context context)
      throws IOException, InterruptedException {
    LoggerUtils.log(DataGettingMapper.class.getName(), "map key:" + key
        + " value:" + value);
    UrlData data = new UrlData();
    data.decode(value.toString());
    Text outputKey = new Text();
    outputKey.set(data.getUrlName());
    Text url = new Text();
    url.set(data.getUrl());
    context.write(outputKey, url);
  }
}
TOP

Related Classes of com.mapreduce.DataGettingMapper

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.