001/**
002 *
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 *     http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 */
019package org.apache.hadoop.hbase.mapreduce;
020
021import java.io.IOException;
022import java.nio.ByteBuffer;
023import java.util.HashMap;
024import java.util.List;
025import java.util.Map;
026
027import org.apache.hadoop.conf.Configuration;
028import org.apache.hadoop.fs.Path;
029import org.apache.hadoop.hbase.TableName;
030import org.apache.yetus.audience.InterfaceAudience;
031
032/**
033 * Tool to load the output of HFileOutputFormat into an existing table.
034 * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. Use
035 *             {@link org.apache.hadoop.hbase.tool.LoadIncrementalHFiles} instead.
036 */
037@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "NM_SAME_SIMPLE_NAME_AS_SUPERCLASS",
038    justification = "Temporary glue. To be removed")
039@Deprecated
040@InterfaceAudience.Public
041public class LoadIncrementalHFiles extends org.apache.hadoop.hbase.tool.LoadIncrementalHFiles {
042
043  /**
044   * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. Use
045   *             {@link org.apache.hadoop.hbase.tool.LoadIncrementalHFiles.LoadQueueItem} instead.
046   */
047  @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "NM_SAME_SIMPLE_NAME_AS_SUPERCLASS",
048      justification = "Temporary glue. To be removed")
049  @Deprecated
050  @InterfaceAudience.Public
051  public static class LoadQueueItem
052      extends org.apache.hadoop.hbase.tool.LoadIncrementalHFiles.LoadQueueItem {
053
054    public LoadQueueItem(byte[] family, Path hfilePath) {
055      super(family, hfilePath);
056    }
057  }
058
059  public LoadIncrementalHFiles(Configuration conf) {
060    super(conf);
061  }
062
063  public Map<LoadQueueItem, ByteBuffer> run(String dirPath, Map<byte[], List<Path>> map,
064      TableName tableName) throws IOException {
065    Map<org.apache.hadoop.hbase.tool.LoadIncrementalHFiles.LoadQueueItem, ByteBuffer> originRet;
066    if (dirPath != null) {
067      originRet = run(dirPath, tableName);
068    } else {
069      originRet = run(map, tableName);
070    }
071    Map<LoadQueueItem, ByteBuffer> ret = new HashMap<>();
072    originRet.forEach((k, v) -> {
073      ret.put(new LoadQueueItem(k.getFamily(), k.getFilePath()), v);
074    });
075    return ret;
076  }
077}