Project

General

Profile

1
package eu.dnetlib.data.mapreduce.hbase.dli;
2

    
3
import com.googlecode.protobuf.format.JsonFormat;
4
import eu.dnetlib.data.proto.dli.DLIObjectProtos.*;
5

    
6
import eu.dnetlib.dli.proto.DNGFDLISummaryConverter;
7
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
8
import org.apache.hadoop.io.Text;
9
import org.apache.hadoop.mapreduce.Mapper;
10

    
11
import java.io.IOException;
12

    
13
/**
14
 * Created by sandro on 2/15/17.
15
 */
16
public class ElasticsearchFeedMapper extends Mapper<Text, ImmutableBytesWritable, Text, Text> {
17

    
18

    
19
    @Override
20
    protected void map(Text key, ImmutableBytesWritable value, Context context) throws IOException, InterruptedException {
21
        final DNGFDLISummaryConverter converter = new DNGFDLISummaryConverter();
22

    
23
        final DLIObjectSummary summary = DLIObjectSummary.parseFrom(value.copyBytes());
24
        context.write(key, new Text(JsonFormat.printToString(summary)));
25
    }
26
}
(1-1/5)