001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package org.apache.hadoop.hbase.regionserver; 019 020import java.io.IOException; 021import java.util.ArrayList; 022import java.util.List; 023import java.util.Locale; 024import java.util.UUID; 025 026import org.apache.yetus.audience.InterfaceAudience; 027import org.apache.yetus.audience.InterfaceStability; 028import org.apache.hadoop.hbase.HBaseInterfaceAudience; 029import org.apache.hadoop.hbase.client.Durability; 030import org.apache.hadoop.hbase.wal.WALEdit; 031 032import com.google.protobuf.Message; 033 034/** 035 * Base class for RowProcessor with some default implementations. 036 */ 037@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC) 038@InterfaceStability.Evolving 039public abstract class BaseRowProcessor<S extends Message,T extends Message> 040implements RowProcessor<S,T> { 041 042 @Override 043 public void preProcess(HRegion region, WALEdit walEdit) throws IOException { 044 } 045 046 @Override 047 public void preBatchMutate(HRegion region, WALEdit walEdit) throws IOException { 048 } 049 050 @Override 051 public void postBatchMutate(HRegion region) throws IOException { 052 } 053 054 @Override 055 public void postProcess(HRegion region, WALEdit walEdit, boolean success) throws IOException { 056 } 057 058 @Override 059 public List<UUID> getClusterIds() { 060 return new ArrayList<>(); 061 } 062 063 @Override 064 public String getName() { 065 return this.getClass().getSimpleName().toLowerCase(Locale.ROOT); 066 } 067 068 @Override 069 public Durability useDurability() { 070 return Durability.USE_DEFAULT; 071 } 072}