/*
 * Licensed to the University of California, Berkeley under one or more contributor license
 * agreements. See the NOTICE file distributed with this work for additional information regarding
 * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance with the License. You may obtain a
 * copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */

package tachyon.master.next.rawtable;

import java.nio.ByteBuffer;

import org.apache.thrift.TException;

import tachyon.TachyonURI;
import tachyon.thrift.FileAlreadyExistException;
import tachyon.thrift.InvalidPathException;
import tachyon.thrift.RawTableInfo;
import tachyon.thrift.RawTableMasterService;
import tachyon.thrift.TableColumnException;
import tachyon.thrift.TableDoesNotExistException;
import tachyon.thrift.TachyonException;

public class RawTableMasterServiceHandler implements RawTableMasterService.Iface {
  private final RawTableMaster mRawTableMaster;

  public RawTableMasterServiceHandler(RawTableMaster rawTableMaster) {
    mRawTableMaster = rawTableMaster;
  }

  @Override
  public long userCreateRawTable(String path, int columns, ByteBuffer metadata)
      throws FileAlreadyExistException, InvalidPathException, TableColumnException,
      TachyonException, TException {
    return mRawTableMaster.createRawTable(new TachyonURI(path), columns, metadata);
  }

  @Override
  public long userGetRawTableId(String path) throws InvalidPathException,
      TableDoesNotExistException, TException {
    return mRawTableMaster.getRawTableId(new TachyonURI(path));
  }

  @Override
  public RawTableInfo userGetClientRawTableInfo(long id, String path)
      throws TableDoesNotExistException, InvalidPathException, TException {
    if (id != -1) {
      return mRawTableMaster.getClientRawTableInfo(id);
    }
    return mRawTableMaster.getClientRawTableInfo(new TachyonURI(path));
  }

  @Override
  public void userUpdateRawTableMetadata(long tableId, ByteBuffer metadata)
      throws TableDoesNotExistException, TachyonException, TException {
    mRawTableMaster.updateRawTableMetadata(tableId, metadata);
  }
}

@@ -2041,16 +2041,20 @@
 Info
+ById
 (long id
 , St
@@ -2053,28 +2053,9 @@
 g id
-, String path)%0A     
+)
  thr
@@ -2089,125 +2089,241 @@
 ion,
- InvalidPathException, TException %7B%0A    if (id != -1) %7B%0A      return mRawTableMaster.getClientRawTableInfo(id);%0A    %7D
+%0A      TException %7B%0A    return mRawTableMaster.getClientRawTableInfo(id);%0A  %7D%0A%0A  @Override%0A  public RawTableInfo userGetClientRawTableInfoByPath(String path)%0A      throws TableDoesNotExistException, InvalidPathException, TException %7B
 %0A   

Reimplement userGetClientRawTableInfo service methods.