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.mapreduce;
019
020import java.io.IOException;
021import java.nio.ByteBuffer;
022import java.util.HashMap;
023import java.util.List;
024import java.util.Map;
025import org.apache.hadoop.conf.Configuration;
026import org.apache.hadoop.fs.Path;
027import org.apache.hadoop.hbase.TableName;
028import org.apache.yetus.audience.InterfaceAudience;
029
030/**
031 * Tool to load the output of HFileOutputFormat into an existing table.
032 * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. Use
033 *             {@link org.apache.hadoop.hbase.tool.LoadIncrementalHFiles} instead.
034 */
035@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "NM_SAME_SIMPLE_NAME_AS_SUPERCLASS",
036    justification = "Temporary glue. To be removed")
037@Deprecated
038@InterfaceAudience.Public
039public class LoadIncrementalHFiles extends org.apache.hadoop.hbase.tool.LoadIncrementalHFiles {
040
041  /**
042   * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. Use
043   *             {@link org.apache.hadoop.hbase.tool.LoadIncrementalHFiles.LoadQueueItem} instead.
044   */
045  @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "NM_SAME_SIMPLE_NAME_AS_SUPERCLASS",
046      justification = "Temporary glue. To be removed")
047  @Deprecated
048  @InterfaceAudience.Public
049  public static class LoadQueueItem
050    extends org.apache.hadoop.hbase.tool.LoadIncrementalHFiles.LoadQueueItem {
051
052    public LoadQueueItem(byte[] family, Path hfilePath) {
053      super(family, hfilePath);
054    }
055  }
056
057  public LoadIncrementalHFiles(Configuration conf) {
058    super(conf);
059  }
060
061  public Map<LoadQueueItem, ByteBuffer> run(String dirPath, Map<byte[], List<Path>> map,
062    TableName tableName) throws IOException {
063    Map<org.apache.hadoop.hbase.tool.LoadIncrementalHFiles.LoadQueueItem, ByteBuffer> originRet;
064    if (dirPath != null) {
065      originRet = run(dirPath, tableName);
066    } else {
067      originRet = run(map, tableName);
068    }
069    Map<LoadQueueItem, ByteBuffer> ret = new HashMap<>();
070    originRet.forEach((k, v) -> {
071      ret.put(new LoadQueueItem(k.getFamily(), k.getFilePath()), v);
072    });
073    return ret;
074  }
075}