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 com.google.protobuf.Message; 021import java.io.IOException; 022import java.util.Collections; 023import java.util.List; 024import java.util.Locale; 025import java.util.UUID; 026import org.apache.hadoop.hbase.HBaseInterfaceAudience; 027import org.apache.hadoop.hbase.client.Durability; 028import org.apache.hadoop.hbase.wal.WALEdit; 029import org.apache.yetus.audience.InterfaceAudience; 030import org.apache.yetus.audience.InterfaceStability; 031 032/** 033 * Base class for RowProcessor with some default implementations. 034 */ 035@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC) 036@InterfaceStability.Evolving 037public abstract class BaseRowProcessor<S extends Message, T extends Message> 038 implements RowProcessor<S, T> { 039 040 @Override 041 public void preProcess(HRegion region, WALEdit walEdit) throws IOException { 042 } 043 044 @Override 045 public void preBatchMutate(HRegion region, WALEdit walEdit) throws IOException { 046 } 047 048 @Override 049 public void postBatchMutate(HRegion region) throws IOException { 050 } 051 052 @Override 053 public void postProcess(HRegion region, WALEdit walEdit, boolean success) throws IOException { 054 } 055 056 @Override 057 public List<UUID> getClusterIds() { 058 return Collections.emptyList(); 059 } 060 061 @Override 062 public String getName() { 063 return this.getClass().getSimpleName().toLowerCase(Locale.ROOT); 064 } 065 066 @Override 067 public Durability useDurability() { 068 return Durability.USE_DEFAULT; 069 } 070}