2c0f0e6c5a2d06d88b0ea0f3f11e3dee82243882
[flume.git] / flume-ng-sinks / flume-ng-hbase-sink / src / main / java / org / apache / flume / sink / hbase / HbaseEventSerializer.java
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.flume.sink.hbase;
20
21 import java.util.List;
22
23 import org.apache.flume.Event;
24 import org.apache.flume.conf.Configurable;
25 import org.apache.flume.conf.ConfigurableComponent;
26 import org.apache.hadoop.hbase.client.Increment;
27 import org.apache.hadoop.hbase.client.Row;
28
29 /**
30 * Interface for an event serializer which serializes the headers and body
31 * of an event to write them to hbase. This is configurable, so any config
32 * params required should be taken through this. Only the column family is
33 * passed in. The columns should exist in the table and column family
34 * specified in the configuration for the HbaseSink.
35 *
36 */
37 public interface HbaseEventSerializer extends Configurable,
38 ConfigurableComponent {
39 /**
40 * Initialize the event serializer.
41 * @param Event to be written to HBase.
42 */
43 public void initialize(Event event, byte[] columnFamily);
44
45 /**
46 * Get the actions that should be written out to hbase as a result of this
47 * event. This list is written to hbase using the HBase batch API.
48 * @return List of {@link org.apache.hadoop.hbase.client.Row} which
49 * are written as such to HBase.
50 *
51 * 0.92 increments do not implement Row, so this is not generic.
52 *
53 */
54 public List<Row> getActions();
55
56 public List<Increment> getIncrements();
57 /*
58 * Clean up any state. This will be called when the sink is being stopped.
59 */
60 public void close();
61
62
63 }

Copyright 2016, The Apache Software Foundation.